Skip to content

Commit 647fe16

Browse files
committed
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 <[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]> Link: https://lore.kernel.org/[email protected] Fixes: 0306e48 ("cpufreq: powernv/tracing: Add powernv_throttle tracepoint") Acked-by: Viresh Kumar <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 06cc77a commit 647fe16

5 files changed

Lines changed: 48 additions & 24 deletions

File tree

drivers/cpufreq/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ obj-$(CONFIG_CPUFREQ_VIRT) += virtual-cpufreq.o
2121

2222
# Traces
2323
CFLAGS_amd-pstate-trace.o := -I$(src)
24+
CFLAGS_powernv-cpufreq.o := -I$(src)
2425
amd_pstate-y := amd-pstate.o amd-pstate-trace.o
2526

2627
##################################################################################

drivers/cpufreq/powernv-cpufreq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/string_choices.h>
2222
#include <linux/cpu.h>
2323
#include <linux/hashtable.h>
24-
#include <trace/events/power.h>
2524

2625
#include <asm/cputhreads.h>
2726
#include <asm/firmware.h>
@@ -30,6 +29,9 @@
3029
#include <asm/opal.h>
3130
#include <linux/timer.h>
3231

32+
#define CREATE_TRACE_POINTS
33+
#include "powernv-trace.h"
34+
3335
#define POWERNV_MAX_PSTATES_ORDER 8
3436
#define POWERNV_MAX_PSTATES (1UL << (POWERNV_MAX_PSTATES_ORDER))
3537
#define PMSR_PSAFE_ENABLE (1UL << 30)

drivers/cpufreq/powernv-trace.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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>

include/trace/events/power.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -99,28 +99,6 @@ DEFINE_EVENT(psci_domain_idle, psci_domain_idle_exit,
9999
TP_ARGS(cpu_id, state, s2idle)
100100
);
101101

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-
124102
TRACE_EVENT(pstate_sample,
125103

126104
TP_PROTO(u32 core_busy,

kernel/trace/power-traces.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@
1717
EXPORT_TRACEPOINT_SYMBOL_GPL(suspend_resume);
1818
EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle);
1919
EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_frequency);
20-
EXPORT_TRACEPOINT_SYMBOL_GPL(powernv_throttle);
2120

0 commit comments

Comments
 (0)