Skip to contentSkip to conversation

perf stat branch: perf stat fails on unsupported event

DISCUSSION David Ahern 2 participants 6 messages Apr 29, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Tried the perf stat branch this morning. perf stat fails with:

# /tmp/build-perf/perf stat -- sleep 1
  Error: stalled-cycles-frontend event is not supported.
  Fatal: Not all events could be opened.

This is a Dell R410 with an E5620 processor.

David

#1 lore raw
Quoted 7 lines · David Ahern

Tried the perf stat branch this morning. perf stat fails with:

# /tmp/build-perf/perf stat -- sleep 1
  Error: stalled-cycles-frontend event is not supported.
  Fatal: Not all events could be opened.

This is a Dell R410 with an E5620 processor.

Does the patch below allow the other events to be counted?

Thanks,

Ingo

tools/perf/builtin-stat.c +1 -3
index 9e596ab..c11ec76 100644
@@ -377,7 +377,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 
 	list_for_each_entry(counter, &evsel_list->entries, node) {
 		if (create_perf_stat_counter(counter) < 0) {
-			if (errno == EINVAL || errno == ENOSYS)
+			if (errno == EINVAL || errno == ENOSYS || errno = ENOENT)
 				continue;
 
 			if (errno == EPERM || errno == EACCES) {
@@ -385,8 +385,6 @@ static int run_perf_stat(int argc __used, const char **argv)
 				      "\t Consider tweaking"
 				      " /proc/sys/kernel/perf_event_paranoid or running as root.",
 				      system_wide ? "system-wide " : "");
-			} else if (errno == ENOENT) {
-				error("%s event is not supported. ", event_name(counter));
 			} else {
 				error("open_counter returned with %d (%s). "
 				      "/bin/dmesg may provide additional information.\n",
#3 lore raw
In reply to David Ahern
Quoted 1 line · David Ahern

This is a Dell R410 with an E5620 processor.

That's a Westmere CPU.

Could you check whether the patch below applied to latest -tip gives you stalled-cycles-frontend and stalled-cycles-backend events?

Thanks,

Ingo

--------------->

Quoted 1 line

From 3808ae38f1905c1f11da46ac981c8d2579936fd8 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Sat, 30 Apr 2011 09:14:54 +0200
Subject: [PATCH] perf events, x86: Add Westmere stalled-cycles-frontend/backend events

Extend the Intel Westmere PMU driver with definitions for generic front-end and back-end stall events.

( These are only approximations. )

---
 arch/x86/kernel/cpu/perf_event_intel.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +6 -0
index 7983b9a..be8363a 100644
@@ -1458,6 +1458,12 @@ static __init int intel_pmu_init(void)
 		x86_pmu.enable_all = intel_pmu_nhm_enable_all;
 		x86_pmu.pebs_constraints = intel_westmere_pebs_event_constraints;
 		x86_pmu.extra_regs = intel_westmere_extra_regs;
+
+		/* UOPS_ISSUED.STALLED_CYCLES */
+		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x180010e;
+		/* UOPS_EXECUTED.CORE_ACTIVE_CYCLES,c=1,i=1 */
+		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x1803fb1;
+
 		pr_cont("Westmere events, ");
 		break;
 
#2 lore raw
In reply to Ingo Molnar
Quoted 1 line · Ingo Molnar

Does the patch below allow the other events to be counted?

That patch was buggy - the one below should work better.

Thanks,

Ingo

---------->

Quoted 1 line

From 370faf1dd0461ad811852c8abbbcd3d73b1e4fc4 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 29 Apr 2011 16:11:03 +0200
Subject: [PATCH] perf stat: Fail softly on unsupported events

David Ahern reported this perf stat failure:

Quoted 5 lines
# /tmp/build-perf/perf stat -- sleep 1
  Error: stalled-cycles-frontend event is not supported.
  Fatal: Not all events could be opened.

This is a Dell R410 with an E5620 processor.

Fail in a softer fashion on unknown/unsupported events.

---
 tools/perf/builtin-stat.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
tools/perf/builtin-stat.c +1 -3
index 9e596ab..c8b535b 100644
@@ -377,7 +377,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 
 	list_for_each_entry(counter, &evsel_list->entries, node) {
 		if (create_perf_stat_counter(counter) < 0) {
-			if (errno == EINVAL || errno == ENOSYS)
+			if (errno == EINVAL || errno == ENOSYS || errno == ENOENT)
 				continue;
 
 			if (errno == EPERM || errno == EACCES) {
@@ -385,8 +385,6 @@ static int run_perf_stat(int argc __used, const char **argv)
 				      "\t Consider tweaking"
 				      " /proc/sys/kernel/perf_event_paranoid or running as root.",
 				      system_wide ? "system-wide " : "");
-			} else if (errno == ENOENT) {
-				error("%s event is not supported. ", event_name(counter));
 			} else {
 				error("open_counter returned with %d (%s). "
 				      "/bin/dmesg may provide additional information.\n",
#4 lore raw
In reply to Ingo Molnar
Quoted 9 lines · Ingo Molnar
Quoted 1 line · David Ahern

This is a Dell R410 with an E5620 processor.

That's a Westmere CPU.

Could you check whether the patch below applied to latest -tip gives you stalled-cycles-frontend and stalled-cycles-backend events?

yes, it does. And I see it's been committed already. ;-)

Quoted 43 lines

Thanks,

Ingo

--------------->
From 3808ae38f1905c1f11da46ac981c8d2579936fd8 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <[email protected]>
Date: Sat, 30 Apr 2011 09:14:54 +0200
Subject: [PATCH] perf events, x86: Add Westmere stalled-cycles-frontend/backend events

Extend the Intel Westmere PMU driver with definitions for generic front-end and back-end stall events.

( These are only approximations. )

---
 arch/x86/kernel/cpu/perf_event_intel.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +6 -0
index 7983b9a..be8363a 100644
@@ -1458,6 +1458,12 @@ static __init int intel_pmu_init(void)
 		x86_pmu.enable_all = intel_pmu_nhm_enable_all;
 		x86_pmu.pebs_constraints = intel_westmere_pebs_event_constraints;
 		x86_pmu.extra_regs = intel_westmere_extra_regs;
+
+		/* UOPS_ISSUED.STALLED_CYCLES */
+		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x180010e;
+		/* UOPS_EXECUTED.CORE_ACTIVE_CYCLES,c=1,i=1 */
+		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x1803fb1;
+
 		pr_cont("Westmere events, ");
 		break;
 
#5 lore raw
Quoted 4 lines · David Ahern
Quoted 3 lines · Ingo Molnar

* David Ahern <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

This is a Dell R410 with an E5620 processor.

That's a Westmere CPU.

Could you check whether the patch below applied to latest -tip gives you stalled-cycles-frontend and stalled-cycles-backend events?

yes, it does. And I see it's been committed already. ;-)

yeah :-)

Thanks,

Ingo