1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* amd-pstate-trace.h - AMD Processor P-state Frequency Driver Tracer
*
* Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Author: Huang Rui <ray.huang@amd.com>
*/
#if !defined(_AMD_PSTATE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _AMD_PSTATE_TRACE_H
#include <linux/cpufreq.h>
#include <linux/tracepoint.h>
#include <linux/trace_events.h>
#undef TRACE_SYSTEM
#define TRACE_SYSTEM amd_cpu
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE amd-pstate-trace
#define TPS(x) tracepoint_string(x)
TRACE_EVENT(amd_pstate_perf,
TP_PROTO(u8 min_perf,
u8 target_perf,
u8 capacity,
u64 freq,
u64 mperf,
u64 aperf,
u64 tsc,
unsigned int cpu_id,
bool fast_switch
),
TP_ARGS(min_perf,
target_perf,
capacity,
freq,
mperf,
aperf,
tsc,
cpu_id,
fast_switch
),
TP_STRUCT__entry(
__field(u8, min_perf)
__field(u8, target_perf)
__field(u8, capacity)
__field(unsigned long long, freq)
__field(unsigned long long, mperf)
__field(unsigned long long, aperf)
__field(unsigned long long, tsc)
__field(unsigned int, cpu_id)
__field(bool, fast_switch)
),
TP_fast_assign(
__entry->min_perf = min_perf;
__entry->target_perf = target_perf;
__entry->capacity = capacity;
__entry->freq = freq;
__entry->mperf = mperf;
__entry->aperf = aperf;
__entry->tsc = tsc;
__entry->cpu_id = cpu_id;
__entry->fast_switch = fast_switch;
),
TP_printk("amd_min_perf=%hhu amd_des_perf=%hhu amd_max_perf=%hhu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u fast_switch=%s",
(u8)__entry->min_perf,
(u8)__entry->target_perf,
(u8)__entry->capacity,
(unsigned long long)__entry->freq,
(unsigned long long)__entry->mperf,
(unsigned long long)__entry->aperf,
(unsigned long long)__entry->tsc,
(unsigned int)__entry->cpu_id,
(__entry->fast_switch) ? "true" : "false"
)
);
TRACE_EVENT(amd_pstate_epp_perf,
TP_PROTO(unsigned int cpu_id,
u8 highest_perf,
u8 epp,
u8 min_perf,
u8 max_perf,
bool boost,
bool changed
),
TP_ARGS(cpu_id,
highest_perf,
epp,
min_perf,
max_perf,
boost,
changed),
TP_STRUCT__entry(
__field(unsigned int, cpu_id)
__field(u8, highest_perf)
__field(u8, epp)
__field(u8, min_perf)
__field(u8, max_perf)
__field(bool, boost)
__field(bool, changed)
),
TP_fast_assign(
__entry->cpu_id = cpu_id;
__entry->highest_perf = highest_perf;
__entry->epp = epp;
__entry->min_perf = min_perf;
__entry->max_perf = max_perf;
__entry->boost = boost;
__entry->changed = changed;
),
TP_printk("cpu%u: [%hhu<->%hhu]/%hhu, epp=%hhu, boost=%u, changed=%u",
(unsigned int)__entry->cpu_id,
(u8)__entry->min_perf,
(u8)__entry->max_perf,
(u8)__entry->highest_perf,
(u8)__entry->epp,
(bool)__entry->boost,
(bool)__entry->changed
)
);
TRACE_EVENT(amd_pstate_cppc_req2,
TP_PROTO(unsigned int cpu_id,
u8 floor_perf,
bool changed,
int err_code
),
TP_ARGS(cpu_id,
floor_perf,
changed,
err_code),
TP_STRUCT__entry(
__field(unsigned int, cpu_id)
__field(u8, floor_perf)
__field(bool, changed)
__field(int, err_code)
),
TP_fast_assign(
__entry->cpu_id = cpu_id;
__entry->floor_perf = floor_perf;
__entry->changed = changed;
__entry->err_code = err_code;
),
TP_printk("cpu%u: floor_perf=%u, changed=%u (error = %d)",
__entry->cpu_id,
__entry->floor_perf,
__entry->changed,
__entry->err_code
)
);
#endif /* _AMD_PSTATE_TRACE_H */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#include <trace/define_trace.h>
|