Skip to content

Commit

Permalink
cpufreq: intel_pstate: hybrid: Avoid exposing two global attributes
Browse files Browse the repository at this point in the history
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 <rafael.j.wysocki@intel.com>
  • Loading branch information
Rafael J. Wysocki committed May 21, 2021
1 parent d07f6ca commit c3d175e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Documentation/admin-guide/pm/intel_pstate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ argument is passed to the kernel in the command line.
inclusive) including both turbo and non-turbo P-states (see
`Turbo P-states Support`_).

This attribute is present only if the value exposed by it is the same
for all of the CPUs in the system.

The value of this attribute is not affected by the ``no_turbo``
setting described `below <no_turbo_attr_>`_.

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

This attribute is present only if the value exposed by it is the same
for all of the CPUs in the system.

This attribute is read-only.

.. _no_turbo_attr:
Expand Down
15 changes: 13 additions & 2 deletions drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,6 @@ define_one_global_rw(energy_efficiency);
static struct attribute *intel_pstate_attributes[] = {
&status.attr,
&no_turbo.attr,
&turbo_pct.attr,
&num_pstates.attr,
NULL
};

Expand All @@ -1391,6 +1389,14 @@ static void __init intel_pstate_sysfs_expose_params(void)
if (WARN_ON(rc))
return;

if (!boot_cpu_has(X86_FEATURE_HYBRID_CPU)) {
rc = sysfs_create_file(intel_pstate_kobject, &turbo_pct.attr);
WARN_ON(rc);

rc = sysfs_create_file(intel_pstate_kobject, &num_pstates.attr);
WARN_ON(rc);
}

/*
* If per cpu limits are enforced there are no global limits, so
* return without creating max/min_perf_pct attributes
Expand All @@ -1417,6 +1423,11 @@ static void __init intel_pstate_sysfs_remove(void)

sysfs_remove_group(intel_pstate_kobject, &intel_pstate_attr_group);

if (!boot_cpu_has(X86_FEATURE_HYBRID_CPU)) {
sysfs_remove_file(intel_pstate_kobject, &num_pstates.attr);
sysfs_remove_file(intel_pstate_kobject, &turbo_pct.attr);
}

if (!per_cpu_limits) {
sysfs_remove_file(intel_pstate_kobject, &max_perf_pct.attr);
sysfs_remove_file(intel_pstate_kobject, &min_perf_pct.attr);
Expand Down

0 comments on commit c3d175e

Please sign in to comment.