Skip to contentSkip to conversation

export softirq_to_name symbol

PATCH In review Jason Baron 5 participants 9 messages May 1, 2009 – May 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 export softirq_to_name symbol

hi,

In response to a user request:

Export 'softirq_to_name' so that modules using the softirq tracepoints can resolve the # to a name.

---
 kernel/softirq.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/softirq.c +1 -0
index b76064b..1841ab7 100644
@@ -60,6 +60,7 @@ char *softirq_to_name[NR_SOFTIRQS] = {
 	"HI", "TIMER", "NET_TX", "NET_RX", "BLOCK",
 	"TASKLET", "SCHED", "HRTIMER",	"RCU"
 };
+EXPORT_SYMBOL_GPL(softirq_to_name);
 
 /*
  * we cannot loop indefinitely here to avoid userspace starvation,
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 8 lines · Jason Baron

hi,

In response to a user request:

Export 'softirq_to_name' so that modules using the softirq tracepoints can resolve the # to a name.

Please submit it together with the module that uses it.

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 7 lines · Jason Baron

hi,

In response to a user request:

Export 'softirq_to_name' so that modules using the softirq tracepoints can resolve the # to a name.

Please submit it together with the module that uses it.

I'm adding SystemTap support for the format strings in the TRACE_EVENT macros. The softirq's TP_fast_assign uses softirq_to_name, and so that array is needed to prepare the softirq's trace string.

So, there's no explicit reference to the symbol in SystemTap -- it's just indirectly referenced by the tracepoint declaration.

Thanks,

Josh

#3 lore raw
Quoted 6 lines · Josh Stone

I'm adding SystemTap support for the format strings in the TRACE_EVENT macros. The softirq's TP_fast_assign uses softirq_to_name, and so that array is needed to prepare the softirq's trace string.

So, there's no explicit reference to the symbol in SystemTap -- it's just indirectly referenced by the tracepoint declaration.

TP_fast_assign should only be called by core code, it's the piece that copies the trace into the ring buffer. If systemtap copies events into the ring buffer from modular code something is deeply wrong in it's design.

#4 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Josh Stone

I'm adding SystemTap support for the format strings in the TRACE_EVENT macros. The softirq's TP_fast_assign uses softirq_to_name, and so that array is needed to prepare the softirq's trace string.

Quoted 7 lines
Quoted 2 lines

So, there's no explicit reference to the symbol in SystemTap -- it's just indirectly referenced by the tracepoint declaration.

TP_fast_assign should only be called by core code, it's the piece that copies the trace into the ring buffer. If systemtap copies events into the ring buffer from modular code something is deeply wrong in it's design.

More precisely, it's the piece of code that copies the trace into an __entry pointer. In my case, __entry has nothing to do with the ring buffer.

Josh

#5 lore raw
Quoted 3 lines · Josh Stone

More precisely, it's the piece of code that copies the trace into an __entry pointer. In my case, __entry has nothing to do with the ring buffer.

Well, it should be the ring buffer. If you want to do something more fancy rewrite it in proper C code and submit a patch for discussion to lkml.

#6 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Josh Stone

More precisely, it's the piece of code that copies the trace into an __entry pointer. In my case, __entry has nothing to do with the ring buffer.

Well, it should be the ring buffer. If you want to do something more fancy rewrite it in proper C code and submit a patch for discussion to lkml.

It's not that fancy -- this is basically it:

#define __field(type, item)         type item;
#define __array(type, item, len)    type item[len];
#define __string(item, src)         const char * __str_##item;
#define __assign_str(item, src)     __entry->__str_##item = src
#define __get_str(item)             __entry->__str_##item
#define TRACE_EVENT(name, proto, args, tstruct, assign, print)  \
  static inline int                                             \
  trace_snprintf_##name(char * __buf, size_t __size, proto) {   \
    struct { tstruct } __value, *__entry = &__value;            \
    assign;                                                     \
    return snprintf(__buf, __size, print);                      \

}

I don't know if anyone would need this besides stap, but I can post it as a patch if there's interest.

Josh

#7 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Josh Stone

I'm adding SystemTap support for the format strings in the TRACE_EVENT macros. The softirq's TP_fast_assign uses softirq_to_name, and so that array is needed to prepare the softirq's trace string.

Quoted 7 lines
Quoted 2 lines

So, there's no explicit reference to the symbol in SystemTap -- it's just indirectly referenced by the tracepoint declaration.

TP_fast_assign should only be called by core code, it's the piece that copies the trace into the ring buffer. If systemtap copies events into the ring buffer from modular code something is deeply wrong in it's design.

In itself, the use of TRACE_EVENT from a module is fine, otherwise Steve wouldn't have written the module support.

For example the mac80211 subsystem can be built as a module, and if a tracing code is merged for this subsystem, we want it to be usable whenever it is build as a module or not.

Frederic.

#8 lore raw
In reply to Jason Baron
Quoted 17 lines · Jason Baron

hi,

In response to a user request:

Export 'softirq_to_name' so that modules using the softirq tracepoints can resolve the # to a name.

---
 kernel/softirq.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/softirq.c +0 -0
index b76064b..1841ab7 100644

kernel/softirq.c char *softirq_to_name[NR_SOFTIRQS] = { · line 63

Quoted 4 lines
kernel/softirq.c +1 -0
@@ -60,6 +60,7 @@ char *softirq_to_name[NR_SOFTIRQS] = {
 	"HI", "TIMER", "NET_TX", "NET_RX", "BLOCK",
 	"TASKLET", "SCHED", "HRTIMER",	"RCU"
 };
+EXPORT_SYMBOL_GPL(softirq_to_name);

Hm, that very much looks like as if someone was writing kernel tracing code without the intention to submitting it upstream. Not having exported that symbol is thus a subtle "dont do that please" warning sign ;-)

Ingo