Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM: cpufreq: powernv/tracing: Move powernv_throttle trace event

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 <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/20250612145407.906308844@goodmis.org
Fixes: 0306e481d479a ("cpufreq: powernv/tracing: Add powernv_throttle tracepoint")
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

+48 -24
+1
drivers/cpufreq/Makefile
··· 21 21 22 22 # Traces 23 23 CFLAGS_amd-pstate-trace.o := -I$(src) 24 + CFLAGS_powernv-cpufreq.o := -I$(src) 24 25 amd_pstate-y := amd-pstate.o amd-pstate-trace.o 25 26 26 27 ##################################################################################
+3 -1
drivers/cpufreq/powernv-cpufreq.c
··· 21 21 #include <linux/string_choices.h> 22 22 #include <linux/cpu.h> 23 23 #include <linux/hashtable.h> 24 - #include <trace/events/power.h> 25 24 26 25 #include <asm/cputhreads.h> 27 26 #include <asm/firmware.h> ··· 28 29 #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */ 29 30 #include <asm/opal.h> 30 31 #include <linux/timer.h> 32 + 33 + #define CREATE_TRACE_POINTS 34 + #include "powernv-trace.h" 31 35 32 36 #define POWERNV_MAX_PSTATES_ORDER 8 33 37 #define POWERNV_MAX_PSTATES (1UL << (POWERNV_MAX_PSTATES_ORDER))
+44
drivers/cpufreq/powernv-trace.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + #if !defined(_POWERNV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 4 + #define _POWERNV_TRACE_H 5 + 6 + #include <linux/cpufreq.h> 7 + #include <linux/tracepoint.h> 8 + #include <linux/trace_events.h> 9 + 10 + #undef TRACE_SYSTEM 11 + #define TRACE_SYSTEM power 12 + 13 + TRACE_EVENT(powernv_throttle, 14 + 15 + TP_PROTO(int chip_id, const char *reason, int pmax), 16 + 17 + TP_ARGS(chip_id, reason, pmax), 18 + 19 + TP_STRUCT__entry( 20 + __field(int, chip_id) 21 + __string(reason, reason) 22 + __field(int, pmax) 23 + ), 24 + 25 + TP_fast_assign( 26 + __entry->chip_id = chip_id; 27 + __assign_str(reason); 28 + __entry->pmax = pmax; 29 + ), 30 + 31 + TP_printk("Chip %d Pmax %d %s", __entry->chip_id, 32 + __entry->pmax, __get_str(reason)) 33 + ); 34 + 35 + #endif /* _POWERNV_TRACE_H */ 36 + 37 + /* This part must be outside protection */ 38 + #undef TRACE_INCLUDE_PATH 39 + #define TRACE_INCLUDE_PATH . 40 + 41 + #undef TRACE_INCLUDE_FILE 42 + #define TRACE_INCLUDE_FILE powernv-trace 43 + 44 + #include <trace/define_trace.h>
-22
include/trace/events/power.h
··· 99 99 TP_ARGS(cpu_id, state, s2idle) 100 100 ); 101 101 102 - TRACE_EVENT(powernv_throttle, 103 - 104 - TP_PROTO(int chip_id, const char *reason, int pmax), 105 - 106 - TP_ARGS(chip_id, reason, pmax), 107 - 108 - TP_STRUCT__entry( 109 - __field(int, chip_id) 110 - __string(reason, reason) 111 - __field(int, pmax) 112 - ), 113 - 114 - TP_fast_assign( 115 - __entry->chip_id = chip_id; 116 - __assign_str(reason); 117 - __entry->pmax = pmax; 118 - ), 119 - 120 - TP_printk("Chip %d Pmax %d %s", __entry->chip_id, 121 - __entry->pmax, __get_str(reason)) 122 - ); 123 - 124 102 TRACE_EVENT(pstate_sample, 125 103 126 104 TP_PROTO(u32 core_busy,
-1
kernel/trace/power-traces.c
··· 17 17 EXPORT_TRACEPOINT_SYMBOL_GPL(suspend_resume); 18 18 EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle); 19 19 EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_frequency); 20 - EXPORT_TRACEPOINT_SYMBOL_GPL(powernv_throttle); 21 20