Files
Centos-kernel-stream-10/arch/alpha/include/asm/percpu.h
T
Rafael Aquini 9e421bc85b mm/percpu: conditionally define _shared_alloc_tag via CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU
JIRA: https://redhat.atlassian.net/browse/RHEL-145695

commit 59b5ed409d03bc8b7bb153d78afcd7cea9d7bbfa
Author: Hao Ge <gehao@kylinos.cn>
Date:   Wed Jun 18 09:58:09 2025 +0800

    mm/percpu: conditionally define _shared_alloc_tag via CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU

    Recently discovered this entry while checking kallsyms on ARM64:
    ffff800083e509c0 D _shared_alloc_tag

    If ARCH_NEEDS_WEAK_PER_CPU is not defined(it is only defined for s390 and
    alpha architectures), there's no need to statically define the percpu
    variable _shared_alloc_tag.

    Therefore, we need to implement isolation for this purpose.

    When building the core kernel code for s390 or alpha architectures,
    ARCH_NEEDS_WEAK_PER_CPU remains undefined (as it is gated by #if
    defined(MODULE)).  However, when building modules for these architectures,
    the macro is explicitly defined.

    Therefore, we remove all instances of ARCH_NEEDS_WEAK_PER_CPU from the
    code and introduced CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU to replace the
    relevant logic.  We can now conditionally define the perpcu variable
    _shared_alloc_tag based on CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU.  This
    allows architectures (such as s390/alpha) that require weak definitions
    for percpu variables in modules to include the definition, while others
    can omit it via compile-time exclusion.

    Link: https://lkml.kernel.org/r/20250618015809.1235761-1-hao.ge@linux.dev
    Signed-off-by: Hao Ge <gehao@kylinos.cn>
    Suggested-by: Suren Baghdasaryan <surenb@google.com>
    Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>    [s390]
    Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Cc: Chistoph Lameter <cl@linux.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Dennis Zhou <dennis@kernel.org>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Kent Overstreet <kent.overstreet@linux.dev>
    Cc: Liam Howlett <liam.howlett@oracle.com>
    Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Cc: Matt Turner <mattst88@gmail.com>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Rafael Aquini <raquini@redhat.com>
2026-07-31 14:50:19 -04:00

19 lines
532 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ALPHA_PERCPU_H
#define __ALPHA_PERCPU_H
/*
* To calculate addresses of locally defined variables, GCC uses
* 32-bit displacement from the GP. Which doesn't work for per cpu
* variables in modules, as an offset to the kernel per cpu area is
* way above 4G.
*
* Always use weak definitions for percpu variables in modules.
* Therefore, we have enabled CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU
* in the Kconfig.
*/
#include <asm-generic/percpu.h>
#endif /* __ALPHA_PERCPU_H */