• David Vernet's avatar
    sched_ext: Print sched_ext info when dumping stack · 1538e339
    David Vernet authored
    It would be useful to see what the sched_ext scheduler state is, and what
    scheduler is running, when we're dumping a task's stack. This patch
    therefore adds a new print_scx_info() function that's called in the same
    context as print_worker_info() and print_stop_info(). An example dump
    follows.
    
      BUG: kernel NULL pointer dereference, address: 0000000000000999
      #PF: supervisor write access in kernel mode
      #PF: error_code(0x0002) - not-present page
      PGD 0 P4D 0
      Oops: 0002 [#1] PREEMPT SMP
      CPU: 13 PID: 2047 Comm: insmod Tainted: G           O       6.6.0-work-10323-gb58d4cae8e99-dirty #34
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS unknown 2/2/2022
      Sched_ext: qmap (enabled+all), task: runnable_at=-17ms
      RIP: 0010:init_module+0x9/0x1000 [test_module]
      ...
    
    v3: - scx_ops_enable_state_str[] definition moved to an earlier patch as
          it's now used by core implementation.
    
        - Convert jiffy delta to msecs using jiffies_to_msecs() instead of
          multiplying by (HZ / MSEC_PER_SEC). The conversion is implemented in
          jiffies_delta_msecs().
    
    v2: - We are now using scx_ops_enable_state_str[] outside
          CONFIG_SCHED_DEBUG. Move it outside of CONFIG_SCHED_DEBUG and to the
          top. This was reported by Changwoo and Andrea.
    Signed-off-by: default avatarDavid Vernet <void@manifault.com>
    Reported-by: default avatarChangwoo Min <changwoo@igalia.com>
    Reported-by: default avatarAndrea Righi <andrea.righi@canonical.com>
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    1538e339
dump_stack.c 3.42 KB