Messages in this thread | | | Date | Tue, 12 Jun 2012 19:23:34 +0200 | From | Robert Richter <> | Subject | Re: [PATCH] perf/x86: check ucode before disabling PEBS on SandyBridge |
| |
On 12.06.12 19:13:23, Peter Zijlstra wrote: > On Tue, 2012-06-12 at 19:09 +0200, Stephane Eranian wrote: > > > Instead of registering a microcode notifier, why not checking the > > > availability of pebs dynamically with each syscall in > > > intel_pmu_hw_config()? It looks like intel_snb_verify_ucode() is not > > > that much expensive. We can perform the check only if the event > > could > > > be for pebs and if pebs is broken. The check could be repeated when > > > setting up a new event after ucode could potentially has been > > updated > > > (e.g. after bringing a cpu online or so). > > Because you then end up with a for_each_online_cpu() loop in there, > that's not pretty and quite horrible on large systems when you need to > create nr_cpus events.
But usually the check fails on the current cpu, no need to touch other cpus in this case. for_each_online_cpu() would run only for the case that there just was a ucode update and pebs is going to be enabled. And for this rare case we could use locking.
> Furthermore, ucode update is the rare thing, creating events happens > much more frequently. > > > That's what I had in my original version. > > Right, but you really need to check all cpus, not just the one you > happen to run on or the boot cpu.
Once pebs is enabled no further checks are needed anymore, I think.
-Robert
-- Advanced Micro Devices, Inc. Operating System Research Center
| |