RE: [PATCH v2 1/5] x86/hyperv: Reject unrepresentable TLB flush VP sets
From: Michael Kelley
Date: Mon Nov 23 2026 - 19:14:43 EST
From: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx> 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.
>
> 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
>
> Signed-off-by: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx>
> ---
> 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
>