From: Naman Jain <namjain@linux.microsoft.com>
To: Michael Kelley <mhklinux@outlook.com>,
"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"decui@microsoft.com" <decui@microsoft.com>,
"tglx@kernel.org" <tglx@kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"luto@kernel.org" <luto@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>
Cc: "hpa@zytor.com" <hpa@zytor.com>,
"riel@surriel.com" <riel@surriel.com>,
"bigeasy@linutronix.de" <bigeasy@linutronix.de>,
"zhouchuyi@bytedance.com" <zhouchuyi@bytedance.com>,
"houwenlong.hwl@antgroup.com" <houwenlong.hwl@antgroup.com>,
"qq570070308@gmail.com" <qq570070308@gmail.com>,
"bastien.curutchet@bootlin.com" <bastien.curutchet@bootlin.com>,
"dianders@chromium.org" <dianders@chromium.org>,
"jgross@suse.com" <jgross@suse.com>,
"hawk@kernel.org" <hawk@kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/5] x86/hyperv: Reject unrepresentable TLB flush VP sets
Date: Tue, 24 Nov 2026 12:13:35 +0530 [thread overview]
Message-ID: <2ddd53be-646f-4fe8-b91b-ceddb347a79f@linux.microsoft.com> (raw)
In-Reply-To: <MN2PR02MB6863BDBAFE5B4235BF4AEFABD4442@MN2PR02MB6863.namprd02.prod.outlook.com>
On 11/24/2026 5:44 AM, Michael Kelley wrote:
> From: Naman Jain <namjain@linux.microsoft.com> 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 <namjain@linux.microsoft.com>
>> ---
>> 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
>>
next prev parent reply other threads:[~2026-11-24 6:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 9:15 [PATCH v2 0/5] x86/hyperv: Account for lazy mm_cpumask maintenance Naman Jain
2026-11-17 9:15 ` [PATCH v2 1/5] x86/hyperv: Reject unrepresentable TLB flush VP sets Naman Jain
2026-11-24 0:14 ` Michael Kelley
2026-11-24 6:43 ` Naman Jain [this message]
2026-11-17 9:15 ` [PATCH v2 2/5] x86/tlb: Make the conditional flush predicate reusable Naman Jain
2026-11-23 16:06 ` Dave Hansen
2026-11-24 6:43 ` Naman Jain
2026-11-24 0:16 ` Michael Kelley
2026-11-24 6:44 ` Naman Jain
2026-11-17 9:15 ` [PATCH v2 3/5] x86/hyperv: Use native callbacks for trimming and ASID transitions Naman Jain
2026-11-24 0:16 ` Michael Kelley
2026-11-24 6:44 ` Naman Jain
2026-11-17 9:15 ` [PATCH v2 4/5] x86/hyperv: Filter TLB targets before building hypercalls Naman Jain
2026-11-17 9:24 ` sashiko-bot
2026-11-23 9:57 ` Sahil Chandna
2026-11-23 10:16 ` Naman Jain
2026-11-24 0:16 ` Michael Kelley
2026-11-24 6:44 ` Naman Jain
2026-11-17 9:15 ` [PATCH v2 5/5] x86/hyperv: Request mask cleanup when no remote target remains Naman Jain
2026-11-24 0:17 ` Michael Kelley
2026-11-24 6:45 ` Naman Jain
2026-11-24 0:14 ` [PATCH v2 0/5] x86/hyperv: Account for lazy mm_cpumask maintenance Michael Kelley
2026-11-24 6:43 ` Naman Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ddd53be-646f-4fe8-b91b-ceddb347a79f@linux.microsoft.com \
--to=namjain@linux.microsoft.com \
--cc=bastien.curutchet@bootlin.com \
--cc=bigeasy@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=dianders@chromium.org \
--cc=haiyangz@microsoft.com \
--cc=hawk@kernel.org \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhklinux@outlook.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=qq570070308@gmail.com \
--cc=riel@surriel.com \
--cc=tglx@kernel.org \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
--cc=zhouchuyi@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox