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=1796425222; b=45FVNjj/18ePz2JljwJEBLgsntxD2Ys7y5LyCr+jaqV6eOL8+pnKKRUDyCT0JEf5PWYR waOUoDkL0ucVu3Cg8LFQTSviSZP3tkVD2HTMV7H0KeAkpA4uvghEhAPYWeUos3KiunPjY wJQ3BRE3R+DtuOQPk0Z36e/Ph0f/wfdYOOMv0b/hbR015xPbno2k+1bU4ZcyRJBr7Oxof BSF3dymu7qbs/pIPVWYQkme/03a47NTF1Z5GkcSYfcxrdAKELc5/UzSH4yvPq9WmLSk06 wuIYHYJL0V1U6nlzy4MVvzw/Ntlk0gVe5xEBta3IW1alrmKSiJ8ceAntJf9rLorxCpA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796425222; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=qAFzYz+206QW+o6t0n9PdgvJR/tKePW+G1TPWUpgbd4=; b=LDUsUqSQ9grGhDYvkN2wYrVWd5zdiekduvgDreavnRkdOvYFaa/LL8XV82WOcrcM7H0e ykQLQ0cSkr13Mj+7RB3votzoVp9HRpsMOfEOYZU4XlsXjjRGNfW6FzRpvg51/iZyxPlLN 086hE6ryB9KP5aXgpusRv76gGp/GU/Jx7cs071I4GxzZeMUhivddln0QS/OnoJKmGofeT IUqBVEDWr4pFxDXYfi13WHu7uZ+LZ+yCoWdmF4c8jICR+v4hWj+cqWifkAKRvygpNYCt2 F7Ka0W/lgvVcqshCENmXNkTNQP/7ZVfQy1tI2TGDUb8MTz7Tw69oLeRfLwM0xt2TNpw== 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="Jzcj/A0W"; 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 A03FC606A322 for ; Fri, 4 Dec 2026 23:00:22 +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=Jzcj/A0W Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DD701F0093B; Fri, 4 Dec 2026 23:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796425222; bh=qAFzYz+206QW+o6t0n9PdgvJR/tKePW+G1TPWUpgbd4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Jzcj/A0WxJnDrZ/TR0cUM69bltArrIt2lIQDoLzKmK0nCLq0vfc9/AXoJWgznD1VD V4dKys+B3iCgYTNFzE1dT1wJJi1EtVdnxBY+g3NwC4be9LSu03Cb8q4yT51hfbJwUD 0C/AsnbglHOTD8sqammVRM4mU1PAYTjppGVi+zGZAJEvrMZsn5pzO+oVUQszfk3Q5r CGscSaNn8OojrovkrCTL11pboS4HlM/3fl0tj0O0DrVIdVmFpe35Vfns04db+Y2xpP rqP8jqBmGYTqsseVwYbJq3johfMy8Aq5xLnYPE2yWAekA0rbFNZl1uVDngGQrcUmvU 0WEt9b/eDRXhw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] percpu_ref: defer the release function when the last put is in NMI Reply-To: sashiko-reviews@lists.linux.dev To: "Shakeel Butt" , "Dennis Zhou" , "Tejun Heo" , "Christoph Lameter" Cc: "Andrew Morton" , "Johannes Weiner" , "Michal Hocko" , "Roman Gushchin" , "Muchun Song" , "Alexei Starovoitov" , "David Vernet" , "Vlastimil Babka" , linux-mm@kvack.org, bpf@vger.kernel.org, "Meta kernel team" , mkoutny@suse.com In-Reply-To: <20261204224016.325944-3-shakeel.butt@linux.dev> References: <20261204224016.325944-1-shakeel.butt@linux.dev> <20261204224016.325944-3-shakeel.butt@linux.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 23:00:20 +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] percpu_ref: percpu_ref_resurrect() doc misstates deferred NMI release rule -- commit b7ced7ae84eee24dc735178694ab43386fd34329 Author: Shakeel Butt percpu_ref: defer the release function when the last put is in NMI When a percpu_ref count drops to zero in NMI context, this commit queues the ref on a per-CPU llist and defers invoking its release callback to irq_work, reusing the rcu_head storage in struct percpu_ref_data for the list node. > diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c > index 5def04e3a2c34..b12cc1568d293 100644 > --- a/lib/percpu-refcount.c > +++ b/lib/percpu-refcount.c [ ... ] > @@ -498,7 +504,8 @@ EXPORT_SYMBOL_GPL(percpu_ref_reinit); > * > * If @ref->release() frees @ref then the caller is responsible for > * guaranteeing that @ref->release() does not get called while this > - * function is in progress. > + * function is in progress. That includes a release that > + * percpu_ref_put_many() deferred from NMI. > * > * Note that percpu_ref_tryget[_live]() are safe to perform on @ref while > * this function is in progress. [Severity: Low] Should the NMI deferred release requirement here be unconditional rather th= an tied to "If @ref->release() frees @ref"? Even when release() does not free @ref, resurrecting it before percpu_ref_nmi_release_fn() runs leaves data->nmi_release_node linked on the per-CPU percpu_ref_nmi_release.refs list while the ref is live again. A subsequent switch to atomic mode can then pass &ref->data->rcu to call_rcu_hurry(), overwriting the aliased union member and corrupting the per-CPU list. Stating unconditionally that callers capable of dropping the last reference in NMI must wait for the release function before calling percpu_ref_resurrect() would match percpu_ref_put_many() and percpu_ref_reinit(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204224016.3259= 44-1-shakeel.butt@linux.dev?part=3D2