Skip to content

Commit 851daf8

Browse files
committed
Merge back earlier cpufreq material for 6.14
2 parents 05648c2 + 2dfed74 commit 851daf8

File tree

6 files changed

+311
-292
lines changed

6 files changed

+311
-292
lines changed

drivers/cpufreq/amd-pstate-trace.h

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ TRACE_EVENT(amd_pstate_perf,
3232
u64 aperf,
3333
u64 tsc,
3434
unsigned int cpu_id,
35-
bool changed,
3635
bool fast_switch
3736
),
3837

@@ -44,7 +43,6 @@ TRACE_EVENT(amd_pstate_perf,
4443
aperf,
4544
tsc,
4645
cpu_id,
47-
changed,
4846
fast_switch
4947
),
5048

@@ -57,7 +55,6 @@ TRACE_EVENT(amd_pstate_perf,
5755
__field(unsigned long long, aperf)
5856
__field(unsigned long long, tsc)
5957
__field(unsigned int, cpu_id)
60-
__field(bool, changed)
6158
__field(bool, fast_switch)
6259
),
6360

@@ -70,11 +67,10 @@ TRACE_EVENT(amd_pstate_perf,
7067
__entry->aperf = aperf;
7168
__entry->tsc = tsc;
7269
__entry->cpu_id = cpu_id;
73-
__entry->changed = changed;
7470
__entry->fast_switch = fast_switch;
7571
),
7672

77-
TP_printk("amd_min_perf=%lu amd_des_perf=%lu amd_max_perf=%lu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u changed=%s fast_switch=%s",
73+
TP_printk("amd_min_perf=%lu amd_des_perf=%lu amd_max_perf=%lu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u fast_switch=%s",
7874
(unsigned long)__entry->min_perf,
7975
(unsigned long)__entry->target_perf,
8076
(unsigned long)__entry->capacity,
@@ -83,11 +79,55 @@ TRACE_EVENT(amd_pstate_perf,
8379
(unsigned long long)__entry->aperf,
8480
(unsigned long long)__entry->tsc,
8581
(unsigned int)__entry->cpu_id,
86-
(__entry->changed) ? "true" : "false",
8782
(__entry->fast_switch) ? "true" : "false"
8883
)
8984
);
9085

86+
TRACE_EVENT(amd_pstate_epp_perf,
87+
88+
TP_PROTO(unsigned int cpu_id,
89+
unsigned int highest_perf,
90+
unsigned int epp,
91+
unsigned int min_perf,
92+
unsigned int max_perf,
93+
bool boost
94+
),
95+
96+
TP_ARGS(cpu_id,
97+
highest_perf,
98+
epp,
99+
min_perf,
100+
max_perf,
101+
boost),
102+
103+
TP_STRUCT__entry(
104+
__field(unsigned int, cpu_id)
105+
__field(unsigned int, highest_perf)
106+
__field(unsigned int, epp)
107+
__field(unsigned int, min_perf)
108+
__field(unsigned int, max_perf)
109+
__field(bool, boost)
110+
),
111+
112+
TP_fast_assign(
113+
__entry->cpu_id = cpu_id;
114+
__entry->highest_perf = highest_perf;
115+
__entry->epp = epp;
116+
__entry->min_perf = min_perf;
117+
__entry->max_perf = max_perf;
118+
__entry->boost = boost;
119+
),
120+
121+
TP_printk("cpu%u: [%u<->%u]/%u, epp=%u, boost=%u",
122+
(unsigned int)__entry->cpu_id,
123+
(unsigned int)__entry->min_perf,
124+
(unsigned int)__entry->max_perf,
125+
(unsigned int)__entry->highest_perf,
126+
(unsigned int)__entry->epp,
127+
(bool)__entry->boost
128+
)
129+
);
130+
91131
#endif /* _AMD_PSTATE_TRACE_H */
92132

93133
/* This part must be outside protection */

drivers/cpufreq/amd-pstate-ut.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,22 +207,20 @@ static void amd_pstate_ut_check_freq(u32 index)
207207
int cpu = 0;
208208
struct cpufreq_policy *policy = NULL;
209209
struct amd_cpudata *cpudata = NULL;
210-
u32 nominal_freq_khz;
211210

212211
for_each_possible_cpu(cpu) {
213212
policy = cpufreq_cpu_get(cpu);
214213
if (!policy)
215214
break;
216215
cpudata = policy->driver_data;
217216

218-
nominal_freq_khz = cpudata->nominal_freq*1000;
219-
if (!((cpudata->max_freq >= nominal_freq_khz) &&
220-
(nominal_freq_khz > cpudata->lowest_nonlinear_freq) &&
217+
if (!((cpudata->max_freq >= cpudata->nominal_freq) &&
218+
(cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) &&
221219
(cpudata->lowest_nonlinear_freq > cpudata->min_freq) &&
222220
(cpudata->min_freq > 0))) {
223221
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
224222
pr_err("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n",
225-
__func__, cpu, cpudata->max_freq, nominal_freq_khz,
223+
__func__, cpu, cpudata->max_freq, cpudata->nominal_freq,
226224
cpudata->lowest_nonlinear_freq, cpudata->min_freq);
227225
goto skip_test;
228226
}
@@ -236,13 +234,13 @@ static void amd_pstate_ut_check_freq(u32 index)
236234

237235
if (cpudata->boost_supported) {
238236
if ((policy->max == cpudata->max_freq) ||
239-
(policy->max == nominal_freq_khz))
237+
(policy->max == cpudata->nominal_freq))
240238
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
241239
else {
242240
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
243241
pr_err("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n",
244242
__func__, cpu, policy->max, cpudata->max_freq,
245-
nominal_freq_khz);
243+
cpudata->nominal_freq);
246244
goto skip_test;
247245
}
248246
} else {

0 commit comments

Comments
 (0)