Successful Hyper-V flush hypercalls do not run the guest callbacks that
remove stale CPU-mask entries. Use the native flush path when the common
x86 code requests trimming.

Global ASID transitions also need these callbacks.
finish_asid_transition() requests a flush so that CPUs still using local
ASIDs switch to the global ASID through flush_tlb_func(). Use the native
path for these requests too, without filtering the supplied CPU mask.

Signed-off-by: Naman Jain <[email protected]>
---
 arch/x86/hyperv/mmu.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index 1ea57d642faa4..375f23b157ab3 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -70,6 +70,14 @@ static void hyperv_flush_tlb_multi(const struct cpumask 
*cpus,
        if (!hv_hypercall_pg)
                goto do_native;
 
+       /*
+        * Trimming needs callbacks on stale members. Global ASID transitions
+        * need callbacks to switch CPUs still using local ASIDs. A Hyper-V
+        * flush hypercall does neither.
+        */
+       if (info->trim_cpumask || mm_in_asid_transition(info->mm))
+               goto do_native;
+
        local_irq_save(flags);
 
        flush = *this_cpu_ptr(hyperv_pcpu_input_arg);
-- 
2.43.0


Reply via email to