lkml.org 
[lkml]   [2022]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/5] x86/cacheinfo: move shared cache map definitions

* Sander Vanheule <sander@svanheule.net> wrote:

> The maps to keep track of shared caches between CPUs on SMP systems are
> declared in asm/smp.h, among them specifically cpu_llc_shared_map. These
> maps are externally defined in cpu/smpboot.c. The latter is only compiled
> on CONFIG_SMP=y, which means the declared extern symbols from asm/smp.h do
> not have a corresponding definition on uniprocessor builds.
>
> The inline cpu_llc_shared_mask() function from asm/smp.h refers to the map
> declaration mentioned above. This function is referenced in cacheinfo.c
> inside for_each_cpu() loop macros, to provide cpumask for the loop. On
> uniprocessor builds, the symbol for the cpu_llc_shared_map does not exist.
> However, the current implementation of for_each_cpu() also (wrongly)
> ignores the provided mask.
>
> By sheer luck, the compiler thus optimises out this unused reference to
> cpu_llc_shared_map, and the linker therefore does not require the
> cpu_llc_shared_mask to actually exist on uniprocessor builds. Only on SMP
> bulids does smpboot.o exist to provide the required symbols.
>
> To no longer rely on compiler optimisations for successful uniprocessor
> builds, move the definitions of cpu_llc_shared_map and cpu_l2c_shared_map
> from smpboot.c to cacheinfo.c.
>
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Marco Elver <elver@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Valentin Schneider <vschneid@redhat.com>
> Cc: Yury Norov <yury.norov@gmail.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> ---
> Changes since v3:
> - New patch
>
> arch/x86/kernel/cpu/cacheinfo.c | 6 ++++++
> arch/x86/kernel/smpboot.c | 4 ----
> 2 files changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Ingo Molnar <mingo@kernel.org>

I'm also fine with you guys carrying this in the bitmap tree - the x86
impact is incidental.

Thanks,

Ingo

\
 
 \ /
  Last update: 2022-08-02 13:14    [W:0.138 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site