Re: [PATCH] x86/hyper-v: use cheaper HVCALL_FLUSH_VIRTUAL_ADDRESS_{LIST,SPACE} hypercalls when possible

From: Thomas Gleixner
Date: Tue Jun 19 2018 - 08:05:14 EST


On Fri, 15 Jun 2018, Vitaly Kuznetsov wrote:
> * Fills in gva_list starting from offset. Returns the number of items added.
> @@ -93,10 +95,19 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus,
> if (cpumask_equal(cpus, cpu_present_mask)) {
> flush->flags |= HV_FLUSH_ALL_PROCESSORS;
> } else {
> + /*
> + * It is highly likely that VP ids are in ascending order
> + * matching Linux CPU ids; Check VP index for the highest CPU
> + * in the supplied set to see if EX hypercall is required.
> + * This is just a best guess but should work most of the time.

TLB flushing based on 'best guess' and 'should work most of the time' is
not a brilliant approach.

Thanks,

tglx