[PATCH v4 6/8] cpufreq: CPPC: Add sysfs for min/max_perf and perf_limited

Sumit Gupta posted 8 patches 1 month, 2 weeks ago
[PATCH v4 6/8] cpufreq: CPPC: Add sysfs for min/max_perf and perf_limited
Posted by Sumit Gupta 1 month, 2 weeks ago
Add sysfs interfaces for Minimum Performance, Maximum Performance
and Performance Limited Register in the cppc_cpufreq driver.

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 .../ABI/testing/sysfs-devices-system-cpu      | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 8aed6d94c4cd..6f1f70696000 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -327,6 +327,52 @@ Description:	Energy performance preference
 
 		This file is only present if the cppc-cpufreq driver is in use.
 
+What:		/sys/devices/system/cpu/cpuX/cpufreq/min_perf
+Date:		December 2025
+Contact:	linux-pm@vger.kernel.org
+Description:	Minimum Performance Frequency
+
+		Read/write a frequency value in kHz from/to this file. This
+		file conveys the minimum performance level (as frequency) at
+		which the platform may run. The frequency value is internally
+		converted to a performance value and must correspond to a
+		performance level in the range [Lowest Performance, Highest
+		Performance], inclusive. The minimum must be less than or equal
+		to the maximum performance. The performance range can be checked
+		from nodes:
+			/sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
+			/sys/devices/system/cpu/cpuX/acpi_cppc/lowest_perf
+
+		This file is only present if the cppc-cpufreq driver is in use.
+
+What:		/sys/devices/system/cpu/cpuX/cpufreq/max_perf
+Date:		December 2025
+Contact:	linux-pm@vger.kernel.org
+Description:	Maximum Performance Frequency
+
+		Read/write a frequency value in kHz from/to this file. This
+		file conveys the maximum performance level (as frequency) at
+		which the platform may run. The frequency value is internally
+		converted to a performance value and must correspond to a
+		performance level in the range [Lowest Performance, Highest
+		Performance], inclusive. The performance range can be checked
+		from nodes:
+			/sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
+			/sys/devices/system/cpu/cpuX/acpi_cppc/lowest_perf
+
+		This file is only present if the cppc-cpufreq driver is in use.
+
+What:		/sys/devices/system/cpu/cpuX/cpufreq/perf_limited
+Date:		December 2025
+Contact:	linux-pm@vger.kernel.org
+Description:	Performance Limited
+
+		Read/write a 32 bits value from/to this file. This file indicates
+		to OSPM that an unpredictable event has limited processor
+		performance, and the delivered performance may be less than
+		desired/minimum performance.
+
+		This file is only present if the cppc-cpufreq driver is in use.
 
 What:		/sys/devices/system/cpu/cpu*/cache/index3/cache_disable_{0,1}
 Date:		August 2008
-- 
2.34.1
Re: [PATCH v4 6/8] cpufreq: CPPC: Add sysfs for min/max_perf and perf_limited
Posted by Ionela Voinescu 1 month ago
Hi,

On Wednesday 05 Nov 2025 at 17:08:42 (+0530), Sumit Gupta wrote:
> Add sysfs interfaces for Minimum Performance, Maximum Performance
> and Performance Limited Register in the cppc_cpufreq driver.
> 
> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
>  .../ABI/testing/sysfs-devices-system-cpu      | 46 +++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
> index 8aed6d94c4cd..6f1f70696000 100644
> --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
> +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
> @@ -327,6 +327,52 @@ Description:	Energy performance preference
>  
>  		This file is only present if the cppc-cpufreq driver is in use.
>  
> +What:		/sys/devices/system/cpu/cpuX/cpufreq/min_perf
> +Date:		December 2025
> +Contact:	linux-pm@vger.kernel.org
> +Description:	Minimum Performance Frequency
> +
> +		Read/write a frequency value in kHz from/to this file. This
> +		file conveys the minimum performance level (as frequency) at
> +		which the platform may run. The frequency value is internally
> +		converted to a performance value and must correspond to a
> +		performance level in the range [Lowest Performance, Highest
> +		Performance], inclusive. The minimum must be less than or equal
> +		to the maximum performance. The performance range can be checked
> +		from nodes:
> +			/sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
> +			/sys/devices/system/cpu/cpuX/acpi_cppc/lowest_perf

I think information on highest/lowest performance is irrelevant here. If
the user is expected to provide a frequency value, it should only care
about it being in the range [cpuinfo_min_freq, cpuinfo_max_freq].

I think ideally all of these controls (auto-select, EPP, min, max, etc.)
would have been better placed under
/sys/devices/system/cpu/cpuX/acpi_cppc, but I suppose the intention
was/is to have all performance related controls under cpufreq. But that
means that the user should not be concerned about the underlying CPPC
scale and only use /sys/devices/system/cpu/cpuX/acpi_cppc for
information purposes.

Thanks,
Ionela.

> +
> +		This file is only present if the cppc-cpufreq driver is in use.
> +
> +What:		/sys/devices/system/cpu/cpuX/cpufreq/max_perf
> +Date:		December 2025
> +Contact:	linux-pm@vger.kernel.org
> +Description:	Maximum Performance Frequency
> +
> +		Read/write a frequency value in kHz from/to this file. This
> +		file conveys the maximum performance level (as frequency) at
> +		which the platform may run. The frequency value is internally
> +		converted to a performance value and must correspond to a
> +		performance level in the range [Lowest Performance, Highest
> +		Performance], inclusive. The performance range can be checked
> +		from nodes:
> +			/sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
> +			/sys/devices/system/cpu/cpuX/acpi_cppc/lowest_perf
> +
> +		This file is only present if the cppc-cpufreq driver is in use.
> +
> +What:		/sys/devices/system/cpu/cpuX/cpufreq/perf_limited
> +Date:		December 2025
> +Contact:	linux-pm@vger.kernel.org
> +Description:	Performance Limited
> +
> +		Read/write a 32 bits value from/to this file. This file indicates
> +		to OSPM that an unpredictable event has limited processor
> +		performance, and the delivered performance may be less than
> +		desired/minimum performance.
> +
> +		This file is only present if the cppc-cpufreq driver is in use.
>  
>  What:		/sys/devices/system/cpu/cpu*/cache/index3/cache_disable_{0,1}
>  Date:		August 2008
> -- 
> 2.34.1
>
Re: [PATCH v4 6/8] cpufreq: CPPC: Add sysfs for min/max_perf and perf_limited
Posted by Sumit Gupta 1 month ago
On 13/11/25 18:11, Ionela Voinescu wrote:
> External email: Use caution opening links or attachments
>
>
> Hi,
>
> On Wednesday 05 Nov 2025 at 17:08:42 (+0530), Sumit Gupta wrote:
>> Add sysfs interfaces for Minimum Performance, Maximum Performance
>> and Performance Limited Register in the cppc_cpufreq driver.
>>
>> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>>   .../ABI/testing/sysfs-devices-system-cpu      | 46 +++++++++++++++++++
>>   1 file changed, 46 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
>> index 8aed6d94c4cd..6f1f70696000 100644
>> --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
>> +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
>> @@ -327,6 +327,52 @@ Description:     Energy performance preference
>>
>>                This file is only present if the cppc-cpufreq driver is in use.
>>
>> +What:                /sys/devices/system/cpu/cpuX/cpufreq/min_perf
>> +Date:                December 2025
>> +Contact:     linux-pm@vger.kernel.org
>> +Description: Minimum Performance Frequency
>> +
>> +             Read/write a frequency value in kHz from/to this file. This
>> +             file conveys the minimum performance level (as frequency) at
>> +             which the platform may run. The frequency value is internally
>> +             converted to a performance value and must correspond to a
>> +             performance level in the range [Lowest Performance, Highest
>> +             Performance], inclusive. The minimum must be less than or equal
>> +             to the maximum performance. The performance range can be checked
>> +             from nodes:
>> +                     /sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
>> +                     /sys/devices/system/cpu/cpuX/acpi_cppc/lowest_perf
> I think information on highest/lowest performance is irrelevant here. If
> the user is expected to provide a frequency value, it should only care
> about it being in the range [cpuinfo_min_freq, cpuinfo_max_freq].

Will change it as below:

   Read/write a frequency value in kHz from/to this file. This
   file sets the minimum performance level (as frequency) at
   which the platform may run. The frequency value is internally
   converted to a performance value and must be in the range
   [cpuinfo_min_freq, cpuinfo_max_freq], inclusive.

   This file is only present if the cppc-cpufreq driver is in use.

> I think ideally all of these controls (auto-select, EPP, min, max, etc.)
> would have been better placed under
> /sys/devices/system/cpu/cpuX/acpi_cppc, but I suppose the intention
> was/is to have all performance related controls under cpufreq. But that
> means that the user should not be concerned about the underlying CPPC
> scale and only use /sys/devices/system/cpu/cpuX/acpi_cppc for
> information purposes.
>
> Thanks,
> Ionela.
>

In v1[1], added these controls under acpi_cppc sysfs.
Later after discussion, it was decided to keep them under cpufreq sysfs
and [2] was merged first.

[1] https://lore.kernel.org/lkml/20250211103737.447704-1-sumitg@nvidia.com/
[2] 
https://lore.kernel.org/all/20250507031941.2812701-1-zhenglifeng1@huawei.com/

Thank you,
Sumit Gupta