From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3E60F34C4E for ; Mon, 13 Apr 2026 12:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yMwzKSAQYBUNnvboAIcOWmrY4eXJBg6RwT9EFq08eRY=; b=LEBy3Ii262UwFK Y4C48AJYYGfmbZbFHjzVHX6Kh95ItH5SX3CGTTOmI7A7MdWxXpO+2sJhCJIQpmxYg+uHm/BklO74l NfEtAPAnI8hhguX53Xvtp1unGPw/sbMZH/aLsg7Ml/qaJ2aIiL60YbLX9SyLnyhr1PNLWcMNQI0sD oYuRgamhS0ZkWH82EyAjoucdKanPMslz4sRmqgRx3ck94N6bCxJ4HddrLV/5UweSgyIHZlwU+WCD9 ch3nPJQ9jKezHShylU3OL4cBSG1JP9Bi1Mq2Hm4AFFKwXOwLe3wDXhN8s9m0vFOX0Twj6QUAN3Mcz SgMCu5Z+0RTs/JBBJNvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wCGTy-0000000FeSi-1yJP; Mon, 13 Apr 2026 12:33:38 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wCGTv-0000000FeRI-3IVp; Mon, 13 Apr 2026 12:33:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id A179743F68; Mon, 13 Apr 2026 12:33:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C778C2BCAF; Mon, 13 Apr 2026 12:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776083614; bh=s2vi1gMOe/zR29r19y5FbZV0U3O5/J47TujbBaojO2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tyVdMkfK4Oedgp2gw/N++DpkgaKb8l8tqh6RNQQu+m78z4PZX76lWAkk7uCa7uTzw WjO4QNoNAx8PaoFPUDio7r7lHUblHPTnjKE+CSKp2IFpaRCr2O7H7qA+Ov33NVq9/7 6oqMi2QvgGZ6rInIBaUEcu4wIsjD+tRbVYAmw6sIJvml1IF7ow6rvdRSr3DOLeIk1J Gx72Cfs3ZAm26IK48vwf1zqZr1sSng05KRjk1fpTRty7IiznAstw4qSYj016I6PnKz iggPuonwpdFCEul7W4eCW05XVHjsdAQq5jw6sisOiWjot2aosVsu/Oa7PqOLokO80m TiydTUzKdzQkw== From: Puranjay Mohan To: bpf@vger.kernel.org Cc: Puranjay Mohan , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Xu Kuohai , Catalin Marinas , Will Deacon , Luke Nelson , Xi Wang , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Pu Lehui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 2/2] bpf, riscv: Remove redundant bpf_flush_icache() after pack allocator finalize Date: Mon, 13 Apr 2026 05:32:55 -0700 Message-ID: <20260413123256.3296452-3-puranjay@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260413123256.3296452-1-puranjay@kernel.org> References: <20260413123256.3296452-1-puranjay@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260413_053335_867361_C6DE4369 X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 --- arch/riscv/net/bpf_jit.h | 5 ----- arch/riscv/net/bpf_jit_core.c | 7 ------- 2 files changed, 12 deletions(-) diff --git a/arch/riscv/net/bpf_jit.h b/arch/riscv/net/bpf_jit.h index 632ced07bca4..549537cad86b 100644 --- a/arch/riscv/net/bpf_jit.h +++ b/arch/riscv/net/bpf_jit.h @@ -105,11 +105,6 @@ static inline void bpf_fill_ill_insns(void *area, unsigned int size) memset(area, 0, size); } -static inline void bpf_flush_icache(void *start, void *end) -{ - flush_icache_range((unsigned long)start, (unsigned long)end); -} - /* Emit a 4-byte riscv instruction. */ static inline void emit(const u32 insn, struct rv_jit_context *ctx) { diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c index b3581e926436..f7fd4afc3ca3 100644 --- a/arch/riscv/net/bpf_jit_core.c +++ b/arch/riscv/net/bpf_jit_core.c @@ -183,13 +183,6 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog = orig_prog; goto out_offset; } - /* - * The instructions have now been copied to the ROX region from - * where they will execute. - * Write any modified data cache blocks out to memory and - * invalidate the corresponding blocks in the instruction cache. - */ - bpf_flush_icache(jit_data->ro_header, ctx->ro_insns + ctx->ninsns); for (i = 0; i < prog->len; i++) ctx->offset[i] = ninsns_rvoff(ctx->offset[i]); bpf_prog_fill_jited_linfo(prog, ctx->offset); -- 2.52.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv