PM: tracing: Don't compile in unused trace events
Subsystems (3)
Steven Rostedt
maintainercover PM: tracing: Don't compile in unused trace events
I have code that makes unsued events trigger a warning. I'm currently cleaning up the kernel to remove the majority of events that are defined but not used. When an event is defined, it can take up to 5K of text and meta data per event. An event should not be created if it is not being used.
The powernv_throttle event is only used by the powernv code so I moved it to its own header file and it gets created when the powernv code is compiled in.
For the other power events, I just added #ifdef around them with the configs that enable them.
Steven Rostedt (4):
PM: cpufreq: powernv/tracing: Move powernv_throttle trace event
PM: tracing: Hide psci_domain_idle events under ARM_PSCI_CPUIDLE
PM: tracing: Hide device_pm_callback events under PM_SLEEP
PM: tracing: Hide power_domain_target event under ARCH_OMAP2PLUS
----
drivers/cpufreq/Makefile | 1 + drivers/cpufreq/powernv-cpufreq.c | 4 +++- drivers/cpufreq/powernv-trace.h | 44 +++++++++++++++++++++++++++++++++++++++ include/trace/events/power.h | 28 ++++++------------------- kernel/trace/power-traces.c | 1 - 5 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 drivers/cpufreq/powernv-trace.h
Steven Rostedt
maintainerPATCH 1/4 PM: cpufreq: powernv/tracing: Move powernv_throttle trace event
From: Steven Rostedt <[email protected]>
As the trace event powernv_throttle is only used by the powernv code, move it to a separate include file and have that code directly enable it.
Trace events can take up around 5K of memory when they are defined regardless if they are used or not. It wastes memory to have them defined in configurations where the tracepoint is not used.
--- drivers/cpufreq/Makefile | 1 + drivers/cpufreq/powernv-cpufreq.c | 4 ++- drivers/cpufreq/powernv-trace.h | 44 +++++++++++++++++++++++++++++++ include/trace/events/power.h | 22 ---------------- kernel/trace/power-traces.c | 1 - 5 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 drivers/cpufreq/powernv-trace.h
drivers/cpufreq/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_CPUFREQ_VIRT) += virtual-cpufreq.o # Traces CFLAGS_amd-pstate-trace.o := -I$(src) +CFLAGS_powernv-cpufreq.o := -I$(src) amd_pstate-y := amd-pstate.o amd-pstate-trace.o ##################################################################################
drivers/cpufreq/powernv-cpufreq.c +3 -1
@@ -21,7 +21,6 @@#include <linux/string_choices.h> #include <linux/cpu.h> #include <linux/hashtable.h> -#include <trace/events/power.h> #include <asm/cputhreads.h> #include <asm/firmware.h>
@@ -30,6 +29,9 @@#include <asm/opal.h> #include <linux/timer.h> +#define CREATE_TRACE_POINTS +#include "powernv-trace.h" +#define POWERNV_MAX_PSTATES_ORDER 8#define POWERNV_MAX_PSTATES (1UL << (POWERNV_MAX_PSTATES_ORDER))#define PMSR_PSAFE_ENABLE (1UL << 30)
drivers/cpufreq/powernv-trace.h new file +44 -0
44 lines not on this page · raw message
include/trace/events/power.h +0 -22
@@ -99,28 +99,6 @@ DEFINE_EVENT(psci_domain_idle, psci_domain_idle_exit,TP_ARGS (cpu_id, state, s2idle) ); -TRACE_EVENT (powernv_throttle, - - TP_PROTO(int chip_id, const char *reason, int pmax), - -TP_ARGS (chip_id, reason, pmax), - -TP_STRUCT__entry ( - __field(int, chip_id) - __string(reason, reason) -__field (int, pmax) - ), - -TP_fast_assign ( - __entry->chip_id = chip_id; - __assign_str(reason); - __entry->pmax = pmax; - ), - -TP_printk ("Chip %d Pmax %d %s" , __entry->chip_id, - __entry->pmax,__get_str (reason)) -); - TRACE_EVENT(pstate_sample, TP_PROTO(u32 core_busy,
kernel/trace/power-traces.c +0 -1
@@ -17,5 +17,4 @@EXPORT_TRACEPOINT_SYMBOL_GPL (suspend_resume);EXPORT_TRACEPOINT_SYMBOL_GPL (cpu_idle);EXPORT_TRACEPOINT_SYMBOL_GPL (cpu_frequency); -EXPORT_TRACEPOINT_SYMBOL_GPL (powernv_throttle);
Signature · 1 line
2.47.2
Re: [PATCH 1/4] PM: cpufreq: powernv/tracing: Move powernv_throttle trace event
Quoted 11 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
As the trace event
powernv_throttleis only used by the powernv code, move it to a separate include file and have that code directly enable it.Trace events can take up around 5K of memory when they are defined regardless if they are used or not. It wastes memory to have them defined in configurations where the tracepoint is not used.
Fixes 0306e481d479a ("cpufreq: powernv/tracing: Add powernv_throttle tracepoint")Signed-off-by Steven Rostedt (Google) <[email protected]>
Quoted 8 lines
--- drivers/cpufreq/Makefile | 1 + drivers/cpufreq/powernv-cpufreq.c | 4 ++- drivers/cpufreq/powernv-trace.h | 44 +++++++++++++++++++++++++++++++ include/trace/events/power.h | 22 ---------------- kernel/trace/power-traces.c | 1 - 5 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 drivers/cpufreq/powernv-trace.h
Signature · 1 line
viresh
Steven Rostedt
maintainerPATCH 2/4 PM: tracing: Hide psci_domain_idle events under ARM_PSCI_CPUIDLE
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
The events psci_domain_idle_enter and psci_domain_idle_exit events are only called when CONFIG_ARM_PSCI_CPUIDLE is defined. As each event can take up to 5K (less for DEFINE_EVENT()) regardless if they are used or not, it's best not to define them when they are not used. Add #ifdef around these events when they are not used.
--- include/trace/events/power.h | 2 ++ 1 file changed, 2 insertions(+)
include/trace/events/power.h +2 -0
@@ -62,6 +62,7 @@ TRACE_EVENT(cpu_idle_miss, (unsigned long)__entry->state, (__entry->below)?"below":"above") ); +#ifdef CONFIG_ARM_PSCI_CPUIDLE DECLARE_EVENT_CLASS(psci_domain_idle, TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle),
@@ -98,6 +99,7 @@ DEFINE_EVENT(psci_domain_idle, psci_domain_idle_exit,TP_ARGS (cpu_id, state, s2idle) ); +#endif TRACE_EVENT(pstate_sample,
Signature · 1 line
2.47.2
Steven Rostedt
maintainerPATCH 3/4 PM: tracing: Hide device_pm_callback events under PM_SLEEP
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
The events device_pm_callback_start and device_pm_callback_end events are only called when CONFIG_PM_SLEEP is defined. As each event can take up to 5K regardless if they are used or not, it's best not to define them when they are not used. Add #ifdef around these events when they are not used.
--- include/trace/events/power.h | 2 ++ 1 file changed, 2 insertions(+)
include/trace/events/power.h +2 -0
@@ -212,6 +212,7 @@ TRACE_EVENT(cpu_frequency_limits, (unsigned long)__entry->cpu_id) ); +#ifdef CONFIG_PM_SLEEP TRACE_EVENT(device_pm_callback_start, TP_PROTO(struct device *dev, const char *pm_ops, int event),
@@ -260,6 +261,7 @@ TRACE_EVENT(device_pm_callback_end,TP_printk ("%s %s, err=%d" ,__get_str (driver),__get_str (device), __entry->error) ); +#endif TRACE_EVENT(suspend_resume,
Signature · 1 line
2.47.2
Steven Rostedt
maintainerPATCH 4/4 PM: tracing: Hide power_domain_target event under ARCH_OMAP2PLUS
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
The power_domain_target event event is only called when CONFIG_OMAP2PLUS is defined. As each event can take up to 5K regardless if they are used or not, it's best not to define them when they are not used. Add #ifdef around these events when they are not used.
--- include/trace/events/power.h | 2 ++ 1 file changed, 2 insertions(+)
include/trace/events/power.h +2 -0
@@ -319,6 +319,7 @@ DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,TP_ARGS (name, state) ); +#ifdef CONFIG_ARCH_OMAP2PLUS /* * The power domain events are used for power domains transitions */
@@ -350,6 +351,7 @@ DEFINE_EVENT(power_domain, power_domain_target,TP_ARGS (name, state, cpu_id) ); +#endif /* * CPU latency QoS events used for global CPU latency QoS list updates
Signature · 1 line
2.47.2
Quoted 19 lines · Steven Rostedt
I have code that makes unsued events trigger a warning. I'm currently cleaning up the kernel to remove the majority of events that are defined but not used. When an event is defined, it can take up to 5K of text and meta data per event. An event should not be created if it is not being used.
The
powernv_throttleevent is only used by the powernv code so I moved it to its own header file and it gets created when the powernv code is compiled in.For the other power events, I just added #ifdef around them with the configs that enable them.
Steven Rostedt (4):
PM: cpufreq: powernv/tracing: Movepowernv_throttletrace event
PM: tracing: Hidepsci_domain_idleevents underARM_PSCI_CPUIDLE
PM: tracing: Hidedevice_pm_callbackevents underPM_SLEEP
PM: tracing: Hidepower_domain_targetevent underARCH_OMAP2PLUS
Quoted 8 lines
----
drivers/cpufreq/Makefile | 1 + drivers/cpufreq/powernv-cpufreq.c | 4 +++- drivers/cpufreq/powernv-trace.h | 44 +++++++++++++++++++++++++++++++++++++++ include/trace/events/power.h | 28 ++++++------------------- kernel/trace/power-traces.c | 1 - 5 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 drivers/cpufreq/powernv-trace.h
For the series:
Thanks!