[PATCH v2 13/25] modify irq -a to hide offline cpus' data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



irq -a will dump cpu affinity for irqs. This patch will hide offline
cpus.

The original output is like below:
<cut>
crash> irq -a
IRQ NAME                 AFFINITY
  0 timer                0-3
  1 i8042                0
  6 floppy               0-3
  8 rtc0                 0-3
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> irq -a
IRQ NAME                 AFFINITY
  0 timer                0-1,3
  1 i8042                0
  6 floppy               0-1,3
  8 rtc0                 0-1,3
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan@xxxxxxxxxxxxxx>
---
 kernel.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel.c b/kernel.c
index 758edcf..8063d61 100755
--- a/kernel.c
+++ b/kernel.c
@@ -5733,14 +5733,19 @@ get_irq_desc_addr(int irq)
 static void
 display_cpu_affinity(ulong *mask)
 {
-	int cpu, seq, start, count;
+	int cpu, seq, start, count, cpu_exist;
 
 	seq = FALSE;
 	start = 0;
 	count = 0;
 
 	for (cpu = 0; cpu < kt->cpus; ++cpu) {
-		if (NUM_IN_BITMAP(mask, cpu)) {
+		/*
+		 * on X86_64, offline cpu should not be displayed.
+		 */
+		cpu_exist = !hide_offline_cpu(cpu) && NUM_IN_BITMAP(mask, cpu);
+
+		if (cpu_exist) {
 			if (seq)
 				continue;
 			start = cpu;
@@ -5757,6 +5762,9 @@ display_cpu_affinity(ulong *mask)
 		}
 	}
 
+	/*
+	 * when seq is TRUE, the following cpus cannot be offline.
+	 */
 	if (seq) {
 		if (count)
 			fprintf(fp, ",");
-- 
1.8.5.3

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux