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] [thread-next>] [day] [month] [year] [list]
Message-ID: <171602549283.10875.15739867145799719700.tip-bot2@tip-bot2>
Date: Sat, 18 May 2024 09:44:52 -0000
From: "tip-bot2 for Uros Bizjak" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Uros Bizjak <ubizjak@...il.com>, Ingo Molnar <mingo@...nel.org>,
 Andy Lutomirski <luto@...nel.org>, Josh Poimboeuf <jpoimboe@...hat.com>,
 Linus Torvalds <torvalds@...ux-foundation.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject:
 [tip: x86/percpu] x86/percpu: Introduce the __raw_cpu_read_const() macro

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

Commit-ID:     539615de7004a46778020183622856f4ca14e4ac
Gitweb:        https://git.kernel.org/tip/539615de7004a46778020183622856f4ca14e4ac
Author:        Uros Bizjak <ubizjak@...il.com>
AuthorDate:    Tue, 30 Apr 2024 11:17:23 +02:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Sat, 18 May 2024 11:18:42 +02:00

x86/percpu: Introduce the __raw_cpu_read_const() macro

Introduce the __raw_cpu_read_const() macro to further reduce ifdeffery
and differences between configs w/ and w/o USE_X86_SEG_SUPPORT.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@...il.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Link: https://lore.kernel.org/r/20240430091833.196482-4-ubizjak@gmail.com
---
 arch/x86/include/asm/percpu.h | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index f360ac5..d202551 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -156,6 +156,8 @@ do {									\
 	*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)) = (val);	\
 } while (0)
 
+#define __raw_cpu_read_const(pcp)	__raw_cpu_read(, , pcp)
+
 #else /* CONFIG_USE_X86_SEG_SUPPORT */
 
 #define __raw_cpu_read(size, qual, _var)				\
@@ -180,6 +182,12 @@ do {									\
 	    : [val] __pcpu_reg_imm_##size(pto_val__));			\
 } while (0)
 
+/*
+ * The generic per-cpu infrastrucutre is not suitable for
+ * reading const-qualified variables.
+ */
+#define __raw_cpu_read_const(pcp)	({ BUILD_BUG(); (typeof(pcp))0; })
+
 #endif /* CONFIG_USE_X86_SEG_SUPPORT */
 
 #define percpu_stable_op(size, op, _var)				\
@@ -470,16 +478,7 @@ do {									\
 #define this_cpu_write_8(pcp, val)	__raw_cpu_write(8, volatile, pcp, val)
 #endif
 
-#ifdef CONFIG_USE_X86_SEG_SUPPORT
-#define this_cpu_read_const(pcp)	__raw_cpu_read(, , pcp)
-#else /* CONFIG_USE_X86_SEG_SUPPORT */
-
-/*
- * The generic per-cpu infrastrucutre is not suitable for
- * reading const-qualified variables.
- */
-#define this_cpu_read_const(pcp)	({ BUILD_BUG(); (typeof(pcp))0; })
-#endif /* CONFIG_USE_X86_SEG_SUPPORT */
+#define this_cpu_read_const(pcp)	__raw_cpu_read_const(pcp)
 
 #define this_cpu_read_stable_1(pcp)	percpu_stable_op(1, "mov", pcp)
 #define this_cpu_read_stable_2(pcp)	percpu_stable_op(2, "mov", pcp)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ