On 11/24/2026 5:47 AM, Michael Kelley wrote:
From: Naman Jain <[email protected]> Sent: Tuesday, November 17, 2026
1:15 AM
Filtering avoids unnecessary hypercalls but leaves historical CPU-mask
entries in place. These entries can keep later flushes on the multi-CPU
path even when only local work is needed.
This needs some rewording. Something like:
Filtering avoids flushing on CPUs that don't need it, but the filtering
doesn't remove any stale entries from the mm_cpumask. These stale
entries can keep later flushes on the multi-CPU path even when only
the local CPU needs to be flushed.
Acked. Thanks.
When no remote target remains after filtering, request native trimming
of the original candidate mask instead of waiting for the periodic trim.
And maybe substitute mm_cpumask instead of "original candidate mask"
(if that's actually correct).
Acked. Yes, that's correct.
Copy the const request so only this call requests cleanup.
The native predicate still skips lazy CPUs, so cleanup may not leave a
Again, be explicit instead of "native predicate".
Acked.
local-only mask. The new early return also makes the empty basic
processor-mask check unnecessary.
Signed-off-by: Naman Jain <[email protected]>
---
arch/x86/hyperv/mmu.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index 833eaea1d3fa8..545a25fcf6c34 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -102,6 +102,21 @@ static void hyperv_flush_tlb_multi(const struct cpumask
*cpus,
}
}
+ /*
+ * No remote target remains after filtering. Request native cleanup
+ * of stale, non-lazy memberships so later flushes can take the local
+ * fast path when possible. Lazy memberships may remain.
This comment reads like an assertion of the state of things at this point.
But it's only true if the below "if" statement is true. Reword as "If no
remote target remains after filtering, request native cleanup ..."
Acked. I will change it.
Regards,
Naman
+ */
+ if (cpumask_any_but(flush_cpus, smp_processor_id()) >= nr_cpu_ids) {
+ /* Keep the caller's const request unchanged. */
+ struct flush_tlb_info trim_info = *info;
+
+ trim_info.trim_cpumask = 1;
+ local_irq_restore(flags);
+ native_flush_tlb_multi(cpus, &trim_info);
+ return;
+ }
+
if (info->mm) {
/*
* AddressSpace argument must match the CR3 with PCID bits
@@ -148,12 +163,6 @@ static void hyperv_flush_tlb_multi(const struct cpumask
*cpus,
__set_bit(vcpu, (unsigned long *)
&flush->processor_mask);
}
-
- /* nothing to flush if 'processor_mask' ends up being empty */
- if (!flush->processor_mask) {
- local_irq_restore(flags);
- return;
- }
}
/*
--
2.43.0