[PATCH v3 3/5] x86/hyperv: Use native flushes for mask trimming and ASID transitions
From: Naman Jain
Date: Mon Nov 30 2026 - 23:37:14 EST
When trimming mm_cpumask(), Linux needs to run flush_tlb_func() on
remote CPUs so they can clear their stale bits. A Hyper-V TLB flush
hypercall invalidates translations but does not run this function.
The same applies during a global ASID transition. CPUs still using
local ASIDs need to run flush_tlb_func() to switch to the global ASID.
Call native_flush_tlb_multi() in both cases so the required work runs
on the target CPUs.
Signed-off-by: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx>
---
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