[PATCH v1 2/4] powerpc/ftrace: Refactor ftrace_{regs_}caller

Christophe Leroy christophe.leroy at csgroup.eu
Fri Mar 4 04:39:51 AEDT 2022



Le 03/03/2022 à 17:59, Naveen N. Rao a écrit :
> Christophe Leroy wrote:
>> ftrace_caller() and frace_regs_caller() have now a lot in common.
>>
>> Refactor them using GAS macros.
> 
> Thanks for doing this - this looks much better.
> 
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
>> ---
>>  arch/powerpc/kernel/trace/ftrace_mprofile.S | 147 ++++++--------------
>>  1 file changed, 45 insertions(+), 102 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/trace/ftrace_mprofile.S 
>> b/arch/powerpc/kernel/trace/ftrace_mprofile.S
>> index 76dab07fd8fd..630b2de9957b 100644
>> --- a/arch/powerpc/kernel/trace/ftrace_mprofile.S
>> +++ b/arch/powerpc/kernel/trace/ftrace_mprofile.S
>> @@ -32,7 +32,7 @@
>>   * Our job is to save the register state into a struct pt_regs (on 
>> the stack)
>>   * and then arrange for the ftrace function to be called.
>>   */
>> -_GLOBAL(ftrace_regs_caller)
>> +.macro    ftrace_regs_entry allregs
>>      /* Save the original return address in A's stack frame */
>>  #ifdef CONFIG_MPROFILE_KERNEL
>>      PPC_STL    r0,LRSAVE(r1)
>> @@ -43,7 +43,7 @@ _GLOBAL(ftrace_regs_caller)
>>
>>      /* Save all gprs to pt_regs */
>>      SAVE_GPR(0, r1)
>> -    SAVE_GPRS(2, 11, r1)
>> +    SAVE_GPRS(3, 10, r1)
>>
>>  #ifdef CONFIG_PPC64
>>      /* Ok to continue? */
>> @@ -52,17 +52,29 @@ _GLOBAL(ftrace_regs_caller)
>>      beq    ftrace_no_trace
>>  #endif
> 
> The ability to disable ftrace in certain code paths through 
> paca_struct->ftrace_enabled will also be relevant on ppc32 - it will be 
> nice if it can be introduced there.

Ah ? I understood from commit ea678ac627e0 ("powerpc64/ftrace: Add a 
field in paca to disable ftrace in unsafe code paths") that it was for 
when it runs in real mode. PPC32 doesn't run any C code in real mode.

Are there any other situations that real_mode where we'd like to disable 
it ? If so we could use the thread_struct as we don't have paca on PPC32.


Christophe


More information about the Linuxppc-dev mailing list