mach -c will display some per-cpu structures. This patch will hide
offline cpus' structures.
The original output is like below:
<cut>
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 '(',
...
<cut>
With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
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,
...
<cut>
Signed-off-by: Qiao Nuohan <qiaonuohan(a)cn.fujitsu.com>
---
x86_64.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/x86_64.c b/x86_64.c
index 69d7ea8..473ea8b 100755
--- a/x86_64.c
+++ b/x86_64.c
@@ -5163,8 +5163,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