Print top address of emergency stacks with 'mach' command.

Signed-off-by: Hari Bathini <hbath...@linux.ibm.com>
---

Changes in v2:
* With 'mach' command, print emergency stack data by default
  (no special option).


 ppc64.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/ppc64.c b/ppc64.c
index 8ea91c2..0561471 100644
--- a/ppc64.c
+++ b/ppc64.c
@@ -3161,6 +3161,44 @@ opalmsg(void)
                fprintf(fp, "\n");
 }
 
+static void ppc64_print_emergency_stack_info(void)
+{
+       struct machine_specific *ms = machdep->machspec;
+       char buf[32];
+       int i;
+
+       fprintf(fp, "    EMERGENCY STACK: ");
+       if (ms->emergency_sp) {
+               fprintf(fp, "\n");
+               for (i = 0; i < kt->cpus; i++) {
+                       sprintf(buf, "CPU %d", i);
+                       fprintf(fp, "%19s: %lx\n", buf, ms->emergency_sp[i]);
+               }
+       } else
+               fprintf(fp, "(unused)\n");
+
+       fprintf(fp, "NMI EMERGENCY STACK: ");
+       if (ms->nmi_emergency_sp) {
+               fprintf(fp, "\n");
+               for (i = 0; i < kt->cpus; i++) {
+                       sprintf(buf, "CPU %d", i);
+                       fprintf(fp, "%19s: %lx\n", buf, 
ms->nmi_emergency_sp[i]);
+               }
+       } else
+               fprintf(fp, "(unused)\n");
+
+       fprintf(fp, " MC EMERGENCY STACK: ");
+       if (ms->mc_emergency_sp) {
+               fprintf(fp, "\n");
+               for (i = 0; i < kt->cpus; i++) {
+                       sprintf(buf, "CPU %d", i);
+                       fprintf(fp, "%19s: %lx\n", buf, ms->mc_emergency_sp[i]);
+               }
+       } else
+               fprintf(fp, "(unused)\n");
+       fprintf(fp, "\n");
+}
+
 /*
  *  Machine dependent command.
  */
@@ -3241,6 +3279,8 @@ ppc64_display_machine_stats(void)
                        fprintf(fp, "%19s: %lx\n", buf, tt->softirq_ctx[c]);
                }
        }
+
+       ppc64_print_emergency_stack_info();
 }
 
 static const char *hook_files[] = {
-- 
2.35.3

--
Crash-utility mailing list
Crash-utility@redhat.com
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to