With the patch, runq [-t/-m/-g/-d] can hide data on offline cpus. The original output of thest command is like below: <cut> crash> runq CPU 0 RUNQUEUE: ffff88002c216680 CURRENT: PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" RT PRIO_ARRAY: ffff88002c216808 [no tasks queued] CFS RB_ROOT: ffff88002c216718 [no tasks queued] ... CPU 3 RUNQUEUE: ffff88002c396680 CURRENT: PID: 0 TASK: ffff880219f9aaa0 COMMAND: "swapper" RT PRIO_ARRAY: ffff88002c396808 [no tasks queued] CFS RB_ROOT: ffff88002c396718 [no tasks queued] crash> runq -t CPU 0: 107470918732460 000000000000000 PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" CPU 1: 107470922094506 000000000000000 PID: 0 TASK: ffff880219f5b540 COMMAND: "swapper" CPU 2: 107470921985118 107470921000315 PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" CPU 3: 15082503595357 00000000000000 PID: 0 TASK: ffff880219f9aaa0 COMMAND: "swapper" crash> runq -m CPU 0: [1 05:51:25.919] PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" CPU 1: [0 00:00:00.002] PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" CPU 2: [1 05:51:25.911] PID: 0 TASK: ffff880219f64040 COMMAND: "swapper" CPU 3: [0 04:11:22.503] PID: 0 TASK: ffff880219f9aaa0 COMMAND: "swapper" crash> runq -g CPU 0 CURRENT: PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" INIT_TASK_GROUP: ffffffff81e1f780 RT_RQ: ffff88002c216808 [no tasks queued] INIT_TASK_GROUP: ffffffff81e1f780 CFS_RQ: ffff88002c2166e8 [no tasks queued] ... CPU 3 CURRENT: PID: 0 TASK: ffff880219f9aaa0 COMMAND: "swapper" INIT_TASK_GROUP: ffffffff81e1f780 RT_RQ: ffff88002c396808 [no tasks queued] INIT_TASK_GROUP: ffffffff81e1f780 CFS_RQ: ffff88002c3966e8 [no tasks queued] crash> runq -d CPU 0 [no tasks queued] CPU 1 [120] PID: 2760 TASK: ffff88021305aaa0 COMMAND: "Xorg" CPU 2 [120] PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" CPU 3 [no tasks queued] <cut> With data of offline cpu(cpu #3) hiden, the output is like below: <cut> crash> runq CPU 0 RUNQUEUE: ffff88002c216680 CURRENT: PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" RT PRIO_ARRAY: ffff88002c216808 [no tasks queued] CFS RB_ROOT: ffff88002c216718 [no tasks queued] ... CPU 2 RUNQUEUE: ffff88002c316680 CURRENT: PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" RT PRIO_ARRAY: ffff88002c316808 [no tasks queued] CFS RB_ROOT: ffff88002c316718 [no tasks queued] CPU 3 <OFFLINE> crash> runq -t CPU 0: 107605503006397 107605495037692 PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" CPU 1: 107605503645955 000000000000000 PID: 0 TASK: ffff880219f5b540 COMMAND: "swapper" CPU 2: 107605500267130 000000000000000 PID: 0 TASK: ffff880219f64040 COMMAND: "swapper" CPU 3: <OFFLINE> crash> runq -m CPU 0: [1 05:53:41.958] PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" CPU 1: [1 05:53:41.959] PID: 0 TASK: ffff880219f5b540 COMMAND: "swapper" CPU 2: [0 00:00:00.000] PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" CPU 3: <OFFLINE> crash> runq -g CPU 0 CURRENT: PID: 0 TASK: ffffffff81a8d020 COMMAND: "swapper" INIT_TASK_GROUP: ffffffff81e1f780 RT_RQ: ffff88002c216808 [no tasks queued] INIT_TASK_GROUP: ffffffff81e1f780 CFS_RQ: ffff88002c2166e8 [no tasks queued] ... CPU 2 CURRENT: PID: 0 TASK: ffff880219f64040 COMMAND: "swapper" INIT_TASK_GROUP: ffffffff81e1f780 RT_RQ: ffff88002c316808 [no tasks queued] INIT_TASK_GROUP: ffffffff81e1f780 CFS_RQ: ffff88002c3166e8 [no tasks queued] CPU 3 <OFFLINE> crash> runq -d CPU 0 [no tasks queued] CPU 1 [120] PID: 16905 TASK: ffff88018f6e3500 COMMAND: "crash" CPU 2 [no tasks queued] CPU 3 <OFFLINE> <cut> Signed-off-by: Qiao Nuohan <qiaonuohan@xxxxxxxxxxxxxx> --- task.c | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/task.c b/task.c index bc11cf3..68a52a3 100755 --- a/task.c +++ b/task.c @@ -7641,8 +7641,14 @@ dump_on_rq_timestamp(void) sprintf(buf, pc->output_radix == 10 ? "%llu" : "%llx", timestamp); - fprintf(fp, "%sCPU %d: %s\n", cpu < 10 ? " " : "", - cpu, buf); + fprintf(fp, "%sCPU %d: ", cpu < 10 ? " " : "", cpu); + + if (hide_offline_cpu(cpu)) { + fprintf(fp, "<OFFLINE>\n"); + continue; + } else + fprintf(fp, "%s\n", buf); + len = strlen(buf); if ((tc = task_to_context(tt->active_set[cpu]))){ @@ -7721,6 +7727,11 @@ dump_on_rq_milliseconds(void) else indent = max_indent - 4; + if (hide_offline_cpu(cpu)) { + fprintf(fp, "%sCPU %d: <OFFLINE>\n", space(indent), cpu); + continue; + } + if ((tc = task_to_context(tt->active_set[cpu]))) task_timestamp = task_last_run(tc->task); else { @@ -7848,8 +7859,13 @@ dump_runqueues(void) runq = rq_sp->value; } - fprintf(fp, "%sCPU %d RUNQUEUE: %lx\n", cpu ? "\n" : "", - cpu, runq); + fprintf(fp, "%sCPU %d ", cpu ? "\n" : "", cpu); + + if (hide_offline_cpu(cpu)) { + fprintf(fp, "<OFFLINE>\n"); + continue; + } else + fprintf(fp, "RUNQUEUE: %lx\n", runq); fprintf(fp, " CURRENT: "); if ((tc = task_to_context(tt->active_set[cpu]))) @@ -8303,8 +8319,13 @@ dump_on_rq_tasks(void) } for (cpu = 0; cpu < kt->cpus; cpu++) { + fprintf(fp, "%sCPU %d", cpu ? "\n" : "", cpu); - fprintf(fp, "%sCPU %d\n", cpu ? "\n" : "", cpu); + if (hide_offline_cpu(cpu)) { + fprintf(fp, " <OFFLINE>\n"); + continue; + } else + fprintf(fp, "\n"); tc = FIRST_CONTEXT(); tot = 0; @@ -8437,8 +8458,13 @@ dump_CFS_runqueues(void) else runq = rq_sp->value; - fprintf(fp, "%sCPU %d RUNQUEUE: %lx\n", cpu ? "\n" : "", - cpu, runq); + fprintf(fp, "%sCPU %d ", cpu ? "\n" : "", cpu); + + if (hide_offline_cpu(cpu)) { + fprintf(fp, "<OFFLINE>\n"); + continue; + } else + fprintf(fp, "RUNQUEUE: %lx\n", runq); fprintf(fp, " CURRENT: "); if ((tc = task_to_context(tt->active_set[cpu]))) @@ -8930,7 +8956,14 @@ dump_tasks_by_task_group(void) sizeof(ulong), "task_group rt_rq", FAULT_ON_ERROR); readmem(cfs_rq + cpu * sizeof(ulong), KVADDR, &cfs_rq_p, sizeof(ulong), "task_group cfs_rq", FAULT_ON_ERROR); - fprintf(fp, "%sCPU %d\n", cpu ? "\n" : "", cpu); + fprintf(fp, "%sCPU %d", cpu ? "\n" : "", cpu); + + if (hide_offline_cpu(cpu)) { + fprintf(fp, " <OFFLINE>\n"); + continue; + } else + fprintf(fp, "\n"); + fprintf(fp, " CURRENT: "); if ((tc = task_to_context(tt->active_set[cpu]))) fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"\n", -- 1.8.5.3 -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility