From 56b429bce1fe972ee8f876cc2294723fef72df71 Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Sat, 23 Aug 2014 10:22:58 +0800 Subject: [PATCH 05/23] x86_64: modify mach -c only to display online cpu's data mach -c will display some per-cpu structures. This patch will ignore offline cpus' structures. Signed-off-by: Qiao Nuohan --- x86_64.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/x86_64.c b/x86_64.c index 33045c9..41f4890 100755 --- a/x86_64.c +++ b/x86_64.c @@ -5159,23 +5159,30 @@ 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 (!check_offline_cpu(cpu)) + fprintf(fp, "%sCPU %d:\n", cpu ? "\n" : "", cpu); + } if (per_cpu) cpu_data = per_cpu->value + kt->__per_cpu_offset[cpu]; - dump_struct("cpuinfo_x86", cpu_data, radix); + if (!check_offline_cpu(cpu)) + dump_struct("cpuinfo_x86", cpu_data, radix); if (_cpu_pda) { readmem(cpu_pda, KVADDR, &cpu_pda_addr, sizeof(unsigned long), "_cpu_pda addr", FAULT_ON_ERROR); - fprintf(fp, "\n"); - dump_struct("x8664_pda", cpu_pda_addr, radix); + if (!check_offline_cpu(cpu)) { + fprintf(fp, "\n"); + dump_struct("x8664_pda", cpu_pda_addr, radix); + } cpu_pda += sizeof(void *); } else if (VALID_STRUCT(x8664_pda)) { - fprintf(fp, "\n"); - dump_struct("x8664_pda", cpu_pda, radix); + if (!check_offline_cpu(cpu)) { + fprintf(fp, "\n"); + dump_struct("x8664_pda", cpu_pda, radix); + } cpu_pda += SIZE(x8664_pda); } -- 1.8.5.3