linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: daniel@iogearbox.net (Daniel Borkmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 net-next] arm: eBPF JIT compiler
Date: Tue, 22 Aug 2017 17:08:23 +0200	[thread overview]
Message-ID: <599C48E7.3000409@iogearbox.net> (raw)
In-Reply-To: <1503383772-5788-1-git-send-email-illusionist.neo@gmail.com>

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?

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
>   }

  parent reply	other threads:[~2017-08-22 15:08 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 [this message]
2017-08-22 15:25   ` Daniel Borkmann
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=599C48E7.3000409@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=linux-arm-kernel@lists.infradead.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).