Fix tracing infrastructure to support multiple includes when defining CREATE_TRACE_POINTS
PATCH 1/1 Fix tracing infrastructure to support multiple includes when defining CREATE_TRACE_POINTS
Fix tracing infrastructure to allow multiple header files with TRACE_EVENTS to be included with CREATE_TRACE_EVENTS defined
I've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to net/core/net-traces.c with TRACE_EVENTS defined in them. net-traces.c defines CREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find that define_trace.h redefined DECLARE_TRACE to be DEFINE_TRACE, so after the first run through define_trace.h (which is included from skb.h, included in net-trace.c first), the DECLARE_TRACE macro was left with an improper definition to start a new cycle with the next header.
The fix I came up with was to make sure that DECLARE_TRACE was undefined at the end of define_trace.h, and to add a conditional re-definition in tracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file. Not sure if theres a better way to handle this, but this worked well for me, allowing me to include multiple headers with TRACE_EVENT macros in a c file with CREATE_TRACE_POINTS defined.
linux/tracepoint.h | 18 ++++++++++++++++++trace/define_trace.h | 1 +
2 files changed, 19 insertions(+)
include/linux/tracepoint.h +18 -0
@@ -173,6 +173,24 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#ifndef DECLARE_TRACE +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /*
include/trace/define_trace.h +1 -0
@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
Steven Rostedt
maintainerQuoted 13 lines · Neil Horman
Fix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.
Quoted 7 lines
The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file. Not sure if theres a better way to handle this, but this worked well for me, allowing me to include multiple headers withTRACE_EVENTmacros in a c file withCREATE_TRACE_POINTSdefined.
Nice, just some comments below.
Quoted 24 lines
Signed-off-by Neil Horman <[email protected]>
linux/tracepoint.h| 18 ++++++++++++++++++trace/define_trace.h| 1 +2 files changed, 19 insertions(+)include/linux/tracepoint.h +9
-0@@ -173,6 +173,24 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#ifndef DECLARE_TRACE +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \
include/linux/tracepoint.h static inline void tracepoint_synchronize_unregister(void) · line 194
Quoted 10 lines
include/linux/tracepoint.h +9
-0+ static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif
You duplicate the DECLARE_TRACE from above and place it into an unprotected area. Why not move it instead of duplicating it. This is just a bug waiting to happen if we ever need to modify DECLARE_TRACE.
If you change it to:
#if !defined(CONFIG_TRACEPOINTS) && !defined(DECLARE_TRACE)
#define DECLARE_TRACE(...) ....
#endif
Then you can remove the first definition of it. The first time processing the file, when it hits the #ifndef DECLARE_TRACE in the _LINUX_TRACEPOINT_H conditional, it still does not define DECLARE_TRACE, and then when it exits that conditional, it does.
-- Steve
Quoted 14 lines
include/linux/tracepoint.h +0
-0#ifndef TRACE_EVENT /* include/trace/define_trace.h +1
-0@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
Quoted 33 lines · Steven Rostedt
Quoted 13 lines · Neil Horman
Fix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.Quoted 7 lines
The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file. Not sure if theres a better way to handle this, but this worked well for me, allowing me to include multiple headers withTRACE_EVENTmacros in a c file withCREATE_TRACE_POINTSdefined.Nice, just some comments below.
<snip>You duplicate the
DECLARE_TRACEfrom above and place it into an unprotected area. Why not move it instead of duplicating it. This is just a bug waiting to happen if we ever need to modifyDECLARE_TRACE.If you change it to:
#if !defined(CONFIG_TRACEPOINTS) && !defined(DECLARE_TRACE)
Quoted 8 lines
#define
DECLARE_TRACE(...)....#endif
Then you can remove the first definition of it. The first time processing the file, when it hits the #ifndef
DECLARE_TRACEin the_LINUX_TRACEPOINT_Hconditional, it still does not defineDECLARE_TRACE, and then when it exits that conditional, it does.
Yeah, that makes sense to me. Although I think you mean if defined(CONFIG_TRACEPOINTS) rather than if !defined(CONFIG_TRACEPOINTS). The case I'm moving to outside the unprotected area is the one that we use if tracepoints are enabled. I just tested this new patch, and it works well for me. Thanks!
Neil
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + 2 files changed, 24 insertions(+), 22 deletions(-)
Fix tracing infrastructure to allow multiple header files with TRACE_EVENTS to be included with CREATE_TRACE_EVENTS defined
I've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to net/core/net-traces.c with TRACE_EVENTS defined in them. net-traces.c defines CREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find that define_trace.h redefined DECLARE_TRACE to be DEFINE_TRACE, so after the first run through define_trace.h (which is included from skb.h, included in net-trace.c first), the DECLARE_TRACE macro was left with an improper definition to start a new cycle with the next header.
The fix I came up with was to make sure that DECLARE_TRACE was undefined at the end of define_trace.h, and to add a conditional re-definition in tracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.
include/linux/tracepoint.h +23 -22
@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ } while (0) -/* -* Make sure the alignment of the structure in the __tracepoints section will -* not add unwanted padding between the beginning of the section and the -* structure. Force alignment to the same alignment as the section start. - */ -#define DECLARE_TRACE (name, proto, args) \ - extern struct tracepoint __tracepoint_##name; \ - static inline void trace_##name(proto) \ - { \ - if (unlikely(__tracepoint_##name.state)) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_register(#name, (void *)probe); \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_unregister(#name, (void *)probe);\ - } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \
@@ -173,6 +151,29 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#if defined(CONFIG_TRACEPOINTS ) && !defined(DECLARE_TRACE ) +/* +* Make sure the alignment of the structure in the __tracepoints section will +* not add unwanted padding between the beginning of the section and the +* structure. Force alignment to the same alignment as the section start. +*/ +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /*
include/trace/define_trace.h +1 -0
@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
Steven Rostedt
maintainerQuoted 38 lines · Neil Horman
Quoted 37 lines · Steven Rostedt
Quoted 13 lines · Neil Horman
Fix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.Quoted 7 lines
The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file. Not sure if theres a better way to handle this, but this worked well for me, allowing me to include multiple headers withTRACE_EVENTmacros in a c file withCREATE_TRACE_POINTSdefined.Nice, just some comments below.
<snip>You duplicate the
DECLARE_TRACEfrom above and place it into an unprotected area. Why not move it instead of duplicating it. This is just a bug waiting to happen if we ever need to modifyDECLARE_TRACE.If you change it to:
#if !defined(CONFIG_TRACEPOINTS) && !defined(DECLARE_TRACE)
#define
DECLARE_TRACE(...)....#endif
Quoted 8 lines
Quoted 4 lines
Then you can remove the first definition of it. The first time processing the file, when it hits the #ifndef
DECLARE_TRACEin the_LINUX_TRACEPOINT_Hconditional, it still does not defineDECLARE_TRACE, and then when it exits that conditional, it does.Yeah, that makes sense to me. Although I think you mean if
defined(CONFIG_TRACEPOINTS)rather than if !defined(CONFIG_TRACEPOINTS). The
Yep, that's what I meant ;-)
Quoted 7 lines
case I'm moving to outside the unprotected area is the one that we use if tracepoints are enabled. I just tested this new patch, and it works well for me. Thanks!
Neil
Signed-off-by Neil Horman <[email protected]>
OK, I'll give it some testing tonight.
-- Steve
Steven Rostedt
maintainerQuoted 13 lines · Neil Horman
Fix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.
Quoted 7 lines
The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.Signed-off-by Neil Horman <[email protected]>
By itself, this patch breaks the build (for me). I take it that you converted the napi.h file to use TRACE_EVENT. Currently it uses a DECLARE_TRACE, which will break with this patch. We need a patch that removes that DECLARE_TRACE before we can apply this patch.
To keep bisectablity, we either need to make one patch that converts the napi to TRACE_EVENT and this patch, or we need to first remove the napi.h DECLARE_TRACE, add this patch, and then one that adds TRACE_EVENT.
-- Steve
Quoted 75 lines
include/linux/tracepoint.h +23
-22@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ } while (0) -/* -* Make sure the alignment of the structure in the __tracepoints section will -* not add unwanted padding between the beginning of the section and the -* structure. Force alignment to the same alignment as the section start. - */ -#define DECLARE_TRACE (name, proto, args) \ - extern struct tracepoint __tracepoint_##name; \ - static inline void trace_##name(proto) \ - { \ - if (unlikely(__tracepoint_##name.state)) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_register(#name, (void *)probe); \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_unregister(#name, (void *)probe);\ - } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \@@ -173,6 +151,29 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#if defined(CONFIG_TRACEPOINTS ) && !defined(DECLARE_TRACE ) +/* +* Make sure the alignment of the structure in the __tracepoints section will +* not add unwanted padding between the beginning of the section and the +* structure. Force alignment to the same alignment as the section start. +*/ +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /* include/trace/define_trace.h +1
-0@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
Quoted 20 lines · Steven Rostedt
Quoted 18 lines · Neil Horman
Fix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Neil Horman <[email protected]>By itself, this patch breaks the build (for me). I take it that you converted the
napi.hfile to useTRACE_EVENT. Currently it uses aDECLARE_TRACE, which will break with this patch. We need a patch that removes thatDECLARE_TRACEbefore we can apply this patch.
Yes, I did that conversion, sorry, wasn't thinking about how that might affect the build. Given that converting to a TRACE_EVENT shouldn't be noticible to any of the users of that tracepoint (it can still be hooked in an identical fashion), I'd vote for just doing a monolitic patch. please find that below.
Regards
Neil
Fix tracing infrastructure to allow multiple header files with TRACE_EVENTS to be included with CREATE_TRACE_EVENTS defined
I've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to net/core/net-traces.c with TRACE_EVENTS defined in them. net-traces.c defines CREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find that define_trace.h redefined DECLARE_TRACE to be DEFINE_TRACE, so after the first run through define_trace.h (which is included from skb.h, included in net-trace.c first), the DECLARE_TRACE macro was left with an improper definition to start a new cycle with the next header.
The fix I came up with was to make sure that DECLARE_TRACE was undefined at the end of define_trace.h, and to add a conditional re-definition in tracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.
Note this patch also converts the napi_poll tracepoint to a TRACE_EVENT. This is done so that the TRACE_EVENT fix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not have napi_poll be an independent event.
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 25 deletions(-)
include/linux/tracepoint.h +23 -22
@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ } while (0) -/* -* Make sure the alignment of the structure in the __tracepoints section will -* not add unwanted padding between the beginning of the section and the -* structure. Force alignment to the same alignment as the section start. - */ -#define DECLARE_TRACE (name, proto, args) \ - extern struct tracepoint __tracepoint_##name; \ - static inline void trace_##name(proto) \ - { \ - if (unlikely(__tracepoint_##name.state)) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_register(#name, (void *)probe); \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_unregister(#name, (void *)probe);\ - } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \
@@ -173,6 +151,29 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#if defined(CONFIG_TRACEPOINTS ) && !defined(DECLARE_TRACE ) +/* +* Make sure the alignment of the structure in the __tracepoints section will +* not add unwanted padding between the beginning of the section and the +* structure. Force alignment to the same alignment as the section start. +*/ +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /*
include/trace/define_trace.h +1 -0
@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
include/trace/events/napi.h +22 -3
@@ -1,11 +1,30 @@ -#ifndef _TRACE_NAPI_H_ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM napi + +#if !defined(_TRACE_NAPI_H_) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_NAPI_H_#include <linux/netdevice.h> #include <linux/tracepoint.h> -DECLARE_TRACE (napi_poll, +TRACE_EVENT (napi_poll, + TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + +TP_ARGS (napi), + +TP_STRUCT__entry ( + __field( struct napi_struct *, napi) + ), + +TP_fast_assign ( + __entry->napi = napi; + ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi, __entry->napi->dev->name) +);#endif + +#include <trace/define_trace.h>
Steven Rostedt
maintainerQuoted 58 lines · Neil Horman
Quoted 20 lines · Steven Rostedt
Quoted 18 lines · Neil Horman
Fix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.Quoted 8 lines
Quoted 2 lines
Signed-off-by Neil Horman <[email protected]>By itself, this patch breaks the build (for me). I take it that you converted the
napi.hfile to useTRACE_EVENT. Currently it uses aDECLARE_TRACE, which will break with this patch. We need a patch that removes thatDECLARE_TRACEbefore we can apply this patch.Yes, I did that conversion, sorry, wasn't thinking about how that might affect the build. Given that converting to a
TRACE_EVENTshouldn't be noticible to any of the users of that tracepoint (it can still be hooked in an identical fashion), I'd vote for just doing a monolitic patch. please find that below.Regards
NeilFix tracing infrastructure to allow multiple header files with
TRACE_EVENTSto be included withCREATE_TRACE_EVENTSdefinedI've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to
net/core/net-traces.cwithTRACE_EVENTSdefined in them.net-traces.cdefinesCREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find thatdefine_trace.hredefinedDECLARE_TRACEto beDEFINE_TRACE, so after the first run throughdefine_trace.h(which is included fromskb.h, included innet-trace.cfirst), theDECLARE_TRACEmacro was left with an improper definition to start a new cycle with the next header.The fix I came up with was to make sure that
DECLARE_TRACEwas undefined at the end ofdefine_trace.h, and to add a conditional re-definition intracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.
Quoted 6 lines
Note this patch also converts the
napi_polltracepoint to aTRACE_EVENT. This is done so that theTRACE_EVENTfix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not havenapi_pollbe an independent event.Signed-off-by Neil Horman <[email protected]>
Thanks, I'll give it a test. But because this now touches networking code, I need an Acked-by from David Miller before I can pull it in.
-- Steve
Quoted 120 lines
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 25 deletions(-)include/linux/tracepoint.h +23
-22@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ } while (0) -/* -* Make sure the alignment of the structure in the __tracepoints section will -* not add unwanted padding between the beginning of the section and the -* structure. Force alignment to the same alignment as the section start. - */ -#define DECLARE_TRACE (name, proto, args) \ - extern struct tracepoint __tracepoint_##name; \ - static inline void trace_##name(proto) \ - { \ - if (unlikely(__tracepoint_##name.state)) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_register(#name, (void *)probe); \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_unregister(#name, (void *)probe);\ - } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \@@ -173,6 +151,29 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#if defined(CONFIG_TRACEPOINTS ) && !defined(DECLARE_TRACE ) +/* +* Make sure the alignment of the structure in the __tracepoints section will +* not add unwanted padding between the beginning of the section and the +* structure. Force alignment to the same alignment as the section start. +*/ +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /* include/trace/define_trace.h +1
-0@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE include/trace/events/napi.h +22
-3@@ -1,11 +1,30 @@ -#ifndef _TRACE_NAPI_H_ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM napi + +#if !defined(_TRACE_NAPI_H_) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_NAPI_H_#include <linux/netdevice.h> #include <linux/tracepoint.h> -DECLARE_TRACE (napi_poll, +TRACE_EVENT (napi_poll, + TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + +TP_ARGS (napi), + +TP_STRUCT__entry ( + __field( struct napi_struct *, napi) + ), + +TP_fast_assign ( + __entry->napi = napi; + ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi, __entry->napi->dev->name) +);#endif + +#include <trace/define_trace.h>
Steven Rostedt
maintainerQuoted 6 lines · Steven Rostedt
Quoted 6 lines
Note this patch also converts the
napi_polltracepoint to aTRACE_EVENT. This is done so that theTRACE_EVENTfix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not havenapi_pollbe an independent event.
Quoted 14 lines
Quoted 1 line
Signed-off-by Neil Horman <[email protected]>Thanks, I'll give it a test. But because this now touches networking code, I need an Acked-by from David Miller before I can pull it in.
-- Steve
Quoted 5 lines
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++---
Hmm, This really isn't networking code. But still, a patch that changes the way a networking trace point works, I would rather have an ack.
Thanks,
-- Steve
Quoted 10 lines
Quoted 10 lines
3 files changed, 46 insertions(+), 25 deletions(-)include/linux/tracepoint.h +0
-0@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ }while (0 )
Quoted 19 lines · Steven Rostedt
Quoted 17 lines · Steven Rostedt
Quoted 7 lines
Note this patch also converts the
napi_polltracepoint to aTRACE_EVENT. This is done so that theTRACE_EVENTfix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not havenapi_pollbe an independent event.Signed-off-by Neil Horman <[email protected]>Thanks, I'll give it a test. But because this now touches networking code, I need an Acked-by from David Miller before I can pull it in.
-- Steve
Quoted 2 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++---Hmm, This really isn't networking code. But still, a patch that changes the way a networking trace point works, I would rather have an ack.
Thanks,
Copy that, I agree an Ack from dave is called for here, but Just FYi, theres only one user of this tracepoint currently in the tree (the drop monitor) and this change has no bearing on it, as you can still hook the tracepoint with the same register_trace_napi_poll call
Neil
Quoted 15 lines
-- Steve
Quoted 10 lines
Quoted 10 lines
3 files changed, 46 insertions(+), 25 deletions(-)include/linux/tracepoint.h +0
-0@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ }while (0 )
Quoted 27 lines · Neil Horman
Quoted 26 lines · Steven Rostedt
Quoted 6 lines · Steven Rostedt
Quoted 6 lines
Note this patch also converts the
napi_polltracepoint to aTRACE_EVENT. This is done so that theTRACE_EVENTfix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not havenapi_pollbe an independent event.Quoted 14 lines
Quoted 1 line
Signed-off-by Neil Horman <[email protected]>Thanks, I'll give it a test. But because this now touches networking code, I need an Acked-by from David Miller before I can pull it in.
-- Steve
Quoted 5 lines
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++---Hmm, This really isn't networking code. But still, a patch that changes the way a networking trace point works, I would rather have an ack.
Quoted 9 lines
Quoted 2 lines
Thanks,
Copy that, I agree an Ack from dave is called for here, but Just FYi, theres only one user of this tracepoint currently in the tree (the drop monitor) and this change has no bearing on it, as you can still hook the tracepoint with the same
register_trace_napi_pollcallNeil
Ping, Dave, any thoughts here?
Regards
Neil
Neil Horman
Acked-by David S. MillerQuoted 35 lines · Neil Horman
Quoted 34 lines · Neil Horman
Quoted 19 lines · Steven Rostedt
Quoted 17 lines · Steven Rostedt
Quoted 7 lines
Note this patch also converts the
napi_polltracepoint to aTRACE_EVENT. This is done so that theTRACE_EVENTfix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not havenapi_pollbe an independent event.Signed-off-by Neil Horman <[email protected]>Thanks, I'll give it a test. But because this now touches networking code, I need an Acked-by from David Miller before I can pull it in.
-- Steve
Quoted 2 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++---Hmm, This really isn't networking code. But still, a patch that changes the way a networking trace point works, I would rather have an ack.
Thanks,
Copy that, I agree an Ack from dave is called for here, but Just FYi, theres only one user of this tracepoint currently in the tree (the drop monitor) and this change has no bearing on it, as you can still hook the tracepoint with the same
register_trace_napi_pollcall
Quoted 5 lines
Quoted 2 lines
Neil
Ping, Dave, any thoughts here?
Regards
Neil
So because I have no patience, I asked Dave M. about this on irc last night, and he asked that I append his ACK to it, so here's the patch again, with his blessing by proxy :)
Fix tracing infrastructure to allow multiple header files with TRACE_EVENTS to be included with CREATE_TRACE_EVENTS defined
I've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to net/core/net-traces.c with TRACE_EVENTS defined in them. net-traces.c defines CREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find that define_trace.h redefined DECLARE_TRACE to be DEFINE_TRACE, so after the first run through define_trace.h (which is included from skb.h, included in net-trace.c first), the DECLARE_TRACE macro was left with an improper definition to start a new cycle with the next header.
The fix I came up with was to make sure that DECLARE_TRACE was undefined at the end of define_trace.h, and to add a conditional re-definition in tracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.
Note this patch also converts the napi_poll tracepoint to a TRACE_EVENT. This is done so that the TRACE_EVENT fix doesn't break the build, and because its rather pointless I think given the current tracing infrastructure to not have napi_poll be an independent event.
linux/tracepoint.h | 45 +++++++++++++++++++++++---------------------- trace/define_trace.h | 1 + trace/events/napi.h | 25 ++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 25 deletions(-)
include/linux/tracepoint.h +23 -22
@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ } while (0) -/* -* Make sure the alignment of the structure in the __tracepoints section will -* not add unwanted padding between the beginning of the section and the -* structure. Force alignment to the same alignment as the section start. - */ -#define DECLARE_TRACE (name, proto, args) \ - extern struct tracepoint __tracepoint_##name; \ - static inline void trace_##name(proto) \ - { \ - if (unlikely(__tracepoint_##name.state)) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_register(#name, (void *)probe); \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_unregister(#name, (void *)probe);\ - } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \
@@ -173,6 +151,29 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#if defined(CONFIG_TRACEPOINTS ) && !defined(DECLARE_TRACE ) +/* +* Make sure the alignment of the structure in the __tracepoints section will +* not add unwanted padding between the beginning of the section and the +* structure. Force alignment to the same alignment as the section start. +*/ +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /*
include/trace/define_trace.h +1 -0
@@ -64,6 +64,7 @@#undef TRACE_EVENT#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
include/trace/events/napi.h +22 -3
@@ -1,11 +1,30 @@ -#ifndef _TRACE_NAPI_H_ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM napi + +#if !defined(_TRACE_NAPI_H_) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_NAPI_H_#include <linux/netdevice.h> #include <linux/tracepoint.h> -DECLARE_TRACE (napi_poll, +TRACE_EVENT (napi_poll, + TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + +TP_ARGS (napi), + +TP_STRUCT__entry ( + __field( struct napi_struct *, napi) + ), + +TP_fast_assign ( + __entry->napi = napi; + ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi, __entry->napi->dev->name) +);#endif + +#include <trace/define_trace.h>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Steven Rostedt
maintainerOn Tue, 2009-12-15 at 11:08 -0500, Neil Horman wrote:
Hi Neil,
I was playing with this, and I got really nasty errors in the trace parsing tools. Then I noticed why:
Quoted 8 lines
include/trace/events/napi.h +5
-2-DECLARE_TRACE (napi_poll, +TRACE_EVENT(napi_poll, + TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + + TP_ARGS(napi), +
include/trace/events/napi.h line 25
Quoted 10 lines
include/trace/events/napi.h +10
-0+TP_STRUCT__entry ( +__field (struct napi_struct *,napi ) + ), + +TP_fast_assign ( + __entry->napi = napi; + ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi, __entry->napi->dev->name)
You can't trust this! That "__entry" happens to reside on the ring buffer. If for some reason the device goes away, this blows up when you read the trace.
If you need to save the name of the device, then store it in the ring buffer. You can do it with a dynamic array:
TP_STRUCT__entry(
__field( struct napi_struct *, napi)
__string( dev_name, napi->dev->name)
),
TP_fast_assign(
__entry->napi = napi;
__assign_str(dev_name, napi->dev->name);
),
TP_printk("napi poll on napi struct %p for device %s",
__entry->napi, __get_string(dev_name))-- Steve
Quoted 3 lines
+);
#endif
Quoted 46 lines · Steven Rostedt
On Tue, 2009-12-15 at 11:08 -0500, Neil Horman wrote:
Hi Neil,
I was playing with this, and I got really nasty errors in the trace parsing tools. Then I noticed why:
Quoted 8 lines
include/trace/events/napi.h +5
-2-DECLARE_TRACE (napi_poll, +TRACE_EVENT(napi_poll, + TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + + TP_ARGS(napi), +include/trace/events/napi.h line 25
Quoted 10 lines
include/trace/events/napi.h +10
-0+TP_STRUCT__entry ( +__field (struct napi_struct *,napi ) + ), + +TP_fast_assign ( + __entry->napi = napi; + ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi, __entry->napi->dev->name)You can't trust this! That "
__entry" happens to reside on the ring buffer. If for some reason the device goes away, this blows up when you read the trace.If you need to save the name of the device, then store it in the ring buffer. You can do it with a dynamic array:
TP_STRUCT__entry( __field( struct napi_struct *, napi) __string( dev_name, napi->dev->name) ), TP_fast_assign( __entry->napi = napi; __assign_str(dev_name, napi->dev->name); ), TP_printk("napi poll on napi struct %p for device %s", __entry->napi, __get_string(dev_name))
Quoted 8 lines
-- Steve
Quoted 3 lines
+);
#endif
Ok, thanks, I'll resubmit shortly.
Neil
Neil Horman
Acked-by David S. MillerSteven-
Here you go, new version of the patch, with the napi trace event fixed
up so that we don't errneously access a net_device we don't hold a ref on. I've tested it here and its working well
Regards
Neil
Fix tracing infrastructure to allow multiple header files with TRACE_EVENTS to be included with CREATE_TRACE_EVENTS defined
I've been workingon adding a few tracepoints to the network stack, and in so doing it was convienient for me to add a second include file to net/core/net-traces.c with TRACE_EVENTS defined in them. net-traces.c defines CREATE_TRACE_EVENTS, and during the build it was failing, complaining about duplicate definitions of __tpstrtab_<name>. I tracked down the bug to find that define_trace.h redefined DECLARE_TRACE to be DEFINE_TRACE, so after the first run through define_trace.h (which is included from skb.h, included in net-trace.c first), the DECLARE_TRACE macro was left with an improper definition to start a new cycle with the next header.
The fix I came up with was to make sure that DECLARE_TRACE was undefined at the end of define_trace.h, and to add a conditional re-definition in tracepoint.h. This places us back in the proper state to define a new set of tracepoints in a subsequent header file.
include/linux/tracepoint.h +23 -22
@@ -58,28 +58,6 @@ struct tracepoint {rcu_read_unlock_sched_notrace (); \ } while (0) -/* -* Make sure the alignment of the structure in the __tracepoints section will -* not add unwanted padding between the beginning of the section and the -* structure. Force alignment to the same alignment as the section start. - */ -#define DECLARE_TRACE (name, proto, args) \ - extern struct tracepoint __tracepoint_##name; \ - static inline void trace_##name(proto) \ - { \ - if (unlikely(__tracepoint_##name.state)) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_register(#name, (void *)probe); \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return tracepoint_probe_unregister(#name, (void *)probe);\ - } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \
@@ -173,6 +151,29 @@ static inline void tracepoint_synchronize_unregister(void)* trace event headers under one "CREATE_TRACE_POINTS" the first include * will override the TRACE_EVENT and break the second include. */ +#if defined(CONFIG_TRACEPOINTS ) && !defined(DECLARE_TRACE ) +/* +* Make sure the alignment of the structure in the __tracepoints section will +* not add unwanted padding between the beginning of the section and the +* structure. Force alignment to the same alignment as the section start. +*/ +#define DECLARE_TRACE (name, proto, args) \ + extern struct tracepoint __tracepoint_##name; \ + static inline void trace_##name(proto) \ + { \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ + } \ + static inline int register_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_register(#name, (void *)probe); \ + } \ + static inline int unregister_trace_##name(void (*probe)(proto)) \ + { \ + return tracepoint_probe_unregister(#name, (void *)probe);\ + } +#endif #ifndef TRACE_EVENT /*
include/trace/define_trace.h +1 -0
@@ -75,6 +75,7 @@#undef DEFINE_EVENT#undef DEFINE_EVENT_PRINT#undef TRACE_HEADER_MULTI_READ +#undef DECLARE_TRACE/* Only undef what we defined in this file */ #ifdef UNDEF_TRACE_INCLUDE_FILE
include/trace/events/napi.h +25 -3
@@ -1,11 +1,33 @@ -#ifndef _TRACE_NAPI_H_ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM napi + +#if !defined(_TRACE_NAPI_H_) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_NAPI_H_#include <linux/netdevice.h> #include <linux/tracepoint.h> +#include <linux/ftrace.h> + +TRACE_EVENT (napi_poll, -DECLARE_TRACE (napi_poll, TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + +TP_ARGS (napi), + +TP_STRUCT__entry ( + __field( struct napi_struct *, napi) +__string ( dev_name, napi->dev->name) + ), + +TP_fast_assign ( + __entry->napi = napi; + __assign_str(dev_name, napi->dev->name); + ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi,__get_str (dev_name)) +);#endif + +#include <trace/define_trace.h>
Steven Rostedt
maintainerQuoted 3 lines · Neil Horman
+#if !defined(_TRACE_NAPI_H_) ||
defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_NAPI_H_
Ug, I'm still getting panics because of this. I found out that it's because napi->dev can be NULL.
Here's what I did to solve it:
Review
Quoted 4 lines
#include <
linux/netdevice.h>
#include <linux/tracepoint.h>(quoted diff) +2
-0+#include <linux/ftrace.h> +
#define NO_DEV "(no device)"
include/trace/events/napi.h line 19
Quoted 11 lines
include/trace/events/napi.h +7
-2+TRACE_EVENT(napi_poll, -DECLARE_TRACE (napi_poll, TP_PROTO(struct napi_struct *napi), -TP_ARGS (napi)); + + TP_ARGS(napi), + + TP_STRUCT__entry( + __field( struct napi_struct *, napi) + __string( dev_name, napi->dev->name)
__string( dev_name, napi->dev ? napi->dev->name, NO_DEV )
include/trace/events/napi.h line 24
Quoted 5 lines
include/trace/events/napi.h +5
-0+ ), + + TP_fast_assign( + __entry->napi = napi; +__assign_str (dev_name, napi->dev->name);
__assign_str(dev_name, napi->dev ? napi->dev->name, NO_DEV);
include/trace/events/napi.h line 29
Quoted 5 lines
include/trace/events/napi.h +5
-0+ ), + +TP_printk ("napi poll on napi struct %p for device %s" , + __entry->napi,__get_str (dev_name)) +);
#undef NO_DEV
-- Steve
Quoted 4 lines
#endif
(quoted diff) +2
-0+ +#include <trace/define_trace.h>
Quoted 11 lines · Steven Rostedt
Quoted 3 lines · Neil Horman
+#if !defined(_TRACE_NAPI_H_) ||
defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_NAPI_H_Ug, I'm still getting panics because of this. I found out that it's because
napi->devcan be NULL.Here's what I did to solve it:
Gahhh, you're right, We had to do the same thing in net-next's commit f2798eb4e01b095f273f4bf40f511c9d69c0e1da. If you queue to the backlog, the backlog napi instance has no net device and so its null. This is exactly the right fix.
Thanks!
Neil
Quoted 1 line
Steven Rostedt
maintainerQuoted 8 lines · Neil Horman
Quoted 7 lines · Steven Rostedt
Quoted 3 lines · Neil Horman
+#if !defined(_TRACE_NAPI_H_) ||
defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_NAPI_H_
Quoted 8 lines
Quoted 4 lines
Ug, I'm still getting panics because of this. I found out that it's because
napi->devcan be NULL.Here's what I did to solve it:
Gahhh, you're right, We had to do the same thing in net-next's commit
f2798eb4e01b095f273f4bf40f511c9d69c0e1da. If you queue to the backlog, the backlog napi instance has no net device and so its null. This is exactly the right fix.
OK, I'll update the patch and apply it.
But this doesn't need to go into 33 correct. We can let it brew for 34?
-- Steve
Quoted 13 lines · Steven Rostedt
Quoted 12 lines · Neil Horman
Quoted 11 lines · Steven Rostedt
Quoted 3 lines · Neil Horman
+#if !defined(_TRACE_NAPI_H_) ||
defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_NAPI_H_Ug, I'm still getting panics because of this. I found out that it's because
napi->devcan be NULL.Here's what I did to solve it:
Quoted 9 lines
Quoted 4 lines
Gahhh, you're right, We had to do the same thing in net-next's commit
f2798eb4e01b095f273f4bf40f511c9d69c0e1da. If you queue to the backlog, the backlog napi instance has no net device and so its null. This is exactly the right fix.OK, I'll update the patch and apply it.
But this doesn't need to go into 33 correct. We can let it brew for 34?
Yeah, the thing I was depending on it for got NAK'ed anyway, so its just a straight bugfix + a cleanup of the napi_poll tracepoint. It can definately wait until 34.
Thanks!
Neil
Quoted 4 lines
-- Steve