Blame SOURCES/0007-ppc64-print-emergency-stacks-info-with-mach-command.patch

3ce5e9
From 9429b15851f184fbff187d9a751451c9ed8ae5c9 Mon Sep 17 00:00:00 2001
3ce5e9
From: Hari Bathini <hbathini@linux.ibm.com>
3ce5e9
Date: Mon, 4 Jul 2022 10:55:45 +0530
3ce5e9
Subject: [PATCH 07/28] ppc64: print emergency stacks info with 'mach' command
3ce5e9
3ce5e9
Print top address of emergency stacks with 'mach' command.
3ce5e9
3ce5e9
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
3ce5e9
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
3ce5e9
---
3ce5e9
 ppc64.c | 40 ++++++++++++++++++++++++++++++++++++++++
3ce5e9
 1 file changed, 40 insertions(+)
3ce5e9
3ce5e9
diff --git a/ppc64.c b/ppc64.c
3ce5e9
index 03047a85955d..ad1d6e121e81 100644
3ce5e9
--- a/ppc64.c
3ce5e9
+++ b/ppc64.c
3ce5e9
@@ -3161,6 +3161,44 @@ opalmsg(void)
3ce5e9
 		fprintf(fp, "\n");
3ce5e9
 }
3ce5e9
 
3ce5e9
+static void ppc64_print_emergency_stack_info(void)
3ce5e9
+{
3ce5e9
+	struct machine_specific *ms = machdep->machspec;
3ce5e9
+	char buf[32];
3ce5e9
+	int i;
3ce5e9
+
3ce5e9
+	fprintf(fp, "    EMERGENCY STACK: ");
3ce5e9
+	if (ms->emergency_sp) {
3ce5e9
+		fprintf(fp, "\n");
3ce5e9
+		for (i = 0; i < kt->cpus; i++) {
3ce5e9
+			sprintf(buf, "CPU %d", i);
3ce5e9
+			fprintf(fp, "%19s: %lx\n", buf, ms->emergency_sp[i]);
3ce5e9
+		}
3ce5e9
+	} else
3ce5e9
+		fprintf(fp, "(unused)\n");
3ce5e9
+
3ce5e9
+	fprintf(fp, "NMI EMERGENCY STACK: ");
3ce5e9
+	if (ms->nmi_emergency_sp) {
3ce5e9
+		fprintf(fp, "\n");
3ce5e9
+		for (i = 0; i < kt->cpus; i++) {
3ce5e9
+			sprintf(buf, "CPU %d", i);
3ce5e9
+			fprintf(fp, "%19s: %lx\n", buf, ms->nmi_emergency_sp[i]);
3ce5e9
+		}
3ce5e9
+	} else
3ce5e9
+		fprintf(fp, "(unused)\n");
3ce5e9
+
3ce5e9
+	fprintf(fp, " MC EMERGENCY STACK: ");
3ce5e9
+	if (ms->mc_emergency_sp) {
3ce5e9
+		fprintf(fp, "\n");
3ce5e9
+		for (i = 0; i < kt->cpus; i++) {
3ce5e9
+			sprintf(buf, "CPU %d", i);
3ce5e9
+			fprintf(fp, "%19s: %lx\n", buf, ms->mc_emergency_sp[i]);
3ce5e9
+		}
3ce5e9
+	} else
3ce5e9
+		fprintf(fp, "(unused)\n");
3ce5e9
+	fprintf(fp, "\n");
3ce5e9
+}
3ce5e9
+
3ce5e9
 /*
3ce5e9
  *  Machine dependent command.
3ce5e9
  */
3ce5e9
@@ -3241,6 +3279,8 @@ ppc64_display_machine_stats(void)
3ce5e9
 			fprintf(fp, "%19s: %lx\n", buf, tt->softirq_ctx[c]);
3ce5e9
 		}
3ce5e9
 	}
3ce5e9
+
3ce5e9
+	ppc64_print_emergency_stack_info();
3ce5e9
 }
3ce5e9
 
3ce5e9
 static const char *hook_files[] = {
3ce5e9
-- 
3ce5e9
2.37.1
3ce5e9