[PATCH v2 3/5] x86/hyperv: Use native callbacks for trimming and ASID transitions

From
Naman Jain <hidden>
Date
2026-11-17 09:15:37
Also in
lkml
Reply to
Naman Jain, 2026-11-17
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 <redacted>
---
 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
Thread (7 messages) 7 messages, 2 authors, last reply 11h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help