linux/arch/x86/kernel/cpu
Stephane Eranian 2f7f73a520 perf/x86: Fix shared register mutual exclusion enforcement
This patch fixes a problem with the shared registers mutual
exclusion code and incremental event scheduling by the
generic perf_event code.

There was a bug whereby the mutual exclusion on the shared
registers was not enforced because of incremental scheduling
abort due to event constraints. As an example on Intel
Nehalem, consider the following events:

group1= L1D_CACHE_LD:E_STATE,OFFCORE_RESPONSE_0:PF_RFO,L1D_CACHE_LD:I_STATE
group2= L1D_CACHE_LD:I_STATE

The L1D_CACHE_LD event can only be measured by 2 counters. Yet, there
are 3 instances here. The first group can be scheduled and is committed.
Then, the generic code tries to schedule group2 and this fails (because
there is no more counter to support the 3rd instance of L1D_CACHE_LD).
But in x86_schedule_events() error path, put_event_contraints() is invoked
on ALL the events and not just the ones that just failed. That causes the
"lock" on the shared offcore_response MSR to be released. Yet the first group
is actually scheduled and is exposed to reprogramming of that shared msr by
the sibling HT thread. In other words, there is no guarantee on what is
measured.

This patch fixes the problem by tagging committed events with the
PERF_X86_EVENT_COMMITTED tag. In the error path of x86_schedule_events(),
only the events NOT tagged have their constraint released. The tag
is eventually removed when the event in descheduled.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20130620164254.GA3556@quad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-06-26 21:58:49 +02:00
..
mcheck Clean up cmci_rediscover code to fix problems found by Dave Jones 2013-04-08 17:41:50 +02:00
mtrr taint: add explicit flag to show whether lock dep is still OK. 2013-01-21 17:17:57 +10:30
.gitignore
amd.c x86, CPU, AMD: Drop useless label 2013-04-16 11:50:51 +02:00
bugs_64.c
bugs.c x86: Fold-in trivial check_config function 2013-04-16 11:50:50 +02:00
centaur.c x86, centaur: Enable cx8 for VIA Eden too 2011-12-15 08:04:42 -08:00
common.c x86, cpu: Expand cpufeature facility to include cpu bugs 2013-04-02 10:12:52 -07:00
cpu.h x86/tlb_info: get last level TLB entry number of CPU 2012-06-27 19:28:24 -07:00
cyrix.c x86, cpu: Convert Cyrix coma bug detection 2013-04-02 10:12:54 -07:00
hypervisor.c x86/apic: Allow x2apic without IR on VMware platform 2013-01-24 13:11:18 +01:00
intel_cacheinfo.c Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-02-19 20:09:48 -08:00
intel.c Merge branch 'x86-kaslr-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-04-30 08:37:24 -07:00
Makefile perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation 2013-06-19 13:04:53 +02:00
match.c x86: Fix typo in MODULE_DEVICE_TABLE example: s/x86_cpu/x86cpu/ 2012-04-16 14:20:19 +02:00
mkcapflags.sh mkcapflags.pl: convert to mkcapflags.sh 2013-04-29 15:54:27 -07:00
mshyperv.c x86, hyperv: Handle Xen emulation of Hyper-V more gracefully 2013-04-18 08:59:20 -07:00
perf_event_amd_ibs.c treewide: Replace incomming with incoming in all comments and strings 2013-01-03 16:15:49 +01:00
perf_event_amd_iommu.c perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation 2013-06-19 13:04:53 +02:00
perf_event_amd_iommu.h perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation 2013-06-19 13:04:53 +02:00
perf_event_amd_uncore.c perf/x86/amd: Fix AMD NB and L2I "uncore" support 2013-04-22 10:10:55 +02:00
perf_event_amd.c perf/x86/amd: Rework AMD PMU init code 2013-05-28 09:13:55 +02:00
perf_event_intel_ds.c perf/x86/intel: Add mem-loads/stores support for Haswell 2013-06-19 14:43:35 +02:00
perf_event_intel_lbr.c perf/x86/intel: Support Haswell/v4 LBR format 2013-06-19 14:43:35 +02:00
perf_event_intel_uncore.c perf/x86/intel: Fix sparse warning 2013-06-19 13:04:55 +02:00
perf_event_intel_uncore.h perf/x86/intel: Prevent some shift wrapping bugs in the Intel uncore driver 2013-05-28 09:13:52 +02:00
perf_event_intel.c perf/x86: Fix shared register mutual exclusion enforcement 2013-06-26 21:58:49 +02:00
perf_event_knc.c x86: Constify a few items 2013-03-11 15:11:03 +01:00
perf_event_p4.c perf/x86/intel/P4: Robistify P4 PMU types 2013-04-26 09:31:41 +02:00
perf_event_p6.c x86: Constify a few items 2013-03-11 15:11:03 +01:00
perf_event.c perf/x86: Fix shared register mutual exclusion enforcement 2013-06-26 21:58:49 +02:00
perf_event.h perf/x86: Fix shared register mutual exclusion enforcement 2013-06-26 21:58:49 +02:00
perfctr-watchdog.c perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU 2012-10-04 13:32:37 +02:00
powerflags.c x86: Report cpb and eff_freq_ro flags correctly 2011-12-15 08:14:49 +01:00
proc.c x86, cpu: Convert Cyrix coma bug detection 2013-04-02 10:12:54 -07:00
rdrand.c x86, random: Verify RDRAND functionality and allow it to be disabled 2011-07-31 14:02:19 -07:00
scattered.c cpufreq: AMD "frequency sensitivity feedback" powersave bias for ondemand governor 2013-04-10 13:19:26 +02:00
topology.c x86, cpu: Split addon_cpuid_features.c 2010-07-19 19:02:41 -07:00
transmeta.c
umc.c
vmware.c x86/apic: Allow x2apic without IR on VMware platform 2013-01-24 13:11:18 +01:00