From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796099818; b=UDc9G4VhA2cHxcdlzN77tdQ3n1Tc5kDWxm3EjAN3BGCl2BLidyrkAKZMFgL+gw1DURXc tAqFQF4cRh93GH+SCRJxu5S8S3+Aq+flzA+fkyT0dony9Omz5bm5z59xflx1HZ0bDs22B XqHxFORNhOOC011AnTTvwL4QW1s8SL/cjGd1kxjTMXJ9oWMYI9gzSYRVGaSEAv35DuI+R EGJQ9z+ED2RROiSzfhwwTdzdCP8SpvTftIt/lkZAkjVeoUbnubYX1EDoIoiVPZSnUvyHF xCdo92B/+OWCKbphFJiCLTY99hLb3IEk81I81Wh2vuqJ4+t+hYE8dqPcJ4TGxncsWCA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796099818; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=h+tZaWmZkmtsgQdkJx9LYtoYJ8JRzOPyVHVWT+H/bLE=; b=zFBQgoLzqSbkzcj7zn2UmJlEs379PWsEf+6RKX5jETk6oKUEx2RN/pAHRCbYeB3SAIJe SjZ7fcviwqdtNvJ7UNnLICYj4H3rXg1pe0AoQu4A2C21PqVq7wAByfh0TlMQPecCGvLhB c0AtoUu5Zu43u0s7XoVmEHIQxNdvy5aLJE5vyYoEX1QWC8QA2zdE5YK/8pYF05UunmXIb H7J1FUQMX0aRZIMBb5Rnf65UY3T/5T4fLLYi/weALu3EIcEtlLyooFw/Y34n6EoiMY3nD UUON/26FoRtYzoTV8S+DUgNYNFIyXnNsvCqv1y5UBxWWm4VsBnFBQFe6i+nBSpnaoPQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=jigqvtHW; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5053E606A320; Tue, 1 Dec 2026 04:36:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5053E606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=jigqvtHW Received: from CPC-namja-026ON.localdomain (unknown [4.213.232.23]) by linux.microsoft.com (Postfix) with ESMTPSA id 06E1E20B7167; Mon, 30 Nov 2026 20:36:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 06E1E20B7167 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796099810; bh=h+tZaWmZkmtsgQdkJx9LYtoYJ8JRzOPyVHVWT+H/bLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jigqvtHWTVFNbCP+2czNicrac9SQIN9lijiOEUZ6qXbQS6TXp5sVQbCfVyNf6T6/y GRCPs9VwPEF8TXf+WW/4rfPGUktrtt18ZSwtzSwXOiTXjynzQrVHZ7AetICe3aSIQ9 oJ+3QJch1b8bBySBGwvv1j96Bok45+Wp+O13sn4M= From: Naman Jain To: haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, luto@kernel.org, peterz@infradead.org Cc: dave.hansen@intel.com, hpa@zytor.com, riel@surriel.com, mhklinux@outlook.com, schandna@linux.microsoft.com, namjain@linux.microsoft.com, qq570070308@gmail.com, houwenlong.hwl@antgroup.com, zhouchuyi@bytedance.com, jgross@suse.com, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] x86/hyperv: Reject unrepresentable TLB flush VP sets Date: Tue, 1 Dec 2026 04:36:38 +0000 Message-ID: <20261201043642.1054258-2-namjain@linux.microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261201043642.1054258-1-namjain@linux.microsoft.com> References: <20261201043642.1054258-1-namjain@linux.microsoft.com> X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit cpumask_to_vpset_skip() returns zero if hv_max_vp_index is at least 4096, beyond the range of its sparse VP set. Treat zero as an error instead of issuing an extended flush with an empty target set. This makes hyperv_flush_tlb_multi() fall back to native flushing, matching the extended IPI path. This is a defensive check and the issue is not seen in practice. Signed-off-by: Naman Jain --- 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; /* base-commit: e5aad2bdbbee783611d32599f89cea3f12f9593d -- 2.43.0