Skip to contentSkip to conversation

pebs, x86: Make sure to really disable PEBS

PATCH In review Andi Kleen 3 participants 4 messages Aug 18, 2012 – Aug 21, 2012

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/2 pebs, x86: Make sure to really disable PEBS

From: Andi Kleen <[email protected]>

When disabling a PEBS event we need to check the old value to determine if PEBS was running. Otherwise the last PEBS value could be kept running.

---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_ds.c +2 -1
index e38d97b..db49ab3 100644
@@ -438,9 +438,10 @@ void intel_pmu_pebs_disable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
+	u64 old = cpuc->pebs_enabled;
 
 	cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
-	if (cpuc->enabled)
+	if (old)
 		wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
 
 	hwc->config |= ARCH_PERFMON_EVENTSEL_INT;
Signature · 1 line
1.7.7.6
author
#1 lore raw

PATCH 2/2 perf: Enable function tracing for perf core

From: Andi Kleen <[email protected]>

According to Steven R. there is no reason left to not support function tracing for the perf core. This makes it easier to debug perf.

Don't remove -pg for the x86 and generic perf core.

---
 arch/x86/kernel/cpu/Makefile |    1 -
 kernel/events/Makefile       |    4 ----
 2 files changed, 0 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/Makefile +0 -1
index d30a6a9..6a16725 100644
@@ -5,7 +5,6 @@
 # Don't trace early stages of a secondary CPU boot
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_common.o = -pg
-CFLAGS_REMOVE_perf_event.o = -pg
 endif
 
 # Make sure load_percpu_segment has no stackprotector
kernel/events/Makefile +0 -4
index 103f5d1..a630994 100644
@@ -1,7 +1,3 @@
-ifdef CONFIG_FUNCTION_TRACER
-CFLAGS_REMOVE_core.o = -pg
-endif
-
 obj-y := core.o ring_buffer.o callchain.o
 
 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [PATCH 2/2] perf: Enable function tracing for perf core

Quoted 7 lines · Andi Kleen

From: Andi Kleen <[email protected]>

According to Steven R. there is no reason left to not support function tracing for the perf core. This makes it easier to debug perf.

Don't remove -pg for the x86 and generic perf core.

There's some new patches queued for 3.7 that has better function tracing recursion protection. This should go after those.

Thanks,

-- Steve

#3 lore raw
In reply to Andi Kleen
Quoted 16 lines · Andi Kleen

From: Andi Kleen <[email protected]>

When disabling a PEBS event we need to check the old value to determine if PEBS was running. Otherwise the last PEBS value could be kept running.

---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_ds.c +0 -0
index e38d97b..db49ab3 100644

arch/x86/kernel/cpu/perf_event_intel_ds.c void intel_pmu_pebs_disable(struct perf_event *event) · line 444

Quoted 8 lines
arch/x86/kernel/cpu/perf_event_intel_ds.c +2 -1
@@ -438,9 +438,10 @@ void intel_pmu_pebs_disable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
+	u64 old = cpuc->pebs_enabled;
 
 	cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
-	if (cpuc->enabled)
+	if (old)

cpuc->enabled != cpuc->pebs_enabled

Quoted 3 lines
arch/x86/kernel/cpu/perf_event_intel_ds.c +0 -0
 		wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
 
 	hwc->config |= ARCH_PERFMON_EVENTSEL_INT;