From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F05AA606A31A for ; Wed, 2 Dec 2026 11:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=kvfTAJpJ; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=outgoing.csail.mit.edu header.i=@outgoing.csail.mit.edu header.a=rsa-sha256 header.s=test20231205 header.b=jARO23xi DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=fwrq38hr/pgAIxwnoRhJUgG5Yde4tTpkHpSayaN7tU0=; b=kvfTAJpJ9+kAH+6nCLflio6tK/ 8Vmi6RpT/DHbsVQ7C7IrFeYViIuv+4Bqa+9DgJezO3GMTvDYFcdATb+cByln7gwv7W1og3ycM1lGc sb4RJD+8fqicXodePkZqWETu+dDfsNadK/pWkv/9cQzTBjnsvvrGZmV4YLu8pqKYRernyrsVVxHhp qhwt8wgV0ry5ySr0wxEU/VHkSDN+XZy1YXETYDyMksph352kXHhEVwgYAjTPnqXAJKNUVlLG7d3sL sZrLPI8O7dnhFV230ifla5itHlhmHy5LZNv+W3OnkBIjSlbgPNDaxAF4YPIOCD1KJQwYqjmHuctRK na2udkYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhmW-0000000BCqg-0mfv; Wed, 02 Dec 2026 10:41:48 +0000 Received: from outgoing2021.csail.mit.edu ([128.30.2.78]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhmS-0000000BCpY-08e0 for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 10:41:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=outgoing.csail.mit.edu; s=test20231205; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fwrq38hr/pgAIxwnoRhJUgG5Yde4tTpkHpSayaN7tU0=; t=1796208103; x=1797072103; b=jARO23xiP7lXXXxarwTiugONFOWPC7qMqvVfpQYvDxYjTMNNfCRpdrj46ZxVC/nP+ffAwmkv2P/ g4L/dTwUJpsxQJNKbXfbvJPbBGJc+pD9SxS0K1IcKYHnHbn/y7l4EiE1X3aOndBH5oSybeP3gmfXk TUu6Bp+P7FvfebhlrTFgQdkhDi1glh1kneO0PL4GZ9NgjyzzppnLUZeeMA6Yy+zWmeGbItsy6+lfE RhE8nXFC4emzh2YiiIT4COXAzZUdfdgQgTT4VvrwRPRcODIs2Iw8WkMqODviUjdPUJV/gzR+fGIss MxdwVWN24Ggyh192UNYJQ0D2EO0LT0gzAVFw==; Received: from [167.220.238.83] (helo=csail.mit.edu) by outgoing2021.csail.mit.edu with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1xYhmM-00DC1t-0A; Wed, 02 Dec 2026 05:41:38 -0500 Date: Wed, 2 Dec 2026 16:11:30 +0530 From: "Srivatsa S. Bhat" To: Prasanna Kumar T S M Cc: jassisinghbrar@gmail.com, michal.simek@amd.com, tanmay.shah@amd.com, saeed.nowshadi@amd.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ssengar@linux.microsoft.com, tgopinath@linux.microsoft.com, tejas.patel@xilinx.com, rajan.vaja@xilinx.com, abhyuday.godhasara@xilinx.com, gregkh@linuxfoundation.org Subject: Re: [PATCH v2 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup Message-ID: References: <20261130094513.2454356-1-ptsm@linux.microsoft.com> <20261130094513.2454356-2-ptsm@linux.microsoft.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130094513.2454356-2-ptsm@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_024144_245359_4EFF57B6 X-CRM114-Status: GOOD ( 27.87 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Prasanna, On Mon, Nov 30, 2026 at 01:45:12AM -0800, Prasanna Kumar T S M wrote: > On driver removal, the CPUHP_AP_ONLINE_DYN CPU hotplug state is removed > instead of its actual state. This can leave the mailbox driver callbacks > dangling. Use the actual CPU hotplug state during driver removal. > > Hotplug registration failures are also ignored, allowing probe to > succeed without the callbacks needed to enable interrupts on CPUs > brought online later. > > This is found by code inspection. Minor nit: This bit of detail doesn't feel necessary to capture in the commit message. On the other hand, if you had used a script or some automation tool (ex: coccinelle) to find such issues, its corresponding snippet would have been useful to include. > > Fixes: 6ffb1635341b ("mailbox: zynqmp: handle SGI for shared IPI") > Cc: stable@vger.kernel.org > Signed-off-by: Prasanna Kumar T S M > --- > drivers/mailbox/zynqmp-ipi-mailbox.c | 29 ++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > > diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c > index 42d2583e44ca..843b5ecc905a 100644 > --- a/drivers/mailbox/zynqmp-ipi-mailbox.c > +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c > @@ -126,6 +126,7 @@ struct zynqmp_ipi_mbox { > * @method: IPI SMC or HVC is going to be used > * @local_id: local IPI agent ID > * @virq_sgi: IRQ number mapped to SGI > + * @hp_state: CPU hotplug state for SGI callbacks > * @num_mboxes: number of mailboxes of this IPI agent > * @ipi_mboxes: IPI mailboxes of this IPI agent > */ The hp_state variable appears to be only added to the comment, and not the actual zynqmp_ipi_pdata struct. So, how did this even build? > @@ -136,6 +137,7 @@ struct zynqmp_ipi_pdata { > unsigned int method; > u32 local_id; > int virq_sgi; > + enum cpuhp_state hp_state; > int num_mboxes; > struct zynqmp_ipi_mbox ipi_mboxes[] __counted_by(num_mboxes); > }; > @@ -863,21 +865,32 @@ static int xlnx_mbox_init_sgi(struct platform_device *pdev, > irq_set_status_flags(pdata->virq_sgi, IRQ_PER_CPU); > > /* Setup function for the CPU hot-plug cases */ > - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mailbox/sgi:starting", > - xlnx_mbox_cpuhp_start, xlnx_mbox_cpuhp_down); > + pdata->hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, > + "mailbox/sgi:starting", > + xlnx_mbox_cpuhp_start, > + xlnx_mbox_cpuhp_down); > + if (pdata->hp_state < 0) { > + irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); > + free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); > + irq_dispose_mapping(pdata->virq_sgi); > + pdata->virq_sgi = 0; > + return pdata->hp_state; > + } > I thought we agreed on a simpler cleanup in the discussion on the v1 patch [1] but this v2 changes a lot more instead in both xlnx_mbox_init_sgi() and xlnx_mbox_cleanup_sgi(). Would you mind sharing your thoughts on why this approach is better than leaving the cleanup to the caller? > return ret; > } > > static void xlnx_mbox_cleanup_sgi(struct zynqmp_ipi_pdata *pdata) > { > - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); > - > - on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); > + if (pdata->hp_state >= CPUHP_AP_ONLINE_DYN) > + cpuhp_remove_state(pdata->hp_state); > > - irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); > - free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); > - irq_dispose_mapping(pdata->virq_sgi); > + if (pdata->virq_sgi) { > + on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); > + irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); > + free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); > + irq_dispose_mapping(pdata->virq_sgi); > + } > } > > [1]. https://lore.kernel.org/all/3a44999e-655b-409a-8806-cd434722ff45@linux.microsoft.com/ Regards, Srivatsa