[PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC64

Naveen N. Rao naveen.n.rao at linux.vnet.ibm.com
Thu Mar 3 03:40:03 AEDT 2022


Christophe Leroy wrote:
> 
> 
> Le 27/07/2021 à 08:55, Jordan Niethe a écrit :
>> Implement commit 40272035e1d0 ("powerpc/bpf: Reallocate BPF registers to
>> volatile registers when possible on PPC32") for PPC64.
>> 
>> When the BPF routine doesn't call any function, the non volatile
>> registers can be reallocated to volatile registers in order to avoid
>> having to save them/restore on the stack. To keep track of which
>> registers can be reallocated to make sure registers are set seen when
>> used.
>> 
>> Before this patch, the test #359 ADD default X is:
>>     0:   nop
>>     4:   nop
>>     8:   std     r27,-40(r1)
>>     c:   std     r28,-32(r1)
>>    10:   xor     r8,r8,r8
>>    14:   rotlwi  r8,r8,0
>>    18:   xor     r28,r28,r28
>>    1c:   rotlwi  r28,r28,0
>>    20:   mr      r27,r3
>>    24:   li      r8,66
>>    28:   add     r8,r8,r28
>>    2c:   rotlwi  r8,r8,0
>>    30:   ld      r27,-40(r1)
>>    34:   ld      r28,-32(r1)
>>    38:   mr      r3,r8
>>    3c:   blr
>> 
>> After this patch, the same test has become:
>>     0:   nop
>>     4:   nop
>>     8:   xor     r8,r8,r8
>>     c:   rotlwi  r8,r8,0
>>    10:   xor     r5,r5,r5
>>    14:   rotlwi  r5,r5,0
>>    18:   mr      r4,r3
>>    1c:   li      r8,66
>>    20:   add     r8,r8,r5
>>    24:   rotlwi  r8,r8,0
>>    28:   mr      r3,r8
>>    2c:   blr
>> 
>> Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
> 
> If this series is still applicable, it needs to be rebased of Naveen's 
> series https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=286000

Thanks for bringing this up. My apologies - I missed copying you and 
Jordan on the new series.

I have included the first patch and a variant of the second patch in 
this series, in the new series I posted. For patch 3/3, it might be 
simpler to not track temp register usage on ppc64.


Thanks,
Naveen



More information about the Linuxppc-dev mailing list