Skip to contentSkip to conversation

powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked()

PATCH Applied Hari Bathini 3 participants 3 messages Jun 9, 2023 – Aug 23, 2023 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked()

Invoke ibm,os-term call with rtas_call_unlocked(), without using the RTAS spinlock, to avoid deadlock in the unlikely event of a machine crash while making an RTAS call.

---
 arch/powerpc/kernel/rtas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +3 -1
index c087eeee320f..a8192e5b1a5f 100644
@@ -1587,6 +1587,7 @@ static bool ibm_extended_os_term;
 void rtas_os_term(char *str)
 {
 	s32 token = rtas_function_token(RTAS_FN_IBM_OS_TERM);
+	static struct rtas_args args;
 	int status;
 
 	/*
@@ -1607,7 +1608,8 @@ void rtas_os_term(char *str)
 	 * schedules.
 	 */
 	do {
-		status = rtas_call(token, 1, 1, NULL, __pa(rtas_os_term_buf));
+		rtas_call_unlocked(&args, token, 1, 1, NULL, __pa(rtas_os_term_buf));
+		status = be32_to_cpu(args.rets[0]);
 	} while (rtas_busy_delay_time(status));
 
 	if (status != 0)
Signature · 1 line
2.40.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 22 lines · Hari Bathini

Invoke ibm,os-term call with rtas_call_unlocked(), without using the RTAS spinlock, to avoid deadlock in the unlikely event of a machine crash while making an RTAS call.

---
 arch/powerpc/kernel/rtas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -0
index c087eeee320f..a8192e5b1a5f 100644
@@ -1587,6 +1587,7 @@ static bool ibm_extended_os_term;
 void rtas_os_term(char *str)
 {
 	s32 token = rtas_function_token(RTAS_FN_IBM_OS_TERM);
+	static struct rtas_args args;
 	int status;
 
 	/*

arch/powerpc/kernel/rtas.c void rtas_os_term(char *str) · line 1612

Quoted 6 lines
arch/powerpc/kernel/rtas.c +2 -1
@@ -1607,7 +1608,8 @@ void rtas_os_term(char *str)
 	 * schedules.
 	 */
 	do {
-		status = rtas_call(token, 1, 1, NULL, __pa(rtas_os_term_buf));
+		rtas_call_unlocked(&args, token, 1, 1, NULL, __pa(rtas_os_term_buf));
+		status = be32_to_cpu(args.rets[0]);

Looks good to me.

arch/powerpc/kernel/rtas.c void rtas_os_term(char *str) · line 1613

Quoted 1 line
arch/powerpc/kernel/rtas.c +0 -0
 	} while (rtas_busy_delay_time(status));

Thanks,
-Mahesh.