irq -s will display kernel irq stats. This patch will hide data of
offline cpus

The original output is like below:
<cut>
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
...
<cut>

With data of offline cpu(cpu#2) hiden, the output is like below:
<cut>
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
...
<cut>

Signed-off-by: Qiao Nuohan <[email protected]>
---
 kernel.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/kernel.c b/kernel.c
index 560b292..758edcf 100755
--- a/kernel.c
+++ b/kernel.c
@@ -5622,9 +5622,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);
@@ -6422,6 +6431,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

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to