netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Shubham Bansal <illusionist.neo@gmail.com>,
	linux@armlinux.org.uk, davem@davemloft.net
Cc: netdev@vger.kernel.org, ast@fb.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, keescook@chromium.org
Subject: Re: [PATCH v4 net-next] arm: eBPF JIT compiler
Date: Tue, 22 Aug 2017 17:25:54 +0200	[thread overview]
Message-ID: <599C4D02.7090901@iogearbox.net> (raw)
In-Reply-To: <599C48E7.3000409@iogearbox.net>

On 08/22/2017 05:08 PM, Daniel Borkmann wrote:
> On 08/22/2017 08:36 AM, Shubham Bansal wrote:
> [...]
>> +
>> +static int out_offset = -1; /* initialized on the first pass of build_body() */
>
> Hm, why is this a global var actually? There can be
> multiple parallel calls to bpf_int_jit_compile(), we
> don't take a global lock on this. Unless I'm missing
> something this should really reside in jit_ctx, no?

Hm, okay, it's for generating the out jmp offsets in
tail call emission which are supposed to always be the
same relative offsets; should be fine then.

> Given this is on emit_bpf_tail_call(), did you get
> tail calls working the way I suggested to test?
>
>> +static int emit_bpf_tail_call(struct jit_ctx *ctx)
>>   {
> [...]
>> +    const int idx0 = ctx->idx;
>> +#define cur_offset (ctx->idx - idx0)
>> +#define jmp_offset (out_offset - (cur_offset))
> [...]
>> +
>> +    /* out: */
>> +    if (out_offset == -1)
>> +        out_offset = cur_offset;
>> +    if (cur_offset != out_offset) {
>> +        pr_err_once("tail_call out_offset = %d, expected %d!\n",
>> +                cur_offset, out_offset);
>> +        return -1;
>> +    }
>> +    return 0;
>> +#undef cur_offset
>> +#undef jmp_offset
>>   }

  reply	other threads:[~2017-08-22 15:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22  6:36 [PATCH v4 net-next] arm: eBPF JIT compiler Shubham Bansal
2017-08-22  7:18 ` Shubham Bansal
2017-08-22 15:08 ` Daniel Borkmann
2017-08-22 15:25   ` Daniel Borkmann [this message]
2017-08-22 16:32 ` David Miller
2017-08-23  3:05   ` Shubham Bansal
  -- strict thread matches above, loose matches on Subject: below --
2017-08-22  6:34 Shubham Bansal
2017-08-22  7:30 ` Shubham Bansal

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=599C4D02.7090901@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@fb.com \
    --cc=davem@davemloft.net \
    --cc=illusionist.neo@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@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 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).