Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1717502
| From | Daniel Borkmann <daniel@iogearbox.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 net-next] arm: eBPF JIT compiler |
| Date | 2017-08-22 17:30 +0200 |
| Message-ID | <uhjhT-4dB-13@gated-at.bofh.it> (permalink) |
| References | <uhb10-6Xp-13@gated-at.bofh.it> <uhiYy-45R-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
>> }
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH v4 net-next] arm: eBPF JIT compiler Daniel Borkmann <daniel@iogearbox.net> - 2017-08-22 17:10 +0200 Re: [PATCH v4 net-next] arm: eBPF JIT compiler Daniel Borkmann <daniel@iogearbox.net> - 2017-08-22 17:30 +0200
csiph-web