with [:cpuspec] struct/union/* will display per-cpu structure/union of the
specified cpus. This patch will hide data of offline cpus.

The original output is like below:
<cut>
crash> call_function_data 15080:a
[0]: ffff88003fc15080
struct call_function_data {
  csd = 0x177e8,
...
  cpumask = 0xffff88003daf4000,
  cpumask_ipi = 0xffff88003daf4400
}
[2]: ffff88003fd15080
struct call_function_data {
  csd = 0x18248,
  cpumask = 0xffff88003daf4800,
  cpumask_ipi = 0xffff88003daf4c00
}
[3]: ffff88003fd95080
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> call_function_data 15080:a
[0]: ffff88003fc15080
struct call_function_data {
  csd = 0x177e8,
...
  cpumask = 0xffff88003daf4000,
  cpumask_ipi = 0xffff88003daf4400
}
[2]: <OFFLINE>
[3]: ffff88003fd95080
...
<cut>

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

diff --git a/symbols.c b/symbols.c
index a0f256e..11bae02 100755
--- a/symbols.c
+++ b/symbols.c
@@ -6147,7 +6147,15 @@ cmd_datatype_common(ulong flags)
                                continue;
 
                        cpuaddr = addr + kt->__per_cpu_offset[c];
-                       fprintf(fp, "[%d]: %lx\n", c, cpuaddr);
+
+                       fprintf(fp, "[%d]: ", c);
+
+                       if (hide_offline_cpu(c)) {
+                               fprintf(fp, "<OFFLINE>\n");
+                               continue;
+                       }
+
+                       fprintf(fp, "%lx\n", cpuaddr);
                        do_datatype_addr(dm, cpuaddr , count,
                                         flags, memberlist, argc_members);
                }
-- 
1.8.5.3

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

Reply via email to