linux/arch/x86
Mike Rapoport (Microsoft) c7a2a36182 x86/bpf: Make arch_bpf_trampoline_size allocate from EXECMEM_MODULE_DATA
Jiri Olsa reports slowdown of tracing_multi benchmark that allocates huge
number of trampolines [1].

The slowdown caused by extra protection changes in execmem_alloc_rw() and
execmem_free().

With ROX caches enabled, all execmem allocations except EXECMEM_MODULE_DATA
are ROX after the allocation. execmem_alloc_rw() temporarily sets them to
W+NX and execmem_free() resets them back to ROX.

The only user of bpf_jit_alloc_exec_rw() is x86::arch_bpf_trampoline_size()
that only needs a temporary writable buffer in the modules address space.

On x86 executable memory and module data are constrained to the same
address range, so x86::arch_bpf_trampoline_size() can directly use
execmem_alloc(EXECMEM_MODULE_DATA)

Replace the call to bpf_jit_alloc_exec_rw() with a call to
execmem_alloc(EXECMEM_MODULE_DATA) in x86::arch_bpf_trampoline_size() and
drop bpf_jit_alloc_exec_rw() helper.

Fixes: 5bf02dbf39 ("bpf, x86: Make sure allocation in arch_bpf_trampoline_size() is writable")
Reported-by: Jiri Olsa <olsajiri@gmail.com>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/all/an8r7EODLIL-bZM3@krava
Link: https://lore.kernel.org/bpf/20260818130510.3110054-1-rppt@kernel.org
2026-08-20 17:52:31 +02:00
..
boot - The usual pile of smallish cleanups and fixlets all over the place 2026-08-18 18:34:58 -07:00
coco * Fix TDX port I/O bugs 2026-08-18 17:41:36 -07:00
configs x86/64/defconfig: Add CONFIG_IRQ_REMAP 2026-03-10 19:01:37 +01:00
crypto This update includes the following changes: 2026-04-15 15:22:26 -07:00
entry Fix frame pointer unwinder when it encounters FRED stack frames 2026-08-18 17:38:30 -07:00
events - Get rid of static_cpu_has() - one less API to care about testing CPU 2026-08-18 19:09:42 -07:00
hyperv x86/msr updates for v7.3: 2026-08-18 14:02:15 -07:00
ia32
include - Get rid of static_cpu_has() - one less API to care about testing CPU 2026-08-18 19:09:42 -07:00
kernel - Get rid of static_cpu_has() - one less API to care about testing CPU 2026-08-18 19:09:42 -07:00
kvm - Get rid of static_cpu_has() - one less API to care about testing CPU 2026-08-18 19:09:42 -07:00
lib - Get rid of static_cpu_has() - one less API to care about testing CPU 2026-08-18 19:09:42 -07:00
mm Major changes: 2026-08-20 07:36:20 -07:00
net x86/bpf: Make arch_bpf_trampoline_size allocate from EXECMEM_MODULE_DATA 2026-08-20 17:52:31 +02:00
pci x86/pci: Stop using 32-bit MSR interfaces 2026-07-02 11:54:52 +02:00
platform gpio updates for v7.3-rc1 2026-08-19 09:10:07 -07:00
power PM: hibernate: x86: Remove inclusion of crypto/hash.h 2026-03-19 16:13:32 +01:00
purgatory x86/purgatory: Return bool from verify_sha256_digest() 2026-07-23 15:45:02 +02:00
realmode x86/realmode: Make the location of the trampoline configurable 2026-05-28 20:01:25 +00:00
tools x86/alternative: Drop smp_locks glue 2026-07-13 09:23:36 -07:00
um Mostly cleanups and small things, notably: 2026-04-20 16:36:46 -07:00
video x86/video: Only fall back to vga_default_device() without screen info 2026-07-07 08:14:55 -07:00
virt x86/msr updates for v7.3: 2026-08-18 14:02:15 -07:00
xen * Fix pkey_alloc() return value when pkeys are not supported 2026-08-18 17:44:09 -07:00
.gitignore
Kbuild
Kconfig gpio updates for v7.3-rc1 2026-08-19 09:10:07 -07:00
Kconfig.assembler
Kconfig.cpu - The usual pile of cleanups and fixlets the cat dragged in 2026-06-16 05:41:22 +05:30
Kconfig.cpufeatures x86/cpu: Make CONFIG_X86_CX8 unconditional 2026-06-11 10:25:40 +02:00
Kconfig.debug
Makefile x86/cpu updates for v7.2: 2026-06-15 15:25:17 +05:30
Makefile_32.cpu x86/cpu, cpufreq: Remove AMD ELAN support 2026-05-08 07:34:03 +02:00
Makefile.um rust: kasan/kbuild: fix rustc-option when cross-compiling 2026-05-26 09:44:54 +02:00