Skip to content

Commit 2dfed74

Browse files
committed
Merge tag 'amd-pstate-v6.14-2024-12-18' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux
Merge amd-pstate changes for 6.14 from Mario Limonciello: "Mostly cleanups and optimizations to increase code reuse by shuffling around and using helpers. Notable other changes: * Add ftrace event for active mode to use * Set default EPP policy on Ryzen" * tag 'amd-pstate-v6.14-2024-12-18' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux: (21 commits) cpufreq/amd-pstate: Drop boost_state variable cpufreq/amd-pstate: Set different default EPP policy for Epyc and Ryzen cpufreq/amd-pstate: Drop ret variable from amd_pstate_set_energy_pref_index() cpufreq/amd-pstate: Always write EPP value when updating perf cpufreq/amd-pstate: Cache EPP value and use that everywhere cpufreq/amd-pstate: Move limit updating code cpufreq/amd-pstate: Change amd_pstate_update_perf() to return an int cpufreq/amd-pstate: store all values in cpudata struct in khz cpufreq/amd-pstate: Only update the cached value in msr_set_epp() on success cpufreq/amd-pstate: Use FIELD_PREP and FIELD_GET macros cpufreq/amd-pstate: Drop cached epp_policy variable cpufreq/amd-pstate: convert mutex use to guard() cpufreq/amd-pstate: Add trace event for EPP perf updates cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and amd_pstate_epp_offline() cpufreq/amd-pstate: Remove the cppc_state check in offline/online functions cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and amd_pstate_epp_offline() cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf() cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static calls cpufreq/amd-pstate: Use boost numerator for upper bound of frequencies cpufreq/amd-pstate: Store the boost numerator as highest perf again ...
2 parents 8e461a1 + 95fad7f commit 2dfed74

File tree

5 files changed

+301
-290
lines changed

5 files changed

+301
-290
lines changed

Documentation/admin-guide/pm/amd-pstate.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ performance supported in `AMD CPPC Performance Capability <perf_cap_>`_).
251251
In some ASICs, the highest CPPC performance is not the one in the ``_CPC``
252252
table, so we need to expose it to sysfs. If boost is not active, but
253253
still supported, this maximum frequency will be larger than the one in
254-
``cpuinfo``. On systems that support preferred core, the driver will have
255-
different values for some cores than others and this will reflect the values
256-
advertised by the platform at bootup.
254+
``cpuinfo``.
257255
This attribute is read-only.
258256

259257
``amd_pstate_lowest_nonlinear_freq``

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)