Skip to contentSkip to conversation

tracing: Fixes for unused tracepoints for 6.17

PATCH New Steven Rostedt 1 participant 10 messages Jul 25, 2025

Subsystems (7)
Arm (32-bit) PowerPC arm64 Tracing +3 more subsystems
lore
Share & tools
lore
#0 lore raw

cover tracing: Fixes for unused tracepoints for 6.17

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
unused-tracepoints/for-next

Head SHA1: 8c4e53a1a09374c232fe96232426226b2824f473

Steven Rostedt (9):
tracing, AER: Hide PCIe AER event when PCIEAER is not configured
alarmtimer: Hide alarmtimer_suspend event when RTC_CLASS is not configured
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
binder: Remove unused binder lock events
tracing: arm: arm64: Hide trace events ipi_raise, ipi_entry and ipi_exit
tracing: Call trace_ftrace_test_filter() for the event

----

 arch/arm/Kconfig                   |  1 +
 arch/arm64/Kconfig                 |  1 +
 drivers/android/binder_trace.h     | 21 --------------
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/powernv-cpufreq.c  |  4 ++-
 drivers/cpufreq/powernv-trace.h    | 44 +++++++++++++++++++++++++++++
 include/ras/ras_event.h            |  2 ++
 include/trace/events/alarmtimer.h  |  2 ++
 include/trace/events/ipi.h         | 58 ++++++++++++++++++++------------------
 include/trace/events/power.h       | 28 ++++--------------
 kernel/trace/Kconfig               |  6 ++++
 kernel/trace/power-traces.c        |  1 -
 kernel/trace/trace_events_filter.c |  4 +++
 13 files changed, 100 insertions(+), 73 deletions(-)
 create mode 100644 drivers/cpufreq/powernv-trace.h
#1 lore raw

PATCH 1/9 tracing, AER: Hide PCIe AER event when PCIEAER is not configured

From: Steven Rostedt <[email protected]>

The event aer_event is only used when CONFIG_PCIEAER is configured. It should not be created when it is not. When an event is created it creates around 5K of text and meta data regardless if the tracepoint is used or not. Instead of wasting this memory, put #ifdef around the event to not create it when it is not used.

---
 include/ras/ras_event.h | 2 ++
 1 file changed, 2 insertions(+)
include/ras/ras_event.h +2 -0
index 14c9f943d53f..c8cd0f00c845 100644
@@ -252,6 +252,7 @@ TRACE_EVENT(non_standard_event,
 		  __print_hex(__get_dynamic_array(buf), __entry->len))
 );
 
+#ifdef CONFIG_PCIEAER
 /*
  * PCIe AER Trace event
  *
@@ -337,6 +338,7 @@ TRACE_EVENT(aer_event,
 			__print_array(__entry->tlp_header, PCIE_STD_MAX_TLP_HEADERLOG, 4) :
 			"Not available")
 );
+#endif /* CONFIG_PCIEAER */
 
 /*
  * memory-failure recovery action result event
Signature · 1 line
2.47.2
#2 lore raw

PATCH 2/9 alarmtimer: Hide alarmtimer_suspend event when RTC_CLASS is not configured

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

The trace event alarmtimer_suspend is only called when RTC_CLASS is defined. As every event created can create up to 5K of text and meta data regardless if it is called or not it should not be created and waste memory. Hide the event when CONFIG_RTC_CLASS is not defined.

---
 include/trace/events/alarmtimer.h | 2 ++
 1 file changed, 2 insertions(+)
include/trace/events/alarmtimer.h +2 -0
index 13483c7ca70b..8e9c76a7f21b 100644
@@ -20,6 +20,7 @@ TRACE_DEFINE_ENUM(ALARM_BOOTTIME_FREEZER);
 	{ 1 << ALARM_REALTIME_FREEZER, "REALTIME Freezer" },	\
 	{ 1 << ALARM_BOOTTIME_FREEZER, "BOOTTIME Freezer" })
 
+#ifdef CONFIG_RTC_CLASS
 TRACE_EVENT(alarmtimer_suspend,
 
 	TP_PROTO(ktime_t expires, int flag),
@@ -41,6 +42,7 @@ TRACE_EVENT(alarmtimer_suspend,
 		  __entry->expires
 	)
 );
+#endif /* CONFIG_RTC_CLASS */
 
 DECLARE_EVENT_CLASS(alarm_class,
 
Signature · 1 line
2.47.2
#3 lore raw

PATCH 3/9 PM: cpufreq: powernv/tracing: Move powernv_throttle trace event

In reply to Steven Rostedt

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.

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Fixes 0306e481d479a ("cpufreq: powernv/tracing: Add powernv_throttle tracepoint")
---
 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
index d38526b8e063..681d687b5a18 100644
@@ -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
index a8943e2a93be..7d9a5f656de8 100644
@@ -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
index 6c631eec23e3..913181cebfe9 100644
@@ -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
index 21bb161c2316..f2fe33573e54 100644
@@ -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
#4 lore raw

PATCH 4/9 PM: tracing: Hide psci_domain_idle events under ARM_PSCI_CPUIDLE

In reply to Steven Rostedt

From: 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.

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
---
 include/trace/events/power.h | 2 ++
 1 file changed, 2 insertions(+)
include/trace/events/power.h +2 -0
index 913181cebfe9..a10ad300d660 100644
@@ -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
#5 lore raw

PATCH 5/9 PM: tracing: Hide device_pm_callback events under PM_SLEEP

In reply to Steven Rostedt

From: 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.

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
---
 include/trace/events/power.h | 2 ++
 1 file changed, 2 insertions(+)
include/trace/events/power.h +2 -0
index a10ad300d660..5b1df5e1e092 100644
@@ -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
#6 lore raw

PATCH 6/9 PM: tracing: Hide power_domain_target event under ARCH_OMAP2PLUS

In reply to Steven Rostedt

From: 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.

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
---
 include/trace/events/power.h | 2 ++
 1 file changed, 2 insertions(+)
include/trace/events/power.h +2 -0
index 5b1df5e1e092..82904291c2b8 100644
@@ -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
#7 lore raw

PATCH 7/9 binder: Remove unused binder lock events

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

Trace events can take up to 5K each when they are defined, regardless if they are used or not. The binder lock events: binder_lock, binder_locked and binder_unlock are no longer used.

Remove them.

Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Arve =?utf-8?b?SGrDuG5u?= =?utf-8?b?ZXbDpWc=?= " <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Martijn Coenen <[email protected]>
Cc Joel Fernandes <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Fixes a60b890f607d ("binder: remove global binder lock")
---
 drivers/android/binder_trace.h | 21 ---------------------
 1 file changed, 21 deletions(-)
drivers/android/binder_trace.h +0 -21
index 16de1b9e72f7..97a78e5623db 100644
@@ -34,27 +34,6 @@ TRACE_EVENT(binder_ioctl,
 	TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg)
 );
 
-DECLARE_EVENT_CLASS(binder_lock_class,
-	TP_PROTO(const char *tag),
-	TP_ARGS(tag),
-	TP_STRUCT__entry(
-		__field(const char *, tag)
-	),
-	TP_fast_assign(
-		__entry->tag = tag;
-	),
-	TP_printk("tag=%s", __entry->tag)
-);
-
-#define DEFINE_BINDER_LOCK_EVENT(name)	\
-DEFINE_EVENT(binder_lock_class, name,	\
-	TP_PROTO(const char *func), \
-	TP_ARGS(func))
-
-DEFINE_BINDER_LOCK_EVENT(binder_lock);
-DEFINE_BINDER_LOCK_EVENT(binder_locked);
-DEFINE_BINDER_LOCK_EVENT(binder_unlock);
-
 DECLARE_EVENT_CLASS(binder_function_return_class,
 	TP_PROTO(int ret),
 	TP_ARGS(ret),
Signature · 1 line
2.47.2
#8 lore raw

PATCH 8/9 tracing: arm: arm64: Hide trace events ipi_raise, ipi_entry and ipi_exit

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

The ipi tracepoints are mostly generic, but the tracepoints ipi_raise, ipi_entry and ipi_exit are only used by arm and arm64. This means these trace events are wasting memory in all the other architectures that do not use them.

Add CONFIG_HAVE_EXTRA_IPI_TRACEPOINTS and have arm and arm64 select it to enable these trace events. The config makes it easy if other architectures decide to trace these as well.

Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Will Deacon <[email protected]>
Cc Russell King <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Valentin Schneider <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 arch/arm/Kconfig           |  1 +
 arch/arm64/Kconfig         |  1 +
 include/trace/events/ipi.h | 58 ++++++++++++++++++++------------------
 kernel/trace/Kconfig       |  6 ++++
 4 files changed, 38 insertions(+), 28 deletions(-)
arch/arm/Kconfig +1 -0
index 3072731fe09c..e8f98217d0fc 100644
@@ -102,6 +102,7 @@ config ARM
 	select HAVE_BUILDTIME_MCOUNT_SORT
 	select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL
 	select HAVE_DMA_CONTIGUOUS if MMU
+	select HAVE_EXTRA_IPI_TRACEPOINTS
 	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
 	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
 	select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU
arch/arm64/Kconfig +1 -0
index 393d71124f5d..a027cb81dfcc 100644
@@ -136,6 +136,7 @@ config ARM64
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select CPUMASK_OFFSTACK if NR_CPUS > 256
 	select DCACHE_WORD_ACCESS
+	select HAVE_EXTRA_IPI_TRACEPOINTS
 	select DYNAMIC_FTRACE if FUNCTION_TRACER
 	select DMA_BOUNCE_UNALIGNED_KMALLOC
 	select DMA_DIRECT_REMAP
include/trace/events/ipi.h +30 -28

76 lines not on this page · raw message

kernel/trace/Kconfig +6 -0
index a3f35c7d83b6..35448f7233fe 100644
@@ -53,6 +53,12 @@ config HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 config HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
 	bool
 
+config HAVE_EXTRA_IPI_TRACEPOINTS
+	bool
+	help
+	 For architectures that use ipi_raise, ipi_entry and ipi_exit
+	 tracepoints.
+
 config HAVE_DYNAMIC_FTRACE_WITH_ARGS
 	bool
 	help
Signature · 1 line
2.47.2
#9 lore raw

PATCH 9/9 tracing: Call trace_ftrace_test_filter() for the event

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

The trace event filter bootup self test tests a bunch of filter logic against the ftrace_test_filter event, but does not actually call the event. Work is being done to cause a warning if an event is defined but not used. To quiet the warning call the trace event under an if statement where it is disabled so it doesn't get optimized out.

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nicolas Schier <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 kernel/trace/trace_events_filter.c | 4 ++++
 1 file changed, 4 insertions(+)
kernel/trace/trace_events_filter.c +4 -0
index 3885aadc434d..e4581e10782b 100644
@@ -2900,6 +2900,10 @@ static __init int ftrace_test_event_filter(void)
 	if (i == DATA_CNT)
 		printk(KERN_CONT "OK\n");
 
+	/* Need to call ftrace_test_filter to prevent a warning */
+	if (!trace_ftrace_test_filter_enabled())
+		trace_ftrace_test_filter(1, 2, 3, 4, 5, 6, 7, 8);
+
 	return 0;
 }
 
Signature · 1 line
2.47.2