linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH v1 15/15] perf: export tracepoint events via sysfs: mac80211
@ 2010-07-22 11:18 Lin Ming
  2010-07-22 11:21 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Ming @ 2010-07-22 11:18 UTC (permalink / raw)
  To: Ingo Molnar, Johannes Berg
  Cc: Robert Richter, Corey Ashford, Johannes Berg, Peter Zijlstra,
	Greg KH, Frederic Weisbecker, Paul Mundt, eranian@gmail.com,
	Gary.Mohr@Bull.com, arjan@linux.intel.com, Zhang, Yanmin,
	Paul Mackerras, David S. Miller, Russell King,
	Arnaldo Carvalho de Melo, Will Deacon, Maynard Johnson, Carl Love,
	Kay Sievers, lkml, Thomas Gleixner, Steven Rostedt

mac80211 tracepoint events are exported like below,

/sys/class/ieee80211/events/
|-- api_beacon_loss
|   |-- config
|   |-- type
....
....
|-- drv_add_interface
|   |-- config
|   |-- type
....
....
|-- stop_queue
|   |-- config
|   |-- type
|-- wake_queue
|   |-- config
|   |-- type
---
 drivers/base/class.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 8e231d0..57ada53 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -19,6 +19,7 @@
 #include <linux/slab.h>
 #include <linux/genhd.h>
 #include <linux/mutex.h>
+#include <linux/perf_event.h>
 #include "base.h"
 
 #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
@@ -160,6 +161,14 @@ static void klist_class_dev_put(struct klist_node *n)
 	put_device(dev);
 }
 
+extern struct class ieee80211_class;
+
+static void class_sys_add_tp(struct kobject *class_kobj, struct class *cls)
+{
+	if (cls == &ieee80211_class)
+		perf_sys_add_tp(class_kobj, "mac80211");
+}
+
 int __class_register(struct class *cls, struct lock_class_key *key)
 {
 	struct class_private *cp;
@@ -202,6 +211,9 @@ int __class_register(struct class *cls, struct lock_class_key *key)
 	}
 	error = add_class_attrs(class_get(cls));
 	class_put(cls);
+
+	class_sys_add_tp(&cp->class_subsys.kobj, cls);
+
 	return error;
 }
 EXPORT_SYMBOL_GPL(__class_register);




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

* Re: [RFC][PATCH v1 15/15] perf: export tracepoint events via sysfs: mac80211
  2010-07-22 11:18 [RFC][PATCH v1 15/15] perf: export tracepoint events via sysfs: mac80211 Lin Ming
@ 2010-07-22 11:21 ` Johannes Berg
  2010-07-22 13:07   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2010-07-22 11:21 UTC (permalink / raw)
  To: Lin Ming
  Cc: Ingo Molnar, Robert Richter, Corey Ashford, Peter Zijlstra,
	Greg KH, Frederic Weisbecker, Paul Mundt, eranian@gmail.com,
	Gary.Mohr@Bull.com, arjan@linux.intel.com, Zhang, Yanmin,
	Paul Mackerras, David S. Miller, Russell King,
	Arnaldo Carvalho de Melo, Will Deacon, Maynard Johnson, Carl Love,
	Kay Sievers, lkml, Thomas Gleixner, Steven Rostedt

On Thu, 2010-07-22 at 19:18 +0800, Lin Ming wrote:
> mac80211 tracepoint events are exported like below,
> 
> /sys/class/ieee80211/events/
> |-- api_beacon_loss
> |   |-- config
> |   |-- type
> ....
> ....
> |-- drv_add_interface
> |   |-- config
> |   |-- type
> ....
> ....
> |-- stop_queue
> |   |-- config
> |   |-- type
> |-- wake_queue
> |   |-- config
> |   |-- type
> ---
>  drivers/base/class.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/base/class.c b/drivers/base/class.c
> index 8e231d0..57ada53 100644
> --- a/drivers/base/class.c
> +++ b/drivers/base/class.c
> @@ -19,6 +19,7 @@
>  #include <linux/slab.h>
>  #include <linux/genhd.h>
>  #include <linux/mutex.h>
> +#include <linux/perf_event.h>
>  #include "base.h"
>  
>  #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
> @@ -160,6 +161,14 @@ static void klist_class_dev_put(struct klist_node *n)
>  	put_device(dev);
>  }
>  
> +extern struct class ieee80211_class;
> +
> +static void class_sys_add_tp(struct kobject *class_kobj, struct class *cls)
> +{
> +	if (cls == &ieee80211_class)
> +		perf_sys_add_tp(class_kobj, "mac80211");
> +}
> +

Ick, what a bad hack! No way. And this really can't work anyway when
cfg80211 is a module. This is all messed up. The events should probably
be in /sys/class/ieee80211/phyX/ anyway.

johannes


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

* Re: [RFC][PATCH v1 15/15] perf: export tracepoint events via sysfs: mac80211
  2010-07-22 11:21 ` Johannes Berg
@ 2010-07-22 13:07   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2010-07-22 13:07 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Lin Ming, Robert Richter, Corey Ashford, Peter Zijlstra, Greg KH,
	Frederic Weisbecker, Paul Mundt, eranian@gmail.com,
	Gary.Mohr@Bull.com, arjan@linux.intel.com, Zhang, Yanmin,
	Paul Mackerras, David S. Miller, Russell King,
	Arnaldo Carvalho de Melo, Will Deacon, Maynard Johnson, Carl Love,
	Kay Sievers, lkml, Thomas Gleixner, Steven Rostedt


* Johannes Berg <johannes@sipsolutions.net> wrote:

> On Thu, 2010-07-22 at 19:18 +0800, Lin Ming wrote:
> > mac80211 tracepoint events are exported like below,
> > 
> > /sys/class/ieee80211/events/
> > |-- api_beacon_loss
> > |   |-- config
> > |   |-- type
> > ....
> > ....
> > |-- drv_add_interface
> > |   |-- config
> > |   |-- type
> > ....
> > ....
> > |-- stop_queue
> > |   |-- config
> > |   |-- type
> > |-- wake_queue
> > |   |-- config
> > |   |-- type
> > ---
> >  drivers/base/class.c |   12 ++++++++++++
> >  1 files changed, 12 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/base/class.c b/drivers/base/class.c
> > index 8e231d0..57ada53 100644
> > --- a/drivers/base/class.c
> > +++ b/drivers/base/class.c
> > @@ -19,6 +19,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/genhd.h>
> >  #include <linux/mutex.h>
> > +#include <linux/perf_event.h>
> >  #include "base.h"
> >  
> >  #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
> > @@ -160,6 +161,14 @@ static void klist_class_dev_put(struct klist_node *n)
> >  	put_device(dev);
> >  }
> >  
> > +extern struct class ieee80211_class;
> > +
> > +static void class_sys_add_tp(struct kobject *class_kobj, struct class *cls)
> > +{
> > +	if (cls == &ieee80211_class)
> > +		perf_sys_add_tp(class_kobj, "mac80211");
> > +}
> > +
> 
> Ick, what a bad hack! [...]

Yeah, putting driver specific code into generic code for a prototype is OK but 
not acceptable as an end result.

Thanks,

	Ingo

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 11:18 [RFC][PATCH v1 15/15] perf: export tracepoint events via sysfs: mac80211 Lin Ming
2010-07-22 11:21 ` Johannes Berg
2010-07-22 13:07   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).