lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120608141543.GD31359@aftab.osrc.amd.com>
Date:	Fri, 8 Jun 2012 16:15:43 +0200
From:	Borislav Petkov <borislav.petkov@....com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Borislav Petkov <borislav.petkov@....com>,
	Ingo Molnar <mingo@...nel.org>,
	Stephane Eranian <eranian@...gle.com>,
	<linux-kernel@...r.kernel.org>, <andi@...stfloor.org>,
	<mingo@...e.hu>, <ming.m.lin@...el.com>,
	Andreas Herrmann <andreas.herrmann3@....com>,
	Dimitri Sivanich <sivanich@....com>,
	Dmitry Adamushko <dmitry.adamushko@...il.com>
Subject: Re: [PATCH] perf/x86: check ucode before disabling PEBS on
 SandyBridge

On Fri, Jun 08, 2012 at 03:54:29PM +0200, Peter Zijlstra wrote:
> On Fri, 2012-06-08 at 15:51 +0200, Borislav Petkov wrote:
> > Reportedly, there are some obscure systems which need different
> > microcode versions per CPU:
> > 
> > http://lkml.indiana.edu/hypermail/linux/kernel/1105.3/01010.html
> 
> *groan*,.. ok.

Tell me about it - if we didn't have to support this, we could've killed
a lot of code from the thing.

> > > The biggest problem is finding when the minimum revision changes, at
> > > best this is a n log n sorting problem due to the per-cpu setup, but I
> > > couldn't be arsed to implement a tree or anything fancy since it all
> > > stinks anyway.
> > 
> > I know. Can't you just iterate over all CPUs and collect the lowest
> > ucode version? Provided, of course, newer microcode versions means a
> > higher version number. 
> 
> That's what I do.. but that's O(n) per cpu, so if you update all cpus,
> that's O(n^2).
> 
> You don't know when userspace is done updating the 'last' cpu, so you
> have to scan all cpus for every cpu.
> 
> I'm sure the SGI people with their silly CPU counts aren't too thrilled
> to have this.

Ok, hmm, I don't have a bright idea right now except maybe a stupid one:

have a variable which gets initialized to the number of all CPUs and
each time ->apply_microcode() finishes by returning 0, we decrement it
once.

"Finishes by returning 0" means ucode successfully updated.

When it has reached 0, microcode_notifier_done() says
MICROCODE_SUCCESSFULLY_UPDATED_ON_ALL_CPUS and only then you run
intel_snb_verify_ucode().

However(!),

* what do you do when you boot the box with less CPUs than present? All
the offline CPUs cannot get to userspace to get the chance to update
ucode. In that case, counter stays !0 and bo PEBS, tough luck.

* hotplug: we don't care about it because once we ONLINE a CPU again, it
automatically gets the ucode applied.

Hmm, I'm probably missing some obscure case.

-- 
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

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ