Skip to content

Commit 0d20169

Browse files
committed
Merge: cpufreq/amd-pstate: updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/380 Description: updates for cpufreq amd-pstate JIRA: https://issues.redhat.com/browse/RHEL-75925 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=66691904 Tested: Successful platform test results on AMD (amd-genoa-03) system. Omitted-fix: e120829 Signed-off-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Desnes Nunes <desnesn@redhat.com> Approved-by: Lenny Szubowicz <lszubowi@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 95390fc + b162947 commit 0d20169

File tree

8 files changed

+391
-426
lines changed

8 files changed

+391
-426
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``

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
#define X86_FEATURE_BHI_CTRL (21*32+ 2) /* BHI_DIS_S HW control available */
477477
#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */
478478
#define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */
479-
#define X86_FEATURE_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */
479+
#define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */
480480

481481
/*
482482
* BUG word(s)

arch/x86/kernel/cpu/scattered.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static const struct cpuid_bit cpuid_bits[] = {
4545
{ X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 },
4646
{ X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 },
4747
{ X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },
48-
{ X86_FEATURE_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 },
48+
{ X86_FEATURE_AMD_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 },
4949
{ X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 },
5050
{ X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 },
5151
{ X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 },

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: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,42 +207,40 @@ 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
}
229227

230-
if (cpudata->min_freq != policy->min) {
228+
if (cpudata->lowest_nonlinear_freq != policy->min) {
231229
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
232-
pr_err("%s cpu%d cpudata_min_freq=%d policy_min=%d, they should be equal!\n",
233-
__func__, cpu, cpudata->min_freq, policy->min);
230+
pr_err("%s cpu%d cpudata_lowest_nonlinear_freq=%d policy_min=%d, they should be equal!\n",
231+
__func__, cpu, cpudata->lowest_nonlinear_freq, policy->min);
234232
goto skip_test;
235233
}
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)