[Crash-utility] [PATCH v2 16/25] modify ptov offset:cpuspec to hide offline cpus' data

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


ptov offset:cpuspec can be used to translate per-cpu offset to kernel
virtual address. This patch will hide data of offline cpu.

The original output is like below:
<cut>
crash> ptov bfa0:a
PER-CPU OFFSET: bfa0
  CPU    VIRTUAL
  [0]  ffff88003fc0bfa0
  [1]  ffff88003fc8bfa0
  [2]  ffff88003fd0bfa0
  [3]  ffff88003fd8bfa0
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> ptov bfa0:a
PER-CPU OFFSET: bfa0
  CPU    VIRTUAL
  [0]  ffff88003fc0bfa0
  [1]  ffff88003fc8bfa0
  [2]  <OFFLINE>
  [3]  ffff88003fd8bfa0
<cut>

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

diff --git a/memory.c b/memory.c
index 518c917..fbbd01d 100755
--- a/memory.c
+++ b/memory.c
@@ -3192,9 +3192,13 @@ cmd_ptov(void)
 					continue;
 				vaddr = paddr + kt->__per_cpu_offset[c];
 				sprintf(buf1, "[%d]", c);
-				fprintf(fp, "  %s%lx\n", 
-			    		mkstring(buf2, len, LJUST, buf1),
-					vaddr);
+
+				fprintf(fp, "  %s",
+					mkstring(buf2, len, LJUST, buf1));
+				if (hide_offline_cpu(c))
+					fprintf(fp, "<OFFLINE>\n");
+				else
+					fprintf(fp, "%lx\n", vaddr);
 			}
 			FREEBUF(cpus);
 		} else {
-- 
1.8.5.3




More information about the Crash-utility mailing list