From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796307636; b=nM5DvozNk6XglOfG18DDD/cxnOe23OsXwSg4edxj7R5nAvefAf4yuErpDS5n+MWaJj3Y qkkfs4GPCzsYZHkAdyJhjDUKOlvSe8hn5zqjnV+ufJn3Syh7RfoTgh9459CkiDb07TYYa UqhBIrl7dA8cz3+r5FENJuQMNUPRs0N18KCQucGIVQYU4r9kHBEwjsoYuDARCSCjFZQQK iV/Y4BcNY0DOabQ3XaoTcPtirQafqV65478N9QSHr5xZ+apdzCA5OriaAl8DU6JZsbaZf hZ3Fc24zdrDEJvqbbF2MKw/t55Xlt2Zpyz6/5rG/fQjaXwMBVEEhlV1jHrzWXhuEZzQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796307636; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=UbmS+kwPdu6FlDInJU0fFF4FHYbGn2StjhjbuPQgWrU=; b=YxKTAEKciCP93VjUpZdbaPxbMTLvC6C+BpKT2K2OZWhPIWHA2GoaW8ruK6iuxUU/IUtA sj2uXKMQkIGL3iol+weA2hXD+ZhMPkakqLHqR1UgGixJxO78C8CYqeP6babk8pPk7iYS/ eUJK/PLxXi4A90lyPIEwtAbyraqJ87LEnInUd88RfUrHMlA4TbslVlCGBZYIiI5yuivI5 uZr2YMtFadLSVtwmdm+tujh+X7Qr121yBJ4PwUmyZuCS6y2pw3a2nPSzr/ThvXcNrek84 4xL+nr12L8vE5IvnG91bXdsAekXqU5QzjuGxlCTChp3AP+8q55xNTtXRE3wVMUebasw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cjkNWbNA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C64606A322 for ; Thu, 3 Dec 2026 14:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cjkNWbNA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3982F1F00893; Thu, 3 Dec 2026 14:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796307635; bh=UbmS+kwPdu6FlDInJU0fFF4FHYbGn2StjhjbuPQgWrU=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=cjkNWbNA3009Tdj/EKngK1C9JrzXHK3OtBAwIAoFrhsK/46jI1RDdKBi4n7SL0+zI FlJmhoIkv2yBjKIfVHuaYojRmIrpJ4YCZeMlmvSThXJRcSsvt/ydvkxEXoMH4ZIvo6 v+IMxQbBiTdABE7B9PRWYTAnUECAlGRCgvUxpSa7A8tfdXLI8s0juYMqOs2wqktNnq k1IKbbCnSNICdS0mv2uxMmWr7/kxWYBk1f+7+DfrvjU9VtIDcgZAyp8jSoNGCyzGBq 4KxQLMOUV29ePyp8CjeHakH6IotvrZtW5emoNtf55WD8yOXJlVvj4iOB2IZFW9X/Vq a56PNGipuM/mQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 01/10] riscv: store percpu offset into thread_info Reply-To: sashiko-reviews@lists.linux.dev To: "Yunhui Cui" , pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, dennis@kernel.org, tj@kernel.org, cl@gentwo.org, oleg@redhat.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, bjorn@kernel.org, pulehui@huawei.com, puranjay@kernel.org, broonie@kernel.org, dave@stgolabs.net, david.laight.linux@gmail.com, jszhang@kernel.org, tglx@kernel.org, conor.dooley@microchip.com, thuth@redhat.com, ajones@ventanamicro.com, ben.dooks@codethink.co.uk, rkrcmar@ventanamicro.com, samuel.holland@sifive.com, zong.li@sifive.com, debug@rivosinc.com, seanwascoding@gmail.com, andybnac@gmail.com, menglong8.dong@gmail.com, cyrilbur@tenstorrent.com, wangruikang@iscas.ac.cn, atishp@rivosinc.com, apatel@ventanamicro.com, arnd@arndb.de, nathan@kernel.org, nick.desaulniers+lkml@gmail.com, morbo@google.com, justinstitt@google.com, qingfang.deng@siflower.com.cn, linux-mm@kvack.org, bpf@vger.kernel.org In-Reply-To: <20261203135328.32990-2-cuiyunhui@bytedance.com> References: <20261203135328.32990-1-cuiyunhui@bytedance.com> <20261203135328.32990-2-cuiyunhui@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:20:32 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] riscv, bpf: emit_priv_stack_frame() still uses __per_cpu_offset[] -- commit 1b5c188eca72654acc3662013da85bb0d5d13b4f Author: Yunhui Cui riscv: store percpu offset into thread_info This commit caches the current CPU's per-CPU offset in thread_info, initializes it on boot and secondary CPUs, and propagates it across context switches so per-CPU accesses and the RV64 BPF JIT can load it directly. Link: https://lists.riscv.org/g/tech-privileged/topic/risc_v_tech_arch_revi= ew/113437553?page=3D2 Link: https://lore.kernel.org/r/20260826012457.ig3rfmji7vywf6kc@offworld > diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_com= p64.c > index a7a7d2f9da85a..23380d12f6163 100644 > --- a/arch/riscv/net/bpf_jit_comp64.c > +++ b/arch/riscv/net/bpf_jit_comp64.c > @@ -1466,15 +1466,8 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn,= struct rv_jit_context *ctx, > if (rd !=3D rs) > emit_mv(rd, rs, ctx); > #ifdef CONFIG_SMP > - /* Load current CPU number in T1 */ > - emit_lw(RV_REG_T1, offsetof(struct thread_info, cpu), > + emit_ld(RV_REG_T1, offsetof(struct thread_info, pcpu_offset), > RV_REG_TP, ctx); > - /* Load address of __per_cpu_offset array in T2 */ > - emit_addr(RV_REG_T2, (u64)&__per_cpu_offset, extra_pass, ctx); > - /* Get address of __per_cpu_offset[cpu] in T1 */ > - emit_sh3add(RV_REG_T1, RV_REG_T1, RV_REG_T2, ctx); > - /* Load __per_cpu_offset[cpu] in T1 */ > - emit_ld(RV_REG_T1, 0, RV_REG_T1, ctx); > /* Add the offset to Rd */ > emit_add(rd, rd, RV_REG_T1, ctx); > #endif [Severity: Low] Should emit_priv_stack_frame() in the same file also be updated to load thread_info.pcpu_offset directly? arch/riscv/net/bpf_jit_comp64.c:emit_priv_stack_frame() { ... #ifdef CONFIG_SMP emit_lw(RV_REG_T1, offsetof(struct thread_info, cpu), RV_REG_TP, ctx); emit_imm(RV_REG_T2, (u64)__per_cpu_offset, ctx); emit_sh3add(RV_REG_T1, RV_REG_T1, RV_REG_T2, ctx); emit_ld(RV_REG_T1, 0, RV_REG_T1, ctx); emit_add(RV_REG_S5, RV_REG_S5, RV_REG_T1, ctx); #endif } As written, every RV64 BPF program or subprogram using a private stack still emits the multi-instruction __per_cpu_offset[] lookup in its prologue instead of a single load from thread_info.pcpu_offset. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203135328.3299= 0-1-cuiyunhui@bytedance.com?part=3D1