[PATCH V4 12/15] x86/hyper-v: Add HvFlushGuestAddressList hypercall support

Paolo Bonzini pbonzini at redhat.com
Mon Oct 15 10:30:08 UTC 2018

On 13/10/2018 16:54, lantianyu1986 at gmail.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

> +	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.


More information about the devel mailing list