diff mbox series

[12/14] powerpc/64s: system call avoid setting MSR[RI] until we set MSR[EE]

Message ID 20210315220402.260594-13-npiggin@gmail.com (mailing list archive)
State Superseded
Headers show
Series powerpc/64: fast interrupt exits | expand
Related show

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (91966823812efbd175f904599e5cf2a854b39809)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (280d542f6ffac0e6d65dc267f92191d509b13b64)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (5c88a17e15795226b56d83f579cbb9b7a4864f79)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (7a7fd0de4a9804299793e564a555a49c1fc924cb)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Nicholas Piggin March 15, 2021, 10:04 p.m. UTC
This extends the MSR[RI]=0 window a little further into the system
call in order to pair RI and EE enabling with a single mtmsrd.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/exceptions-64s.S | 2 --
 arch/powerpc/kernel/interrupt_64.S   | 6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Christophe Leroy March 16, 2021, 7:21 a.m. UTC | #1
Le 15/03/2021 à 23:04, Nicholas Piggin a écrit :
> This extends the MSR[RI]=0 window a little further into the system
> call in order to pair RI and EE enabling with a single mtmsrd.

Time ago, I proposed to delay that on PPC32 and Michael objected, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/9f9dd859d571e324c7412ed9db9da8cfba678257.1548956511.git.christophe.leroy@c-s.fr/


> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   arch/powerpc/kernel/exceptions-64s.S | 2 --
>   arch/powerpc/kernel/interrupt_64.S   | 6 +++---
>   2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index bd0c82ac9de5..2f14ac3c377c 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1999,8 +1999,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
>   	mtctr	r10
>   	bctr
>   	.else
> -	li	r10,MSR_RI
> -	mtmsrd 	r10,1			/* Set RI (EE=0) */
>   #ifdef CONFIG_RELOCATABLE
>   	__LOAD_HANDLER(r10, system_call_common)
>   	mtctr	r10
> diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S
> index f28f41a1a85a..eef61800f734 100644
> --- a/arch/powerpc/kernel/interrupt_64.S
> +++ b/arch/powerpc/kernel/interrupt_64.S
> @@ -311,10 +311,10 @@ END_BTB_FLUSH_SECTION
>   	 * nothing pending. system_call_exception() will call
>   	 * trace_hardirqs_off().
>   	 */
> -	li	r11,IRQS_ALL_DISABLED
> -	li	r12,PACA_IRQ_HARD_DIS
> +	li	r11,IRQS_DISABLED
> +	li	r12,-1 /* Set MSR_EE and MSR_RI */
>   	stb	r11,PACAIRQSOFTMASK(r13)
> -	stb	r12,PACAIRQHAPPENED(r13)
> +	mtmsrd	r12,1
>   
>   	ENTER_KERNEL_SECURITY_FALLBACK
>   
>
Nicholas Piggin March 16, 2021, 8:13 a.m. UTC | #2
Excerpts from Christophe Leroy's message of March 16, 2021 5:21 pm:
> 
> 
> Le 15/03/2021 à 23:04, Nicholas Piggin a écrit :
>> This extends the MSR[RI]=0 window a little further into the system
>> call in order to pair RI and EE enabling with a single mtmsrd.
> 
> Time ago, I proposed to delay that on PPC32 and Michael objected, see 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/9f9dd859d571e324c7412ed9db9da8cfba678257.1548956511.git.christophe.leroy@c-s.fr/

Yeah, it is a concern. The speedup should be at least 5% I think on
64s (have not measured in isolation yet), so might be worth it.

We'll see.

Thanks,
Nick
Michael Ellerman March 19, 2021, 11:29 a.m. UTC | #3
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 15/03/2021 à 23:04, Nicholas Piggin a écrit :
>> This extends the MSR[RI]=0 window a little further into the system
>> call in order to pair RI and EE enabling with a single mtmsrd.
>
> Time ago, I proposed to delay that on PPC32 and Michael objected, see 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/9f9dd859d571e324c7412ed9db9da8cfba678257.1548956511.git.christophe.leroy@c-s.fr/

I don't think I objected, I was just curious about what the added
exposure to RI=0 was :)

cheers

>> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
>> index bd0c82ac9de5..2f14ac3c377c 100644
>> --- a/arch/powerpc/kernel/exceptions-64s.S
>> +++ b/arch/powerpc/kernel/exceptions-64s.S
>> @@ -1999,8 +1999,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
>>   	mtctr	r10
>>   	bctr
>>   	.else
>> -	li	r10,MSR_RI
>> -	mtmsrd 	r10,1			/* Set RI (EE=0) */
>>   #ifdef CONFIG_RELOCATABLE
>>   	__LOAD_HANDLER(r10, system_call_common)
>>   	mtctr	r10
>> diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S
>> index f28f41a1a85a..eef61800f734 100644
>> --- a/arch/powerpc/kernel/interrupt_64.S
>> +++ b/arch/powerpc/kernel/interrupt_64.S
>> @@ -311,10 +311,10 @@ END_BTB_FLUSH_SECTION
>>   	 * nothing pending. system_call_exception() will call
>>   	 * trace_hardirqs_off().
>>   	 */
>> -	li	r11,IRQS_ALL_DISABLED
>> -	li	r12,PACA_IRQ_HARD_DIS
>> +	li	r11,IRQS_DISABLED
>> +	li	r12,-1 /* Set MSR_EE and MSR_RI */
>>   	stb	r11,PACAIRQSOFTMASK(r13)
>> -	stb	r12,PACAIRQHAPPENED(r13)
>> +	mtmsrd	r12,1
>>   
>>   	ENTER_KERNEL_SECURITY_FALLBACK
>>   
>>
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index bd0c82ac9de5..2f14ac3c377c 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1999,8 +1999,6 @@  END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
 	mtctr	r10
 	bctr
 	.else
-	li	r10,MSR_RI
-	mtmsrd 	r10,1			/* Set RI (EE=0) */
 #ifdef CONFIG_RELOCATABLE
 	__LOAD_HANDLER(r10, system_call_common)
 	mtctr	r10
diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S
index f28f41a1a85a..eef61800f734 100644
--- a/arch/powerpc/kernel/interrupt_64.S
+++ b/arch/powerpc/kernel/interrupt_64.S
@@ -311,10 +311,10 @@  END_BTB_FLUSH_SECTION
 	 * nothing pending. system_call_exception() will call
 	 * trace_hardirqs_off().
 	 */
-	li	r11,IRQS_ALL_DISABLED
-	li	r12,PACA_IRQ_HARD_DIS
+	li	r11,IRQS_DISABLED
+	li	r12,-1 /* Set MSR_EE and MSR_RI */
 	stb	r11,PACAIRQSOFTMASK(r13)
-	stb	r12,PACAIRQHAPPENED(r13)
+	mtmsrd	r12,1
 
 	ENTER_KERNEL_SECURITY_FALLBACK