linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
To: "Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Paul\
	 Mackerras" <paulus@samba.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] powerpc/bpf: Always reallocate BPF_REG_5, BPF_REG_AX and TMP_REG when possible
Date: Fri, 14 Jan 2022 16:07:11 +0530	[thread overview]
Message-ID: <1642156339.pkhk6znoh0.naveen@linux.ibm.com> (raw)
In-Reply-To: <f6a5027a-6f3b-ee50-3439-56b5948d860a@csgroup.eu>

Christophe Leroy wrote:
> 
> 
> Le 14/01/2022 à 08:58, Naveen N. Rao a écrit :
>> Christophe Leroy wrote:
>>> BPF_REG_5, BPF_REG_AX and TMP_REG are mapped on non volatile registers
>>> because there are not enough volatile registers, but they don't need
>>> to be preserved on function calls.
>>>
>>> So when some volatile registers become available, those registers can
>>> always be reallocated regardless of whether SEEN_FUNC is set or not.
>>>
>>> Suggested-by: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>>> ---
>>>  arch/powerpc/net/bpf_jit.h        |  3 ---
>>>  arch/powerpc/net/bpf_jit_comp32.c | 14 +++++++++++---
>>>  2 files changed, 11 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
>>> index b20a2a83a6e7..b75507fc8f6b 100644
>>> --- a/arch/powerpc/net/bpf_jit.h
>>> +++ b/arch/powerpc/net/bpf_jit.h
>>> @@ -127,9 +127,6 @@
>>>  #define SEEN_FUNC    0x20000000 /* might call external helpers */
>>>  #define SEEN_TAILCALL    0x40000000 /* uses tail calls */
>>>
>>> -#define SEEN_VREG_MASK    0x1ff80000 /* Volatile registers r3-r12 */
>>> -#define SEEN_NVREG_MASK    0x0003ffff /* Non volatile registers 
>>> r14-r31 */
>>> -
>>>  #ifdef CONFIG_PPC64
>>>  extern const int b2p[MAX_BPF_JIT_REG + 2];
>>>  #else
>>> diff --git a/arch/powerpc/net/bpf_jit_comp32.c 
>>> b/arch/powerpc/net/bpf_jit_comp32.c
>>> index d3a52cd42f53..cfec42c8a511 100644
>>> --- a/arch/powerpc/net/bpf_jit_comp32.c
>>> +++ b/arch/powerpc/net/bpf_jit_comp32.c
>>> @@ -77,14 +77,22 @@ static int bpf_jit_stack_offsetof(struct 
>>> codegen_context *ctx, int reg)
>>>      return BPF_PPC_STACKFRAME(ctx) - 4;
>>>  }
>>>
>>> +#define SEEN_VREG_MASK        0x1ff80000 /* Volatile registers r3-r12 */
>>> +#define SEEN_NVREG_FULL_MASK    0x0003ffff /* Non volatile registers 
>>> r14-r31 */
>>> +#define SEEN_NVREG_TEMP_MASK    0x00001e01 /* BPF_REG_5, BPF_REG_AX, 
>>> TMP_REG */
>> 
>> Could have been named better: SEEN_NVREG_BPF_VGER_MASK, or such.
> 
> Yes, I was suffering from a lack of inspiration.
> 
> What does BPF_VGER mean ?

That I was suffering from a lack of caffeine.

I meant to suggest BPF_VREG, to indicate those are BPF volatile 
registers.


- Naveen


  reply	other threads:[~2022-01-14 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 12:29 [PATCH] powerpc/bpf: Always reallocate BPF_REG_5, BPF_REG_AX and TMP_REG when possible Christophe Leroy
2022-01-14  7:58 ` Naveen N. Rao
2022-01-14  8:03   ` Christophe Leroy
2022-01-14 10:37     ` Naveen N. Rao [this message]
2022-02-16 12:25 ` Michael Ellerman

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=1642156339.pkhk6znoh0.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.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).