diff mbox series

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

Message ID 20230609051846.132457-1-hbathini@linux.ibm.com (mailing list archive)
State Superseded, archived
Headers show
Series powerpc/fadump: invoke ibm,os-term with rtas_call_unlocked() | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse fail 2 of 4 jobs failed.
snowpatch_ozlabs/github-powerpc_kernel_qemu fail kernel (ppc64_defconfig, fedora-37) failed at step Build.
snowpatch_ozlabs/github-powerpc_clang fail 2 of 6 jobs failed.

Commit Message

Hari Bathini June 9, 2023, 5:18 a.m. UTC
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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mahesh J Salgaonkar June 9, 2023, 5:33 a.m. UTC | #1
On 2023-06-09 10:48:46 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.

Thanks for the patch. Minor comment bellow.

> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---
>  arch/powerpc/kernel/rtas.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index c087eeee320f..f65b2a8cc0f1 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,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.

>  	} while (rtas_busy_delay_time(status));
>  
>  	if (status != 0)
> -- 
> 2.40.1
>
Hari Bathini June 9, 2023, 6:51 a.m. UTC | #2
On 09/06/23 11:03 am, Mahesh J Salgaonkar wrote:
> On 2023-06-09 10:48:46 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.
> 
> Thanks for the patch. Minor comment bellow.
> 
>>
>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>> ---
>>   arch/powerpc/kernel/rtas.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
>> index c087eeee320f..f65b2a8cc0f1 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,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
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index c087eeee320f..f65b2a8cc0f1 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,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)