linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Jordan Niethe <jniethe5@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC64
Date: Fri, 07 Jan 2022 23:28:44 +0530	[thread overview]
Message-ID: <1641576378.y0c7p3in1e.naveen@linux.ibm.com> (raw)
In-Reply-To: <0c70202c-54f7-78e7-0091-0dfa8e6ab207@csgroup.eu>

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.
> 
> Maybe you could try and do as on PPC32, try to use r0 as much as possible instead of TMP regs.
> r0 needs to be used carefully because for some instructions (ex: addi, lwz, etc) r0 means 0 instead 
> of register 0, but it would help freeing one more register in several cases.

Yes, but I think the utility of register re-mapping is debatable on 
ppc64 since we are using NVRs only for BPF NVRs. Unlike the savings seen 
with the test case shown in the commit description (and with other test 
programs in test_bpf), most real world BPF programs will be generated by 
llvm which will only use the NVRs if necessary. I also suspect that most 
BPF programs will end up making at least one helper call.

On ppc32 though, there is value in re-mapping registers, especially 
BPF_REG_AX and TMP_REG, and to a lesser extent, BPF_REG_5, since those 
are volatile BPF registers and can be remapped regardless of a helper 
call.


- Naveen


  reply	other threads:[~2022-01-07 17:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  6:55 [PATCH 1/3] powerpc64/bpf: Store temp registers' bpf to ppc mapping Jordan Niethe
2021-07-27  6:55 ` [PATCH 2/3] powerpc/bpf: Use helper for mapping bpf to ppc registers on PPC64 Jordan Niethe
2022-01-07 17:25   ` Naveen N. Rao
2021-07-27  6:55 ` [PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible " Jordan Niethe
2021-08-05  8:21   ` Christophe Leroy
2022-01-07 17:58     ` Naveen N. Rao [this message]
2022-02-22 14:23   ` Christophe Leroy
2022-03-02 16:40     ` Naveen N. Rao
2022-01-07 17:13 ` [PATCH 1/3] powerpc64/bpf: Store temp registers' bpf to ppc mapping Naveen N. Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1641576378.y0c7p3in1e.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=jniethe5@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).