On 11/24/2026 5:44 AM, Michael Kelley wrote:
From: Naman Jain <[email protected]> Sent: Tuesday, November 17, 2026
1:15 AM
The VP-set conversion helper returns zero when it cannot represent the
maximum VP index. Treat zero as an error, just like negative results,
rather than issuing an extended flush with an empty target set.
This is more a theoretical issue than a real issue, right? The max VP
index would need to be >= 4096 for this error to occur, and to my
knowledge the max vCPU count in a Hyper-V VM is something smaller
than 4096.
Right, this is more of a defensive solution. I can remove this if at
all, you feel this is not required at the moment. Or else, I can make
it clear in the commit message.
This lets the caller fall back to native flushing, as the extended IPI
path already does. Filtering a mask that initially includes all present
CPUs can make it use this conversion instead of the all-processors
shortcut.
I don't understand the last sentence. Is it a leftover or a bad copy/paste?
Michael
I meant that removing stale CPUs from an all-present mask can make the
flush use an explicit VP set instead of HV_FLUSH_ALL_PROCESSORS. The
control flow would then reach this condition more often after these
changes. But that doesn't establish that the conversion limit can
actually be reached. The sentence adds confusion, so I'll remove it.
Regards,
Naman
Signed-off-by: Naman Jain <[email protected]>
---
arch/x86/hyperv/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index cfcb60468b01c..1ea57d642faa4 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -199,7 +199,7 @@ static u64 hyperv_flush_tlb_others_ex(const struct cpumask
*cpus,
flush->hv_vp_set.format = HV_GENERIC_SET_SPARSE_4K;
nr_bank = cpumask_to_vpset_skip(&flush->hv_vp_set, cpus,
info->freed_tables ? NULL : cpu_is_lazy);
- if (nr_bank < 0)
+ if (nr_bank <= 0)
return HV_STATUS_INVALID_PARAMETER;
/*
--
2.43.0