Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa9dd599 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by Alexei Starovoitov
Browse files

bpf: get rid of pure_initcall dependency to enable jits



Having a pure_initcall() callback just to permanently enable BPF
JITs under CONFIG_BPF_JIT_ALWAYS_ON is unnecessary and could leave
a small race window in future where JIT is still disabled on boot.
Since we know about the setting at compilation time anyway, just
initialize it properly there. Also consolidate all the individual
bpf_jit_enable variables into a single one and move them under one
location. Moreover, don't allow for setting unspecified garbage
values on them.

Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 87c1793b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@

#include "bpf_jit_32.h"

int bpf_jit_enable __read_mostly;

#define STACK_OFFSET(k)	(k)
#define TMP_REG_1	(MAX_BPF_JIT_REG + 0)	/* TEMP Register 1 */
#define TMP_REG_2	(MAX_BPF_JIT_REG + 1)	/* TEMP Register 2 */
+0 −2
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@

#include "bpf_jit.h"

int bpf_jit_enable __read_mostly;

#define TMP_REG_1 (MAX_BPF_JIT_REG + 0)
#define TMP_REG_2 (MAX_BPF_JIT_REG + 1)
#define TCALL_CNT (MAX_BPF_JIT_REG + 2)
+0 −2
Original line number Diff line number Diff line
@@ -1207,8 +1207,6 @@ static int build_body(struct jit_ctx *ctx)
	return 0;
}

int bpf_jit_enable __read_mostly;

void bpf_jit_compile(struct bpf_prog *fp)
{
	struct jit_ctx ctx;
+0 −2
Original line number Diff line number Diff line
@@ -177,8 +177,6 @@ static u32 b_imm(unsigned int tgt, struct jit_ctx *ctx)
		(ctx->idx * 4) - 4;
}

int bpf_jit_enable __read_mostly;

enum which_ebpf_reg {
	src_reg,
	src_reg_no_fp,
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@

#include "bpf_jit32.h"

int bpf_jit_enable __read_mostly;

static inline void bpf_flush_icache(void *start, void *end)
{
	smp_wmb();
Loading