Skip to contentSkip to conversation

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

PATCH Superseded Hari Bathini 2 participants 3 messages Jun 9, 2023 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +2 -1
index c087eeee320f..f65b2a8cc0f1 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,7 @@ void rtas_os_term(char *str)
 	 * schedules.
 	 */
 	do {
-		status = rtas_call(token, 1, 1, NULL, __pa(rtas_os_term_buf));
+		status = rtas_call_unlocked(&args, token, 1, 1, NULL, __pa(rtas_os_term_buf));
 	} while (rtas_busy_delay_time(status));
 
 	if (status != 0)
Signature · 1 line
2.40.1
#1 lore raw
Quoted 3 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.

Thanks for the patch. Minor comment bellow.

Quoted 19 lines
---
 arch/powerpc/kernel/rtas.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -0
index c087eeee320f..f65b2a8cc0f1 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 1611

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

rtas_call_unlocked() returns void. You may want to extract the status from args->rets[0].

Thanks,
-Mahesh.

Quoted 6 lines
arch/powerpc/kernel/rtas.c +0 -0
 	} while (rtas_busy_delay_time(status));
 
 	if (status != 0)
Signature · 1 line
2.40.1
Signature · 1 line
Mahesh J Salgaonkar
#2 lore raw
Quoted 24 lines · Mahesh J Salgaonkar
Quoted 3 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.

Thanks for the patch. Minor comment bellow.

Quoted 17 lines
---
  arch/powerpc/kernel/rtas.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -0
index c087eeee320f..f65b2a8cc0f1 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;
 
Quoted 10 lines

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

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

rtas_call_unlocked() returns void. You may want to extract the status from args->rets[0].

Yeah, Mahesh. I posted a stale version. Will post the updated version.

Thanks
Hari