Re: [PATCH] perf/x86: check ucode before disabling PEBS on SandyBridge

Peter Zijlstra
2012-06-08T13:54:43Z

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.

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