public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Sander Vanheule <sander@svanheule.net>
Cc: linux-kernel@vger.kernel.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Brendan Higgins" <brendanhiggins@google.com>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"David Gow" <davidgow@google.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Maíra Canal" <mairacanal@riseup.net>,
	"Marco Elver" <elver@google.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Valentin Schneider" <vschneid@redhat.com>,
	"Yury Norov" <yury.norov@gmail.com>
Subject: Re: [PATCH v5 1/5] x86/cacheinfo: move shared cache map definitions
Date: Tue, 2 Aug 2022 13:13:06 +0200	[thread overview]
Message-ID: <YukGwkzicp+aNLXx@gmail.com> (raw)
In-Reply-To: <3181e52cb86b57f3a98dec4aaab8935f14b683a1.1659077534.git.sander@svanheule.net>


* 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

  reply	other threads:[~2022-08-02 11:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  7:01 [PATCH v5 0/5] cpumask: fix invalid uniprocessor assumptions Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 1/5] x86/cacheinfo: move shared cache map definitions Sander Vanheule
2022-08-02 11:13   ` Ingo Molnar [this message]
2022-07-29  7:01 ` [PATCH v5 2/5] cpumask: add UP optimised for_each_*_cpu versions Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 3/5] cpumask: fix invalid uniprocessor mask assumption Sander Vanheule
2022-08-08 16:23   ` [RFC] issue with cpumask for UniProcessor Saurabh Sengar
2022-08-08 17:34     ` Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 4/5] lib/test: introduce cpumask KUnit test suite Sander Vanheule
2022-07-31 15:23   ` Maíra Canal
2022-07-31 15:42     ` Sander Vanheule
2022-07-31 22:11       ` Maíra Canal
2022-08-09 18:38     ` Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 5/5] cpumask: update cpumask_next_wrap() signature Sander Vanheule
2022-07-30 18:15 ` [PATCH v5 0/5] cpumask: fix invalid uniprocessor assumptions Yury Norov
2022-07-31 13:02   ` Sander Vanheule
2022-07-31 15:28     ` Yury Norov

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=YukGwkzicp+aNLXx@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=brendanhiggins@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davidgow@google.com \
    --cc=elver@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mairacanal@riseup.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sander@svanheule.net \
    --cc=tglx@linutronix.de \
    --cc=vschneid@redhat.com \
    --cc=yury.norov@gmail.com \
    /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