public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* perf stat branch: perf stat fails on unsupported event
@ 2011-04-29 14:05 David Ahern
  2011-04-29 14:11 ` Ingo Molnar
  2011-04-29 14:20 ` Ingo Molnar
  0 siblings, 2 replies; 6+ messages in thread
From: David Ahern @ 2011-04-29 14:05 UTC (permalink / raw)
  To: Ingo Molnar, LKML

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: perf stat branch: perf stat fails on unsupported event
  2011-04-29 14:05 perf stat branch: perf stat fails on unsupported event David Ahern
@ 2011-04-29 14:11 ` Ingo Molnar
  2011-04-29 14:23   ` Ingo Molnar
  2011-04-29 14:20 ` Ingo Molnar
  1 sibling, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2011-04-29 14:11 UTC (permalink / raw)
  To: David Ahern
  Cc: LKML, Arnaldo Carvalho de Melo, Peter Zijlstra, Thomas Gleixner,
	Frédéric Weisbecker


* David Ahern <dsahern@gmail.com> wrote:

> 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

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9e596ab..c11ec76 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -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",

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: perf stat branch: perf stat fails on unsupported event
  2011-04-29 14:05 perf stat branch: perf stat fails on unsupported event David Ahern
  2011-04-29 14:11 ` Ingo Molnar
@ 2011-04-29 14:20 ` Ingo Molnar
  2011-04-29 14:47   ` David Ahern
  1 sibling, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2011-04-29 14:20 UTC (permalink / raw)
  To: David Ahern
  Cc: LKML, Arnaldo Carvalho de Melo, Peter Zijlstra, Thomas Gleixner,
	Frédéric Weisbecker


* David Ahern <dsahern@gmail.com> wrote:

> 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

--------------->
>From 3808ae38f1905c1f11da46ac981c8d2579936fd8 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
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. )

Reported-by: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/n/tip-7y40wib8n008io7hjpn1dsrm@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 7983b9a..be8363a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -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;
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: perf stat branch: perf stat fails on unsupported event
  2011-04-29 14:11 ` Ingo Molnar
@ 2011-04-29 14:23   ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2011-04-29 14:23 UTC (permalink / raw)
  To: David Ahern
  Cc: LKML, Arnaldo Carvalho de Melo, Peter Zijlstra, Thomas Gleixner,
	Frédéric Weisbecker


* Ingo Molnar <mingo@elte.hu> wrote:

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

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

Thanks,

	Ingo

---------->
>From 370faf1dd0461ad811852c8abbbcd3d73b1e4fc4 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
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:

> # /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.

Reported-by: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/n/tip-7y40wib8n006io7hjpn1dsrm@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-stat.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9e596ab..c8b535b 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -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",

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: perf stat branch: perf stat fails on unsupported event
  2011-04-29 14:20 ` Ingo Molnar
@ 2011-04-29 14:47   ` David Ahern
  2011-04-29 17:59     ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2011-04-29 14:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Arnaldo Carvalho de Melo, Peter Zijlstra, Thomas Gleixner,
	Frédéric Weisbecker



On 04/29/11 08:20, Ingo Molnar wrote:
> 
> * David Ahern <dsahern@gmail.com> wrote:
> 
>> 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. ;-)

> 
> Thanks,
> 
> 	Ingo
> 
> --------------->
> From 3808ae38f1905c1f11da46ac981c8d2579936fd8 Mon Sep 17 00:00:00 2001
> From: Ingo Molnar <mingo@elte.hu>
> 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. )
> 
> Reported-by: David Ahern <dsahern@gmail.com>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Link: http://lkml.kernel.org/n/tip-7y40wib8n008io7hjpn1dsrm@git.kernel.org
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  arch/x86/kernel/cpu/perf_event_intel.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
> index 7983b9a..be8363a 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel.c
> @@ -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;
>  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: perf stat branch: perf stat fails on unsupported event
  2011-04-29 14:47   ` David Ahern
@ 2011-04-29 17:59     ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2011-04-29 17:59 UTC (permalink / raw)
  To: David Ahern
  Cc: LKML, Arnaldo Carvalho de Melo, Peter Zijlstra, Thomas Gleixner,
	Frédéric Weisbecker


* David Ahern <dsahern@gmail.com> wrote:

> On 04/29/11 08:20, Ingo Molnar wrote:
> > 
> > * David Ahern <dsahern@gmail.com> wrote:
> > 
> >> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-29 17:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29 14:05 perf stat branch: perf stat fails on unsupported event David Ahern
2011-04-29 14:11 ` Ingo Molnar
2011-04-29 14:23   ` Ingo Molnar
2011-04-29 14:20 ` Ingo Molnar
2011-04-29 14:47   ` David Ahern
2011-04-29 17:59     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox