lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176864712057.510.13786059241373886036.tip-bot2@tip-bot2>
Date: Sat, 17 Jan 2026 10:52:00 -0000
From: "tip-bot2 for Hou Wenlong" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Hou Wenlong <houwenlong.hwl@...group.com>,
 "Borislav Petkov (AMD)" <bp@...en8.de>, Rik van Riel <riel@...riel.com>,
 x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/cleanups] x86/mm: Hide mm_free_global_asid() definition
 under CONFIG_BROADCAST_TLB_FLUSH

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     954fc7ac15c18fc21c4a423e542f6df5dc727cad
Gitweb:        https://git.kernel.org/tip/954fc7ac15c18fc21c4a423e542f6df5dc727cad
Author:        Hou Wenlong <houwenlong.hwl@...group.com>
AuthorDate:    Thu, 15 Jan 2026 11:38:34 +08:00
Committer:     Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Fri, 16 Jan 2026 22:16:32 +01:00

x86/mm: Hide mm_free_global_asid() definition under CONFIG_BROADCAST_TLB_FLUSH

When CONFIG_BROADCAST_TLB_FLUSH is not enabled, mm_free_global_asid() remains
a globally visible symbol and generates a useless function call to it in
destroy_context(). Therefore, hide the mm_free_global_asid() definition under
CONFIG_BROADCAST_TLB_FLUSH and provide a static inline empty version when it
is not enabled to remove the function call.

Signed-off-by: Hou Wenlong <houwenlong.hwl@...group.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: Rik van Riel <riel@...riel.com>
Link: https://patch.msgid.link/b262a8ec8076fb26bb692aaf113848b1e6f40e40.1768448079.git.houwenlong.hwl@antgroup.com
---
 arch/x86/include/asm/mmu_context.h | 2 --
 arch/x86/include/asm/tlbflush.h    | 3 +++
 arch/x86/mm/tlb.c                  | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 73bf3b1..1acafb1 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -139,9 +139,7 @@ static inline void mm_reset_untag_mask(struct mm_struct *mm)
 #define enter_lazy_tlb enter_lazy_tlb
 extern void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk);
 
-#define mm_init_global_asid mm_init_global_asid
 extern void mm_init_global_asid(struct mm_struct *mm);
-
 extern void mm_free_global_asid(struct mm_struct *mm);
 
 /*
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 00daedf..5114bf5 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -292,9 +292,12 @@ static inline bool mm_in_asid_transition(struct mm_struct *mm)
 
 	return mm && READ_ONCE(mm->context.asid_transition);
 }
+
+extern void mm_free_global_asid(struct mm_struct *mm);
 #else
 static inline u16 mm_global_asid(struct mm_struct *mm) { return 0; }
 static inline void mm_init_global_asid(struct mm_struct *mm) { }
+static inline void mm_free_global_asid(struct mm_struct *mm) { }
 static inline void mm_assign_global_asid(struct mm_struct *mm, u16 asid) { }
 static inline void mm_clear_asid_transition(struct mm_struct *mm) { }
 static inline bool mm_in_asid_transition(struct mm_struct *mm) { return false; }
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index f5b93e0..621e09d 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -401,6 +401,7 @@ static void use_global_asid(struct mm_struct *mm)
 	mm_assign_global_asid(mm, asid);
 }
 
+#ifdef CONFIG_BROADCAST_TLB_FLUSH
 void mm_free_global_asid(struct mm_struct *mm)
 {
 	if (!cpu_feature_enabled(X86_FEATURE_INVLPGB))
@@ -412,13 +413,12 @@ void mm_free_global_asid(struct mm_struct *mm)
 	guard(raw_spinlock_irqsave)(&global_asid_lock);
 
 	/* The global ASID can be re-used only after flush at wrap-around. */
-#ifdef CONFIG_BROADCAST_TLB_FLUSH
 	__set_bit(mm->context.global_asid, global_asid_freed);
 
 	mm->context.global_asid = 0;
 	global_asid_available++;
-#endif
 }
+#endif
 
 /*
  * Is the mm transitioning from a CPU-local ASID to a global ASID?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ