]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pm: cpupower: bindings: Add test to confirm cpu state is disabled
authorJohn B. Wyatt IV <jwyatt@redhat.com>
Mon, 30 Sep 2024 23:21:55 +0000 (19:21 -0400)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 2 Oct 2024 20:50:23 +0000 (14:50 -0600)
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>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py

index bb2b26db8b1079817dbf1f85b7c149a455013448..ca5aa46c9b2071845ff40c0f99c56e198c012b3a 100755 (executable)
@@ -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