linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked()
@ 2023-06-09  7:14 Hari Bathini
  2023-06-09 13:51 ` Mahesh J Salgaonkar
  2023-08-23 11:55 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Hari Bathini @ 2023-06-09  7:14 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Mahesh J Salgaonkar, Sourabh Jain

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.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
 arch/powerpc/kernel/rtas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index c087eeee320f..a8192e5b1a5f 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -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)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked()
  2023-06-09  7:14 [PATCH v2] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked() Hari Bathini
@ 2023-06-09 13:51 ` Mahesh J Salgaonkar
  2023-08-23 11:55 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Mahesh J Salgaonkar @ 2023-06-09 13:51 UTC (permalink / raw)
  To: Hari Bathini; +Cc: linuxppc-dev, Sourabh Jain

On 2023-06-09 12:44:04 Fri, Hari Bathini wrote:
> 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.
> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---
>  arch/powerpc/kernel/rtas.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index c087eeee320f..a8192e5b1a5f 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -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]);

Looks good to me.

Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>

>  	} while (rtas_busy_delay_time(status));

Thanks,
-Mahesh.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked()
  2023-06-09  7:14 [PATCH v2] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked() Hari Bathini
  2023-06-09 13:51 ` Mahesh J Salgaonkar
@ 2023-08-23 11:55 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-08-23 11:55 UTC (permalink / raw)
  To: Hari Bathini; +Cc: linuxppc-dev, Mahesh J Salgaonkar, Sourabh Jain

On Fri, 09 Jun 2023 12:44:04 +0530, Hari Bathini wrote:
> 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.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked()
      https://git.kernel.org/powerpc/c/b949ee6801f4a47ae0e02845242c99af351c4d26

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-23 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09  7:14 [PATCH v2] powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked() Hari Bathini
2023-06-09 13:51 ` Mahesh J Salgaonkar
2023-08-23 11:55 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).