From nobody Mon Feb 9 22:38:03 2026 Received: from out28-122.mail.aliyun.com (out28-122.mail.aliyun.com [115.124.28.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B77734A764 for ; Tue, 20 Jan 2026 13:44:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768916693; cv=none; b=kl9ZTjGjFYTUA10+mhYgQrnVNuCavzoQ/3L0k5mD/GAsUUhJI7AT0H/TO7N/84bAevWYnEmrSD7kFsFnHT8NfLT8dfLDhnrOCYJWGU+NWo/3mqWT65pS4qmkOkmHZT2cfy93PkAhC7KHwLyRikgE9V1PukRahtUa4v3EVNIlSQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768916693; c=relaxed/simple; bh=l5TCr6d0DBNUImXYllUM1CzphLMo9G7REtug++RTJy4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g2sVepipZ8NO37wd4jvNIbQJ3F26YGLy4BVbq2i9415zJswX3byDVC6vfO95lWPuBJMU3fRVZrwXIidjn4GqqNLihKZpvzC2k6L3Uf0QplwiVX4QmvMqzH5MLKDhhxzAxX635x9U3lRfqj6Qm5KQxEeWno7HM62I1kpXseLFyOk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=hdCVSHZw; arc=none smtp.client-ip=115.124.28.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="hdCVSHZw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1768916681; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=WJMpK15aVPs71VpaiKevDcKfNPdj8VTYSyZEWH/2LUo=; b=hdCVSHZwUfa08xb1j3UKo66ZKrBXXmv16Q+AVQi/vRWkL3a5oMe7Xb6enjMLHflDVSgIiP7bnrAkIF65UaPykZh7xIMATvllFbivCcrGhIk/4j/P/JZDEs45QiGZI37a49jtCc/E6qwFrlNgYEZRSZ61Gbv+sqg55FyRCCb6JWQ= Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.gBJQx.0_1768916680 cluster:ay29) by smtp.aliyun-inc.com; Tue, 20 Jan 2026 21:44:40 +0800 From: Hou Wenlong To: linux-kernel@vger.kernel.org Cc: Hou Wenlong , Rik van Riel , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH v2 2/4] x86/mm: Fix wrong judgement in allocate_global_asid() Date: Tue, 20 Jan 2026 21:44:28 +0800 Message-Id: <7351bac66842ba58a9da011ea2ad45fb26079638.1768900340.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In allocate_global_asid(), 'global_asid_available' cannot be zero, as it has already been checked in use_global_asid(). The wrong judgment could result in the invalid ASID 'MAX_ASID_AVAILABLE' being allocated, triggering the warning in kern_pcid(). Therefore, remove the check for 'global_asid_available', since when the allocation reaches 'MAX_ASID_AVAILABLE', it must return regardless of the value of 'global_asid_available'. Fixes: d504d1247e36 ("x86/mm: Add global ASID allocation helper functions") Reviewed-by: Rik van Riel Signed-off-by: Hou Wenlong --- arch/x86/mm/tlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 42b025e2f825..a1e217a382d1 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -326,7 +326,7 @@ static u16 allocate_global_asid(void) =20 asid =3D find_next_zero_bit(global_asid_used, MAX_ASID_AVAILABLE, last_gl= obal_asid); =20 - if (asid >=3D MAX_ASID_AVAILABLE && !global_asid_available) { + if (asid >=3D MAX_ASID_AVAILABLE) { /* This should never happen. */ VM_WARN_ONCE(1, "Unable to allocate global ASID despite %d available\n", global_asid_available); --=20 2.31.1