From 2ea64d2e3af46b32a17382252d3976e978175baf Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Thu, 2 Oct 2014 10:17:35 +0800 Subject: [PATCH v3 04/21] x86_64: modify mach to indicate offline cpus' data mach will display number of cpus and cpus' irq stacks and exception stacks. This patch can indicate data of offline cpus. The original output is like below: crash> mach MACHINE TYPE: x86_64 MEMORY SIZE: 1 GB CPUS: 4 ... IRQ STACKS: CPU 0: ffff88003fc00000 CPU 1: ffff88003fc80000 CPU 2: ffff88003fd00000 CPU 3: ffff88003fd80000 STACKFAULT STACK SIZE: 4096 STACKFAULT STACKS: CPU 0: ffff88003fc04000 CPU 1: ffff88003fc84000 CPU 2: ffff88003fd04000 CPU 3: ffff88003fd84000 ... With crash variable offline set to "hide", the output is like below: crash> mach MACHINE TYPE: x86_64 MEMORY SIZE: 1 GB CPUS: 4 [1 OFFLINE] ... IRQ STACKS: CPU 0: ffff88003fc00000 CPU 1: ffff88003fc80000 CPU 2: ffff88003fd00000 CPU 3: ffff88003fd80000 STACKFAULT STACK SIZE: 4096 STACKFAULT STACKS: CPU 0: ffff88003fc04000 CPU 1: ffff88003fc84000 CPU 2: ffff88003fd04000 CPU 3: ffff88003fd84000 ... Signed-off-by: Qiao Nuohan --- x86_64.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/x86_64.c b/x86_64.c index a076b02..9ff57d6 100755 --- a/x86_64.c +++ b/x86_64.c @@ -5047,7 +5047,8 @@ x86_64_display_machine_stats(void) fprintf(fp, " MACHINE TYPE: %s\n", uts->machine); fprintf(fp, " MEMORY SIZE: %s\n", get_memory_size(buf)); - fprintf(fp, " CPUS: %d\n", kt->cpus); + fprintf(fp, " CPUS: %d [%d OFFLINE]\n", kt->cpus, + kt->cpus - get_cpus_to_display()); if (!STREQ(kt->hypervisor, "(undetermined)") && !STREQ(kt->hypervisor, "bare hardware")) fprintf(fp, " HYPERVISOR: %s\n", kt->hypervisor); @@ -5071,8 +5072,14 @@ x86_64_display_machine_stats(void) fprintf(fp, " IRQ STACKS:\n"); for (c = 0; c < kt->cpus; c++) { sprintf(buf, "CPU %d", c); - fprintf(fp, "%22s: %016lx\n", + + fprintf(fp, "%22s: %016lx", buf, machdep->machspec->stkinfo.ibase[c]); + + if (hide_offline_cpu(c)) + fprintf(fp, " [OFFLINE]\n"); + else + fprintf(fp, "\n"); } for (i = 0; i < MAX_EXCEPTION_STACKS; i++) { @@ -5087,8 +5094,14 @@ x86_64_display_machine_stats(void) if (machdep->machspec->stkinfo.ebase[c][i] == 0) break; sprintf(buf, "CPU %d", c); - fprintf(fp, "%22s: %016lx\n", + + fprintf(fp, "%22s: %016lx", buf, machdep->machspec->stkinfo.ebase[c][i]); + + if (hide_offline_cpu(c)) + fprintf(fp, " [OFFLINE]\n"); + else + fprintf(fp, "\n"); } } } -- 1.8.5.3