tracing: allow disabling compilation of specific trace systems
cover tracing: allow disabling compilation of specific trace systems
Currently, enabling CONFIG_TRACING on a system comes as all-or-nothing: either tracepoints for all subsystems are compiled (with CONFIG_TRACING) or none of them do (without it).
This caused me an unacceptable performance penalty (obviously SOME penalty was expected, but not one so severe) which made me revert the changes in configuration.
The first patch in this series modifies the files that actually define the tracepoint to look for a preprocessor macro NOTRACE and define nops (as if CONFIG_TRACING was not set) instead of them.
The second patch provides an example of how I see this working, with the gpio subsystem as the example for absolutely no reason.
If this idea is deemed worth the time by the community, I'll create patches for the other subsystems.
Tal Shorer (2):
tracing: allow disabling compilation of specific trace systems
tracing: gpio: add Kconfig option for enabling/disabling trace events
drivers/gpio/Kconfig | 6 ++++++ include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 ++++ 4 files changed, 14 insertions(+), 4 deletions(-)
Signature · 5 lines
2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
RFC PATCH 1/2 tracing: allow disabling compilation of specific trace systems
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE.
This could be done, for example, according to a Kconfig option.
--- include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/tracepoint.h +3 -3
@@ -111,7 +111,7 @@ extern void syscall_unregfunc(void); #define TP_ARGS(args...) args #define TP_CONDITION(args...) args -#ifdef CONFIG_TRACEPOINTS +#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE )/* * it_func[0] is never NULL because there is at least one element in the array
@@ -234,7 +234,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !CONFIG_TRACEPOINTS */ +#else /* !(defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE)) */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \
@@ -266,7 +266,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* CONFIG_TRACEPOINTS */ +#endif /* defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE) */ #ifdef CONFIG_TRACING /**
include/trace/define_trace.h +1 -1
@@ -86,7 +86,7 @@#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#if defined(CONFIG_EVENT_TRACING ) && !defined(NOTRACE )#include <trace/ftrace.h> #endif
Signature · 5 lines
2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
RFC PATCH 2/2 tracing: gpio: add Kconfig option for enabling/disabling trace events
In reply to Tal ShorerAdd a new options to gpio Kconfig, CONFIG_GPIO_TRACING, that is used for enabling/disabling compilation of gpio function trace events.
--- drivers/gpio/Kconfig | 6 ++++++ include/trace/events/gpio.h | 4 ++++ 2 files changed, 10 insertions(+)
drivers/gpio/Kconfig +6 -0
@@ -88,6 +88,12 @@ config GPIO_SYSFS config GPIO_GENERIC tristate +config GPIO_TRACING + bool "gpio tracing" + depends on TRACING + help + Enable tracing for gpio subsystem + # put drivers in the right section, in alphabetical order # This symbol is selected by both I2C and SPI expanders
include/trace/events/gpio.h +4 -0
@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_GPIO_TRACING +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_H
Signature · 5 lines
2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
ping?
Quoted 30 lines · Tal Shorer
Currently, enabling
CONFIG_TRACINGon a system comes as all-or-nothing: either tracepoints for all subsystems are compiled (withCONFIG_TRACING) or none of them do (without it).This caused me an unacceptable performance penalty (obviously SOME penalty was expected, but not one so severe) which made me revert the changes in configuration.
The first patch in this series modifies the files that actually define the tracepoint to look for a preprocessor macro NOTRACE and define nops (as if
CONFIG_TRACINGwas not set) instead of them.The second patch provides an example of how I see this working, with the gpio subsystem as the example for absolutely no reason.
If this idea is deemed worth the time by the community, I'll create patches for the other subsystems.Tal Shorer (2):
tracing: allow disabling compilation of specific trace systems
tracing: gpio: addKconfigoption for enabling/disabling trace eventsdrivers/gpio/Kconfig | 6 ++++++ include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 ++++ 4 files changed, 14 insertions(+), 4 deletions(-)--
2.2.2
Steven Rostedt
maintainerQuoted 1 line · On Thu, 25 Jun 2015 23:41:17 +0300 Tal Shorer <[email protected]> wrote:
ping?
I'm planning on looking at this after I've finished everything for the merge window. This came over the weekend (always a bad time), and the merge window opened. All new code needs to take a backseat while the merge window is opened.
I may not get to this till next week. Feel free to ping me again then.
-- Steve
Quoted 32 lines · Tal Shorer
Quoted 30 lines
Currently, enabling
CONFIG_TRACINGon a system comes as all-or-nothing: either tracepoints for all subsystems are compiled (withCONFIG_TRACING) or none of them do (without it).This caused me an unacceptable performance penalty (obviously SOME penalty was expected, but not one so severe) which made me revert the changes in configuration.
The first patch in this series modifies the files that actually define the tracepoint to look for a preprocessor macro NOTRACE and define nops (as if
CONFIG_TRACINGwas not set) instead of them.The second patch provides an example of how I see this working, with the gpio subsystem as the example for absolutely no reason.
If this idea is deemed worth the time by the community, I'll create patches for the other subsystems.Tal Shorer (2):
tracing: allow disabling compilation of specific trace systems
tracing: gpio: addKconfigoption for enabling/disabling trace eventsdrivers/gpio/Kconfig | 6 ++++++ include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 ++++ 4 files changed, 14 insertions(+), 4 deletions(-)--
2.2.2
Quoted 11 lines · Steven Rostedt
Quoted 1 line · On Thu, 25 Jun 2015 23:41:17 +0300 Tal Shorer <[email protected]> wrote:
ping?
I'm planning on looking at this after I've finished everything for the merge window. This came over the weekend (always a bad time), and the merge window opened. All new code needs to take a backseat while the merge window is opened.
I may not get to this till next week. Feel free to ping me again then.
ping
Quoted 37 lines
-- Steve
Quoted 32 lines · Tal Shorer
Quoted 30 lines
Currently, enabling
CONFIG_TRACINGon a system comes as all-or-nothing: either tracepoints for all subsystems are compiled (withCONFIG_TRACING) or none of them do (without it).This caused me an unacceptable performance penalty (obviously SOME penalty was expected, but not one so severe) which made me revert the changes in configuration.
The first patch in this series modifies the files that actually define the tracepoint to look for a preprocessor macro NOTRACE and define nops (as if
CONFIG_TRACINGwas not set) instead of them.The second patch provides an example of how I see this working, with the gpio subsystem as the example for absolutely no reason.
If this idea is deemed worth the time by the community, I'll create patches for the other subsystems.Tal Shorer (2):
tracing: allow disabling compilation of specific trace systems
tracing: gpio: addKconfigoption for enabling/disabling trace eventsdrivers/gpio/Kconfig | 6 ++++++ include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 ++++ 4 files changed, 14 insertions(+), 4 deletions(-)--
2.2.2
Steven Rostedt
maintainerQuoted 16 lines · On Sat, 20 Jun 2015 23:21:18 +0300 Tal Shorer <[email protected]> wrote:
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE.
This could be done, for example, according to a
Kconfigoption.Signed-off-by Tal Shorer <[email protected]>--- include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)include/linux/tracepoint.h +0
-0
include/linux/tracepoint.h extern void syscall_unregfunc(void); · line 114
Quoted 5 lines
include/linux/tracepoint.h +1
-1@@ -111,7 +111,7 @@ extern void syscall_unregfunc(void); #define TP_ARGS(args...) args #define TP_CONDITION(args...) args -#ifdef CONFIG_TRACEPOINTS +#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE )
Instead of the duplicate condition above, it would be better to make a new macro at the top. And we can add a nice comment to it as well.
/*
* Individual subsystem my have a separate configuration to
* enable their tracepoints. By default, this file will create
* the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem
* wants to be able to disable its tracepoints from being created
* it can define NOTRACE before including the tracepoint headers. */
#if defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE)
# define TRACEPOINTS_ENABLED #endif
Then switch all the conditions below to:
#ifdef TRACEPOINTS_ENABLED
-- Steve
Quoted 34 lines
include/linux/tracepoint.h +2
-2/* * it_func[0] is never NULL because there is at least one element in the array @@ -234,7 +234,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !CONFIG_TRACEPOINTS */ +#else /* !(defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE)) */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \@@ -266,7 +266,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* CONFIG_TRACEPOINTS */ +#endif /* defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE) */ #ifdef CONFIG_TRACING /** include/trace/define_trace.h +1
-1@@ -86,7 +86,7 @@#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#if defined(CONFIG_EVENT_TRACING ) && !defined(NOTRACE )#include <trace/ftrace.h> #endif
Quoted 22 lines · Steven Rostedt
Quoted 19 lines · On Sat, 20 Jun 2015 23:21:18 +0300 Tal Shorer <[email protected]> wrote:
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE.
This could be done, for example, according to a
Kconfigoption.Signed-off-by Tal Shorer <[email protected]>--- include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)include/linux/tracepoint.h +0
-0@@ -111,7 +111,7 @@ extern void syscall_unregfunc(void); #define TP_ARGS(args...) args #define TP_CONDITION(args...) args
Quoted 5 lines
include/linux/tracepoint.h extern void syscall_unregfunc(void); · line 114
Quoted 2 lines
include/linux/tracepoint.h +1
-1-#ifdef CONFIG_TRACEPOINTS +#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE )Instead of the duplicate condition above, it would be better to make a new macro at the top. And we can add a nice comment to it as well.
Technically they're a little different, one with CONFIG_TRACEPOINTS and the other with CONFIG_EVENT_TRACING.
Looking briefly at the Kconfig files, it appears you can't really have CONFIG_TRACEPOINTS without also getting CONFIG_EVENT_TRACING along the way.
If it's fine with you to effectively change the check for CONFIG_EVENT_TRACING with a check for CONFIG_TRACEPOINTS (or vice versa, let me know if you have a preference), it's fine with me and will be added in v2.
Quoted 8 lines
/*
* Individual subsystem my have a separate configuration to
* enable their tracepoints. By default, this file will create
* the tracepoints ifCONFIG_TRACEPOINTis defined. If a subsystem
* wants to be able to disable its tracepoints from being created
* it can define NOTRACE before including the tracepoint headers. */
Will be added in v2. I believe I'll have time to write and test it during the week.
Quoted 46 lines
#if
defined(CONFIG_TRACEPOINTS)&& !defined(NOTRACE)# define TRACEPOINTS_ENABLED #endifThen switch all the conditions below to:
#ifdef
TRACEPOINTS_ENABLED-- Steve
Quoted 34 lines
include/linux/tracepoint.h +2
-2/* * it_func[0] is never NULL because there is at least one element in the array @@ -234,7 +234,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !CONFIG_TRACEPOINTS */ +#else /* !(defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE)) */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \@@ -266,7 +266,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* CONFIG_TRACEPOINTS */ +#endif /* defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE) */ #ifdef CONFIG_TRACING /** include/trace/define_trace.h +1
-1@@ -86,7 +86,7 @@#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#if defined(CONFIG_EVENT_TRACING ) && !defined(NOTRACE )#include <trace/ftrace.h> #endif
v2 cover tracing: allow disabling compilation of specific trace systems
In reply to Steven RostedtCurrently, enabling CONFIG_TRACING on a system comes as all-or-nothing: either tracepoints for all subsystems are compiled (with CONFIG_TRACING) or none of them do (without it).
This caused me an unacceptable performance penalty (obviously SOME penalty was expected, but not one so severe) which made me revert the changes in configuration.
The first patch in this series modifies the files that actually define the tracepoint to look for a preprocessor macro NOTRACE and define nops (as if CONFIG_TRACING was not set) instead of them.
The second patch provides an example of how I see this working, with the gpio subsystem as the example for absolutely no reason.
If this idea is deemed worth the time by the community, I'll create patches for the other subsystems.
Changelog:
v2:
- A comment in tracepoint.h explaining NOTRACE and its use
- Avoid duplication of the test for both NOTRACE and a config option by defining TRACEPOINTS_ENABLED when both are present and using that to check whether or not to define tracepoints
Tal Shorer (2):
tracing: allow disabling compilation of specific trace systems
tracing: gpio: add Kconfig option for enabling/disabling trace events
drivers/gpio/Kconfig | 7 +++++++ include/linux/tracepoint.h | 6 +++--- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 ++++ 4 files changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
2.4.3
PATCH v2 1/2 tracing: allow disabling compilation of specific trace systems
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE.
This could be done, for example, according to a Kconfig option.
--- include/linux/tracepoint.h | 17 ++++++++++++++--- include/trace/define_trace.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-)
include/linux/tracepoint.h +14 -3
@@ -103,7 +103,18 @@ extern void syscall_unregfunc(void); #define TP_ARGS(args...) args #define TP_CONDITION(args...) args -#ifdef CONFIG_TRACEPOINTS +/* +* Individual subsystem my have a separate configuration to +* enable their tracepoints. By default, this file will create +* the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem +* wants to be able to disable its tracepoints from being created +* it can define NOTRACE before including the tracepoint headers. +*/ +#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE ) +#define TRACEPOINTS_ENABLED +#endif + +#ifdef TRACEPOINTS_ENABLED /* * it_func[0] is never NULL because there is at least one element in the array
@@ -226,7 +237,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !CONFIG_TRACEPOINTS */ +#else /* !TRACEPOINTS_ENABLED */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \
@@ -258,7 +269,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* CONFIG_TRACEPOINTS */ +#endif /* TRACEPOINTS_ENABLED */ #ifdef CONFIG_TRACING /**
include/trace/define_trace.h +1 -1
@@ -86,7 +86,7 @@#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#ifdef TRACEPOINTS_ENABLED #include <trace/ftrace.h> #endif
Signature · 1 line
2.4.3
PATCH v2 2/2 tracing: gpio: add Kconfig option for enabling/disabling trace events
In reply to Tal ShorerAdd a new options to gpio Kconfig, CONFIG_GPIO_TRACING, that is used for enabling/disabling compilation of gpio function trace events.
--- drivers/gpio/Kconfig | 7 +++++++ include/trace/events/gpio.h | 4 ++++ 2 files changed, 11 insertions(+)
drivers/gpio/Kconfig +7 -0
@@ -88,6 +88,13 @@ config GPIO_SYSFS config GPIO_GENERIC tristate +config GPIO_TRACING + bool "gpio tracing" + depends on TRACING + help + Enable tracing for gpio subsystem + + # put drivers in the right section, in alphabetical order config GPIO_DA9052
include/trace/events/gpio.h +4 -0
@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_GPIO_TRACING +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_H
Signature · 1 line
2.4.3
Steven Rostedt
maintainerRe: [PATCH v2 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
Quoted 3 lines · On Thu, 16 Jul 2015 20:39:36 +0300 Tal Shorer <[email protected]> wrote:
Add a new options to gpio
Kconfig,CONFIG_GPIO_TRACING, that is used for enabling/disabling compilation of gpio function trace events.
If I can get acks from the gpio maintainers, I can take this in my tree, as it depends on code that modifies the core tracing facility.
-- Steve
Quoted 39 lines
Signed-off-by Tal Shorer <[email protected]>--- drivers/gpio/Kconfig | 7 +++++++ include/trace/events/gpio.h | 4 ++++ 2 files changed, 11 insertions(+)drivers/gpio/Kconfig +7
-0@@ -88,6 +88,13 @@ config GPIO_SYSFS config GPIO_GENERIC tristate +config GPIO_TRACING + bool "gpio tracing" + depends on TRACING + help + Enable tracing for gpio subsystem + + # put drivers in the right section, in alphabetical order config GPIO_DA9052include/trace/events/gpio.h +4
-0@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_GPIO_TRACING +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_H
Re: [PATCH v2 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
On second thought, I wonder if the config option shouldn't be in kernel/trace/Kconfig
Imagine there's an option for every subsystem. Disabling all of them but the one you actually care about is going to be a mess if they're scattered all over the place.
Your thoughts?
Quoted 52 lines · Steven Rostedt
Quoted 3 lines · On Thu, 16 Jul 2015 20:39:36 +0300 Tal Shorer <[email protected]> wrote:
Add a new options to gpio
Kconfig,CONFIG_GPIO_TRACING, that is used for enabling/disabling compilation of gpio function trace events.If I can get acks from the gpio maintainers, I can take this in my tree, as it depends on code that modifies the core tracing facility.
-- Steve
Quoted 39 lines
Signed-off-by Tal Shorer <[email protected]>--- drivers/gpio/Kconfig | 7 +++++++ include/trace/events/gpio.h | 4 ++++ 2 files changed, 11 insertions(+)drivers/gpio/Kconfig +7
-0@@ -88,6 +88,13 @@ config GPIO_SYSFS config GPIO_GENERIC tristate +config GPIO_TRACING + bool "gpio tracing" + depends on TRACING + help + Enable tracing for gpio subsystem + + # put drivers in the right section, in alphabetical order config GPIO_DA9052include/trace/events/gpio.h +4
-0@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_GPIO_TRACING +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_H
Linus Walleij
Acked-byRe: [PATCH v2 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
In reply to Steven RostedtQuoted 9 lines · Steven Rostedt
Quoted 3 lines · On Thu, 16 Jul 2015 20:39:36 +0300 Tal Shorer <[email protected]> wrote:
Add a new options to gpio
Kconfig,CONFIG_GPIO_TRACING, that is used for enabling/disabling compilation of gpio function trace events.If I can get acks from the gpio maintainers, I can take this in my tree, as it depends on code that modifies the core tracing facility.
What works for the tracing maintainer works for me.
Now you can decide if you want this or not... there are some comments from Tal Shorer I see.
Yours,
Linus Walleij
v3 cover tracing: allow disabling compilation of specific trace systems
In reply to Tal ShorerCurrently, enabling CONFIG_TRACING on a system comes as all-or-nothing:
either tracepoints for all subsystems are compiled (with CONFIG_TRACING) or none of them are (without it).
This caused me an unacceptable performance penalty (obviously SOME penalty was expected, but not one so severe) which made me revert the changes in configuration.
The first patch in this series modifies the files that actually define the tracepoint to look for a preprocessor macro NOTRACE and define nops (as if CONFIG_TRACING was not set) instead of them.
The second patch provides an example of how I see this working, with the gpio subsystem as the example for absolutely no reason.
Changelog:
v2:
- A comment in tracepoint.h explaining NOTRACE and its use
- Avoid duplication of the test for both NOTRACE and a config option by defining TRACEPOINTS_ENABLED when both are present and using that to check whether or not to define tracepoints
v3:
- Fix Patch 1/2 to apply to changes in include/trace/define_trace.h
- Add Linus Walleij's ack to Patch 2/2
- Move the Kconfig option from drivers/gpio/Kconfig to kernel/trace/Kconfig This was done to group up all TRACING_EVENTS_* options together in the future to ease disabling everything you don't need.
Tal Shorer (2):
tracing: allow disabling compilation of specific trace systems
tracing: gpio: add Kconfig option for enabling/disabling trace events
include/linux/tracepoint.h | 17 ++++++++++++++--- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 ++++ kernel/trace/Kconfig | 7 +++++++ 4 files changed, 26 insertions(+), 4 deletions(-)
Signature · 1 line
2.4.6
PATCH v3 1/2 tracing: allow disabling compilation of specific trace systems
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE.
This could be done, for example, according to a Kconfig option.
--- include/linux/tracepoint.h | 17 ++++++++++++++--- include/trace/define_trace.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-)
include/linux/tracepoint.h +14 -3
@@ -111,7 +111,18 @@ extern void syscall_unregfunc(void); #define TP_ARGS(args...) args #define TP_CONDITION(args...) args -#ifdef CONFIG_TRACEPOINTS +/* +* Individual subsystem my have a separate configuration to +* enable their tracepoints. By default, this file will create +* the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem +* wants to be able to disable its tracepoints from being created +* it can define NOTRACE before including the tracepoint headers. +*/ +#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE ) +#define TRACEPOINTS_ENABLED +#endif + +#ifdef TRACEPOINTS_ENABLED /* * it_func[0] is never NULL because there is at least one element in the array
@@ -234,7 +245,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !CONFIG_TRACEPOINTS */ +#else /* !TRACEPOINTS_ENABLED */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \
@@ -266,7 +277,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* CONFIG_TRACEPOINTS */ +#endif /* TRACEPOINTS_ENABLED */ #ifdef CONFIG_TRACING /**
include/trace/define_trace.h +1 -1
@@ -86,7 +86,7 @@#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#ifdef TRACEPOINTS_ENABLED #include <trace/trace_events.h> #include <trace/perf.h> #endif
Signature · 1 line
2.4.6
PATCH v3 2/2 tracing: gpio: add Kconfig option for enabling/disabling trace events
In reply to Tal ShorerAdd a new options to trace Kconfig, CONFIG_TRACING_EVENTS_GPIO, that is used for enabling/disabling compilation of gpio function trace events.
--- include/trace/events/gpio.h | 4 ++++ kernel/trace/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+)
include/trace/events/gpio.h +4 -0
@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_TRACING_EVENTS_GPIO +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_H
kernel/trace/Kconfig +7 -0
@@ -635,6 +635,13 @@ config TRACE_ENUM_MAP_FILE If unsure, say N +config TRACING_EVENTS_GPIO + bool "Trace gpio events" + depends on GPIOLIB + default y + help + Enable tracing events for gpio subsystem + endif # FTRACE endif # TRACING_SUPPORT
Signature · 1 line
2.4.6
Re: [Patch v3 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
ping?
Quoted 46 lines · Tal Shorer
Add a new options to trace
Kconfig,CONFIG_TRACING_EVENTS_GPIO, that is used for enabling/disabling compilation of gpio function trace events.Signed-off-by Tal Shorer <[email protected]>Acked-by Linus Walleij <[email protected]>--- include/trace/events/gpio.h | 4 ++++ kernel/trace/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+)include/trace/events/gpio.h +4
-0@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_TRACING_EVENTS_GPIO +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_Hkernel/trace/Kconfig +7
-1@@ -635,6 +635,13 @@ config TRACE_ENUM_MAP_FILE If unsure, say N +config TRACING_EVENTS_GPIO + bool "Trace gpio events" + depends on GPIOLIB + default y + help + Enable tracing events for gpio subsystem + endif # FTRACE endif # TRACING_SUPPORT --2.4.6
Re: [Patch v3 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
Merge window for 4.3 is over, so I figured I might bring this back up
Quoted 49 lines · Tal Shorer
ping?
Quoted 46 lines · Tal Shorer
Add a new options to trace
Kconfig,CONFIG_TRACING_EVENTS_GPIO, that is used for enabling/disabling compilation of gpio function trace events.Signed-off-by Tal Shorer <[email protected]>Acked-by Linus Walleij <[email protected]>--- include/trace/events/gpio.h | 4 ++++ kernel/trace/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+)include/trace/events/gpio.h +4
-0@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_TRACING_EVENTS_GPIO +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_Hkernel/trace/Kconfig +7
-1@@ -635,6 +635,13 @@ config TRACE_ENUM_MAP_FILE If unsure, say N +config TRACING_EVENTS_GPIO + bool "Trace gpio events" + depends on GPIOLIB + default y + help + Enable tracing events for gpio subsystem + endif # FTRACE endif # TRACING_SUPPORT --2.4.6
Re: [Patch v3 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
In reply to Tal ShorerQuoted 30 lines · Tal Shorer
Add a new options to trace
Kconfig,CONFIG_TRACING_EVENTS_GPIO, that is used for enabling/disabling compilation of gpio function trace events.Signed-off-by Tal Shorer <[email protected]>Acked-by Linus Walleij <[email protected]>--- include/trace/events/gpio.h | 4 ++++ kernel/trace/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+)include/trace/events/gpio.h +4
-0@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_TRACING_EVENTS_GPIO +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_Hkernel/trace/Kconfig +0
-0
kernel/trace/Kconfig config TRACE_ENUM_MAP_FILE · line 644
Quoted 10 lines
kernel/trace/Kconfig +7
-0@@ -635,6 +635,13 @@ config TRACE_ENUM_MAP_FILE If unsure, say N +config TRACING_EVENTS_GPIO + bool "Trace gpio events" + depends on GPIOLIB + default y + help + Enable tracing events for gpio subsystem +
It happened a few times to me since this patch was merged (in 4.4-rc1) that I worked on a system with tracing enabled but /sys/kernel/debug/tracing/events/gpio were missing because of CONFIG_TRACING_EVENTS_GPIO=n. This is annoying and I wonder what is the motivating purpose of allowing to disable gpio events. There is no other event type that can be disabled with kconfig symbols. Theoretically the overhead should be so small, that having these events enabled unconditionally should be fine, shouldn't it?
Best regards
Uwe
Re: [Patch v3 2/2] tracing: gpio: add Kconfig option for enabling/disabling trace events
Quoted 8 lines · Uwe Kleine-König
It happened a few times to me since this patch was merged (in 4.4-rc1) that I worked on a system with tracing enabled but
/sys/kernel/debug/tracing/events/gpiowere missing because ofCONFIG_TRACING_EVENTS_GPIO=n. This is annoying and I wonder what is the motivating purpose of allowing to disable gpio events. There is no other event type that can be disabled with kconfig symbols. Theoretically the overhead should be so small, that having these events enabled unconditionally should be fine, shouldn't it?
You have a good point. We should not do anything special.
I guess by the time this was merged I believed it was customary for trancepoints to live behind a Kconfig option.
I guess it is not.
I happily merge a patch removing this again if no case can be made for it.
Yours,
Linus Walleij
Re: [PATCH 2/2] tracing: drop handling of NOTRACE symbol
In reply to a message not in the archiveHello Linus and Steven,
Quoted 12 lines · Linus Walleij
Quoted 10 lines · Steven Rostedt
Quoted 6 lines · On Mon, 8 Apr 2019 15:42:55 +0200 Linus Walleij <[email protected]>…
Quoted 2 lines
That's fine for me, but I'm a bit surprised you did that without an ack from the tracing people?
oOOPS no I guess I shouldn't, haha I just didn't look close enough, I thought for some reason it only applied in the GPIO subsystem. I'll back this out.
Quoted 5 lines
Quoted 3 lines
No need to back it out.
OK applied to the GPIO tree.
I just found this patch in one of my older topic branches and it still applies to current Linus (Torvald)'s master.
Given that the only user is gone since 5.2-rc1 (commit 12f2639038ef420fe796171ffb810b30d1ac0619)
For reference, here comes it again, slightly adapted to reality. (Use git am --scissors to apply.)
Best regards
Uwe
---->8----
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
Date: Fri, 5 Apr 2019 21:31:47 +0200
Subject: [PATCH] tracing: drop handling of NOTRACE symbol
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When a header defined the NOTRACE cpp symbol creation of tracepoints was skipped. Since this feature was introduced in 4.4-rc1 it was only ever used by the gpio events and this was dropped in v5.2-rc1. So remove this now unused knob, also to not encourage a new usage.
--- include/linux/tracepoint.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
include/linux/tracepoint.h +3 -14
@@ -136,18 +136,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) #define TP_ARGS(args...) args #define TP_CONDITION(args...) args -/* -* Individual subsystem my have a separate configuration to -* enable their tracepoints. By default, this file will create -* the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem -* wants to be able to disable its tracepoints from being created -* it can define NOTRACE before including the tracepoint headers. -*/ -#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE ) -#define TRACEPOINTS_ENABLED -#endif - -#ifdef TRACEPOINTS_ENABLED +#ifdef CONFIG_TRACEPOINTS /* * it_func[0] is never NULL because there is at least one element in the array
@@ -295,7 +284,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !TRACEPOINTS_ENABLED */ +#else /* !CONFIG_TRACEPOINTS */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \
@@ -327,7 +316,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* TRACEPOINTS_ENABLED */ +#endif /* CONFIG_TRACEPOINTS */ #ifdef CONFIG_TRACING /**
Signature · 6 lines
2.20.1 -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 2/2] tracing: drop handling of NOTRACE symbol
Quoted 1 line · Uwe Kleine-König
Hello Linus and Steven,
(...)
Quoted 8 lines
I just found this patch in one of my older topic branches and it still applies to current Linus (Torvald)'s master.
Given that the only user is gone since 5.2-rc1 (commit
12f2639038ef420fe796171ffb810b30d1ac0619)For reference, here comes it again, slightly adapted to reality. (Use git am --scissors to apply.)
Sorry Uwe, it exploded last time for some reason that may have been my fault, bad luck or something interim, or something that has gone away since. But I had to pull it out and I guess I missed to communicate about it.
I put it in a separate branch and push to the build servers so we can see if something happens!
Yours,
Linus Walleij
Re: [PATCH 2/2] tracing: drop handling of NOTRACE symbol
Quoted 2 lines · Linus Walleij
I put it in a separate branch and push to the build servers so we can see if something happens!
Oh there it is... buildserver says:
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
devel-drop-trace
branch HEAD: 40da9a24a778d94e034d160bfacf4931ae5922cd tracing: drop handling of NOTRACE symbol
Regressions in current branch:
kernel/trace/trace_events_filter.c:2105:14: error: field name not in record or union initializer kernel/trace/trace_events_filter.c:2115:44: error: field 'rec' has incomplete typekernel/trace/trace_events_filter.c:2121:2: note: in expansion of macro 'DATA_REC'kernel/trace/trace_events_filter.c:2142:9: sparse: sparse: too many errors kernel/trace/trace_events_filter.c:2222:29: error: passing argument 2 of 'create_filter' from incompatible pointer type [-Werror=incompatible-pointer-types] kernel/trace/trace_events_filter.c:2222:30: error:
'event_ftrace_test_filter' undeclared (first use in this function); did you mean 'trace_ftrace_test_filter'?
Error ids grouped by kconfigs:
recent_errors
|-- arm-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- arm64-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- arm64-allyesconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- mips-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- s390-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- sh-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- sparc64-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| `-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
|-- x86_64-allmodconfig
| |-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
| |-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
| |-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
| |-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type
| |-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
| `-- kernel-trace-trace_events_filter.c:sparse:sparse:too-many-errors
`-- x86_64-allyesconfig
|-- kernel-trace-trace_events_filter.c:error:event_ftrace_test_filter-undeclared-(first-use-in-this-function)-did-you-mean-trace_ftrace_test_filter
|-- kernel-trace-trace_events_filter.c:error:field-name-not-in-record-or-union-initializer
|-- kernel-trace-trace_events_filter.c:error:field-rec-has-incomplete-type
|-- kernel-trace-trace_events_filter.c:error:passing-argument-of-create_filter-from-incompatible-pointer-type`-- kernel-trace-trace_events_filter.c:note:in-expansion-of-macro-DATA_REC
I looked into this last time but couldn't wrap my head around it.
Yours,
Linus Walleij
Steven Rostedt
maintainerRe: [PATCH 2/2] tracing: drop handling of NOTRACE symbol
In reply to Uwe Kleine-KönigQuoted 21 lines · On Sat, 24 Aug 2019 16:04:26 +0200 Uwe Kleine-König…
Hello Linus and Steven,
Quoted 12 lines · Linus Walleij
Quoted 10 lines · Steven Rostedt
Quoted 6 lines · On Mon, 8 Apr 2019 15:42:55 +0200 Linus Walleij <[email protected]>…
Quoted 2 lines
That's fine for me, but I'm a bit surprised you did that without an ack from the tracing people?
oOOPS no I guess I shouldn't, haha I just didn't look close enough, I thought for some reason it only applied in the GPIO subsystem. I'll back this out.
Quoted 5 lines
Quoted 3 lines
No need to back it out.
OK applied to the GPIO tree.
Quoted 8 lines
I just found this patch in one of my older topic branches and it still applies to current Linus (Torvald)'s master.
Given that the only user is gone since 5.2-rc1 (commit
12f2639038ef420fe796171ffb810b30d1ac0619)For reference, here comes it again, slightly adapted to reality. (Use git am --scissors to apply.)
I have some reservations against this patch. Mainly being that I'm starting to think that we should be able to compile out individual systems of trace events. The number of trace events continues to grow, and there are many that I don't care about. This could be use to make it easy to add configs that keep various trace event systems from being compiled into the kernel.
-- Steve