Blob Blame History Raw
From 9429b15851f184fbff187d9a751451c9ed8ae5c9 Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Mon, 4 Jul 2022 10:55:45 +0530
Subject: [PATCH 07/28] ppc64: print emergency stacks info with 'mach' command

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

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
 ppc64.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/ppc64.c b/ppc64.c
index 03047a85955d..ad1d6e121e81 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.37.1