From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=128.30.2.78 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796208110; b=XlcDumWmUfSXCR/oHh0NH+of3qSM3dQj0fdIGJeKx8RPzGYoMt9To+BcvGavKoWskEUi 72K9gqrwH2KKNDdOWIGGaaT5yuQQWhk5T0WNjK11XGfdu4g7/6a98AxKkX9XjURt0xeyI jZuIddovQtV/wDOvHhdKbtvovHkHjjz5SPCQN+g+8jkfYIQyIoMdbvY4a0pk2VHheg3P4 00dl4ox24Ga5jUM/aNt3QkI2N6mFaH3aqG4/4GJwV5/p7PHVk5YgPWZz1KpE18tVzZonq RTueUuIeFsbH6ClxrB7fNys+Deu4E+OvtfxzLAX1n3ZGcYASt/AA0GbrOeqbWRYF2jQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796208110; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=fwrq38hr/pgAIxwnoRhJUgG5Yde4tTpkHpSayaN7tU0=; b=JwWpkO/HUHZYAWQF21pPJcHUb+H/44KJO6VQG5NimHoL0Jf3ifyTEcBB4QIRW8cmQUoM 86EKYedgHOMrEDHnZ0izo6QnSslbtYjJICtMfqemk+Rnfg7eZh14EPRekOQUdhuKvmEqu s+uBJVZzSKuKfdChvszgrajVjfY1JKr2UK3CGor79Q18IWUv8ijr6HDUFNc3XLqvbnuFq yvqiX8BCQZyb1kkNbTXAxSpqWLwOLdBhru9E/EG8bzMZ9DcNSaP0ysAGv5KOQNyGQcAZR D6L1kMD7Y6c1P5ogq85cpBAEw/lP7jO/9cVrycuFuLf5iEq64/0iFmYlYwVgxm8k8Xg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=csail.mit.edu; spf=pass smtp.mailfrom=csail.mit.edu; dkim=pass header.d=outgoing.csail.mit.edu header.i=@outgoing.csail.mit.edu header.a=rsa-sha256 header.s=test20231205 header.b=pIpBTkfG; arc=none smtp.remote-ip=128.30.2.78 Received: from outgoing2021.csail.mit.edu (outgoing2021.csail.mit.edu [128.30.2.78]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37B4A606A339 for ; Wed, 2 Dec 2026 10:41:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 37B4A606A339 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=csail.mit.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csail.mit.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (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=pIpBTkfG 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=1796208108; x=1797072108; b=pIpBTkfG9t8Ol9bam9VhhYjJI2WD7AU45x48Jc+7VooTMh5LEPwlC2yJxYyCuhcHMfvVoliKSlo ju9uv+LvS435xLypJZQnLMKVlcTZIemAHJNwtjVBtuvJ6lSFUJOi1pZW7bd09CxAfST/yHYXWmuP4 Hi/A5cfuukNavjZVjBrImlkHo92BObDnzeJYyA0CQR8NaIcOD5fslO/Da2e/Ca0DE1X7wcPcPQCC0 7HPjSHUQvtcLJbxsVw2w9PshLZdUTngU8hV/6KONQ3rS0rJIcH/Be/YOgHrXy9c4ultB1tBiIUJze 27aFwVY2/bxC6B8+JsseQCTpanXGLk+p3iVg==; 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-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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130094513.2454356-2-ptsm@linux.microsoft.com> 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