mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Uros Bizjak" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/percpu] x86/percpu: Unify percpu read-write accessors
Date: Sat, 18 May 2024 09:44:52 -0000	[thread overview]
Message-ID: <171602549296.10875.10251646123842908935.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240430091833.196482-3-ubizjak@gmail.com>

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

Commit-ID:     a50ea641296699af1947336c2e75f6234f53548a
Gitweb:        https://git.kernel.org/tip/a50ea641296699af1947336c2e75f6234f53548a
Author:        Uros Bizjak <ubizjak@gmail.com>
AuthorDate:    Tue, 30 Apr 2024 11:17:22 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Sat, 18 May 2024 11:18:41 +02:00

x86/percpu: Unify percpu read-write accessors

Redefine percpu_from_op() and percpu_to_op() as __raw_cpu_read()
and __raw_cpu_write().  Unify __raw_cpu_{read,write}() macros
between configs w/ and w/o USE_X86_SEG_SUPPORT in order to
unify {raw,this}_cpu{read_write}_N() accessors between configs.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20240430091833.196482-3-ubizjak@gmail.com
---
 arch/x86/include/asm/percpu.h | 72 +++++++++++-----------------------
 1 file changed, 25 insertions(+), 47 deletions(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 08113a2..f360ac5 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -146,28 +146,28 @@
 
 #ifdef CONFIG_USE_X86_SEG_SUPPORT
 
-#define __raw_cpu_read(qual, pcp)					\
+#define __raw_cpu_read(size, qual, pcp)					\
 ({									\
 	*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp));		\
 })
 
-#define __raw_cpu_write(qual, pcp, val)					\
+#define __raw_cpu_write(size, qual, pcp, val)				\
 do {									\
 	*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)) = (val);	\
 } while (0)
 
 #else /* CONFIG_USE_X86_SEG_SUPPORT */
 
-#define percpu_from_op(size, qual, op, _var)				\
+#define __raw_cpu_read(size, qual, _var)				\
 ({									\
 	__pcpu_type_##size pfo_val__;					\
-	asm qual (__pcpu_op2_##size(op, __percpu_arg([var]), "%[val]")	\
+	asm qual (__pcpu_op2_##size("mov", __percpu_arg([var]), "%[val]") \
 	    : [val] __pcpu_reg_##size("=", pfo_val__)			\
 	    : [var] "m" (__my_cpu_var(_var)));				\
 	(typeof(_var))(unsigned long) pfo_val__;			\
 })
 
-#define percpu_to_op(size, qual, op, _var, _val)			\
+#define __raw_cpu_write(size, qual, _var, _val)				\
 do {									\
 	__pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val);	\
 	if (0) {		                                        \
@@ -175,7 +175,7 @@ do {									\
 		pto_tmp__ = (_val);					\
 		(void)pto_tmp__;					\
 	}								\
-	asm qual(__pcpu_op2_##size(op, "%[val]", __percpu_arg([var]))	\
+	asm qual(__pcpu_op2_##size("mov", "%[val]", __percpu_arg([var])) \
 	    : [var] "+m" (__my_cpu_var(_var))				\
 	    : [val] __pcpu_reg_imm_##size(pto_val__));			\
 } while (0)
@@ -448,54 +448,32 @@ do {									\
  */
 #define this_cpu_read_stable(pcp)	__pcpu_size_call_return(this_cpu_read_stable_, pcp)
 
-#ifdef CONFIG_USE_X86_SEG_SUPPORT
-#define raw_cpu_read_1(pcp)		__raw_cpu_read(, pcp)
-#define raw_cpu_read_2(pcp)		__raw_cpu_read(, pcp)
-#define raw_cpu_read_4(pcp)		__raw_cpu_read(, pcp)
-#define raw_cpu_write_1(pcp, val)	__raw_cpu_write(, pcp, val)
-#define raw_cpu_write_2(pcp, val)	__raw_cpu_write(, pcp, val)
-#define raw_cpu_write_4(pcp, val)	__raw_cpu_write(, pcp, val)
-
-#define this_cpu_read_1(pcp)		__raw_cpu_read(volatile, pcp)
-#define this_cpu_read_2(pcp)		__raw_cpu_read(volatile, pcp)
-#define this_cpu_read_4(pcp)		__raw_cpu_read(volatile, pcp)
-#define this_cpu_write_1(pcp, val)	__raw_cpu_write(volatile, pcp, val)
-#define this_cpu_write_2(pcp, val)	__raw_cpu_write(volatile, pcp, val)
-#define this_cpu_write_4(pcp, val)	__raw_cpu_write(volatile, pcp, val)
+#define raw_cpu_read_1(pcp)		__raw_cpu_read(1, , pcp)
+#define raw_cpu_read_2(pcp)		__raw_cpu_read(2, , pcp)
+#define raw_cpu_read_4(pcp)		__raw_cpu_read(4, , pcp)
+#define raw_cpu_write_1(pcp, val)	__raw_cpu_write(1, , pcp, val)
+#define raw_cpu_write_2(pcp, val)	__raw_cpu_write(2, , pcp, val)
+#define raw_cpu_write_4(pcp, val)	__raw_cpu_write(4, , pcp, val)
+
+#define this_cpu_read_1(pcp)		__raw_cpu_read(1, volatile, pcp)
+#define this_cpu_read_2(pcp)		__raw_cpu_read(2, volatile, pcp)
+#define this_cpu_read_4(pcp)		__raw_cpu_read(4, volatile, pcp)
+#define this_cpu_write_1(pcp, val)	__raw_cpu_write(1, volatile, pcp, val)
+#define this_cpu_write_2(pcp, val)	__raw_cpu_write(2, volatile, pcp, val)
+#define this_cpu_write_4(pcp, val)	__raw_cpu_write(4, volatile, pcp, val)
 
 #ifdef CONFIG_X86_64
-#define raw_cpu_read_8(pcp)		__raw_cpu_read(, pcp)
-#define raw_cpu_write_8(pcp, val)	__raw_cpu_write(, pcp, val)
+#define raw_cpu_read_8(pcp)		__raw_cpu_read(8, , pcp)
+#define raw_cpu_write_8(pcp, val)	__raw_cpu_write(8, , pcp, val)
 
-#define this_cpu_read_8(pcp)		__raw_cpu_read(volatile, pcp)
-#define this_cpu_write_8(pcp, val)	__raw_cpu_write(volatile, pcp, val)
+#define this_cpu_read_8(pcp)		__raw_cpu_read(8, volatile, pcp)
+#define this_cpu_write_8(pcp, val)	__raw_cpu_write(8, volatile, pcp, val)
 #endif
 
-#define this_cpu_read_const(pcp)	__raw_cpu_read(, pcp)
+#ifdef CONFIG_USE_X86_SEG_SUPPORT
+#define this_cpu_read_const(pcp)	__raw_cpu_read(, , pcp)
 #else /* CONFIG_USE_X86_SEG_SUPPORT */
 
-#define raw_cpu_read_1(pcp)		percpu_from_op(1, , "mov", pcp)
-#define raw_cpu_read_2(pcp)		percpu_from_op(2, , "mov", pcp)
-#define raw_cpu_read_4(pcp)		percpu_from_op(4, , "mov", pcp)
-#define raw_cpu_write_1(pcp, val)	percpu_to_op(1, , "mov", (pcp), val)
-#define raw_cpu_write_2(pcp, val)	percpu_to_op(2, , "mov", (pcp), val)
-#define raw_cpu_write_4(pcp, val)	percpu_to_op(4, , "mov", (pcp), val)
-
-#define this_cpu_read_1(pcp)		percpu_from_op(1, volatile, "mov", pcp)
-#define this_cpu_read_2(pcp)		percpu_from_op(2, volatile, "mov", pcp)
-#define this_cpu_read_4(pcp)		percpu_from_op(4, volatile, "mov", pcp)
-#define this_cpu_write_1(pcp, val)	percpu_to_op(1, volatile, "mov", (pcp), val)
-#define this_cpu_write_2(pcp, val)	percpu_to_op(2, volatile, "mov", (pcp), val)
-#define this_cpu_write_4(pcp, val)	percpu_to_op(4, volatile, "mov", (pcp), val)
-
-#ifdef CONFIG_X86_64
-#define raw_cpu_read_8(pcp)		percpu_from_op(8, , "mov", pcp)
-#define raw_cpu_write_8(pcp, val)	percpu_to_op(8, , "mov", (pcp), val)
-
-#define this_cpu_read_8(pcp)		percpu_from_op(8, volatile, "mov", pcp)
-#define this_cpu_write_8(pcp, val)	percpu_to_op(8, volatile, "mov", (pcp), val)
-#endif
-
 /*
  * The generic per-cpu infrastrucutre is not suitable for
  * reading const-qualified variables.

  reply	other threads:[~2024-05-18  9:44 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-bot2 for Uros Bizjak [this message]
2024-04-30  9:17 ` [PATCH -tip 4/5] x86/percpu: Introduce __raw_cpu_read_const() macro Uros Bizjak
2024-05-18  9:44   ` [tip: x86/percpu] x86/percpu: Introduce the " 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=171602549296.10875.10251646123842908935.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ubizjak@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®