* [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup
@ 2026-11-03 6:20 Prasanna Kumar T S M
2026-11-03 6:35 ` [PATCH 2/2] soc: xilinx: Fix event manager " Prasanna Kumar T S M
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Prasanna Kumar T S M @ 2026-11-03 6:20 UTC (permalink / raw)
To: ptsm, jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi,
linux-kernel, linux-arm-kernel, ssengar, tgopinath, srivatsa
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")
Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
---
drivers/mailbox/zynqmp-ipi-mailbox.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 42d2583e44ca..b0643ee75db0 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -136,6 +136,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,15 +864,22 @@ 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);
+ return pdata->hp_state;
+ }
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);
--
2.49.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup 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 ` Prasanna Kumar T S M 2026-11-03 12:26 ` Jay Buddhabhatti 2026-11-18 6:33 ` 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 2 siblings, 2 replies; 13+ messages in thread From: Prasanna Kumar T S M @ 2026-11-03 6:35 UTC (permalink / raw) To: ptsm, tgopinath, ssengar, srivatsa, michal.simek, rajan.vaja, tejas.patel, abhyuday.godhasara, gregkh, linux-arm-kernel, linux-kernel On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN CPU hotplug state instead of the its actual state. This can leave the event manager 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 event interrupts on CPUs brought online later. Fixes: c7fdb2404f66 ("drivers: soc: xilinx: add xilinx event management driver") Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> --- drivers/soc/xilinx/xlnx_event_manager.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c index f733dc42b3b1..2d8bfeab4190 100644 --- a/drivers/soc/xilinx/xlnx_event_manager.c +++ b/drivers/soc/xilinx/xlnx_event_manager.c @@ -24,6 +24,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number); static int virq_sgi; static int event_manager_availability = -EACCES; +static enum cpuhp_state hp_state; /* SGI number used for Event management driver */ #define XLNX_EVENT_SGI_NUM (15) @@ -625,8 +626,6 @@ static int xlnx_event_init_sgi(struct platform_device *pdev) static void xlnx_event_cleanup_sgi(struct platform_device *pdev) { - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); - on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); irq_clear_status_flags(virq_sgi, IRQ_PER_CPU); @@ -660,8 +659,13 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) } /* Setup function for the CPU hot-plug cases */ - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting", - xlnx_event_cpuhp_start, xlnx_event_cpuhp_down); + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, + "soc/event:starting", xlnx_event_cpuhp_start, + xlnx_event_cpuhp_down); + if (hp_state < 0) { + xlnx_event_cleanup_sgi(pdev); + return hp_state; + } ret = zynqmp_pm_register_sgi(sgi_num, 0); if (ret) { @@ -670,6 +674,7 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) else dev_err(&pdev->dev, "SGI %d registration failed, err %d\n", sgi_num, ret); + cpuhp_remove_state(hp_state); xlnx_event_cleanup_sgi(pdev); return ret; } @@ -704,6 +709,7 @@ static void xlnx_event_manager_remove(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "SGI unregistration over TF-A failed with %d\n", ret); + cpuhp_remove_state(hp_state); xlnx_event_cleanup_sgi(pdev); event_manager_availability = -EACCES; -- 2.49.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup 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 1 sibling, 1 reply; 13+ messages in thread From: Jay Buddhabhatti @ 2026-11-03 12:26 UTC (permalink / raw) To: ptsm Cc: gregkh, linux-arm-kernel, linux-kernel, michal.simek, srivatsa, ssengar, tgopinath Hi Prasanna, On Mon, Nov 02, 2026 at 10:35:15PM -0800, Prasanna Kumar T S M wrote: > On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN > CPU hotplug state instead of the its actual state. This can leave the > event manager 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 event interrupts on > CPUs brought online later. > > Fixes: c7fdb2404f66 ("drivers: soc: xilinx: add xilinx event management driver") > Signed-off-by: Prasanna Kumar T S M ptsm@linux.microsoft.com This looks good to me. A couple of small nits: - "instead of the its actual state" -> "instead of its actual state" - Minor alignment on the cpuhp_setup_state() continuation lines; checkpatch --strict complains. CHECK: Alignment should match open parenthesis #49: FILE: drivers/soc/xilinx/xlnx_event_manager.c:663: + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, + "soc/event:starting", xlnx_event_cpuhp_start, total: 0 errors, 0 warnings, 1 checks, 44 lines checked Worth Cc: stable@vger.kernel.org as well, given the Fixes tag. Reviewed-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com> Thanks, Jay ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup 2026-11-03 12:26 ` Jay Buddhabhatti @ 2026-11-03 15:18 ` Prasanna Kumar T S M 0 siblings, 0 replies; 13+ messages in thread From: Prasanna Kumar T S M @ 2026-11-03 15:18 UTC (permalink / raw) To: Jay Buddhabhatti Cc: gregkh, linux-arm-kernel, linux-kernel, michal.simek, srivatsa, ssengar, tgopinath Hi Jay, On 03-11-2026 17:56, Jay Buddhabhatti wrote: > Hi Prasanna, > > On Mon, Nov 02, 2026 at 10:35:15PM -0800, Prasanna Kumar T S M wrote: > > On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN > > CPU hotplug state instead of the its actual state. This can leave the > > event manager 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 event interrupts on > > CPUs brought online later. > > > > Fixes: c7fdb2404f66 ("drivers: soc: xilinx: add xilinx event > management driver") > > Signed-off-by: Prasanna Kumar T S M ptsm@linux.microsoft.com > > This looks good to me. > > A couple of small nits: > > - "instead of the its actual state" -> "instead of its actual state" Thanks for catching this. > - Minor alignment on the cpuhp_setup_state() continuation lines; > checkpatch --strict complains. > CHECK: Alignment should match open parenthesis > #49: FILE: drivers/soc/xilinx/xlnx_event_manager.c:663: > + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, > + "soc/event:starting", xlnx_event_cpuhp_start, > > total: 0 errors, 0 warnings, 1 checks, 44 lines checked I missed this. I think the issues are minor. Is it possible to fix this while merging the patch? > > Worth Cc: stable@vger.kernel.org as well, given the Fixes tag. Do I need to send v2 to address this? > > Reviewed-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com> > > Thanks, > Jay Thanks, Prasanna Kumar ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup 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-18 6:33 ` Srivatsa S. Bhat 2026-11-28 17:05 ` Prasanna Kumar T S M 1 sibling, 1 reply; 13+ messages in thread From: Srivatsa S. Bhat @ 2026-11-18 6:33 UTC (permalink / raw) To: Prasanna Kumar T S M Cc: tgopinath, ssengar, michal.simek, rajan.vaja, tejas.patel, abhyuday.godhasara, gregkh, linux-arm-kernel, linux-kernel, tglx On Mon, Nov 02, 2026 at 10:35:15PM -0800, Prasanna Kumar T S M wrote: > On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN > CPU hotplug state instead of the its actual state. This can leave the > event manager 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 event interrupts on > CPUs brought online later. > > Fixes: c7fdb2404f66 ("drivers: soc: xilinx: add xilinx event management driver") > Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> > --- > drivers/soc/xilinx/xlnx_event_manager.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c > index f733dc42b3b1..2d8bfeab4190 100644 > --- a/drivers/soc/xilinx/xlnx_event_manager.c > +++ b/drivers/soc/xilinx/xlnx_event_manager.c > @@ -24,6 +24,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number); > > static int virq_sgi; > static int event_manager_availability = -EACCES; > +static enum cpuhp_state hp_state; > > /* SGI number used for Event management driver */ > #define XLNX_EVENT_SGI_NUM (15) > @@ -625,8 +626,6 @@ static int xlnx_event_init_sgi(struct platform_device *pdev) > > static void xlnx_event_cleanup_sgi(struct platform_device *pdev) > { > - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); > - > on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); > > irq_clear_status_flags(virq_sgi, IRQ_PER_CPU); > @@ -660,8 +659,13 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) > } > > /* Setup function for the CPU hot-plug cases */ > - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting", > - xlnx_event_cpuhp_start, xlnx_event_cpuhp_down); > + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, > + "soc/event:starting", xlnx_event_cpuhp_start, Let's change :starting to :online as per convention, as this is associated with the ONLINE_DYN state. Can we also edit the callback names for symmetry similar to the suggestion for patch 1/2? > + xlnx_event_cpuhp_down); > + if (hp_state < 0) { > + xlnx_event_cleanup_sgi(pdev); > + return hp_state; > + } > > ret = zynqmp_pm_register_sgi(sgi_num, 0); > if (ret) { > @@ -670,6 +674,7 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) > else > dev_err(&pdev->dev, "SGI %d registration failed, err %d\n", sgi_num, ret); > > + cpuhp_remove_state(hp_state); > xlnx_event_cleanup_sgi(pdev); > return ret; > } > @@ -704,6 +709,7 @@ static void xlnx_event_manager_remove(struct platform_device *pdev) > if (ret) > dev_err(&pdev->dev, "SGI unregistration over TF-A failed with %d\n", ret); > > + cpuhp_remove_state(hp_state); > xlnx_event_cleanup_sgi(pdev); > > event_manager_availability = -EACCES; It looks like this patch 2/2 doesn't have the kind of bugs in the cleanup path that affected patch 1/2, so that's good. Regards, Srivatsa ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup 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 0 siblings, 1 reply; 13+ messages in thread From: Prasanna Kumar T S M @ 2026-11-28 17:05 UTC (permalink / raw) To: Srivatsa S. Bhat Cc: tgopinath, ssengar, michal.simek, rajan.vaja, tejas.patel, abhyuday.godhasara, gregkh, linux-arm-kernel, linux-kernel, tglx Hi Srivatsa, On 18-11-2026 12:03, Srivatsa S. Bhat wrote: > On Mon, Nov 02, 2026 at 10:35:15PM -0800, Prasanna Kumar T S M wrote: >> On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN >> CPU hotplug state instead of the its actual state. This can leave the >> event manager 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 event interrupts on >> CPUs brought online later. >> >> Fixes: c7fdb2404f66 ("drivers: soc: xilinx: add xilinx event management driver") >> Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> >> --- >> drivers/soc/xilinx/xlnx_event_manager.c | 14 ++++++++++---- >> 1 file changed, 10 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c >> index f733dc42b3b1..2d8bfeab4190 100644 >> --- a/drivers/soc/xilinx/xlnx_event_manager.c >> +++ b/drivers/soc/xilinx/xlnx_event_manager.c >> @@ -24,6 +24,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number); >> >> static int virq_sgi; >> static int event_manager_availability = -EACCES; >> +static enum cpuhp_state hp_state; >> >> /* SGI number used for Event management driver */ >> #define XLNX_EVENT_SGI_NUM (15) >> @@ -625,8 +626,6 @@ static int xlnx_event_init_sgi(struct platform_device *pdev) >> >> static void xlnx_event_cleanup_sgi(struct platform_device *pdev) >> { >> - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); >> - >> on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); >> >> irq_clear_status_flags(virq_sgi, IRQ_PER_CPU); >> @@ -660,8 +659,13 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) >> } >> >> /* Setup function for the CPU hot-plug cases */ >> - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting", >> - xlnx_event_cpuhp_start, xlnx_event_cpuhp_down); >> + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, >> + "soc/event:starting", xlnx_event_cpuhp_start, > > Let's change :starting to :online as per convention, as this is > associated with the ONLINE_DYN state. > > Can we also edit the callback names for symmetry similar to the > suggestion for patch 1/2? I will incorporate these in v2. > >> + xlnx_event_cpuhp_down); >> + if (hp_state < 0) { >> + xlnx_event_cleanup_sgi(pdev); >> + return hp_state; >> + } >> >> ret = zynqmp_pm_register_sgi(sgi_num, 0); >> if (ret) { >> @@ -670,6 +674,7 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) >> else >> dev_err(&pdev->dev, "SGI %d registration failed, err %d\n", sgi_num, ret); >> >> + cpuhp_remove_state(hp_state); >> xlnx_event_cleanup_sgi(pdev); >> return ret; >> } >> @@ -704,6 +709,7 @@ static void xlnx_event_manager_remove(struct platform_device *pdev) >> if (ret) >> dev_err(&pdev->dev, "SGI unregistration over TF-A failed with %d\n", ret); >> >> + cpuhp_remove_state(hp_state); >> xlnx_event_cleanup_sgi(pdev); >> >> event_manager_availability = -EACCES; > > It looks like this patch 2/2 doesn't have the kind of bugs in the > cleanup path that affected patch 1/2, so that's good. > > Regards, > Srivatsa ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup 2026-11-28 17:05 ` Prasanna Kumar T S M @ 2026-11-28 17:50 ` Srivatsa S. Bhat 0 siblings, 0 replies; 13+ messages in thread From: Srivatsa S. Bhat @ 2026-11-28 17:50 UTC (permalink / raw) To: Prasanna Kumar T S M Cc: tgopinath, ssengar, michal.simek, rajan.vaja, tejas.patel, abhyuday.godhasara, gregkh, linux-arm-kernel, linux-kernel, tglx Hi Prasanna, On Sat, Nov 28, 2026 at 10:35:34PM +0530, Prasanna Kumar T S M wrote: > Hi Srivatsa, > > On 18-11-2026 12:03, Srivatsa S. Bhat wrote: > > On Mon, Nov 02, 2026 at 10:35:15PM -0800, Prasanna Kumar T S M wrote: > > > On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN > > > CPU hotplug state instead of the its actual state. This can leave the > > > event manager callbacks dangling. Use the actual CPU hotplug state > > > during driver removal. > > > [...] > > > on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); > > > irq_clear_status_flags(virq_sgi, IRQ_PER_CPU); > > > @@ -660,8 +659,13 @@ static int xlnx_event_manager_probe(struct platform_device *pdev) > > > } > > > /* Setup function for the CPU hot-plug cases */ > > > - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting", > > > - xlnx_event_cpuhp_start, xlnx_event_cpuhp_down); > > > + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, > > > + "soc/event:starting", xlnx_event_cpuhp_start, > > > > Let's change :starting to :online as per convention, as this is > > associated with the ONLINE_DYN state. > > > > Can we also edit the callback names for symmetry similar to the > > suggestion for patch 1/2? > > I will incorporate these in v2. > Actually, I found several instances of such mismatch throughout the tree, so I have prepared a patch series to address that tree-wide. I'm planning to send it out shortly. So, your v2 can continue to retain the original scope of the fixes. Thank you! Regards, Srivatsa ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup 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 16:05 ` kernel test robot 2026-11-04 5:53 ` Pandey, Radhey Shyam 2 siblings, 0 replies; 13+ messages in thread From: kernel test robot @ 2026-11-03 16:05 UTC (permalink / raw) To: Prasanna Kumar T S M, jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi, linux-kernel, linux-arm-kernel, ssengar, tgopinath, srivatsa Cc: oe-kbuild-all Hi Prasanna, kernel test robot noticed the following build warnings: [auto build test WARNING on jassibrar-mailbox/for-next] [also build test WARNING on linus/master xilinx-xlnx/master v7.3 next-20261030] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Prasanna-Kumar-T-S-M/soc-xilinx-Fix-event-manager-CPU-hotplug-state-cleanup/20261102-223515 base: https://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox.git for-next patch link: https://lore.kernel.org/r/20261103062051.676519-1-ptsm%40linux.microsoft.com patch subject: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup config: arm64-defconfig (https://download.01.org/0day-ci/archive/20261103/202611032308.xkvLFqmo-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 16.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261103/202611032308.xkvLFqmo-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202611032308.xkvLFqmo-lkp@intel.com/ All warnings (new ones prefixed by >>): >> Warning: drivers/mailbox/zynqmp-ipi-mailbox.c:141 struct member 'hp_state' not described in 'zynqmp_ipi_pdata' >> Warning: drivers/mailbox/zynqmp-ipi-mailbox.c:141 struct member 'hp_state' not described in 'zynqmp_ipi_pdata' -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup 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 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:19 ` Srivatsa S. Bhat 2 siblings, 2 replies; 13+ messages in thread From: Pandey, Radhey Shyam @ 2026-11-04 5:53 UTC (permalink / raw) To: Prasanna Kumar T S M, jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi, linux-kernel, linux-arm-kernel, ssengar, tgopinath, srivatsa 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") Nit - only first 12 characters of the SHA-1 ID are sufficient. Also describe the failure signature and how the error is reproduced. > Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> > --- > drivers/mailbox/zynqmp-ipi-mailbox.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c > index 42d2583e44ca..b0643ee75db0 100644 > --- a/drivers/mailbox/zynqmp-ipi-mailbox.c > +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c > @@ -136,6 +136,7 @@ struct zynqmp_ipi_pdata { > unsigned int method; > u32 local_id; > int virq_sgi; > + enum cpuhp_state hp_state; Warning: drivers/mailbox/zynqmp-ipi-mailbox.c:141 struct member 'hp_state' not described in 'zynqmp_ipi_pdata' > int num_mboxes; > struct zynqmp_ipi_mbox ipi_mboxes[] __counted_by(num_mboxes); > }; > @@ -863,15 +864,22 @@ 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, what is :starting here ? > + 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(). 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. > + } > > 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); > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup 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 1 sibling, 1 reply; 13+ messages in thread From: Prasanna Kumar T S M @ 2026-11-04 11:21 UTC (permalink / raw) To: Pandey, Radhey Shyam, jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi, linux-kernel, linux-arm-kernel, ssengar, tgopinath, srivatsa Hi Radhey Shyam, Thanks for reviewing this. On 04-11-2026 11:23, 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") > > Nit - only first 12 characters of the SHA-1 ID are sufficient. Sure, I will update. > > Also describe the failure signature and how the error is reproduced. > > >> Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> >> --- >> drivers/mailbox/zynqmp-ipi-mailbox.c | 14 +++++++++++--- >> 1 file changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/ >> zynqmp-ipi-mailbox.c >> index 42d2583e44ca..b0643ee75db0 100644 >> --- a/drivers/mailbox/zynqmp-ipi-mailbox.c >> +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c >> @@ -136,6 +136,7 @@ struct zynqmp_ipi_pdata { >> unsigned int method; >> u32 local_id; >> int virq_sgi; >> + enum cpuhp_state hp_state; > > Warning: drivers/mailbox/zynqmp-ipi-mailbox.c:141 struct member > 'hp_state' not described in 'zynqmp_ipi_pdata' I will update this in v2. > >> int num_mboxes; >> struct zynqmp_ipi_mbox ipi_mboxes[] __counted_by(num_mboxes); >> }; >> @@ -863,15 +864,22 @@ 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, > > what is :starting here ? I used the existing string. > >> + 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(). 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. > I will fix this 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); Thanks, Prasanna Kumar ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup 2026-11-04 11:21 ` Prasanna Kumar T S M @ 2026-11-18 6:08 ` Srivatsa S. Bhat 0 siblings, 0 replies; 13+ messages in thread From: Srivatsa S. Bhat @ 2026-11-18 6:08 UTC (permalink / raw) To: Prasanna Kumar T S M Cc: Pandey, Radhey Shyam, jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi, linux-kernel, linux-arm-kernel, ssengar, tgopinath, tglx On Wed, Nov 04, 2026 at 04:51:28PM +0530, Prasanna Kumar T S M wrote: > Hi Radhey Shyam, > > Thanks for reviewing this. > > On 04-11-2026 11:23, 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. > > > [...] > > > @@ -863,15 +864,22 @@ 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, > > > > what is :starting here ? > > I used the existing string. Let's please fix it while we are at it. The convention is to match the mode in the @name argument to the CPU hotplug state that it is associated with. So in this case, :online would be the right one to use instead of :starting. Also, could you consider editing the names of the callbacks for symmetry? Ex: We can rename them to xlnx_mbox_cpuhp_startup() and xlnx_mbox_cpuhp_teardown() instead of _start() and _down() that are used today. Regards, Srivatsa ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup 2026-11-04 5:53 ` Pandey, Radhey Shyam 2026-11-04 11:21 ` Prasanna Kumar T S M @ 2026-11-18 6:19 ` Srivatsa S. Bhat 2026-11-28 17:06 ` Prasanna Kumar T S M 1 sibling, 1 reply; 13+ messages in thread From: Srivatsa S. Bhat @ 2026-11-18 6:19 UTC (permalink / raw) To: Pandey, Radhey Shyam Cc: Prasanna Kumar T S M, jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi, linux-kernel, linux-arm-kernel, ssengar, tgopinath, tglx 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. > > > + } > > 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup 2026-11-18 6:19 ` Srivatsa S. Bhat @ 2026-11-28 17:06 ` Prasanna Kumar T S M 0 siblings, 0 replies; 13+ messages in thread From: Prasanna Kumar T S M @ 2026-11-28 17:06 UTC (permalink / raw) To: Srivatsa S. Bhat, Pandey, Radhey Shyam Cc: jassisinghbrar, michal.simek, tanmay.shah, saeed.nowshadi, linux-kernel, linux-arm-kernel, ssengar, tgopinath, tglx 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-11-28 17:50 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox