All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: David Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org
Subject: Re: [PATCH RFC] sparc64: eBPF JIT
Date: Mon, 17 Apr 2017 22:55:01 +0200	[thread overview]
Message-ID: <58F52BA5.1090808@iogearbox.net> (raw)
In-Reply-To: <20170417.150326.345314944044934203.davem@davemloft.net>

On 04/17/2017 09:03 PM, David Miller wrote:
> From: Daniel Borkmann <daniel@iogearbox.net>
> Date: Mon, 17 Apr 2017 20:44:35 +0200
>
>> On 04/17/2017 05:38 AM, David Miller wrote:
>>> +/* Map BPF registers to SPARC registers */
>>> +static const int bpf2sparc[] = {
>>> + /* return value from in-kernel function, and exit value from eBPF */
>>> +	[BPF_REG_0] = I5,
>>> +
>>> +	/* arguments from eBPF program to in-kernel function */
>>> +	[BPF_REG_1] = I0,
>>> +	[BPF_REG_2] = I1,
>>> +	[BPF_REG_3] = I2,
>>> +	[BPF_REG_4] = I3,
>>> +	[BPF_REG_5] = I4,
>>> +
>>> + /* callee saved registers that in-kernel function will preserve */
>>> +	[BPF_REG_6] = L0,
>>> +	[BPF_REG_7] = L1,
>>> +	[BPF_REG_8] = L2,
>>> +	[BPF_REG_9] = L3,
>>> +
>>> +	/* read-only frame pointer to access stack */
>>> +	[BPF_REG_FP] = FP,
>>
>> On a quick initial glance, you also need to map BPF_REG_AX. If
>> I understand the convention correctly, you could use L7 for that.
>>
>> You can test for it through tools/testing/selftests/bpf/test_kmod.sh
>> which exercises the test_bpf.ko under various sysctl combinations as
>> part of the BPF selftest suite.
>
> Oh I see, it's used for constant blinding.  I can use a global register
> for that since it's only used as a temporary right?

Yeah, correct.

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Borkmann <daniel@iogearbox.net>
To: David Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org
Subject: Re: [PATCH RFC] sparc64: eBPF JIT
Date: Mon, 17 Apr 2017 20:55:01 +0000	[thread overview]
Message-ID: <58F52BA5.1090808@iogearbox.net> (raw)
In-Reply-To: <20170417.150326.345314944044934203.davem@davemloft.net>

On 04/17/2017 09:03 PM, David Miller wrote:
> From: Daniel Borkmann <daniel@iogearbox.net>
> Date: Mon, 17 Apr 2017 20:44:35 +0200
>
>> On 04/17/2017 05:38 AM, David Miller wrote:
>>> +/* Map BPF registers to SPARC registers */
>>> +static const int bpf2sparc[] = {
>>> + /* return value from in-kernel function, and exit value from eBPF */
>>> +	[BPF_REG_0] = I5,
>>> +
>>> +	/* arguments from eBPF program to in-kernel function */
>>> +	[BPF_REG_1] = I0,
>>> +	[BPF_REG_2] = I1,
>>> +	[BPF_REG_3] = I2,
>>> +	[BPF_REG_4] = I3,
>>> +	[BPF_REG_5] = I4,
>>> +
>>> + /* callee saved registers that in-kernel function will preserve */
>>> +	[BPF_REG_6] = L0,
>>> +	[BPF_REG_7] = L1,
>>> +	[BPF_REG_8] = L2,
>>> +	[BPF_REG_9] = L3,
>>> +
>>> +	/* read-only frame pointer to access stack */
>>> +	[BPF_REG_FP] = FP,
>>
>> On a quick initial glance, you also need to map BPF_REG_AX. If
>> I understand the convention correctly, you could use L7 for that.
>>
>> You can test for it through tools/testing/selftests/bpf/test_kmod.sh
>> which exercises the test_bpf.ko under various sysctl combinations as
>> part of the BPF selftest suite.
>
> Oh I see, it's used for constant blinding.  I can use a global register
> for that since it's only used as a temporary right?

Yeah, correct.

  reply	other threads:[~2017-04-17 20:55 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17  3:38 [PATCH RFC] sparc64: eBPF JIT David Miller
2017-04-17  3:38 ` David Miller
2017-04-17 18:44 ` Daniel Borkmann
2017-04-17 18:44   ` Daniel Borkmann
2017-04-17 19:03   ` David Miller
2017-04-17 19:03     ` David Miller
2017-04-17 20:55     ` Daniel Borkmann [this message]
2017-04-17 20:55       ` Daniel Borkmann
2017-04-17 20:12   ` David Miller
2017-04-17 20:12     ` David Miller
2017-04-21 16:46   ` David Miller
2017-04-21 16:46     ` David Miller
2017-04-21 16:50     ` Daniel Borkmann
2017-04-21 16:50       ` Daniel Borkmann
2017-04-21 18:49     ` Alexei Starovoitov
2017-04-21 18:49       ` Alexei Starovoitov
2017-04-21 19:02       ` David Miller
2017-04-21 19:02         ` David Miller
2017-04-21 19:26         ` Alexei Starovoitov
2017-04-21 19:26           ` Alexei Starovoitov
2017-04-21 19:41           ` David Miller
2017-04-21 19:41             ` David Miller
2017-04-17 23:27 ` Alexei Starovoitov
2017-04-17 23:27   ` Alexei Starovoitov
2017-04-18  1:12   ` David Miller
2017-04-18  1:12     ` David Miller
2017-04-18  5:44     ` Alexei Starovoitov
2017-04-18  5:44       ` Alexei Starovoitov
2017-04-18 18:37       ` David Miller
2017-04-18 18:37         ` David Miller
2017-04-18 22:57         ` Alexei Starovoitov
2017-04-18 22:57           ` Alexei Starovoitov
2017-04-19  2:27           ` David Miller
2017-04-19  2:27             ` David Miller
2017-04-22  1:19           ` David Miller
2017-04-22  1:19             ` David Miller

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=58F52BA5.1090808@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.