From: Borislav Petkov <bp@alien8.de>
To: Andi Kleen <andi@firstfloor.org>
Cc: x86@kernel.org, hpa@zytor.com, eranian@google.com,
linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/2] x86: Track minimum microcode revision globally v2
Date: Tue, 12 Jun 2012 23:39:05 +0200 [thread overview]
Message-ID: <20120612213905.GE26817@liondog.tnic> (raw)
In-Reply-To: <1339536350-10463-1-git-send-email-andi@firstfloor.org>
On Tue, Jun 12, 2012 at 02:25:49PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> For bug workarounds depending on microcode revisions we need to
> know the minimum microcode revision shared by all CPUs.
>
> This patch adds infrastructure to track this.
>
> Every time microcode is updated we update a global variable for
> the minimum microcode revision of all the CPUs in the system.
> At boot time we use the lowest available microcode (and warn
> if they are inconsistent)
>
> At CPU hotplug or S3 resume time there is a short race window
> where something might run on the CPUs but before the microcode
> update notifier runs. For the current workarounds that need this
> this is acceptable and shouldn't be a problem.
>
> Only tested on Intel CPUs, but should work for AMD too.
Yeah, will test this one soonish.
> v2: Use boot_cpu_data.microcode to track minimum revision (H. Peter Anvin)
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> arch/x86/include/asm/processor.h | 2 +
> arch/x86/kernel/cpu/amd.c | 2 +
> arch/x86/kernel/cpu/common.c | 38 +++++++++++++++++++++++++++++++++++++
> arch/x86/kernel/cpu/cpu.h | 3 ++
> arch/x86/kernel/cpu/intel.c | 2 +
> arch/x86/kernel/microcode_amd.c | 1 +
> arch/x86/kernel/microcode_intel.c | 1 +
> 7 files changed, 49 insertions(+), 0 deletions(-)
[ … ]
> +/*
> + * Track the minimum global microcode version. On early bootup assume
> + * the BIOS set all CPUs to the same revision. If that's not the case
> + * some code may be already running assuming the newer revision, but
> + * there's not much we can do about that (but it's unlikely to be
> + * problem in early bootup)
> + */
> +__cpuinit void boot_update_min_microcode(struct cpuinfo_x86 *c)
> +{
> + static int boot_min_microcode;
> +
> + if (!boot_min_microcode) {
> + boot_min_microcode = c->microcode;
> + boot_cpu_data.microcode = c->microcode;
> + } else if (c->microcode < boot_min_microcode) {
> + pr_warn("CPU %d has lower microcode revision %x at boot than boot CPU (%x)\n",
> + smp_processor_id(),
> + c->microcode,
> + boot_min_microcode);
> + boot_cpu_data.microcode = c->microcode;
Ok, is it only me or is this boot_min_microcode superfluous?
IOW, you can only use boot_cpu_data.microcode instead and drop
boot_min_microcode.
--
Regards/Gruss,
Boris.
next prev parent reply other threads:[~2012-06-12 21:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 21:25 Andi Kleen
2012-06-12 21:25 ` [PATCH 2/2] perf/x86: check ucode before disabling PEBS on SandyBridge v3 Andi Kleen
2012-06-12 21:39 ` Borislav Petkov [this message]
2012-06-12 22:09 ` [PATCH 1/2] x86: Track minimum microcode revision globally v2 Andi Kleen
2012-06-12 22:19 ` Borislav Petkov
2012-06-12 22:53 ` Andi Kleen
2012-06-13 6:55 ` Borislav Petkov
2012-06-13 8:49 ` Peter Zijlstra
2012-06-13 14:49 ` Andi Kleen
2012-06-13 8:57 ` Peter Zijlstra
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=20120612213905.GE26817@liondog.tnic \
--to=bp@alien8.de \
--cc=a.p.zijlstra@chello.nl \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®