public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: fix perf-tracepoint OOPS
@ 2009-08-05 18:41 Peter Zijlstra
  2009-08-05 18:48 ` [tip:perfcounters/urgent] ftrace: Fix " tip-bot for Peter Zijlstra
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Peter Zijlstra @ 2009-08-05 18:41 UTC (permalink / raw)
  To: Ingo Molnar, Steven Rostedt, Chris Mason; +Cc: lkml

Not all tracepoints are created equal, in specific the ftrace
tracepoints are created with TRACE_EVENT_FORMAT() which does not
generate the needed bits to tie them into perf counters.

For those events, don't create the 'id' file and fail ->profile_enable
when their ID is specified through other means.

Reported-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/trace/trace_event_profile.c |    2 +-
 kernel/trace/trace_events.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
index 5b5895a..11ba5bb 100644
--- a/kernel/trace/trace_event_profile.c
+++ b/kernel/trace/trace_event_profile.c
@@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id)
 
 	mutex_lock(&event_mutex);
 	list_for_each_entry(event, &ftrace_events, list) {
-		if (event->id == event_id) {
+		if (event->id == event_id && event->profile_enable) {
 			ret = event->profile_enable(event);
 			break;
 		}
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 90cdec5..e2b301d 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -971,7 +971,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
 		entry = trace_create_file("enable", 0644, call->dir, call,
 					  enable);
 
-	if (call->id)
+	if (call->id && call->profile_enable)
 		entry = trace_create_file("id", 0444, call->dir, call,
 					  id);
 



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

* [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS
  2009-08-05 18:41 [PATCH] ftrace: fix perf-tracepoint OOPS Peter Zijlstra
@ 2009-08-05 18:48 ` tip-bot for Peter Zijlstra
  2009-08-05 18:53 ` [PATCH] ftrace: fix " Steven Rostedt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-08-05 18:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, peterz, chris.mason,
	rostedt, tglx, mingo

Commit-ID:  5fe31b14cc8eccc06311c3cc5674420a66431372
Gitweb:     http://git.kernel.org/tip/5fe31b14cc8eccc06311c3cc5674420a66431372
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 5 Aug 2009 20:41:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 5 Aug 2009 20:45:52 +0200

ftrace: Fix perf-tracepoint OOPS

Not all tracepoints are created equal, in specific the ftrace
tracepoints are created with TRACE_EVENT_FORMAT() which does
not generate the needed bits to tie them into perf counters.

For those events, don't create the 'id' file and fail
->profile_enable when their ID is specified through other
means.

Reported-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1249497664.5890.4.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace_event_profile.c |    2 +-
 kernel/trace/trace_events.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
index 5b5895a..11ba5bb 100644
--- a/kernel/trace/trace_event_profile.c
+++ b/kernel/trace/trace_event_profile.c
@@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id)
 
 	mutex_lock(&event_mutex);
 	list_for_each_entry(event, &ftrace_events, list) {
-		if (event->id == event_id) {
+		if (event->id == event_id && event->profile_enable) {
 			ret = event->profile_enable(event);
 			break;
 		}
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 23d2972..e75276a 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
 		entry = trace_create_file("enable", 0644, call->dir, call,
 					  enable);
 
-	if (call->id)
+	if (call->id && call->profile_enable)
 		entry = trace_create_file("id", 0444, call->dir, call,
 					  id);
 

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

* Re: [PATCH] ftrace: fix perf-tracepoint OOPS
  2009-08-05 18:41 [PATCH] ftrace: fix perf-tracepoint OOPS Peter Zijlstra
  2009-08-05 18:48 ` [tip:perfcounters/urgent] ftrace: Fix " tip-bot for Peter Zijlstra
@ 2009-08-05 18:53 ` Steven Rostedt
  2009-08-05 19:23 ` [PATCH] perf: Don't list tracepoints without an id Peter Zijlstra
  2009-08-06  4:27 ` [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS tip-bot for Peter Zijlstra
  3 siblings, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2009-08-05 18:53 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Chris Mason, lkml


On Wed, 5 Aug 2009, Peter Zijlstra wrote:

> Not all tracepoints are created equal, in specific the ftrace
> tracepoints are created with TRACE_EVENT_FORMAT() which does not
> generate the needed bits to tie them into perf counters.
> 
> For those events, don't create the 'id' file and fail ->profile_enable
> when their ID is specified through other means.
> 
> Reported-by: Chris Mason <chris.mason@oracle.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> ---
>  kernel/trace/trace_event_profile.c |    2 +-
>  kernel/trace/trace_events.c        |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
> index 5b5895a..11ba5bb 100644
> --- a/kernel/trace/trace_event_profile.c
> +++ b/kernel/trace/trace_event_profile.c
> @@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id)
>  
>  	mutex_lock(&event_mutex);
>  	list_for_each_entry(event, &ftrace_events, list) {
> -		if (event->id == event_id) {
> +		if (event->id == event_id && event->profile_enable) {
>  			ret = event->profile_enable(event);
>  			break;
>  		}
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 90cdec5..e2b301d 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -971,7 +971,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
>  		entry = trace_create_file("enable", 0644, call->dir, call,
>  					  enable);
>  
> -	if (call->id)
> +	if (call->id && call->profile_enable)
>  		entry = trace_create_file("id", 0444, call->dir, call,
>  					  id);
>  
> 
> 
> 

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

* [PATCH] perf: Don't list tracepoints without an id
  2009-08-05 18:41 [PATCH] ftrace: fix perf-tracepoint OOPS Peter Zijlstra
  2009-08-05 18:48 ` [tip:perfcounters/urgent] ftrace: Fix " tip-bot for Peter Zijlstra
  2009-08-05 18:53 ` [PATCH] ftrace: fix " Steven Rostedt
@ 2009-08-05 19:23 ` Peter Zijlstra
  2009-08-05 20:07   ` Jason Baron
  2009-08-06  4:27 ` [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS tip-bot for Peter Zijlstra
  3 siblings, 1 reply; 11+ messages in thread
From: Peter Zijlstra @ 2009-08-05 19:23 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Chris Mason, lkml, Jason Baron

Stop perf list from displaying tracepoints without an id file.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 tools/perf/util/parse-events.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 7bdad8d..d00636b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -568,6 +568,7 @@ static void print_tracepoint_events(void)
 	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
 	struct stat st;
 	char evt_path[MAXPATHLEN];
+	int fd;
 
 	if (valid_debugfs_mount(debugfs_path))
 		return;
@@ -582,6 +583,15 @@ static void print_tracepoint_events(void)
 			goto cleanup;
 		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next,
 								evt_path, st) {
+
+			snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id",
+					debugfs_path, 
+					sys_dirent.d_name, evt_dirent.d_name);
+			fd = open(evt_path, O_RDONLY);
+			if (fd < 0)
+				continue;
+			close(fd);
+
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
 				 sys_dirent.d_name, evt_dirent.d_name);
 			fprintf(stderr, "  %-40s [%s]\n", evt_path,



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

* Re: [PATCH] perf: Don't list tracepoints without an id
  2009-08-05 19:23 ` [PATCH] perf: Don't list tracepoints without an id Peter Zijlstra
@ 2009-08-05 20:07   ` Jason Baron
  2009-08-06 14:48     ` [PATCH -v2] " Peter Zijlstra
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Baron @ 2009-08-05 20:07 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Steven Rostedt, Chris Mason, lkml

On Wed, Aug 05, 2009 at 09:23:49PM +0200, Peter Zijlstra wrote:
> Stop perf list from displaying tracepoints without an id file.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  tools/perf/util/parse-events.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 7bdad8d..d00636b 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -568,6 +568,7 @@ static void print_tracepoint_events(void)
>  	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
>  	struct stat st;
>  	char evt_path[MAXPATHLEN];
> +	int fd;
>  
>  	if (valid_debugfs_mount(debugfs_path))
>  		return;
> @@ -582,6 +583,15 @@ static void print_tracepoint_events(void)
>  			goto cleanup;
>  		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next,
>  								evt_path, st) {
> +
> +			snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id",
> +					debugfs_path, 
> +					sys_dirent.d_name, evt_dirent.d_name);
> +			fd = open(evt_path, O_RDONLY);
> +			if (fd < 0)
> +				continue;
> +			close(fd);
> +
>  			snprintf(evt_path, MAXPATHLEN, "%s:%s",
>  				 sys_dirent.d_name, evt_dirent.d_name);
>  			fprintf(stderr, "  %-40s [%s]\n", evt_path,
> 
> 

hmmm, might be nicer to add this check to the 'for_each_event()' macro
instead...

thanks,

-Jason

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

* [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS
  2009-08-05 18:41 [PATCH] ftrace: fix perf-tracepoint OOPS Peter Zijlstra
                   ` (2 preceding siblings ...)
  2009-08-05 19:23 ` [PATCH] perf: Don't list tracepoints without an id Peter Zijlstra
@ 2009-08-06  4:27 ` tip-bot for Peter Zijlstra
  2009-08-06  9:11   ` Peter Zijlstra
  3 siblings, 1 reply; 11+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-08-06  4:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, peterz, chris.mason,
	rostedt, tglx, mingo

Commit-ID:  af6af30c0fcd77e621638e53ef8b176bca8bd3b4
Gitweb:     http://git.kernel.org/tip/af6af30c0fcd77e621638e53ef8b176bca8bd3b4
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 5 Aug 2009 20:41:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 6 Aug 2009 06:26:09 +0200

ftrace: Fix perf-tracepoint OOPS

Not all tracepoints are created equal, in specific the ftrace
tracepoints are created with TRACE_EVENT_FORMAT() which does
not generate the needed bits to tie them into perf counters.

For those events, don't create the 'id' file and fail
->profile_enable when their ID is specified through other
means.

Reported-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1249497664.5890.4.camel@laptop>
[ v2: fix build error in the !CONFIG_EVENT_PROFILE case ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/ftrace_event.h       |    8 +++-----
 kernel/trace/trace_event_profile.c |    2 +-
 kernel/trace/trace_events.c        |    2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5c093ff..d7cd193 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -119,11 +119,9 @@ struct ftrace_event_call {
 	void			*filter;
 	void			*mod;
 
-#ifdef CONFIG_EVENT_PROFILE
-	atomic_t	profile_count;
-	int		(*profile_enable)(struct ftrace_event_call *);
-	void		(*profile_disable)(struct ftrace_event_call *);
-#endif
+	atomic_t		profile_count;
+	int			(*profile_enable)(struct ftrace_event_call *);
+	void			(*profile_disable)(struct ftrace_event_call *);
 };
 
 #define MAX_FILTER_PRED		32
diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
index 5b5895a..11ba5bb 100644
--- a/kernel/trace/trace_event_profile.c
+++ b/kernel/trace/trace_event_profile.c
@@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id)
 
 	mutex_lock(&event_mutex);
 	list_for_each_entry(event, &ftrace_events, list) {
-		if (event->id == event_id) {
+		if (event->id == event_id && event->profile_enable) {
 			ret = event->profile_enable(event);
 			break;
 		}
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 23d2972..e75276a 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
 		entry = trace_create_file("enable", 0644, call->dir, call,
 					  enable);
 
-	if (call->id)
+	if (call->id && call->profile_enable)
 		entry = trace_create_file("id", 0444, call->dir, call,
 					  id);
 

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

* Re: [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS
  2009-08-06  4:27 ` [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS tip-bot for Peter Zijlstra
@ 2009-08-06  9:11   ` Peter Zijlstra
  2009-08-06 12:38     ` Ingo Molnar
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Zijlstra @ 2009-08-06  9:11 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, rostedt, chris.mason, tglx, mingo
  Cc: linux-tip-commits


> [ v2: fix build error in the !CONFIG_EVENT_PROFILE case ]
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  include/linux/ftrace_event.h       |    8 +++-----
>  kernel/trace/trace_event_profile.c |    2 +-
>  kernel/trace/trace_events.c        |    2 +-
>  3 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index 5c093ff..d7cd193 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -119,11 +119,9 @@ struct ftrace_event_call {
>  	void			*filter;
>  	void			*mod;
>  
> -#ifdef CONFIG_EVENT_PROFILE
> -	atomic_t	profile_count;
> -	int		(*profile_enable)(struct ftrace_event_call *);
> -	void		(*profile_disable)(struct ftrace_event_call *);
> -#endif
> +	atomic_t		profile_count;
> +	int			(*profile_enable)(struct ftrace_event_call *);
> +	void			(*profile_disable)(struct ftrace_event_call *);
>  };

Ah, I would have added ifdefs around the below bit.

> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 23d2972..e75276a 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
>  		entry = trace_create_file("enable", 0644, call->dir, call,
>  					  enable);
>  
> -	if (call->id)
#ifdef CONFIG_EVENT_PROFILE
> +	if (call->id && call->profile_enable)
>  		entry = trace_create_file("id", 0444, call->dir, call,
>  					  id);
#endif

Like that, but I guess this works too ;-)


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

* Re: [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS
  2009-08-06  9:11   ` Peter Zijlstra
@ 2009-08-06 12:38     ` Ingo Molnar
  0 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2009-08-06 12:38 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, linux-kernel, rostedt, chris.mason, tglx,
	linux-tip-commits


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> 
> > [ v2: fix build error in the !CONFIG_EVENT_PROFILE case ]
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  include/linux/ftrace_event.h       |    8 +++-----
> >  kernel/trace/trace_event_profile.c |    2 +-
> >  kernel/trace/trace_events.c        |    2 +-
> >  3 files changed, 5 insertions(+), 7 deletions(-)
> > 
> > diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> > index 5c093ff..d7cd193 100644
> > --- a/include/linux/ftrace_event.h
> > +++ b/include/linux/ftrace_event.h
> > @@ -119,11 +119,9 @@ struct ftrace_event_call {
> >  	void			*filter;
> >  	void			*mod;
> >  
> > -#ifdef CONFIG_EVENT_PROFILE
> > -	atomic_t	profile_count;
> > -	int		(*profile_enable)(struct ftrace_event_call *);
> > -	void		(*profile_disable)(struct ftrace_event_call *);
> > -#endif
> > +	atomic_t		profile_count;
> > +	int			(*profile_enable)(struct ftrace_event_call *);
> > +	void			(*profile_disable)(struct ftrace_event_call *);
> >  };
> 
> Ah, I would have added ifdefs around the below bit.
> 
> > diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> > index 23d2972..e75276a 100644
> > --- a/kernel/trace/trace_events.c
> > +++ b/kernel/trace/trace_events.c
> > @@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
> >  		entry = trace_create_file("enable", 0644, call->dir, call,
> >  					  enable);
> >  
> > -	if (call->id)
> #ifdef CONFIG_EVENT_PROFILE
> > +	if (call->id && call->profile_enable)
> >  		entry = trace_create_file("id", 0444, call->dir, call,
> >  					  id);
> #endif
> 
> Like that, but I guess this works too ;-)

i think CONFIG_EVENT_PROFILE should go away - it's clearly a core 
functionality of ftrace. Whenever we hit a Kconfig induced build 
breakage we should first consider reducing the Kconfig complexity a 
bit.

	Ingo

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

* [PATCH -v2] perf: Don't list tracepoints without an id
  2009-08-05 20:07   ` Jason Baron
@ 2009-08-06 14:48     ` Peter Zijlstra
  2009-08-06 19:33       ` Jason Baron
  2009-08-07 11:12       ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
  0 siblings, 2 replies; 11+ messages in thread
From: Peter Zijlstra @ 2009-08-06 14:48 UTC (permalink / raw)
  To: Jason Baron; +Cc: Ingo Molnar, Steven Rostedt, Chris Mason, lkml

Stop perf list from displaying tracepoints without an id file.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 tools/perf/util/parse-events.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Index: linux-2.6/tools/perf/util/parse-events.c
===================================================================
--- linux-2.6.orig/tools/perf/util/parse-events.c
+++ linux-2.6/tools/perf/util/parse-events.c
@@ -121,13 +121,29 @@ static unsigned long hw_cache_stat[C(MAX
 	   (strcmp(sys_dirent.d_name, ".")) &&				       \
 	   (strcmp(sys_dirent.d_name, "..")))
 
+static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
+{
+	char evt_path[MAXPATHLEN];
+	int fd;
+
+	snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
+			sys_dir->d_name, evt_dir->d_name);
+	fd = open(evt_path, O_RDONLY);
+	if (fd < 0)
+		return -EINVAL;
+	close(fd);
+
+	return 0;
+}
+
 #define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next, file, st)    \
 	while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next)        \
 	if (snprintf(file, MAXPATHLEN, "%s/%s/%s", debugfs_path,	       \
 		     sys_dirent.d_name, evt_dirent.d_name) &&		       \
 	   (!stat(file, &st)) && (S_ISDIR(st.st_mode)) &&		       \
 	   (strcmp(evt_dirent.d_name, ".")) &&				       \
-	   (strcmp(evt_dirent.d_name, "..")))
+	   (strcmp(evt_dirent.d_name, "..")) &&				       \
+	   (!tp_event_has_id(&sys_dirent, &evt_dirent)))
 
 #define MAX_EVENT_LENGTH 30
 


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

* Re: [PATCH -v2] perf: Don't list tracepoints without an id
  2009-08-06 14:48     ` [PATCH -v2] " Peter Zijlstra
@ 2009-08-06 19:33       ` Jason Baron
  2009-08-07 11:12       ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
  1 sibling, 0 replies; 11+ messages in thread
From: Jason Baron @ 2009-08-06 19:33 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Steven Rostedt, Chris Mason, lkml

On Thu, Aug 06, 2009 at 04:48:54PM +0200, Peter Zijlstra wrote:
> Stop perf list from displaying tracepoints without an id file.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  tools/perf/util/parse-events.c |   18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/tools/perf/util/parse-events.c
> ===================================================================
> --- linux-2.6.orig/tools/perf/util/parse-events.c
> +++ linux-2.6/tools/perf/util/parse-events.c
> @@ -121,13 +121,29 @@ static unsigned long hw_cache_stat[C(MAX
>  	   (strcmp(sys_dirent.d_name, ".")) &&				       \
>  	   (strcmp(sys_dirent.d_name, "..")))
>  
> +static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
> +{
> +	char evt_path[MAXPATHLEN];
> +	int fd;
> +
> +	snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
> +			sys_dir->d_name, evt_dir->d_name);
> +	fd = open(evt_path, O_RDONLY);
> +	if (fd < 0)
> +		return -EINVAL;
> +	close(fd);
> +
> +	return 0;
> +}
> +
>  #define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next, file, st)    \
>  	while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next)        \
>  	if (snprintf(file, MAXPATHLEN, "%s/%s/%s", debugfs_path,	       \
>  		     sys_dirent.d_name, evt_dirent.d_name) &&		       \
>  	   (!stat(file, &st)) && (S_ISDIR(st.st_mode)) &&		       \
>  	   (strcmp(evt_dirent.d_name, ".")) &&				       \
> -	   (strcmp(evt_dirent.d_name, "..")))
> +	   (strcmp(evt_dirent.d_name, "..")) &&				       \
> +	   (!tp_event_has_id(&sys_dirent, &evt_dirent)))
>  
>  #define MAX_EVENT_LENGTH 30
>  

looks good to me.

Acked-by: Jason Baron <jbaron@redhat.com>

thanks,

-Jason

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

* [tip:perfcounters/urgent] perf: Don't list tracepoints without an id
  2009-08-06 14:48     ` [PATCH -v2] " Peter Zijlstra
  2009-08-06 19:33       ` Jason Baron
@ 2009-08-07 11:12       ` tip-bot for Peter Zijlstra
  1 sibling, 0 replies; 11+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-08-07 11:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, peterz, rostedt,
	chris.mason, tglx, jbaron, mingo

Commit-ID:  79e372825f775fabd2219c9c45fbdff93c24cd3f
Gitweb:     http://git.kernel.org/tip/79e372825f775fabd2219c9c45fbdff93c24cd3f
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 6 Aug 2009 16:48:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 Aug 2009 13:09:10 +0200

perf: Don't list tracepoints without an id

Stop perf list from displaying tracepoints without an id file,
those are special tracepoints that are not interfaced to
perfcounters.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Chris Mason <chris.mason@oracle.com>
LKML-Reference: <1249570134.32113.483.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/parse-events.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f77407b..4858d83 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -121,13 +121,29 @@ static unsigned long hw_cache_stat[C(MAX)] = {
 	   (strcmp(sys_dirent.d_name, ".")) &&				       \
 	   (strcmp(sys_dirent.d_name, "..")))
 
+static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
+{
+	char evt_path[MAXPATHLEN];
+	int fd;
+
+	snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
+			sys_dir->d_name, evt_dir->d_name);
+	fd = open(evt_path, O_RDONLY);
+	if (fd < 0)
+		return -EINVAL;
+	close(fd);
+
+	return 0;
+}
+
 #define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next, file, st)    \
 	while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next)        \
 	if (snprintf(file, MAXPATHLEN, "%s/%s/%s", debugfs_path,	       \
 		     sys_dirent.d_name, evt_dirent.d_name) &&		       \
 	   (!stat(file, &st)) && (S_ISDIR(st.st_mode)) &&		       \
 	   (strcmp(evt_dirent.d_name, ".")) &&				       \
-	   (strcmp(evt_dirent.d_name, "..")))
+	   (strcmp(evt_dirent.d_name, "..")) &&				       \
+	   (!tp_event_has_id(&sys_dirent, &evt_dirent)))
 
 #define MAX_EVENT_LENGTH 30
 

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

end of thread, other threads:[~2009-08-07 11:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-05 18:41 [PATCH] ftrace: fix perf-tracepoint OOPS Peter Zijlstra
2009-08-05 18:48 ` [tip:perfcounters/urgent] ftrace: Fix " tip-bot for Peter Zijlstra
2009-08-05 18:53 ` [PATCH] ftrace: fix " Steven Rostedt
2009-08-05 19:23 ` [PATCH] perf: Don't list tracepoints without an id Peter Zijlstra
2009-08-05 20:07   ` Jason Baron
2009-08-06 14:48     ` [PATCH -v2] " Peter Zijlstra
2009-08-06 19:33       ` Jason Baron
2009-08-07 11:12       ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
2009-08-06  4:27 ` [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS tip-bot for Peter Zijlstra
2009-08-06  9:11   ` Peter Zijlstra
2009-08-06 12:38     ` Ingo Molnar

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