All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH -tip 4/5] x86/percpu: Introduce __raw_cpu_read_const() macro
Date: Tue, 30 Apr 2024 11:17:23 +0200	[thread overview]
Message-ID: <20240430091833.196482-4-ubizjak@gmail.com> (raw)
In-Reply-To: <20240430091833.196482-1-ubizjak@gmail.com>

Introduce __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@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.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 f360ac5fccde..d20255138426 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)
-- 
2.44.0


  parent reply	other threads:[~2024-04-30  9:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  9:17 [PATCH -tip 1/5] x86/percpu: Introduce pcpu_binary_op() macro Uros Bizjak
2024-04-30  9:17 ` [PATCH -tip 2/5] x86/percpu: Move some percpu macros around Uros Bizjak
2024-05-18  9:44   ` [tip: x86/percpu] x86/percpu: Move some percpu macros around for readability tip-bot2 for Uros Bizjak
2024-04-30  9:17 ` [PATCH -tip 3/5] x86/percpu: Unify percpu read-write accessors Uros Bizjak
2024-05-18  9:44   ` [tip: x86/percpu] " tip-bot2 for Uros Bizjak
2024-04-30  9:17 ` Uros Bizjak [this message]
2024-05-18  9:44   ` [tip: x86/percpu] x86/percpu: Introduce the __raw_cpu_read_const() macro tip-bot2 for Uros Bizjak
2024-04-30  9:17 ` [PATCH -tip 5/5] x86/percpu: Fix operand constraint modifier in __raw_cpu_write() Uros Bizjak
2024-05-18  9:44   ` [tip: x86/percpu] " tip-bot2 for Uros Bizjak
2024-05-18  9:44 ` [tip: x86/percpu] x86/percpu: Introduce the pcpu_binary_op() macro tip-bot2 for Uros Bizjak

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=20240430091833.196482-4-ubizjak@gmail.com \
    --to=ubizjak@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.