From a238e38e8117bf9da221dec40a588bdebef0f5e9 Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Wed, 24 Sep 2014 14:53:31 +0800 Subject: [PATCH v3 10/21] modify irq -s to hide offline cpus' data irq -s will display kernel irq stats. This patch will hide data of offline cpus The original output is like below: crash> irq -s CPU0 CPU1 CPU2 CPU3 0: 111 1 0 0 IO-APIC-edge timer 1: 71 149 140 155 IO-APIC-edge i8042 8: 0 0 0 1 IO-APIC-edge rtc0 9: 0 0 0 0 IO-APIC-fasteoi acpi ... With data of offline cpu(cpu#2) hiden, the output is like below: crash> irq -s irq: CPU2 is OFFLINE. CPU0 CPU1 CPU3 0: 111 1 0 IO-APIC-edge timer 1: 71 149 155 IO-APIC-edge i8042 8: 0 0 1 IO-APIC-edge rtc0 9: 0 0 0 IO-APIC-fasteoi acpi ... Signed-off-by: Qiao Nuohan --- kernel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel.c b/kernel.c index 6dd6daf..ddf55aa 100755 --- a/kernel.c +++ b/kernel.c @@ -5626,9 +5626,18 @@ cmd_irq(void) SET_BIT(cpus, i); } + for (i = 0; i < kt->cpus; i++) { + if (NUM_IN_BITMAP(cpus, i) && hide_offline_cpu(i)) + error(INFO, "CPU%d is OFFLINE.\n", i); + } + fprintf(fp, " "); BZERO(buf, 10); + for (i = 0; i < kt->cpus; i++) { + if (hide_offline_cpu(i)) + continue; + if (NUM_IN_BITMAP(cpus, i)) { sprintf(buf, "CPU%d", i); fprintf(fp, "%10s ", buf); @@ -6426,6 +6435,9 @@ generic_show_interrupts(int irq, ulong *cpus) fprintf(fp, "%3d: ", irq); for (i = 0; i < kt->cpus; i++) { + if (hide_offline_cpu(i)) + continue; + if (NUM_IN_BITMAP(cpus, i)) fprintf(fp, "%10u ", kstat_irqs[i]); } -- 1.8.5.3