From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796041276; b=lUS+cg7X/C7IA/cNrqpbM06Ot4NjZECDZq06v+0IQlLWN1cGZKYhPOb3xbkkskLwF1qK vb43Sagy0k5H6YS1hgoWclxG25PrNkpR0lUoAacML5k5mcyb8JZ3/ODEAeqjmLSmx0mxB FbNwR06ZMsVXwZYXw9v+3u8eNOkIOld7Ot99RmKj30Finwe4UD4JKzimUl+5v1a7cpp2Y kA4Ywmn6OhW7uGYsu1rrIDAIAHuG8mOK9cgSZwdQbeZ+soaR+G5+sa9y7tUnG9HphqlJn h3YFqpeV3ORcIgYrRyjeblQ+JP0I+Aye7vTqrbp5i7V+78jVC0+C4XFXbG+JWDdHBMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796041276; h=DMARC-Filter:Received:Received:Subject:To:Cc:References:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To:Content-Type: Content-Language:Content-Transfer-Encoding:X-CM-TRANSID: X-CM-SenderInfo:X-Coremail-Antispam; bh=40k8x5dOe1GaVCWx2Arz1yt8p89FfaRS0fuzTypMT7A=; b=LBmGEpXqXI6fdk8pcRQ3SeOPTuFHo0UoBHjdnX/wn+JEnXh0ajPOwMHs8IgXxsW+KMEF lXOB859zyTarbaWnPZ0Tz0bLiCORP6u8+lI7hcH4WxJ3lWufDe0BPytfGjLiekE83rss2 ZKDDho1EX79CMnJgaFp4xkEF8lRlMjBg1/Uht3vNmCV3t6W3JtWQq5uqFe3kDkwdJAtDF OkRScZ7KqGivdDaL+tsORykeaXgOJMRvZrqJTzYd8mgx+DdS53T6kPqCqtsHxSdNsdEhI 1Cin3NqPyhgSvkmJeTskuHiUc6Q1jkcBxmTljjV5qFPvLZkofYSHS1YWYHwEpvBH9Gw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.remote-ip=114.242.206.163 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4943606A32C; Mon, 30 Nov 2026 12:21:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C4943606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [123.138.236.242]) by gateway (Coremail) with SMTP id _____8CxyLU4ag1rvkgkAA--.8736S3; Mon, 30 Nov 2026 20:21:12 +0800 (CST) Received: from [127.0.0.1] (unknown [123.138.236.242]) by front1 (Coremail) with SMTP id qMiowJDxg8w1ag1rCEc4AA--.17830S2; Mon, 30 Nov 2026 20:21:10 +0800 (CST) Subject: Re: [PATCH bpf-next v1] riscv, bpf: Remove invoke_bpf_mod_ret in code comment To: Pu Lehui , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Puranjay Mohan Cc: linux-riscv@lists.infradead.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261130090000.2848-1-yangtiezhu@loongson.cn> <676a79e8-2c68-4d04-85c1-ab94ea7656cf@huawei.com> From: Tiezhu Yang Message-ID: <0e7d9ed9-bfa2-a66d-c6b5-76427dddcf7d@loongson.cn> Date: Mon, 30 Nov 2026 20:21:08 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 In-Reply-To: <676a79e8-2c68-4d04-85c1-ab94ea7656cf@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: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VWU CwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r 1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBI daVFxhVjvjDU0xZFpf9x07jYSoJUUUUU= On 11/30/26 7:56 PM, Pu Lehui wrote: > > > On 2026/11/30 17:00, Tiezhu Yang wrote: >> There is no function invoke_bpf_mod_ret(), remove it in the code comment >> to reflect the reality. >> >> Signed-off-by: Tiezhu Yang >> --- >> I guess this is a copy-paste issue from other architectures, >> because there was already no invoke_bpf_mod_ret() in the initial >> commit 49b5e77ae3e2 ("riscv, bpf: Add bpf trampoline support for RV64"): >> >> $ grep -rn "branches saved in invoke_bpf_mod_ret with" . >> ./arch/x86/net/bpf_jit_comp.c:4552:        /* Update the branches >> saved in invoke_bpf_mod_ret with the >> ./arch/arm64/net/bpf_jit_comp.c:3524:    /* update the branches saved >> in invoke_bpf_mod_ret with cbnz */ >> ./arch/powerpc/net/bpf_jit_comp.c:1150:    /* Update branches saved in >> invoke_bpf_mod_ret with address of do_fexit */ >> ./arch/riscv/net/bpf_jit_comp64.c:1300:    /* update branches saved in >> invoke_bpf_mod_ret with bnez */ >> >>   arch/riscv/net/bpf_jit_comp64.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/riscv/net/bpf_jit_comp64.c >> b/arch/riscv/net/bpf_jit_comp64.c >> index a7a7d2f9da85..fb58524cd095 100644 >> --- a/arch/riscv/net/bpf_jit_comp64.c >> +++ b/arch/riscv/net/bpf_jit_comp64.c >> @@ -1297,7 +1297,7 @@ static int __arch_prepare_bpf_trampoline(struct >> bpf_tramp_image *im, >>           emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx); >>       } >> -    /* update branches saved in invoke_bpf_mod_ret with bnez */ > > I think this is a bit vague. How about: > /* patch fmod_ret nops with bnez to skip orig_call */ > >> +    /* update branches with bnez */ >>       for (i = 0; ctx->insns && i < fmod_ret->nr_nodes; i++) { >>           offset = ninsns_rvoff(ctx->ninsns - branches_off[i]); >>           insn = rv_bne(RV_REG_T1, RV_REG_ZERO, offset >> 1); The reason I wrote /* update branches with bnez */ is to keep it symmetric with the earlier comment /* update branch with beqz */ in invoke_bpf_prog(), and also consistent with the LoongArch BPF JIT implementation (arch/loongarch/net/bpf_jit.c), which uses the exact same phrasing in both places. Also, branches_off[] is populated right above this loop with the comment /* nop reserved for conditional jump */, so the context is quite close and clear here. I am fine with either way, let's see what Björn and Puranjay think, and I can send a v2 if the more descriptive comment is preferred. Thanks, Tiezhu