]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/percpu: Use new percpu code section for arch_this_cpu_[and|or]()
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 26 May 2026 05:57:00 +0000 (07:57 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Wed, 3 Jun 2026 13:32:46 +0000 (15:32 +0200)
Convert arch_this_cpu_[and|or]() to make use of the new percpu code
section infrastructure.

There is no user of this_cpu_and() and only one user of this_cpu_or()
within the kernel. Therefore this conversion has hardly any effect,
and also removes only preempt_schedule_notrace() function call.

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/include/asm/percpu.h

index f2d0e035458222f91418745cd43439d6fc8e3095..5e0185e5960b03decd9895e4e688a651289f3083 100644 (file)
@@ -216,17 +216,29 @@ do {                                                                              \
 
 #define arch_this_cpu_to_op(pcp, val, op)                              \
 do {                                                                   \
+       unsigned long lc_pcpr, lc_pcpo;                                 \
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable_notrace();                                      \
-       ptr__ = raw_cpu_ptr(&(pcp));                                    \
-       asm volatile(                                                   \
-               op "    %[old__],%[val__],%[ptr__]"                     \
-               : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__)           \
-               : [val__] "d" (val__)                                   \
+                                                                       \
+       lc_pcpr = offsetof(struct lowcore, percpu_register);            \
+       lc_pcpo = offsetof(struct lowcore, percpu_offset);              \
+       ptr__ = PERCPU_PTR(&(pcp));                                     \
+       asm_inline volatile(                                            \
+               MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\
+               AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]")     \
+               op "    %[old__],%[val__],0(%[ptr__])\n"                \
+               MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]")               \
+               : [old__] "=&d" (old__),                                \
+                 [ptr__] "+&a" (ptr__), "+m" (*ptr__),                 \
+                 "=m" (((struct lowcore *)0)->percpu_register)         \
+               : [val__] "d" (val__),                                  \
+                 [disppcpr] "i" (lc_pcpr),                             \
+                 [disppcpo] "i" (lc_pcpo),                             \
+                 [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS),    \
+                 [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS),    \
+                 "m" (((struct lowcore *)0)->percpu_offset)            \
                : "cc");                                                \
-       preempt_enable_notrace();                                       \
 } while (0)
 
 #define this_cpu_and_4(pcp, val)       arch_this_cpu_to_op(pcp, val, "lan")