[PATCH] powerpc/bpf: Only update ldimm64 during extra pass when it is an address

Christophe Leroy christophe.leroy at csgroup.eu
Thu Nov 24 23:24:40 AEDT 2022



Le 24/11/2022 à 11:13, Naveen N. Rao a écrit :
> Christophe Leroy wrote:
>> ldimm64 is not only used for loading function addresses, and
> 
> That's probably true today, but I worry that that can change upstream 
> and we may not notice at all.

Not sure what you mean.

Today POWERPC considers that ldimm64 is _always_ loading a function 
address whereas upstream BPF considers that ldimm64 is a function only 
when it is flagged BPF_PSEUDO_FUNC.

In what direction could that change in the future ?

For me if they change that it becomes an API change.

Christophe


> 
>> the NOPs added for padding are impacting performance, so avoid
>> them when not necessary.
>>
>> On QEMU mac99, with the patch:
>>
>> test_bpf: #829 ALU64_MOV_K: all immediate value magnitudes jited:1 
>> 167436810 PASS
>> test_bpf: #831 ALU64_OR_K: all immediate value magnitudes jited:1 
>> 170702940 PASS
>>
>> Without the patch:
>>
>> test_bpf: #829 ALU64_MOV_K: all immediate value magnitudes jited:1 
>> 173012360 PASS
>> test_bpf: #831 ALU64_OR_K: all immediate value magnitudes jited:1 
>> 176424090 PASS
>>
>> That's a 3.5% performance improvement.
> 
> A better approach would be to do a full JIT during the extra pass. 
> That's what most other architectures do today. And, as long as we can 
> ensure that the JIT'ed program size can never increase during the extra 
> pass, we should be ok to do a single extra pass.
> 
> 
> - Naveen


More information about the Linuxppc-dev mailing list