----- Original Message -----
> ----- Original Message -----
> > The patch below adds support to filter foreach on task states. I've
> > found [foreach state=D bt] and [foreach state=R bt] useful; the former
> > allows to emulate the show-blocked-tasks Magic SysRq.
> > Rabin
> I like this idea. But for the sake of conformity, I will change the
> state identifiers to be the same two-letter strings that the "ps"
> command uses. Queued for crash-6.0.5.
And for further conformity -- since no other crash commands use the
"argument=option" format -- and for further simplicity, I'll make
it easier to invoke:
crash> help foreach
foreach - display command data for multiple tasks in the system
foreach [[pid | taskp | name | state | [kernel | user]] ...]
command [flag] [argument]
This command allows for a an examination of various kernel data associated
with any, or all, tasks in the system, without having to set the context
to each targeted task.
pid perform the command(s) on this PID.
taskp perform the command(s) on task referenced by this hexadecimal
name perform the command(s) on all tasks with this name. If the
task name can be confused with a foreach command name, then
precede the name string with a "". If the name string is
enclosed within "'" characters, then the encompassed string
must be a POSIX extended regular expression that will be used
to match task names.
user perform the command(s) on all user (non-kernel) threads.
kernel perform the command(s) on all kernel threads.
active perform the command(s) on the active thread on each CPU.
state perform the command(s) on all tasks in the specified state, which
may be one of: RU, IN, UN, ST, ZO, SW or DE.
If none of the task-identifying arguments above are entered, the command
will be performed on all tasks.
... [ cut ] ...
Display the stack traces for all blocked (TASK_UNINTERRUPTIBLE) tasks:
crash> foreach UN bt
PID: 428 TASK: ffff880036b6c560 CPU: 1 COMMAND: "jbd2/dm-1-8"
#0 [ffff880035779a70] __schedule at ffffffff815df272
#1 [ffff880035779b08] schedule at ffffffff815dfacf
#2 [ffff880035779b18] io_schedule at ffffffff815dfb7f
#3 [ffff880035779b38] sleep_on_page at ffffffff81119a4e
#4 [ffff880035779b48] __wait_on_bit at ffffffff815e039f
#5 [ffff880035779b98] wait_on_page_bit at ffffffff81119bb8
#6 [ffff880035779be8] filemap_fdatawait_range at ffffffff81119ccc
#7 [ffff880035779cd8] filemap_fdatawait at ffffffff81119d8b
#8 [ffff880035779ce8] jbd2_journal_commit_transaction at ffffffff8123a99c
#9 [ffff880035779e58] kjournald2 at ffffffff8123ee7b
#10 [ffff880035779ee8] kthread at ffffffff8108fb9c
#11 [ffff880035779f48] kernel_thread_helper at ffffffff815ebaf4
And again, thanks for the concept -- it's really pretty useful.
Crash-utility mailing list