[PATCH v2 05/25] x86_64: modify mach to hide offline cpus' data

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

 



mach will display number of cpus and cpus' irq stacks and exception
stacks. This patch can hide offline cpus.

The original output is like below:
<cut>
crash> mach
          MACHINE TYPE: x86_64
           MEMORY SIZE: 1 GB
                  CPUS: 4
...
            IRQ STACKS:
                 CPU 0: ffff88003fc00000
                 CPU 1: ffff88003fc80000
                 CPU 2: ffff88003fd00000
                 CPU 3: ffff88003fd80000
 STACKFAULT STACK SIZE: 4096
     STACKFAULT STACKS:
                 CPU 0: ffff88003fc04000
                 CPU 1: ffff88003fc84000
                 CPU 2: ffff88003fd04000
                 CPU 3: ffff88003fd84000
..
<cut>

With data of offline cpu hiden, the output is like below:
<cut>
crash> mach
          MACHINE TYPE: x86_64
           MEMORY SIZE: 1 GB
                  CPUS: 3
...
            IRQ STACKS:
                 CPU 0: ffff88003fc00000
                 CPU 1: ffff88003fc80000
                 CPU 2: <OFFLINE>
                 CPU 3: ffff88003fd80000
 STACKFAULT STACK SIZE: 4096
     STACKFAULT STACKS:
                 CPU 0: ffff88003fc04000
                 CPU 1: ffff88003fc84000
                 CPU 2: <OFFLINE>
                 CPU 3: ffff88003fd84000
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan@xxxxxxxxxxxxxx>
---
 x86_64.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index 19f2d48..69d7ea8 100755
--- a/x86_64.c
+++ b/x86_64.c
@@ -5070,7 +5070,7 @@ x86_64_display_machine_stats(void)
 
 	fprintf(fp, "          MACHINE TYPE: %s\n", uts->machine);
 	fprintf(fp, "           MEMORY SIZE: %s\n", get_memory_size(buf));
-	fprintf(fp, "                  CPUS: %d\n", kt->cpus);
+	fprintf(fp, "                  CPUS: %d\n", get_cpus_to_display());
 	if (!STREQ(kt->hypervisor, "(undetermined)") &&
 	    !STREQ(kt->hypervisor, "bare hardware"))
 		fprintf(fp, "            HYPERVISOR: %s\n",  kt->hypervisor);
@@ -5094,8 +5094,12 @@ x86_64_display_machine_stats(void)
 	fprintf(fp, "            IRQ STACKS:\n");
 	for (c = 0; c < kt->cpus; c++) {
 		sprintf(buf, "CPU %d", c);
-		fprintf(fp, "%22s: %016lx\n", 
-			buf, machdep->machspec->stkinfo.ibase[c]);
+
+		if (hide_offline_cpu(c))
+			fprintf(fp, "%22s: <OFFLINE>\n", buf);
+		else
+			fprintf(fp, "%22s: %016lx\n",
+				buf, machdep->machspec->stkinfo.ibase[c]);
 	}
 
 	for (i = 0; i < MAX_EXCEPTION_STACKS; i++) {
@@ -5110,8 +5114,12 @@ x86_64_display_machine_stats(void)
 			if (machdep->machspec->stkinfo.ebase[c][i] == 0)
 				break;
 			sprintf(buf, "CPU %d", c);
-			fprintf(fp, "%22s: %016lx\n", 
-				buf, machdep->machspec->stkinfo.ebase[c][i]);
+
+			if (hide_offline_cpu(c))
+				fprintf(fp, "%22s: <OFFLINE>\n", buf);
+			else
+				fprintf(fp, "%22s: %016lx\n",
+					buf, machdep->machspec->stkinfo.ebase[c][i]);
 		}
 	}
 }
-- 
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