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=1796307572; b=H0JdyuBqWZGt/CKv4hmvOXHAXIxS/tF0EO3nqnSBugAPeSBjdZu3tL6O5dmAqY0thgr3 wvv9kyjtPIJjxocxCefl3QReNLT1Gd1DC5kK5JoXEe+yp/1StIebJt5vpVSW6NJ45u9hy 0ePeSS06kAReat3xWsjbH/HmiQ4uDLWyd+GRPXY/KiSP6jdbrQ47vUjj7GVptwU5J1p5o I4OoZCmgCZMSZEb64fPcSaAamzE1WbVfYsW4gqBAt1JGQjyO1DUp0OYVX2zKFaPV/0v6h EczazXeieAN/umIsJxQrTTrrlXkLpJ41NI4lsUGiN2t5heUTpibnTYz98vxYq3xxukg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796307572; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Q8ZyLAJJwE3SYyR7UivtH64AwYlKU1C1Fld57nIkNPw=; b=xIfQO6DQ8tnhJVd9WOXqmvXH7r3nziKXgIS3d3dmxNgJjQtdct+bAX7HiBMFZlBRVCrR LH6hBgNsvu1RQNveQ5yiyy2SVl+p5hjalgfGMqX5zSO12QZlOzQdl8eJdraRIAnKXPgrN FY781l5jyMF02rOJ//Dh6HV1lkgA6HDGPyR8cqpwfwyjp5ygtO0aHWJxS6eubFT1Gcm8a 0YlUPPX2ndAX8unjxLk1SARj2E7akk4H1joe9inSVmEwWkt8tJNPzsS6l8v1mdD0ZUAKC CswfBRhvVtEliKRwucjTCaFU25X5DookEpKJO+dYjaGsYRm/oxHTuNKQyprH1/0jClg== 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=Bcttdw1G; 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 C73EC606A322 for ; Thu, 3 Dec 2026 14:19:32 +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=Bcttdw1G Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6FD21F0089A; Thu, 3 Dec 2026 14:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796307571; bh=Q8ZyLAJJwE3SYyR7UivtH64AwYlKU1C1Fld57nIkNPw=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Bcttdw1GuJ86IO/iyRmPwnYjw8mJuWcsSvgggrLbUV1xWB+OgL8wcteL6oWlc6PCt 1ZpfeMzq54XodD8M9qa79yhBs8S+PFU6/0zYXE7uPOTRZfBoAY4jjCZSVrM1xhBF0e nscmHMykDNE1b3sr+gJC28/OvjosAWEqYEYs+P9glMDEl3GCEjhePAyVPY2iSb25Y7 4zbv6Mp51z88bwFrIa/htVy3F7az3XzPou9UdaqS5n6sdGlVIjUIaYYz/pivw2AxB5 eWV+xcj1j51/B7pYbZe4UFa5tBZ3hlb2IeqsqYEYsXUDOo82ZH2Arg2fFFxSg3n0xr OCasuU2W13SCA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 03/10] riscv: add common primitives for preemptible this_cpu operations 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-4-cuiyunhui@bytedance.com> References: <20261203135328.32990-1-cuiyunhui@bytedance.com> <20261203135328.32990-4-cuiyunhui@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:19:29 +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: shadowed __ti, __off, and __addr in __PERCPU_8_16_OP_CASE() -- commit cdee8dcf95e6f5bcb812df1069a67587cc2904b5 Author: Yunhui Cui riscv: add common primitives for preemptible this_cpu operations This commit adds shared macro primitives in asm/percpu.h for preemptible per-CPU AMO and 8/16-bit LR/SC read-modify-write operations. Link: https://lore.kernel.org/r/20261112120928.24145d44@pumpkin > diff --git a/arch/riscv/include/asm/percpu.h b/arch/riscv/include/asm/per= cpu.h > index 3cd60ef18815e..a5ceedc934b54 100644 > --- a/arch/riscv/include/asm/percpu.h > +++ b/arch/riscv/include/asm/percpu.h [ ... ] > @@ -55,6 +58,134 @@ > #define __PCPU_GPRS_END(gprs) \ > "sh zero, " gprs "\n" > =20 > +#define __PCPU_OP_CONTEXT() \ > + struct thread_info *__ti =3D (struct thread_info *)current; \ > + unsigned long __off, __addr [ ... ] > +#define __PERCPU_AMO(insn, isa, ret_arg, pcp_arg, val_arg) \ > +do { \ > + __PCPU_OP_CONTEXT(); \ [ ... ] > +#define __PERCPU_8_16_OP_CASE(name, sz, sfx, op) \ > +static __always_inline unsigned long \ > +__percpu_##name##_amo_case_##sz(void __percpu *pcp, unsigned long val) \ > +{ \ > + __PCPU_OP_CONTEXT(); \ > + const u32 field_mask =3D PERCPU_8_16_GET_MASK(sz); \ > + const unsigned long shift =3D PERCPU_8_16_GET_SHIFT(pcp); \ > + const u32 mask =3D field_mask << shift; \ > + const u32 val_trunc =3D val & field_mask; \ > + void __percpu *pcp32 =3D PERCPU_8_16_GET_PCP32(pcp); \ > + u32 old, new, field; \ > + \ > + if (IS_ENABLED(CONFIG_RISCV_ISA_ZABHA) && \ > + riscv_has_extension_unlikely(RISCV_ISA_EXT_ZABHA)) { \ > + u##sz tmp; \ > + \ > + __PERCPU_AMO("amo" #name #sfx, "zabha", \ > + tmp, pcp, (u##sz)val); \ [Severity: Low] Does calling __PERCPU_AMO() inside __PERCPU_8_16_OP_CASE() shadow __ti, __off, and __addr? Both __PERCPU_8_16_OP_CASE() and __PERCPU_AMO() expand __PCPU_OP_CONTEXT(), redeclaring those locals in the Zabha branch. Once instantiated, this triggers -Wshadow on W=3D2 builds (failing with CONFIG_WERROR=3Dy) in every file including asm/percpu.h. Moving __PCPU_OP_CONTEXT() and the LR/SC-only locals after the Zabha early-return branch would avoid the shadowing. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203135328.3299= 0-1-cuiyunhui@bytedance.com?part=3D3