[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250302070654.GIZ8QDjih21cExg35g@fat_crate.local>
Date: Sun, 2 Mar 2025 08:06:54 +0100
From: Borislav Petkov <bp@...en8.de>
To: Rik van Riel <riel@...riel.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, peterz@...radead.org,
dave.hansen@...ux.intel.com, zhengqi.arch@...edance.com,
nadav.amit@...il.com, thomas.lendacky@....com, kernel-team@...a.com,
linux-mm@...ck.org, akpm@...ux-foundation.org, jackmanb@...gle.com,
jannh@...gle.com, mhklinux@...look.com, andrew.cooper3@...rix.com,
Manali.Shukla@....com, mingo@...nel.org
Subject: Re: [PATCH v14 07/13] x86/mm: add global ASID allocation helper
functions
On Tue, Feb 25, 2025 at 10:00:42PM -0500, Rik van Riel wrote:
> Add functions to manage global ASID space. Multithreaded processes that
> are simultaneously active on 4 or more CPUs can get a global ASID,
> resulting in the same PCID being used for that process on every CPU.
>
> This in turn will allow the kernel to use hardware-assisted TLB flushing
> through AMD INVLPGB or Intel RAR for these processes.
>
> Signed-off-by: Rik van Riel <riel@...riel.com>
> Tested-by: Manali Shukla <Manali.Shukla@....com>
> Tested-by: Brendan Jackman <jackmanb@...gle.com>
> Tested-by: Michael Kelley <mhklinux@...look.com>
> ---
> arch/x86/include/asm/mmu.h | 11 +++
> arch/x86/include/asm/mmu_context.h | 2 +
> arch/x86/include/asm/tlbflush.h | 43 +++++++++
> arch/x86/mm/tlb.c | 146 ++++++++++++++++++++++++++++-
> 4 files changed, 199 insertions(+), 3 deletions(-)
Some small touchups ontop:
--- /tmp/current.patch 2025-03-02 07:33:13.913105249 +0100
+++ /tmp/0001-x86-mm-Add-global-ASID-allocation-helper-functions.patch 2025-03-02 08:05:23.613262232 +0100
diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
-index 3b496cdcb74b..edb5942d4829 100644
+index 3b496cdcb74b..7fbefea5fdae 100644
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -35,6 +38,7 @@ index 3b496cdcb74b..edb5942d4829 100644
+ * hardware-assisted remote TLB invalidation like AMD INVLPGB.
+ */
+ u16 global_asid;
++
+ /* The process is transitioning to a new global ASID number. */
+ bool asid_transition;
+#endif
@@ -251,7 +255,12 @@ index 1cc25e83bd34..9b1652c02452 100644
+ if (mm_global_asid(mm))
+ return;
+
-+ /* The last global ASID was consumed while waiting for the lock. */
++ /*
++ * The last global ASID was consumed while waiting for the lock.
++ *
++ * If this fires, a more aggressive ASID reuse scheme might be
++ * needed.
++ */
+ if (!global_asid_available) {
+ VM_WARN_ONCE(1, "Ran out of global ASIDs\n");
+ return;
@@ -284,5 +293,5 @@ index 1cc25e83bd34..9b1652c02452 100644
* Given an ASID, flush the corresponding user ASID. We can delay this
* until the next time we switch to it.
--
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists