mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Hou Wenlong" <houwenlong.hwl@antgroup.com>
To: linux-kernel@vger.kernel.org
Cc: "Hou Wenlong" <houwenlong.hwl@antgroup.com>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Rik van Riel" <riel@surriel.com>
Subject: [PATCH 0/3] Fix some ASID range size calculation issues in global ASID allocation
Date: Sat, 29 Mar 2025 21:05:23 +0800	[thread overview]
Message-ID: <cover.1743250122.git.houwenlong.hwl@antgroup.com> (raw)

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


             reply	other threads:[~2025-03-29 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-29 13:05 Hou Wenlong [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1743250122.git.houwenlong.hwl@antgroup.com \
    --to=houwenlong.hwl@antgroup.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®