Skip to content

Commit c3d175e

Browse files
committed
cpufreq: intel_pstate: hybrid: Avoid exposing two global attributes
The turbo_pct and num_pstates sysfs attributes represent CPU properties that may be different for differenty types of CPUs in a hybrid processor, so avoid exposing them in that case. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent d07f6ca commit c3d175e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Documentation/admin-guide/pm/intel_pstate.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ argument is passed to the kernel in the command line.
365365
inclusive) including both turbo and non-turbo P-states (see
366366
`Turbo P-states Support`_).
367367

368+
This attribute is present only if the value exposed by it is the same
369+
for all of the CPUs in the system.
370+
368371
The value of this attribute is not affected by the ``no_turbo``
369372
setting described `below <no_turbo_attr_>`_.
370373

@@ -374,6 +377,9 @@ argument is passed to the kernel in the command line.
374377
Ratio of the `turbo range <turbo_>`_ size to the size of the entire
375378
range of supported P-states, in percent.
376379

380+
This attribute is present only if the value exposed by it is the same
381+
for all of the CPUs in the system.
382+
377383
This attribute is read-only.
378384

379385
.. _no_turbo_attr:

drivers/cpufreq/intel_pstate.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,8 +1365,6 @@ define_one_global_rw(energy_efficiency);
13651365
static struct attribute *intel_pstate_attributes[] = {
13661366
&status.attr,
13671367
&no_turbo.attr,
1368-
&turbo_pct.attr,
1369-
&num_pstates.attr,
13701368
NULL
13711369
};
13721370

@@ -1391,6 +1389,14 @@ static void __init intel_pstate_sysfs_expose_params(void)
13911389
if (WARN_ON(rc))
13921390
return;
13931391

1392+
if (!boot_cpu_has(X86_FEATURE_HYBRID_CPU)) {
1393+
rc = sysfs_create_file(intel_pstate_kobject, &turbo_pct.attr);
1394+
WARN_ON(rc);
1395+
1396+
rc = sysfs_create_file(intel_pstate_kobject, &num_pstates.attr);
1397+
WARN_ON(rc);
1398+
}
1399+
13941400
/*
13951401
* If per cpu limits are enforced there are no global limits, so
13961402
* return without creating max/min_perf_pct attributes
@@ -1417,6 +1423,11 @@ static void __init intel_pstate_sysfs_remove(void)
14171423

14181424
sysfs_remove_group(intel_pstate_kobject, &intel_pstate_attr_group);
14191425

1426+
if (!boot_cpu_has(X86_FEATURE_HYBRID_CPU)) {
1427+
sysfs_remove_file(intel_pstate_kobject, &num_pstates.attr);
1428+
sysfs_remove_file(intel_pstate_kobject, &turbo_pct.attr);
1429+
}
1430+
14201431
if (!per_cpu_limits) {
14211432
sysfs_remove_file(intel_pstate_kobject, &max_perf_pct.attr);
14221433
sysfs_remove_file(intel_pstate_kobject, &min_perf_pct.attr);

0 commit comments

Comments
 (0)