From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796220302; b=vI1rAPzFwkSaAtj6qFUZS3fXO3+xk8gWREYWf8r/LPSGW76sHaJipwziBxXoxobHYB8c YQp838sIdCS5NMCGha8Zc/cMj68FdDtR4L2Pq+aDGSMy5s9uYrJpkbK0I9kpYhaPkXGAF +Aa9l9JykPJ90SYQSW8P9Z/m+HHjxDG6ILpwPbtFYvoRNgqLoP/j23KCSqeMsSs1J2Ci/ hazdzZf3LF+JocKZdez2lRlAOuZHDhPVQZENwrADy7snbWrV/JPsoM8X06koydid8dYkh AnqJwAVjLblJpoh8wI6VqoGfDLEF3Gd8M6eiudtXot2mXf/fjfiJfwkQC7j9m9BVBuA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220302; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding:X-Spam-Status: X-Spam-Checker-Version; bh=MQkrajId8k+VQckAnq8x47uS720UNxFtsLfTFpxpNbA=; b=It5hY8/vNJ820MvO81RSRFZUwDQVPCdtDvik2JMet4zTtChwosjp6sNVU6mSAlq7FuLx MuHKBIYZAELHWfK57z64iP3btkjnTilKaPqqstxaibl06WMKLRj7ELLFbny1YVOIeX4Sq 2LkFgEktp8IhikgMPzfUhLfPC1cAqwItmPH+i2d5B7SYL1mJeGS+W/evzCFPxj5THh4up nukXrZkmG7yLegA98kLK0HTZQzEYzAeY2TnnyyHwrsyRsAb0VdD5AjhfqUGCMsGdr3IDq rLR4C9x6pj8U55Jf8O7ASewYdOPmJUazmVuElpxorxzhvzWjtmGxJNxkuBiM6llkLBw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b="fUyKv/zO"; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0B23606A325 for ; Wed, 2 Dec 2026 14:05:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D0B23606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=fUyKv/zO Received: from [192.168.1.10] (unknown [52.172.102.187]) by linux.microsoft.com (Postfix) with ESMTPSA id E02C820B7168; Wed, 2 Dec 2026 06:04:55 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E02C820B7168 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796220298; bh=MQkrajId8k+VQckAnq8x47uS720UNxFtsLfTFpxpNbA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fUyKv/zOKk9sUJCr7RptaGg/SoaGmPcs8VJdcfMeb78YUU2tAmjNAD479Vmqp92n4 j6JuUjPCTxjYCay78hpZH1S04tOyNSkt4ciJJqwuRbg+ync8TsjnU+OHEd18D76O4D m/AWFK5GWcbRGE1GwHwRqHuGQPLQOvmvd5GqKwbU= Message-ID: Date: Wed, 2 Dec 2026 19:34:54 +0530 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup To: "Srivatsa S. Bhat" 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 References: <20261130094513.2454356-1-ptsm@linux.microsoft.com> <20261130094513.2454356-2-ptsm@linux.microsoft.com> Content-Language: en-US From: Prasanna Kumar T S M In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02-12-2026 16:11, Srivatsa S. Bhat wrote: > 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. There was a ask to share the repro steps and the failure signature in v1. It is very difficult to reproduce in my setup so I have shared this info for clarity. >> >> 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? There is no advantage over the approach discussed previously. I missed it in v2. I will update and send v3. > >> 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