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

Peter Zijlstra
2012-06-08T14:21:04Z

On Fri, 2012-06-08 at 16:15 +0200, Borislav Petkov wrote:
> 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.

>
> Hmm, I'm probably missing some obscure case.

Since its all per-cpu sysfs muck, userspace could update a random
subsets of cpus.. leaving us hanging.

The 'bestestet' idea I came up with is doing the verify thing I have
from a delayed work -- say 1 second into the future. That way, when
there's lots of cpus they all try and enqueue the one work, which at the
end executes only once, provided the entire update scan took less than
the second.

But yuck..