From nobody Mon Feb 9 15:11:11 2026 Received: from out28-74.mail.aliyun.com (out28-74.mail.aliyun.com [115.124.28.74]) (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 4AB513D2FF5 for ; Tue, 20 Jan 2026 13:50:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768917012; cv=none; b=jYjGvZZJWRWBEW7S9o0kd/4X+fUbbAMRiyozTorrMdj4C6Rxjt2UdHeQ3OK68iaYHNoq4mkIQoKqQEwL6TyjlIchBoWbxkao92XrRjGstFMNeZFnnjiAESufyQimqZbpk5q6+1pcYfkQNgt8SMPUcIixUmf9INsB+NJfFENIUM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768917012; c=relaxed/simple; bh=vAuKNcn69oxFTnKZdEx4No3npPltdTqe4a+MeHE53xA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VWPOeSZ1yWJT2/Gu+KkuZ5X4oqZOuJrzj7+9EpVtzQiv1it6c2yRmalXWnIDB5ETNNVefOi259EHt7YBjy9DV8hN2OfU3BGEy2m/w8RLaQzNUbviDmPwU0M7J6uwr4kbdFgXEPbtB3mGoHFDuOJkgxqyXAtizg2N1/xv9gsku/g= 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=bBUfqjir; arc=none smtp.client-ip=115.124.28.74 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="bBUfqjir" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1768916997; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=8RCL6736AGQ0Au6J3vFGkQ2igwAm4ViOK4v9rQxGzSU=; b=bBUfqjirYzDUs0fPmuGAHmRSR9VTa9B0LKrz4kSfGvCiZUFjWugDhtKBh5W5OGRdMLSW1ezcovJqwtTw3k4qksoVTK0LyjOGAJrGpC3Q5ZJEn4gytKY/7Iq4ck4IoHMiSVSp5IM89hTC/H2UFXYUjk+mr2uXkB5imGClbUsUEjc= Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.gBJQwxu_1768916678 cluster:ay29) by smtp.aliyun-inc.com; Tue, 20 Jan 2026 21:44:38 +0800 From: Hou Wenlong To: linux-kernel@vger.kernel.org Cc: Hou Wenlong , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH v2 1/4] x86/mm: Correct the actual size of available global ASID range Date: Tue, 20 Jan 2026 21:44:27 +0800 Message-Id: <30c6abf8d2a246cde256f943adaa7251ae09b2df.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" As noted in the comment, the available ASID range for global ASID allocation is '[TLB_NR_DYN_ASIDS, MAX_ASID_AVAILABLE-1]', which is a close interval. The size of bitmap is defined as 'MAX_ASID_AVAILABLE', so the actual available size should be '(MAX_ASID_AVAILABLE-1) - TLB_NR_DYN_ASIDS + 1'; otherwise, one ASID will leak. Signed-off-by: Hou Wenlong Reviewed-by: Rik van Riel --- 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 621e09d049cb..42b025e2f825 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -286,7 +286,7 @@ static DEFINE_RAW_SPINLOCK(global_asid_lock); static u16 last_global_asid =3D MAX_ASID_AVAILABLE; static DECLARE_BITMAP(global_asid_used, MAX_ASID_AVAILABLE); static DECLARE_BITMAP(global_asid_freed, MAX_ASID_AVAILABLE); -static int global_asid_available =3D MAX_ASID_AVAILABLE - TLB_NR_DYN_ASIDS= - 1; +static int global_asid_available =3D MAX_ASID_AVAILABLE - TLB_NR_DYN_ASIDS; =20 /* * When the search for a free ASID in the global ASID space reaches --=20 2.31.1