command p can be used to display data of per-cpu symbol. This patch is
used to hide data of offline cpus.

The original output is like below:
<cut>
crash> p cpu_number:a
per_cpu(cpu_number, 0) = $1 = 0
per_cpu(cpu_number, 1) = $2 = 1
per_cpu(cpu_number, 2) = $3 = 2
per_cpu(cpu_number, 3) = $4 = 3
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> p cpu_number:a
per_cpu(cpu_number, 0) = $1 = 0
per_cpu(cpu_number, 1) = $2 = 1
cpu 2 is OFFLINE.
per_cpu(cpu_number, 3) = $3 = 3
<cut>

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

diff --git a/symbols.c b/symbols.c
index 11bae02..36031c6 100755
--- a/symbols.c
+++ b/symbols.c
@@ -6847,6 +6847,11 @@ display_per_cpu_info(struct syment *sp, int radix, char 
*cpuspec)
                module_symbol(sp->value, NULL, NULL, NULL, *gdb_output_radix);
 
        for (c = 0; c < kt->cpus; c++) {
+               if (hide_offline_cpu(c)) {
+                       fprintf(fp, "cpu %d is OFFLINE.\n", c);
+                       continue;
+               }
+
                if (cpus && !NUM_IN_BITMAP(cpus, c))
                        continue;
                addr = sp->value + kt->__per_cpu_offset[c];
-- 
1.8.5.3

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

Reply via email to