diff options
author | Alexei Starovoitov <ast@kernel.org> | 2022-02-08 14:52:05 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-02-08 18:37:13 -0800 |
commit | cca62426ab493e0fc7227c5972fcbc1daee6d68e (patch) | |
tree | 764d070b52bf28ae08f8ffc2e9fae9869572bb06 | |
parent | 4172843ed4a38f97084032f74f07b2037b5da3a6 (diff) | |
parent | c1b13a9451ab9d46eefb80a2cc4b8b3206460829 (diff) | |
download | linux-cca62426ab493e0fc7227c5972fcbc1daee6d68e.tar.gz linux-cca62426ab493e0fc7227c5972fcbc1daee6d68e.tar.bz2 linux-cca62426ab493e0fc7227c5972fcbc1daee6d68e.zip |
Merge branch 'fix bpf_prog_pack build errors'
Song Liu says:
====================
Fix build errors reported by kernel test robot.
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r-- | arch/powerpc/net/bpf_jit_comp.c | 2 | ||||
-rw-r--r-- | arch/sparc/net/bpf_jit_comp_64.c | 2 | ||||
-rw-r--r-- | kernel/bpf/core.c | 6 |
3 files changed, 7 insertions, 3 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index d6ffdd0f2309..9003c313475d 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c @@ -247,7 +247,7 @@ skip_codegen_passes: fp->jited = 1; fp->jited_len = proglen + FUNCTION_DESCR_SIZE; - bpf_flush_icache(bpf_hdr, (u8 *)bpf_hdr + (bpf_hdr->pages * PAGE_SIZE)); + bpf_flush_icache(bpf_hdr, (u8 *)bpf_hdr + bpf_hdr->size); if (!fp->is_func || extra_pass) { bpf_jit_binary_lock_ro(bpf_hdr); bpf_prog_fill_jited_linfo(fp, addrs); diff --git a/arch/sparc/net/bpf_jit_comp_64.c b/arch/sparc/net/bpf_jit_comp_64.c index b1e38784eb23..fa0759bfe498 100644 --- a/arch/sparc/net/bpf_jit_comp_64.c +++ b/arch/sparc/net/bpf_jit_comp_64.c @@ -1599,7 +1599,7 @@ skip_init_ctx: if (bpf_jit_enable > 1) bpf_jit_dump(prog->len, image_size, pass, ctx.image); - bpf_flush_icache(header, (u8 *)header + (header->pages * PAGE_SIZE)); + bpf_flush_icache(header, (u8 *)header + header->size); if (!prog->is_func || extra_pass) { bpf_jit_binary_lock_ro(header); diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 306aa63fa58e..42d96549a804 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -814,7 +814,11 @@ int bpf_jit_add_poke_descriptor(struct bpf_prog *prog, * allocator. The prog_pack allocator uses HPAGE_PMD_SIZE page (2MB on x86) * to host BPF programs. */ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE #define BPF_PROG_PACK_SIZE HPAGE_PMD_SIZE +#else +#define BPF_PROG_PACK_SIZE PAGE_SIZE +#endif #define BPF_PROG_CHUNK_SHIFT 6 #define BPF_PROG_CHUNK_SIZE (1 << BPF_PROG_CHUNK_SHIFT) #define BPF_PROG_CHUNK_MASK (~(BPF_PROG_CHUNK_SIZE - 1)) @@ -826,7 +830,7 @@ struct bpf_prog_pack { unsigned long bitmap[BITS_TO_LONGS(BPF_PROG_CHUNK_COUNT)]; }; -#define BPF_PROG_MAX_PACK_PROG_SIZE HPAGE_PMD_SIZE +#define BPF_PROG_MAX_PACK_PROG_SIZE BPF_PROG_PACK_SIZE #define BPF_PROG_SIZE_TO_NBITS(size) (round_up(size, BPF_PROG_CHUNK_SIZE) / BPF_PROG_CHUNK_SIZE) static DEFINE_MUTEX(pack_mutex); |