From 8b535909b83701b0495479f874696c00104f1e2a Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Sat, 23 Aug 2014 10:18:10 +0800 Subject: [PATCH 02/23] x86_64: modify help -m/-M only to display online cpu's data help -m/-M will display current task address/crash nmi rsp/exception stack/irq stack, and these data of offline cpu will be hide with this patch Signed-off-by: Qiao Nuohan --- x86_64.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/x86_64.c b/x86_64.c index f4a3e8b..98c587f 100755 --- a/x86_64.c +++ b/x86_64.c @@ -575,7 +575,7 @@ x86_64_init(int when) void x86_64_dump_machdep_table(ulong arg) { - int c, i, cpus; + int c, i, cpus, r; int others; struct machine_specific *ms; @@ -762,23 +762,37 @@ x86_64_dump_machdep_table(ulong arg) ((C) < 10 ? 3 : (C) < 100 ? 2 : (C) < 1000 ? 1 : 0) fprintf(fp, "%s current[%d]:%s", - space(CPU_SPACES(kt->cpus)), kt->cpus, + space(CPU_SPACES(get_cpus_to_display())), get_cpus_to_display(), ms->current ? "\n " : " (unused)\n"); + + r = 0; for (c = 0; ms->current && (c < kt->cpus); c++) { - if (c && !(c%4)) + if (check_offline_cpu(c)) + continue; + + if (r && !(r%4)) fprintf(fp, "\n "); fprintf(fp, "%016lx ", ms->current[c]); + + r++; } if (ms->current) fprintf(fp, "\n"); fprintf(fp, "%s crash_nmi_rsp[%d]:%s", - space(CPU_SPACES(kt->cpus)), kt->cpus, + space(CPU_SPACES(get_cpus_to_display())), get_cpus_to_display(), ms->crash_nmi_rsp ? "\n " : " (unused)\n"); + + r = 0; for (c = 0; ms->crash_nmi_rsp && (c < kt->cpus); c++) { - if (c && !(c%4)) + if (check_offline_cpu(c)) + continue; + + if (r && !(r%4)) fprintf(fp, "\n "); fprintf(fp, "%016lx ", ms->crash_nmi_rsp[c]); + + r++; } if (ms->crash_nmi_rsp) fprintf(fp, "\n"); @@ -802,6 +816,9 @@ x86_64_dump_machdep_table(ulong arg) arg ? "NR_CPUS" : "cpus", MAX_EXCEPTION_STACKS); cpus = arg ? NR_CPUS : kt->cpus; for (c = 0; c < cpus; c++) { + if (!arg && check_offline_cpu(c)) + continue; + fprintf(fp, "\n %s[%d]: ", c < 10 ? " " : "", c); for (i = 0; i < MAX_EXCEPTION_STACKS; i++) { fprintf(fp, "%016lx ", ms->stkinfo.ebase[c][i]); @@ -811,10 +828,17 @@ x86_64_dump_machdep_table(ulong arg) } fprintf(fp, "\n ibase[%s]:\n ", arg ? "NR_CPUS" : "cpus"); + + r = 0; for (c = 0; c < cpus; c++) { - if (c && !(c%4)) + if (!arg && check_offline_cpu(c)) + continue; + + if (r && !(r%4)) fprintf(fp, "\n "); fprintf(fp, "%016lx ", ms->stkinfo.ibase[c]); + + r++; } fprintf(fp, "\n"); } -- 1.8.5.3