From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: "Srivatsa S. Bhat" <srivatsa@csail.mit.edu>,
"Pandey, Radhey Shyam" <radheys@amd.com>
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,
tglx@linutronix.de
Subject: Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup
Date: Sat, 28 Nov 2026 22:36:08 +0530 [thread overview]
Message-ID: <3a44999e-655b-409a-8806-cd434722ff45@linux.microsoft.com> (raw)
In-Reply-To: <av1DetqUhUGqdyu3@csail.mit.edu>
On 18-11-2026 11:49, Srivatsa S. Bhat wrote:
> On Wed, Nov 04, 2026 at 11:23:33AM +0530, Pandey, Radhey Shyam wrote:
>> On 11/3/2026 11:50 AM, Prasanna Kumar T S M wrote:
>>> On driver removal, the CPUHP_AP_ONLINE_DYN CPU hotplug state is removed
>>> instead of the 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.
>>>
>>> Fixes: 6ffb1635341be ("mailbox: zynqmp: handle SGI for shared IPI")
>>
> [...]
>>
>>> + 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);
>>> + return pdata->hp_state;
>>
>> 1. The new error path double-frees and then hits BUG().
>> Please reconfirm.
>>
>> zynqmp_ipi_probe() sets pdata->irq_type before calling xlnx_mbox_init_sgi(),
>> and its only error label runs
>> zynqmp_ipi_free_mboxes() → xlnx_mbox_cleanup_sgi() whenever irq_type ==
>> IPI_IRQ_TYPE_SGI. So the new unwind runs, then the caller's unwind repeats
>> irq_clear_status_flags(), free_percpu_irq() and irq_dispose_mapping().
>
> Good catch!
>
>> Before any of that, cleanup calls cpuhp_remove_state(pdata->hp_state) with
>> the negative errno still in the field, and _cpuhp_remove_state_cpuslocked()
>> opens with BUG_ON(cpuhp_cb_check(state)), which rejects anything <=
>> CPUHP_OFFLINE. A failed hotplug registration now panics instead of failing
>> probe.
>>
>
> So, xlnx_mbox_init_sgi() should simply return an error upon CPU
> hotplug registration failure and let the caller handle the cleanup;
> and in xlnx_mbox_cleanup_sgi(), a check for pdata->hp_state > 0 should
> be added like this:
>
> if (pdata->hp_state > 0)
> cpuhp_remove_state(pdata->hp_state);
>
> I think that ought to fix both the issues pointed out above.
Sure, I will incorporate these in v2.
>
>>
>>> + }
>>> return ret;
>>> }
>>> static void xlnx_mbox_cleanup_sgi(struct zynqmp_ipi_pdata *pdata)
>>> {
>>> - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN);
>>> + cpuhp_remove_state(pdata->hp_state);
>>> on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
>>
>
> Regards,
> Srivatsa
prev parent reply other threads:[~2026-11-28 17:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 6:20 [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup Prasanna Kumar T S M
2026-11-03 6:35 ` [PATCH 2/2] soc: xilinx: Fix event manager " Prasanna Kumar T S M
2026-11-03 12:26 ` Jay Buddhabhatti
2026-11-03 15:18 ` Prasanna Kumar T S M
2026-11-18 6:33 ` Srivatsa S. Bhat
2026-11-28 17:05 ` Prasanna Kumar T S M
2026-11-28 17:50 ` Srivatsa S. Bhat
2026-11-03 16:05 ` [PATCH 1/2] mailbox: zynqmp-ipi: Fix " kernel test robot
2026-11-04 5:53 ` Pandey, Radhey Shyam
2026-11-04 11:21 ` Prasanna Kumar T S M
2026-11-18 6:08 ` Srivatsa S. Bhat
2026-11-18 6:19 ` Srivatsa S. Bhat
2026-11-28 17:06 ` Prasanna Kumar T S M [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a44999e-655b-409a-8806-cd434722ff45@linux.microsoft.com \
--to=ptsm@linux.microsoft.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=radheys@amd.com \
--cc=saeed.nowshadi@amd.com \
--cc=srivatsa@csail.mit.edu \
--cc=ssengar@linux.microsoft.com \
--cc=tanmay.shah@amd.com \
--cc=tglx@linutronix.de \
--cc=tgopinath@linux.microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox