mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix some ASID range size calculation issues in global ASID allocation
@ 2025-03-29 13:05 Hou Wenlong
  2025-03-29 13:05 ` [PATCH 1/3] x86/mm: Correct the actual count of available global ASIDs Hou Wenlong
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Hou Wenlong @ 2025-03-29 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hou Wenlong, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Rik van Riel

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-03-31 13:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-29 13:05 [PATCH 0/3] Fix some ASID range size calculation issues in global ASID allocation Hou Wenlong
2025-03-29 13:05 ` [PATCH 1/3] x86/mm: Correct the actual count of available global ASIDs Hou Wenlong
2025-03-29 17:29   ` Rik van Riel
2025-03-31  3:46     ` Hou Wenlong
2025-03-29 13:05 ` [PATCH 2/3] mm/tlb: Fix wrong judgement in allocate_global_asid() Hou Wenlong
2025-03-29 17:33   ` Rik van Riel
2025-03-31  5:12     ` Hou Wenlong
2025-03-31 12:58       ` Hou Wenlong
2025-03-29 13:05 ` [PATCH 3/3] x86/mm: Fix wrong usage of 'MAX_ASID_AVAILABLE' in global ASID allocation Hou Wenlong
2025-03-30  1:11   ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®