[Crash-utility] [PATCH v2 18/25] modify kmem -o to hide offline cpus' data

Qiao Nuohan qiaonuohan at cn.fujitsu.com
Mon Sep 29 02:09:16 UTC 2014


kmem -o is used to display each cpu's offset value that is added
to per-cpu symbol values to translate them into kernel virtual
addresses. This patch will hide data of offline cpus.

The original output is like below:
<cut>
crash> kmem -o
PER-CPU OFFSET VALUES:
  CPU 0: ffff88003fc00000
  CPU 1: ffff88003fc80000
  CPU 2: ffff88003fd00000
  CPU 3: ffff88003fd80000
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> kmem -o
PER-CPU OFFSET VALUES:
  CPU 0: ffff88003fc00000
  CPU 1: ffff88003fc80000
  CPU 2: <OFFLINE>
  CPU 3: ffff88003fd80000
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
---
 memory.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index 6c7f495..6b7289b 100755
--- a/memory.c
+++ b/memory.c
@@ -17016,7 +17016,12 @@ dump_per_cpu_offsets(void)
 
 	for (c = 0; c < kt->cpus; c++) {
 		sprintf(buf, "CPU %d", c);
-		fprintf(fp, "%7s: %lx\n", buf, kt->__per_cpu_offset[c]);
+
+		fprintf(fp, "%7s: ", buf);
+		if (hide_offline_cpu(c))
+			fprintf(fp, "<OFFLINE>\n");
+		else
+			fprintf(fp, "%lx\n", kt->__per_cpu_offset[c]);
 	}
 }
 
-- 
1.8.5.3




More information about the Crash-utility mailing list