[PATCH 0/3] Fix some ASID range size calculation issues in global ASID allocation
From: Hou Wenlong
Date: Sat Mar 29 2025 - 10:07:03 EST
During the code review of the global ASID allocation, I found some ASID
range size calculation issues and I'm not sure if I missread.
Firstly, as described in the comments, the range for global ASIDs is
[TLB_NR_DYN_SIZE,MAX_ASID_AVAILABLE-1], which is a close interval. So
the size of range is '(MAX_ASID_AVAILABLE-1)- TLB_NR_DYN_SIZE + 1'.
However, 'global_asid_available' is set as 'MAX_ASID_AVAILABLE -
TLB_NR_DYN_ASIDS - 1', which means one ASID is missed.
The macro 'MAX_ASID_AVAILABLE', as I understand it, is used to represent
the maximum valid ASID. Thus the available ASID range described in the
comments is [0,MAX_ASID_AVAILABLE], which is a close interval too. So
the acutal size of the range is 'MAX_ASID_AVAILABLE + 1'. But it is
incorrectly used as the size of the bitmap in global ASID allocation,
leading to the maximum ASID number being excluded from global ASID
allocation.
Hou Wenlong (3):
x86/mm: Correct the actual count of available global ASIDs
mm/tlb: Fix wrong judgement in allocate_global_asid()
x86/mm: Fix wrong usage of 'MAX_ASID_AVAILABLE' in global ASID
allocation
arch/x86/mm/tlb.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--
2.31.1