[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120612204917.GA26817@liondog.tnic>
Date:	Tue, 12 Jun 2012 22:49:17 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	x86@...nel.org, hpa@...or.com, eranian@...gle.com,
	linux-kernel@...r.kernel.org, a.p.zijlstra@...llo.nl,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 1/2] x86: Track minimum microcode revision globally
On Tue, Jun 12, 2012 at 01:33:53PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.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.
> 
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> ---
>  arch/x86/include/asm/processor.h  |    3 ++
>  arch/x86/kernel/cpu/amd.c         |    2 +
>  arch/x86/kernel/cpu/common.c      |   41 +++++++++++++++++++++++++++++++++++++
>  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, 53 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;
> +		min_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);
What do we need that for? Mixed-ucode versions?
-- 
Regards/Gruss,
    Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
