From: Borislav Petkov <bp@amd64.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Borislav Petkov <bp@amd64.org>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Avi Kivity <avi@redhat.com>,
"Przywara, Andre" <Andre.Przywara@amd.com>,
"Pohlack, Martin" <Martin.Pohlack@amd.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -v3.2 3/3] x86, AMD: Move BSP code to cpu_dev helper
Date: Sat, 6 Aug 2011 00:52:07 +0200 [thread overview]
Message-ID: <20110805225207.GA27866@aftab> (raw)
In-Reply-To: <4E3C4D8C.1010709@zytor.com>
On Fri, Aug 05, 2011 at 04:07:40PM -0400, H. Peter Anvin wrote:
> On 08/05/2011 11:04 AM, Borislav Petkov wrote:
> > Move code which is run once on the BSP during boot into the cpu_dev
> > helper.
> > +static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c)
> > +{
> > + if (static_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
> > +
>
> You can't use static_cpu_has() here, since this code runs before
> alternatives -- it will always be false. Furthermore, for code that
> only runs once, it is never a win to do patching.
Oh crap, this is a leftover from when run_on_bsp was struct
x86_cpuinit_ops member with no args. And I f*cked it up even then
although I went and got myself a pointer to boot_cpu_data:
+static void __cpuinit amd_run_on_bsp(void)
+{
+ struct cpuinfo_x86 *c = &boot_cpu_data;
+
+ if (static_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
but forgot to use it. Good catch, will fix it tomorrow.
> Arguably bsp_init should be __init and not __cpuinit, but I don't know
> how to make that work with the machinery, and is something that can be
> fixed anyway.
Yeah, how do we do that? struct cpu_dev is __cpuinitconst,
x86_cpuinit_ops is __cpuinitdata.
We could add it to identify_boot_cpu() - there's already some per-vendor
stuff like init_amd_e400_c1e_mask() which wouldn't hurt to be behind a
vendor check. early_identify_cpu() does already the vendor check with
get_cpu_vendor() so later, in identify_cpu() we could add a run_on_bsp()
which is __init and switch/case on the ->x86_vendor inside.
Then we can collect all the run-once-on-the-BSP code in there.
Hmmm..
--
Regards/Gruss,
Boris.
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
next prev parent reply other threads:[~2011-08-05 22:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 13:15 [PATCH -v3.1 0/3] x86, AMD: Correct F15h IC aliasing issue Borislav Petkov
2011-08-05 13:15 ` [PATCH -v3.1 1/3] " Borislav Petkov
2011-08-05 22:58 ` [tip:x86/cpu] x86, amd: Avoid cache aliasing penalties on AMD family 15h tip-bot for Borislav Petkov
2011-08-06 0:10 ` H. Peter Anvin
2011-08-06 12:31 ` [PATCH] x86, AMD: Fix 32-bit build after cache aliasing patch Borislav Petkov
2011-08-06 23:22 ` [tip:x86/cpu] x86-32, amd: Move va_align definition to unbreak 32-bit build tip-bot for Borislav Petkov
2011-08-05 13:15 ` [PATCH -v3.1 2/3] x86: Add a BSP cpuinit helper Borislav Petkov
2011-08-05 13:15 ` [PATCH -v3.1 3/3] x86, AMD: Move BSP code to " Borislav Petkov
2011-08-05 17:10 ` [PATCH -v3.1 0/3] x86, AMD: Correct F15h IC aliasing issue H. Peter Anvin
2011-08-05 17:55 ` Borislav Petkov
2011-08-05 18:01 ` [PATCH -v3.2 2/3] x86: Add a BSP cpu_dev helper Borislav Petkov
2011-08-05 22:58 ` [tip:x86/cpu] " tip-bot for Borislav Petkov
2011-08-05 18:04 ` [PATCH -v3.2 3/3] x86, AMD: Move BSP code to " Borislav Petkov
2011-08-05 20:07 ` H. Peter Anvin
2011-08-05 22:52 ` Borislav Petkov [this message]
2011-08-05 22:56 ` H. Peter Anvin
2011-08-05 22:59 ` [tip:x86/cpu] x86, amd: " 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=20110805225207.GA27866@aftab \
--to=bp@amd64.org \
--cc=Andre.Przywara@amd.com \
--cc=Martin.Pohlack@amd.com \
--cc=akpm@linux-foundation.org \
--cc=avi@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.