bpf: Eliminate CONFIG_MODULES limitation from JIT for arm64

CONFIG_MODULES is only needed for its memory allocator, which is trivial
to add back into arm64 when modules aren't enabled. Do so in order to
take advantage of JIT compilation when CONFIG_MODULES=n.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Sultan Alsawaf 2021-03-03 22:09:28 -08:00 committed by azrim
parent 0ea2d91e4a
commit e2f6ca9fc8
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
3 changed files with 12 additions and 3 deletions

View File

@ -17,7 +17,7 @@ CFLAGS_setup.o = -DUTS_MACHINE='"$(UTS_MACHINE)"'
arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
entry-fpsimd.o process.o ptrace.o setup.o signal.o \
sys.o stacktrace.o time.o traps.o io.o vdso.o \
hyp-stub.o psci.o cpu_ops.o insn.o \
hyp-stub.o psci.o cpu_ops.o insn.o module.o \
return_address.o cpuinfo.o cpu_errata.o \
cpufeature.o alternative.o cacheinfo.o \
smp.o smp_spin_table.o topology.o smccc-call.o
@ -31,7 +31,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
sys_compat.o entry32.o
arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o
arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o
arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o
arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_trace_counters.o \

View File

@ -30,6 +30,7 @@
#include <asm/insn.h>
#include <asm/sections.h>
#if defined(CONFIG_MODULES) || defined(CONFIG_BPF_JIT)
void *module_alloc(unsigned long size)
{
u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
@ -71,6 +72,13 @@ void *module_alloc(unsigned long size)
return p;
}
void module_memfree(void *module_region)
{
vfree(module_region);
}
#endif /* CONFIG_MODULES || CONFIG_BPF_JIT */
#ifdef CONFIG_MODULES
enum aarch64_reloc_op {
RELOC_OP_NONE,
RELOC_OP_ABS,
@ -434,3 +442,4 @@ int module_finalize(const Elf_Ehdr *hdr,
return 0;
}
#endif /* CONFIG_MODULES */

View File

@ -286,7 +286,7 @@ config BQL
config BPF_JIT
bool "enable BPF Just In Time compiler"
depends on HAVE_CBPF_JIT || HAVE_EBPF_JIT
depends on MODULES
depends on MODULES || ARM64
---help---
Berkeley Packet Filter filtering capabilities are normally handled
by an interpreter. This option allows kernel to generate a native