summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Enju <enjuk@amazon.com>2025-12-26 17:46:49 +0900
committerTejun Heo <tj@kernel.org>2025-12-28 06:11:13 -1000
commitf92ff79ba2640fc482bf2bfb5b42e33957f90caf (patch)
tree1674eaa90262a387d75dc3150de8a85ade1b77fe
parentccaeeb585c7c2a0ac67ee1af9acb4d1411dc409e (diff)
tools/sched_ext: fix scx_show_state.py for scx_root change
Commit 48e126777386 ("sched_ext: Introduce scx_sched") introduced scx_root and removed scx_ops, causing scx_show_state.py to fail when searching for the 'scx_ops' object. [1] Fix by using 'scx_root' instead, with NULL pointer handling. [1] # drgn -s vmlinux ./tools/sched_ext/scx_show_state.py Traceback (most recent call last): File "/root/.venv/bin/drgn", line 8, in <module> sys.exit(_main()) ~~~~~^^ File "/root/.venv/lib64/python3.14/site-packages/drgn/cli.py", line 625, in _main runpy.run_path( ~~~~~~~~~~~~~~^ script_path, init_globals={"prog": prog}, run_name="__main__" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "<frozen runpy>", line 287, in run_path File "<frozen runpy>", line 98, in _run_module_code File "<frozen runpy>", line 88, in _run_code File "./tools/sched_ext/scx_show_state.py", line 30, in <module> ops = prog['scx_ops'] ~~~~^^^^^^^^^^^ _drgn.ObjectNotFoundError: could not find 'scx_ops' Fixes: 48e126777386 ("sched_ext: Introduce scx_sched") Signed-off-by: Kohei Enju <enjuk@amazon.com> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--tools/sched_ext/scx_show_state.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/sched_ext/scx_show_state.py b/tools/sched_ext/scx_show_state.py
index 7cdcc6729ea4..aec4a4498140 100644
--- a/tools/sched_ext/scx_show_state.py
+++ b/tools/sched_ext/scx_show_state.py
@@ -27,10 +27,13 @@ def read_static_key(name):
def state_str(state):
return prog['scx_enable_state_str'][state].string_().decode()
-ops = prog['scx_ops']
+root = prog['scx_root']
enable_state = read_atomic("scx_enable_state_var")
-print(f'ops : {ops.name.string_().decode()}')
+if root:
+ print(f'ops : {root.ops.name.string_().decode()}')
+else:
+ print('ops : ')
print(f'enabled : {read_static_key("__scx_enabled")}')
print(f'switching_all : {read_int("scx_switching_all")}')
print(f'switched_all : {read_static_key("__scx_switched_all")}')