Re: [PATCH bpf-next 2/2] bpf, riscv: Remove redundant bpf_flush_icache() after pack allocator finalize

From: Song Liu

Date: Mon Apr 13 2026 - 13:33:54 EST


On Mon, Apr 13, 2026 at 5:33 AM Puranjay Mohan <puranjay@xxxxxxxxxx> wrote:
>
> bpf_flush_icache() calls flush_icache_range() to clean the data cache
> and invalidate the instruction cache for the JITed code region. However,
> since commit 48a8f78c50bd ("bpf, riscv: use prog pack allocator in the
> BPF JIT"), this flush is redundant.
>
> bpf_jit_binary_pack_finalize() copies the JITed instructions to the ROX
> region via bpf_arch_text_copy() -> patch_text_nosync(), and
> patch_text_nosync() already calls flush_icache_range() on the written
> range. The subsequent bpf_flush_icache() repeats the same cache
> maintenance on an overlapping range.
>
> Remove the redundant bpf_flush_icache() call and its now-unused
> definition.
>
> Fixes: 48a8f78c50bd ("bpf, riscv: use prog pack allocator in the BPF JIT")
> Signed-off-by: Puranjay Mohan <puranjay@xxxxxxxxxx>

Acked-by: Song Liu <song@xxxxxxxxxx>

ditto on #include <asm/cacheflush.h>.