From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Fri, 21 Aug 2026 18:42:18 +0200 Subject: [Devel] [PATCH RHEL10 COMMIT] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long In-Reply-To: <20260821163718.187766-17-khorenko@virtuozzo.com> Message-ID: <202608211642.67LGgIYQ667542@f0.sw.ru> List-Id: The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.6.vz10 ------> commit 739f9b240ca3de6d8ead88a2990724be26366f13 Author: Uros Bizjak Date: Fri Aug 21 18:37:02 2026 +0200 ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long Cast pointer from percpu address space to generic (kernel) address space in PERCPU_PTR() macro via unsigned long intermediate cast [1]. This intermediate cast is also required to avoid build failure when GCC's strict named address space checks for x86 targets [2] are enabled. Found by GCC's named address space checks. [1] https://sparse.docs.kernel.org/en/latest/annotations.html#address-space-name [2] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#x86-Named-Address-Spaces Link: https://lkml.kernel.org/r/20241021080856.48746-3-ubizjak at gmail.com Signed-off-by: Uros Bizjak Acked-by: Christoph Lameter Cc: Dennis Zhou Cc: Tejun Heo Signed-off-by: Andrew Morton (cherry picked from commit dabddd687c9e1a06241d6b4d1f66b9f2b60b3ad1) Conflict resolution: the previous patch of the same upstream series had to drop the stray trailing semicolon of PERCPU_PTR() to stay buildable here, so only the body of the macro is replaced. https://virtuozzo.atlassian.net/browse/VSTOR-134732 Feature: fix rh/sched Signed-off-by: Konstantin Khorenko --- include/linux/percpu-defs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 02bcd74afc6c6..ee236ee0bed6c 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -221,7 +221,10 @@ do { \ } while (0) #define PERCPU_PTR(__p) \ - (typeof(*(__p)) __force __kernel *)(__p) +({ \ + unsigned long __pcpu_ptr = (__force unsigned long)(__p); \ + (typeof(*(__p)) __force __kernel *)(__pcpu_ptr); \ +}) #ifdef CONFIG_SMP