cpufreq-stats: document limitations on modern cpufreq drivers
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 cpufreq-stats: document limitations on modern cpufreq drivers
--- Documentation/cpu-freq/cpufreq-stats.rst | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/cpu-freq/cpufreq-stats.rst +7 -0
@@ -28,6 +28,13 @@ Various statistics will form read_only files under this directory. This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. So, it will work with any cpufreq_driver. +.. note:: + + On some modern systems, this interface may not be available or may not + expose meaningful statistics depending on the active CPU frequency scaling driver. + + In particular, drivers such as intel_pstate or amd_pstate may use alternative + mechanisms for frequency scaling and accounting 2. Statistics Provided (with example) =====================================
Signature · 1 line
2.54.0
Randy Dunlap
reviewerQuoted 10 lines · NicoErdmann
Signed-off-by NicoErdmann <[email protected]>--- Documentation/cpu-freq/cpufreq-stats.rst | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/cpu-freq/cpufreq-stats.rst +0
-0
Documentation/cpu-freq/cpufreq-stats.rst Various statistics will form read_only files under this directory. · line 37
Quoted 10 lines
Documentation/cpu-freq/cpufreq-stats.rst +7
-0@@ -28,6 +28,13 @@ Various statistics will form read_only files under this directory. This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. So, it will work with any cpufreq_driver. +.. note:: + + On some modern systems, this interface may not be available or may not + expose meaningful statistics depending on the active CPU frequency scaling driver. + + In particular, drivers such as intel_pstate or amd_pstate may use alternative + mechanisms for frequency scaling and accounting
Missing an ending period.
Quoted 3 lines
Documentation/cpu-freq/cpufreq-stats.rst +0
-02. Statistics Provided (with example) =====================================
Signature · 1 line
~Randy
PATCH v2 1/1 cpufreq-stats: document limitations on modern cpufreq drivers
Add a note clarifying that cpufreq-stats may not be present or may not provide meaningful statistics depending on the active CPU frequency scaling driver.
In particular, drivers such as intel_pstate and amd_pstate may use alternative mechanisms for frequency scaling and accounting.
v2:
- Add missing period at end of sentence (reported by Randy)
--- Documentation/cpu-freq/cpufreq-stats.rst | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/cpu-freq/cpufreq-stats.rst +7 -0
@@ -28,6 +28,13 @@ Various statistics will form read_only files under this directory. This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. So, it will work with any cpufreq_driver. +.. note:: + + On some modern systems, this interface may not be available or may not + expose meaningful statistics depending on the active CPU frequency scaling driver. + + In particular, drivers such as intel_pstate or amd_pstate may use alternative + mechanisms for frequency scaling and accounting. 2. Statistics Provided (with example) =====================================
Signature · 1 line
2.54.0
Quoted 6 lines · NicoErdmann
Add a note clarifying that cpufreq-stats may not be present or may not provide meaningful statistics depending on the active CPU frequency scaling driver.
In particular, drivers such as
intel_pstateandamd_pstatemay use alternative mechanisms for frequency scaling and accounting.
Hi NicoErdmann,
Thanks for working on this — this documentation gap seems worth addressing.
Please run ./scripts/checkpatch.pl cpufreq-stats-document-xx.patch to avoid style/format issue.
I see the below Error/Warning, please fix.
-----------------------------------------------------------------------
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#6:
Add a note clarifying that cpufreq-stats may not be present or may not provide meaningful statistics depending
ERROR: trailing whitespace
#29: FILE: Documentation/cpu-freq/cpufreq-stats.rst:32:
+^I$
total: 1 errors, 1 warnings, 13 lines checked
-----------------------------------------------------------------------
Quoted 13 lines
v2:
- Add missing period at end of sentence (reported by Randy)Signed-off-by NicoErdmann <[email protected]>--- Documentation/cpu-freq/cpufreq-stats.rst | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/cpu-freq/cpufreq-stats.rst +0
-0
Documentation/cpu-freq/cpufreq-stats.rst Various statistics will form read_only files under this directory. · line 29
Quoted 2 lines
Documentation/cpu-freq/cpufreq-stats.rst +0
-0@@ -28,6 +28,13 @@ Various statistics will form read_only files under this directory. This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. So, it will work with any cpufreq_driver.
The existing statement "it will work with any cpufreq_driver" may not be entirely accurate in practice. The stats driver relies on the scaling driver populating a frequency table (policy->freq_table), which is not the case for some modern drivers. It might be better to clarify this dependency rather than keeping the current wording and adding a contradicting note.
Documentation/cpu-freq/cpufreq-stats.rst Various statistics will form read_only files under this directory. · line 34
Quoted 5 lines
Documentation/cpu-freq/cpufreq-stats.rst +4
-0+.. note:: + + On some modern systems, this interface may not be available or may not + expose meaningful statistics depending on the active CPU frequency scaling driver.
Also, "may not expose meaningful statistics" could be a bit misleading. In these cases, the stats/ directory is typically not created at all, since cpufreq_stats_create_table() returns early when the frequency table is not available.
Documentation/cpu-freq/cpufreq-stats.rst Various statistics will form read_only files under this directory. · line 37
Quoted 3 lines
Documentation/cpu-freq/cpufreq-stats.rst +3
-0+ + In particular, drivers such as intel_pstate or amd_pstate may use alternative + mechanisms for frequency scaling and accounting.
Similarly, describing this as "alternative mechanisms for frequency scaling and accounting" may be slightly vague. The key point is that these drivers do not populate policy->freq_table, which prevents the stats driver from creating its sysfs interface.
Small nit: The subject line "modern cpufreq drivers" feels a bit vague; it might be clearer to refer to drivers that do not populate policy->freq_table, since that is the actual condition under which cpufreq-stats is not available.
For completeness, it may also be worth mentioning cppc_cpufreq, which behaves in a similar way.
Documentation/cpu-freq/cpufreq-stats.rst Various statistics will form read_only files under this directory. · line 40
Quoted 3 lines
Documentation/cpu-freq/cpufreq-stats.rst +0
-02. Statistics Provided (with example) =====================================
Perhaps something along the following lines would make the behavior clearer:
This driver is designed to be independent of any particular cpufreq_driver that may be running on your CPU. However, it requires the scaling driver to populate a frequency table (``policy->freq_table``). Drivers that operate on a continuous performance range rather than a discrete set of frequencies, such as ``intel_pstate``, ``amd_pstate``, and ``cppc_cpufreq``, do not populate this table. As a result, the ``stats/`` directory will not be present for those drivers.
Thanks again for looking into this.
Signature · 2 lines
Thx and BRs, Zhongqiu Han