From ca861830879d3b9e3428d690b6fb502bedf80d16 Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Tue, 23 Sep 2014 10:54:22 +0800 Subject: [PATCH v3 05/21] x86_64: modify mach -c to hide offline cpus' data mach -c will display some per-cpu structures. This patch will hide offline cpus' structures. The original output is like below: crash> mach -c ... cpu_index = 1, microcode = 1 } CPU 2: struct cpuinfo_x86 { x86 = 6 '\006', x86_vendor = 0 '\000', x86_model = 2 '\002', x86_mask = 3 '\003', x86_tlbsize = 0, x86_virt_bits = 48 '0', x86_phys_bits = 40 '(', ... With crash varialbe offline set to "hide", the output is like below: crash> mach -c ... cpu_index = 1, microcode = 1 } CPU 2: [OFFLINE] CPU 3: struct cpuinfo_x86 { struct cpuinfo_x86 { x86 = 6 '\006', x86_vendor = 0 '\000', x86_model = 2 '\002', x86_mask = 3 '\003', x86_tlbsize = 0, ... Signed-off-by: Qiao Nuohan --- x86_64.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x86_64.c b/x86_64.c index 9ff57d6..bd2a3e0 100755 --- a/x86_64.c +++ b/x86_64.c @@ -5145,8 +5145,13 @@ x86_64_display_cpu_data(unsigned int radix) for (cpu = 0; cpu < cpus; cpu++) { if (boot_cpu) fprintf(fp, "BOOT CPU:\n"); - else - fprintf(fp, "%sCPU %d:\n", cpu ? "\n" : "", cpu); + else { + if (hide_offline_cpu(cpu)) { + fprintf(fp, "%sCPU %d: [OFFLINE]\n", cpu ? "\n" : "", cpu); + continue; + } else + fprintf(fp, "%sCPU %d:\n", cpu ? "\n" : "", cpu); + } if (per_cpu) cpu_data = per_cpu->value + kt->__per_cpu_offset[cpu]; -- 1.8.5.3