* [PATCH 0/2] pm: cpupower: bindings: improve test script
@ 2024-09-30 23:21 John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 1/2] pm: cpupower: bindings: Improve disable c_state block John B. Wyatt IV
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: John B. Wyatt IV @ 2024-09-30 23:21 UTC (permalink / raw)
To: Shuah Khan, Thomas Renninger
Cc: John B. Wyatt IV, linux-pm, Shuah Khan, Rafael J. Wysocki,
linux-kernel, John Kacur, John B. Wyatt IV
Improve test_raw_pylibcpupower.py with some cleanup and catching more
states. This includes confirming states have been disabled and a notice to
use sudo.
John B. Wyatt IV (2):
pm: cpupower: bindings: Improve disable c_state block
pm: cpupower: bindings: Add test to confirm cpu state is disabled
.../bindings/python/test_raw_pylibcpupower.py | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
--
2.46.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] pm: cpupower: bindings: Improve disable c_state block
2024-09-30 23:21 [PATCH 0/2] pm: cpupower: bindings: improve test script John B. Wyatt IV
@ 2024-09-30 23:21 ` John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 2/2] pm: cpupower: bindings: Add test to confirm cpu state is disabled John B. Wyatt IV
2024-10-02 20:52 ` [PATCH 0/2] pm: cpupower: bindings: improve test script Shuah Khan
2 siblings, 0 replies; 4+ messages in thread
From: John B. Wyatt IV @ 2024-09-30 23:21 UTC (permalink / raw)
To: Shuah Khan, Thomas Renninger
Cc: John B. Wyatt IV, linux-pm, Shuah Khan, Rafael J. Wysocki,
linux-kernel, John Kacur, John B. Wyatt IV
This commit fixes a bad comment, removes an unneeded code block, and
catches a few more states that cpuidle_state_disable with the test
script. Part of the motivation for this commit was I kept forgetting to
use sudo.
Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com>
Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com>
---
.../bindings/python/test_raw_pylibcpupower.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
index 3d6f62b9556a..bb2b26db8b10 100755
--- a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
+++ b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
@@ -15,21 +15,21 @@ else:
print(f"cstate count error: return code: {cpu_cstates_count}")
"""
-Disable cstate (will fail if the above is 0, ex: a virtual machine)
+Disable cstate (will fail if the above returns is under 1, ex: a virtual machine)
"""
cstate_disabled = p.cpuidle_state_disable(0, 0, 1)
-if cpu_cstates_count == 0:
- print(f"CPU 0 has {cpu_cstates_count} c-states")
-else:
- print(f"cstate count error: return code: {cpu_cstates_count}")
match cstate_disabled:
case 0:
print(f"CPU state disabled")
case -1:
print(f"Idlestate not available")
+ case -2:
+ print(f"Disabling is not supported by the kernel")
+ case -3:
+ print(f"No write access to disable/enable C-states: try using sudo")
case _:
- print(f"Not documented")
+ print(f"Not documented: {cstate_disabled}")
# Pointer example
--
2.46.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] pm: cpupower: bindings: Add test to confirm cpu state is disabled
2024-09-30 23:21 [PATCH 0/2] pm: cpupower: bindings: improve test script John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 1/2] pm: cpupower: bindings: Improve disable c_state block John B. Wyatt IV
@ 2024-09-30 23:21 ` John B. Wyatt IV
2024-10-02 20:52 ` [PATCH 0/2] pm: cpupower: bindings: improve test script Shuah Khan
2 siblings, 0 replies; 4+ messages in thread
From: John B. Wyatt IV @ 2024-09-30 23:21 UTC (permalink / raw)
To: Shuah Khan, Thomas Renninger
Cc: John B. Wyatt IV, linux-pm, Shuah Khan, Rafael J. Wysocki,
linux-kernel, John Kacur, John B. Wyatt IV
Add a simple test to confirm and print out the cpu state.
Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com>
Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com>
---
.../bindings/python/test_raw_pylibcpupower.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
index bb2b26db8b10..ca5aa46c9b20 100755
--- a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
+++ b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
@@ -31,6 +31,22 @@ match cstate_disabled:
case _:
print(f"Not documented: {cstate_disabled}")
+"""
+Test cstate is disabled
+"""
+is_cstate_disabled = p.cpuidle_is_state_disabled(0, 0)
+
+match is_cstate_disabled:
+ case 1:
+ print(f"CPU is disabled")
+ case 0:
+ print(f"CPU is enabled")
+ case -1:
+ print(f"Idlestate not available")
+ case -2:
+ print(f"Disabling is not supported by kernel")
+ case _:
+ print(f"Not documented: {is_cstate_disabled}")
# Pointer example
--
2.46.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] pm: cpupower: bindings: improve test script
2024-09-30 23:21 [PATCH 0/2] pm: cpupower: bindings: improve test script John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 1/2] pm: cpupower: bindings: Improve disable c_state block John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 2/2] pm: cpupower: bindings: Add test to confirm cpu state is disabled John B. Wyatt IV
@ 2024-10-02 20:52 ` Shuah Khan
2 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2024-10-02 20:52 UTC (permalink / raw)
To: John B. Wyatt IV, Thomas Renninger
Cc: linux-pm, Shuah Khan, Rafael J. Wysocki, linux-kernel, John Kacur,
John B. Wyatt IV, Shuah Khan
On 9/30/24 17:21, John B. Wyatt IV wrote:
> Improve test_raw_pylibcpupower.py with some cleanup and catching more
> states. This includes confirming states have been disabled and a notice to
> use sudo.
>
> John B. Wyatt IV (2):
> pm: cpupower: bindings: Improve disable c_state block
> pm: cpupower: bindings: Add test to confirm cpu state is disabled
>
> .../bindings/python/test_raw_pylibcpupower.py | 28 +++++++++++++++----
> 1 file changed, 22 insertions(+), 6 deletions(-)
>
Applied these two patches to
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower
They will be included in my next pull request to PM maintainer.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-02 20:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 23:21 [PATCH 0/2] pm: cpupower: bindings: improve test script John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 1/2] pm: cpupower: bindings: Improve disable c_state block John B. Wyatt IV
2024-09-30 23:21 ` [PATCH 2/2] pm: cpupower: bindings: Add test to confirm cpu state is disabled John B. Wyatt IV
2024-10-02 20:52 ` [PATCH 0/2] pm: cpupower: bindings: improve test script Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).