[PATCH 04/14] powerpc/64s: avoid reloading (H)SRR registers if they are still valid

Nicholas Piggin npiggin at gmail.com
Sun Apr 4 10:51:27 AEST 2021


Excerpts from Michael Ellerman's message of April 3, 2021 12:28 pm:
> Nicholas Piggin <npiggin at gmail.com> writes:
>> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
>> index ccf913cedd29..b466b3e1bb3f 100644
>> --- a/arch/powerpc/kernel/entry_64.S
>> +++ b/arch/powerpc/kernel/entry_64.S
>> @@ -64,6 +64,30 @@ exception_marker:
>>  	.section	".text"
>>  	.align 7
>>  
>> +.macro DEBUG_SRR_VALID srr
>> +#ifdef CONFIG_PPC_RFI_SRR_DEBUG
>> +	.ifc \srr,srr
>> +	mfspr	r11,SPRN_SRR0
>> +	ld	r12,_NIP(r1)
>> +100:	tdne	r11,r12
>> +	EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> 
> This always points at *this* line, not the caller. Works better with the
> patch below.

Good thinking.

Thanks,
Nick

> 
> cheers
> 
> 
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index b466b3e1bb3f..ada76b1279f9 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -64,26 +64,26 @@
>  	.section	".text"
>  	.align 7
>  
> -.macro DEBUG_SRR_VALID srr
> +.macro DEBUG_SRR_VALID srr line
>  #ifdef CONFIG_PPC_RFI_SRR_DEBUG
>  	.ifc \srr,srr
>  	mfspr	r11,SPRN_SRR0
>  	ld	r12,_NIP(r1)
>  100:	tdne	r11,r12
> -	EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> +	EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
>  	mfspr	r11,SPRN_SRR1
>  	ld	r12,_MSR(r1)
>  100:	tdne	r11,r12
> -	EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> +	EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
>  	.else
>  	mfspr	r11,SPRN_HSRR0
>  	ld	r12,_NIP(r1)
>  100:	tdne	r11,r12
> -	EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> +	EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
>  	mfspr	r11,SPRN_HSRR1
>  	ld	r12,_MSR(r1)
>  100:	tdne	r11,r12
> -	EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> +	EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
>  	.endif
>  #endif
>  .endm
> @@ -358,7 +358,7 @@ END_BTB_FLUSH_SECTION
>  	mtspr	SPRN_SRR0,r4
>  	mtspr	SPRN_SRR1,r5
>  1:
> -	DEBUG_SRR_VALID srr
> +	DEBUG_SRR_VALID srr __LINE__
>  
>  BEGIN_FTR_SECTION
>  	stdcx.	r0,0,r1			/* to clear the reservation */
> @@ -753,7 +753,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
>  	stb	r4,PACAHSRR_VALID(r13)
>  #endif
>  	.endif
> -	DEBUG_SRR_VALID \srr
> +	DEBUG_SRR_VALID \srr __LINE__
>  
>  BEGIN_FTR_SECTION
>  	stdcx.	r0,0,r1		/* to clear the reservation */
> @@ -825,7 +825,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
>  	stb	r4,PACAHSRR_VALID(r13)
>  #endif
>  	.endif
> -	DEBUG_SRR_VALID \srr
> +	DEBUG_SRR_VALID \srr __LINE__
>  
>  BEGIN_FTR_SECTION
>  	stdcx.	r0,0,r1		/* to clear the reservation */
> 


More information about the Linuxppc-dev mailing list