Skip to contentSkip to conversation

perf: export tracepoint events via sysfs: iwlwifi and iwlwifi_io

RFC PATCH In review Lin Ming 5 participants 11 messages Jul 22, 2010 – Jul 23, 2010 Networking drivers (wireless)

lore
Share & tools
lore

Lin Ming

author
#0 lore raw

RFC PATCH 6/15 perf: export tracepoint events via sysfs: iwlwifi and iwlwifi_io

iwlwifi and iwlwifi_io tracepoint events are exported like below,

/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/events/

|-- iwlwifi_dev_hcmd
|   |-- config
|   |-- type
|-- iwlwifi_dev_rx
|   |-- config
|   |-- type
....
....
|-- iwlwifi_dev_ioread32
|   |-- config
|   |-- type
|-- iwlwifi_dev_iowrite32
|   |-- config
|   |-- type
|-- iwlwifi_dev_iowrite8
|   |-- config
|   |-- type
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/net/wireless/iwlwifi/iwl3945-base.c +15 -0
index a27872d..cbcc2bb 100644
@@ -41,6 +41,7 @@
 #include <linux/firmware.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <linux/perf_event.h>
 
 #include <net/ieee80211_radiotap.h>
 #include <net/mac80211.h>
@@ -3989,6 +3990,18 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
 	return 0;
 }
 
+static void iwl_sys_add_tp(struct kobject *kobj)
+{
+	struct kobject *events_kobj;
+
+	events_kobj = perf_sys_create_events_dir(kobj);
+	if (!events_kobj)
+		return;
+
+	perf_sys_add_tp_events(events_kobj, "iwlwifi");
+	perf_sys_add_tp_events(events_kobj, "iwlwifi_io");
+}
+
 static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	int err = 0;
@@ -4148,6 +4161,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 		goto out_release_irq;
 	}
 
+	iwl_sys_add_tp(&pdev->dev.kobj);
+
 	iwl_set_rxon_channel(priv,
 			     &priv->bands[IEEE80211_BAND_2GHZ].channels[5]);
 	iwl3945_setup_deferred_work(priv);
maintainer
#1 lore raw
Quoted 4 lines · Lin Ming

iwlwifi and iwlwifi_io tracepoint events are exported like below,

 drivers/net/wireless/iwlwifi/iwl3945-base.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

err, how about iwlagn?

johannes

#2 lore raw
Quoted 7 lines · Johannes Berg
Quoted 4 lines · Lin Ming

iwlwifi and iwlwifi_io tracepoint events are exported like below,

 drivers/net/wireless/iwlwifi/iwl3945-base.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

err, how about iwlagn?

A lot of work went into making the include/trace/events/*.h be able to automate the work. Now it seems that we are going to hand code a lot, and a developer that adds a new system or such will now need to understand the internals of perf to use it. That was what I strived to avoid when creating the TRACE_EVENT() macros.

-- Steve

#3 lore raw
Quoted 7 lines · Steven Rostedt
Quoted 6 lines · Johannes Berg
Quoted 4 lines · Lin Ming

iwlwifi and iwlwifi_io tracepoint events are exported like below,

 drivers/net/wireless/iwlwifi/iwl3945-base.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
Quoted 7 lines
Quoted 1 line

err, how about iwlagn?

A lot of work went into making the include/trace/events/*.h be able to automate the work. Now it seems that we are going to hand code a lot, and a developer that adds a new system or such will now need to understand the internals of perf to use it. That was what I strived to avoid when creating the TRACE_EVENT() macros.

Yeah - and the point of this submission is to allow the discussion of how to achieve these registrations.

Driver authors will want to have some control - for example the place where the events directory shows up in sysfs within the driver's directory structure
- etc.

But we indeed want to automate it as much as possible.

Thanks,

Ingo

#4 lore raw
Quoted 10 lines · Ingo Molnar

* Steven Rostedt <[email protected]> wrote:

Yeah - and the point of this submission is to allow the discussion of how to achieve these registrations.

Driver authors will want to have some control - for example the place where the events directory shows up in sysfs within the driver's directory structure
- etc.

But we indeed want to automate it as much as possible.

Perhaps we can create a TRACE_EVENT_PATH() macro, that allows the developer to specify the path that the event will be seen in sysfs?

-- Steve

#5 lore raw
Quoted 6 lines · Steven Rostedt
Quoted 5 lines · Ingo Molnar

* Steven Rostedt <[email protected]> wrote:

Yeah - and the point of this submission is to allow the discussion of how to achieve these registrations.

Quoted 8 lines
Quoted 5 lines

Driver authors will want to have some control - for example the place where the events directory shows up in sysfs within the driver's directory structure
- etc.

But we indeed want to automate it as much as possible.

Perhaps we can create a TRACE_EVENT_PATH() macro, that allows the developer to specify the path that the event will be seen in sysfs?

Perhaps you could build that into the event class definition as well so each separate class in a subsystem can be placed in it's own sub-directory?

That would make turning on and off specific classes trace points so much simpler than it now, espcially for XFS where we now have > 250 tracepoints that are mostly defined by event classes already...

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#6 lore raw
Quoted 16 lines · Dave Chinner
Quoted 6 lines · Steven Rostedt
Quoted 5 lines · Ingo Molnar

* Steven Rostedt <[email protected]> wrote:

Yeah - and the point of this submission is to allow the discussion of how to achieve these registrations.

Quoted 8 lines
Quoted 5 lines

Driver authors will want to have some control - for example the place where the events directory shows up in sysfs within the driver's directory structure
- etc.

But we indeed want to automate it as much as possible.

Perhaps we can create a TRACE_EVENT_PATH() macro, that allows the developer to specify the path that the event will be seen in sysfs?

Quoted 7 lines

Perhaps you could build that into the event class definition as well so each separate class in a subsystem can be placed in it's own sub-directory?

That would make turning on and off specific classes trace points so much simpler than it now, espcially for XFS where we now have > 250 tracepoints that are mostly defined by event classes already...

I was working on creating a "TRACE_CATEGORY()" that allowed you to put tracepoints into categories. Thus, these tracepoints will all still be in the XFS system, but you can add hierarchical categories that let you group and enable tracepoints in these groups.

But I stopped this work since it was more ftrace specific than perf, and I need to figure out how to continue my work on ftrace and at the same time merge it towards perf. This has been taking much longer than I have expected. Perhaps I should just finish that work, and then see how we can make perf work with it too?

-- Steve

author
#7 lore raw
Quoted 31 lines · Steven Rostedt
Quoted 16 lines · Dave Chinner
Quoted 6 lines · Steven Rostedt
Quoted 5 lines · Ingo Molnar

* Steven Rostedt <[email protected]> wrote:

Yeah - and the point of this submission is to allow the discussion of how to achieve these registrations.

Quoted 8 lines
Quoted 5 lines

Driver authors will want to have some control - for example the place where the events directory shows up in sysfs within the driver's directory structure
- etc.

But we indeed want to automate it as much as possible.

Perhaps we can create a TRACE_EVENT_PATH() macro, that allows the developer to specify the path that the event will be seen in sysfs?

Quoted 7 lines

Perhaps you could build that into the event class definition as well so each separate class in a subsystem can be placed in it's own sub-directory?

That would make turning on and off specific classes trace points so much simpler than it now, espcially for XFS where we now have > 250 tracepoints that are mostly defined by event classes already...

I was working on creating a "TRACE_CATEGORY()" that allowed you to put tracepoints into categories. Thus, these tracepoints will all still be in the XFS system, but you can add hierarchical categories that let you group and enable tracepoints in these groups.

Quoted 5 lines

But I stopped this work since it was more ftrace specific than perf, and I need to figure out how to continue my work on ftrace and at the same time merge it towards perf. This has been taking much longer than I have expected. Perhaps I should just finish that work, and then see how we can make perf work with it too?

That's nice.

Does this "TRACE_CATEGORY()" can help to specify different event attribute value?

/sys/devices/pci0000:00/0000:00:02.0/drm/card0/events

|-- i915_gem_object_bind
|   |-- config
|   |-- type
|   |-- filter  ==> filter for card0

/sys/devices/pci0000:00/0000:00:02.0/drm/card1/events

|-- i915_gem_object_bind
|   |-- config
|   |-- type
|   |-- filter  ==> filter for card1

In above example, the values of "config" and "type" are same. But the values of "filter" are different.

Lin Ming

Quoted 4 lines

-- Steve

#8 lore raw
Quoted 11 lines · Lin Ming

On Fri, 2010-07-23 at 10:14 +0800, Steven Rostedt wrote:

Does this "TRACE_CATEGORY()" can help to specify different event attribute value?

/sys/devices/pci0000:00/0000:00:02.0/drm/card0/events

|-- i915_gem_object_bind
|   |-- config
|   |-- type
|   |-- filter  ==> filter for card0
Quoted 8 lines

/sys/devices/pci0000:00/0000:00:02.0/drm/card1/events

|-- i915_gem_object_bind
|   |-- config
|   |-- type
|   |-- filter  ==> filter for card1

In above example, the values of "config" and "type" are same. But the values of "filter" are different.

No, it does not make a single event with different atts. It is just a way to group events.

What you are showing is two events with the same name under two different groups. But there still only exists one event (the place that trace_i915_gem_object_bind() is located).

-- Steve

#9 lore raw
In reply to Steven Rostedt
Quoted 21 lines · Steven Rostedt
Quoted 20 lines · Dave Chinner
Quoted 6 lines · Steven Rostedt
Quoted 5 lines · Ingo Molnar

* Steven Rostedt <[email protected]> wrote:

Yeah - and the point of this submission is to allow the discussion of how to achieve these registrations.

Quoted 8 lines
Quoted 5 lines

Driver authors will want to have some control - for example the place where the events directory shows up in sysfs within the driver's directory structure
- etc.

But we indeed want to automate it as much as possible.

Perhaps we can create a TRACE_EVENT_PATH() macro, that allows the developer to specify the path that the event will be seen in sysfs?

Perhaps you could build that into the event class definition as well so each separate class in a subsystem can be placed in it's own sub-directory?

Quoted 8 lines
Quoted 3 lines

That would make turning on and off specific classes trace points so much simpler than it now, espcially for XFS where we now have > 250 tracepoints that are mostly defined by event classes already...

I was working on creating a "TRACE_CATEGORY()" that allowed you to put tracepoints into categories. Thus, these tracepoints will all still be in the XFS system, but you can add hierarchical categories that let you group and enable tracepoints in these groups.

Yes, that's pretty much what I was thinking of.

Quoted 5 lines

But I stopped this work since it was more ftrace specific than perf, and I need to figure out how to continue my work on ftrace and at the same time merge it towards perf. This has been taking much longer than I have expected. Perhaps I should just finish that work, and then see how we can make perf work with it too?

I'm not fussed - it's more of a wishlist item right now. If it's in the pipeline, then I'm happy to wait until you've done all the hard work for me. ;)

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
author
#10 lore raw
In reply to Johannes Berg
Quoted 7 lines · Johannes Berg
Quoted 4 lines · Lin Ming

iwlwifi and iwlwifi_io tracepoint events are exported like below,

 drivers/net/wireless/iwlwifi/iwl3945-base.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

err, how about iwlagn?

Will add this.

Quoted 3 lines

johannes