From: Ingo Molnar <mingo@elte.hu>
To: Kevin Winchester <kjwinchester@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Randy Dunlap <rdunlap@xenotime.net>,
Nick Bowler <nbowler@elliptictech.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86
Date: Sun, 12 Feb 2012 12:19:15 +0100 [thread overview]
Message-ID: <20120212111914.GC21493@elte.hu> (raw)
In-Reply-To: <CAELBVzD8eZuxO0KLvZp8VuucoPxBNVsojO1NhC-pvr78Mg1v+w@mail.gmail.com>
* Kevin Winchester <kjwinchester@gmail.com> wrote:
> On 11 February 2012 20:24, Kevin Winchester <kjwinchester@gmail.com> wrote:
> > Commit 141168c36cde ("x86: Simplify code by removing a !SMP #ifdefs from
> > 'struct cpuinfo_x86'") caused the compilation error:
> >
> > mce_amd.c:(.cpuinit.text+0x4723): undefined reference to 'cpu_llc_shared_map'
> >
> > by removing an #ifdef CONFIG_SMP around a block containing a reference
> > to cpu_llc_shared_map. Rather than replace the #ifdef, move
> > cpu_llc_shared_map to be a new field llc_shared_map in struct
> > cpuinfo_x86 and adjust all references to cpu_llc_shared_map.
> >
> > Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
> > ---
> > arch/x86/include/asm/processor.h | 1 +
> > arch/x86/include/asm/smp.h | 6 ------
> > arch/x86/kernel/cpu/intel_cacheinfo.c | 4 ++--
> > arch/x86/kernel/cpu/mcheck/mce_amd.c | 7 ++++---
> > arch/x86/kernel/smpboot.c | 15 ++++++---------
> > arch/x86/xen/smp.c | 1 -
> > 6 files changed, 13 insertions(+), 21 deletions(-)
> >
> >
> > static void impress_friends(void)
> > @@ -1053,7 +1051,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
> > for_each_possible_cpu(i) {
> > zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
> > zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
> > - zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
> > }
> > set_cpu_sibling_map(0);
> >
> > diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
> > index 041d4fe..a898ed5 100644
> > --- a/arch/x86/xen/smp.c
> > +++ b/arch/x86/xen/smp.c
> > @@ -225,7 +225,6 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
> > for_each_possible_cpu(i) {
> > zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
> > zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
> > - zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
> > }
> > set_cpu_sibling_map(0);
> >
>
> I just realized that I took out a couple of allocations here
> for cpu_llc_shared_map, without replacing them. Am I leaving
> cpuinfo_x86.llc_shared_map unallocated then, and just writing
> to whatever address that field happened to get?
That will probably crash CONFIG_CPUMASK_OFFSTACK=y kernels.
The simplest approach would be to use a cpumask_t (i.e. not a
variable cpumask_var_t one), on the [valid looking] assumption
that cpuinfo_x86 gets allocated in sane ways - i.e. never on the
kernel stack and such.
The before/after vmlinux 'size' result should be inspected, with
NR_CPUs set to 4096 and OFFSTACK activated in the .config, to
see how bad the size effect is - but I think it should not be
too bad.
Thanks,
Ingo
next prev parent reply other threads:[~2012-02-12 11:19 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 19:10 [PATCH] MCE, AMD: Select SMP explicitly Borislav Petkov
2012-02-02 19:37 ` Nick Bowler
2012-02-02 20:24 ` Borislav Petkov
2012-02-03 19:18 ` MCE, AMD: Hide smp-only code around CONFIG_SMP Borislav Petkov
2012-02-03 22:05 ` Randy Dunlap
2012-02-07 9:57 ` Ingo Molnar
2012-02-08 0:41 ` Kevin Winchester
2012-02-08 10:19 ` Borislav Petkov
2012-02-08 12:22 ` Kevin Winchester
2012-02-08 13:05 ` Borislav Petkov
2012-02-09 8:06 ` Ingo Molnar
2012-02-10 0:00 ` Kevin Winchester
2012-02-11 14:07 ` Ingo Molnar
2012-02-12 0:24 ` [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-12 2:18 ` Kevin Winchester
2012-02-12 11:19 ` Ingo Molnar [this message]
2012-02-14 0:12 ` [PATCH v2] " Kevin Winchester
2012-02-17 11:56 ` Ingo Molnar
2012-02-17 13:12 ` Kevin Winchester
2012-02-21 2:06 ` [PATCH 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-21 2:06 ` [PATCH 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-21 15:42 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-21 10:37 ` Borislav Petkov
2012-02-21 10:40 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-21 11:35 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-21 14:21 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-21 15:39 ` Borislav Petkov
2012-02-22 1:44 ` Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 6:39 ` H. Peter Anvin
2012-02-22 9:27 ` Ingo Molnar
2012-02-22 12:24 ` Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-22 23:43 ` [PATCH v3 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-23 7:32 ` Ingo Molnar
2012-02-22 1:45 ` [PATCH v2 2/5] x86: Move per cpu cpu_llc_id to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-12 11:23 ` [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Borislav Petkov
2012-02-12 0:31 ` MCE, AMD: Hide smp-only code around CONFIG_SMP Kevin Winchester
2012-02-22 16:13 ` [tip:x86/urgent] x86/mce/AMD: Fix UP build error tip-bot for Borislav Petkov
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=20120212111914.GC21493@elte.hu \
--to=mingo@elte.hu \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=kjwinchester@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nbowler@elliptictech.com \
--cc=rdunlap@xenotime.net \
--cc=tglx@linutronix.de \
/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
Powered by JetHome