[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1fece0bb-ca24-5f4d-2215-93e9705144fd@redhat.com>
Date: Mon, 15 Oct 2018 12:30:08 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: lantianyu1986@...il.com
Cc: Lan Tianyu <Tianyu.Lan@...rosoft.com>, kys@...rosoft.com,
haiyangz@...rosoft.com, sthemmin@...rosoft.com, tglx@...utronix.de,
mingo@...hat.com, hpa@...or.com, x86@...nel.org,
rkrcmar@...hat.com, devel@...uxdriverproject.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
michael.h.kelley@...rosoft.com, vkuznets@...hat.com
Subject: Re: [PATCH V4 12/15] x86/hyper-v: Add HvFlushGuestAddressList
hypercall support
On 13/10/2018 16:54, lantianyu1986@...il.com wrote:
>
> +static int fill_flush_list(union hv_gpa_page_range gpa_list[],
> + int offset, u64 start_gfn, u64 pages)
Pass the entire struct hv_guest_mapping_flush_list to this function,
it's simpler and it hides the gpa_list argument from
range->parse_flush_list_func.
> + if (!range->flush_list)
> + gpa_n = fill_flush_list(flush->gpa_list, gpa_n,
> + range->start_gfn, range->pages);
> + else if (range->parse_flush_list_func)
> + gpa_n = range->parse_flush_list_func(flush->gpa_list, gpa_n,
> + range->flush_list, fill_flush_list);
> + else
You are making the code more complicated in order to avoid making
fill_flush_list public. Just make it public and always go through the
parse_flush_list_func case. In fact:
- make parse_flush_list_func an argument of hyperv_flush_guest_mapping_range
- drop struct hyperv_tlb_range completely, instead just pass a void* to
hyperv_flush_guest_mapping_range and pass it back to the callback. The
void * can point to the start_gfn/pages pair, it can be the flush_list,
or anything else.
Paolo
Powered by blists - more mailing lists