Skip to content

Commit f92ff79

Browse files
hyperenjuhtejun
authored andcommitted
tools/sched_ext: fix scx_show_state.py for scx_root change
Commit 48e1267 ("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: 48e1267 ("sched_ext: Introduce scx_sched") Signed-off-by: Kohei Enju <[email protected]> Reviewed-by: Emil Tsalapatis <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent ccaeeb5 commit f92ff79

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tools/sched_ext/scx_show_state.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ def read_static_key(name):
2727
def state_str(state):
2828
return prog['scx_enable_state_str'][state].string_().decode()
2929

30-
ops = prog['scx_ops']
30+
root = prog['scx_root']
3131
enable_state = read_atomic("scx_enable_state_var")
3232

33-
print(f'ops : {ops.name.string_().decode()}')
33+
if root:
34+
print(f'ops : {root.ops.name.string_().decode()}')
35+
else:
36+
print('ops : ')
3437
print(f'enabled : {read_static_key("__scx_enabled")}')
3538
print(f'switching_all : {read_int("scx_switching_all")}')
3639
print(f'switched_all : {read_static_key("__scx_switched_all")}')

0 commit comments

Comments
 (0)