[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240719032437.35258-1-yuntao.wang@linux.dev>
Date: Fri, 19 Jul 2024 11:24:37 +0800
From: Yuntao Wang <yuntao.wang@...ux.dev>
To: linux-kernel@...r.kernel.org,
x86@...nel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Xin Li <xin3.li@...el.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Vegard Nossum <vegard.nossum@...cle.com>,
Tony Luck <tony.luck@...el.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Yuntao Wang <yuntao.wang@...ux.dev>
Subject: [PATCH] x86/cpu: Use TLS_SIZE instead of open coding it
Currently, there is already a macro named TLS_SIZE defined in segment.h,
which is equivalent to 'GDT_ENTRY_TLS_ENTRIES * 8'. Therefore, we can use
this macro directly in cpu_init() instead of open coding it.
Signed-off-by: Yuntao Wang <yuntao.wang@...ux.dev>
---
arch/x86/include/asm/segment.h | 2 +-
arch/x86/kernel/cpu/common.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index 9d6411c65920..c6d710340c02 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -227,7 +227,7 @@
#define GDT_SIZE (GDT_ENTRIES*8)
#define GDT_ENTRY_TLS_ENTRIES 3
-#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8)
+#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES*8)
/* Bit size and mask of CPU number stored in the per CPU data (and TSC_AUX) */
#define VDSO_CPUNODE_BITS 12
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d4e539d4e158..08b58de86c45 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2220,7 +2220,7 @@ void cpu_init(void)
if (IS_ENABLED(CONFIG_X86_64)) {
loadsegment(fs, 0);
- memset(cur->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
+ memset(cur->thread.tls_array, 0, TLS_SIZE);
syscall_init();
wrmsrl(MSR_FS_BASE, 0);
--
2.45.2
Powered by blists - more mailing lists