* [PATCH 1/2] perf/x86/amd/power: Fix missing CPU hotplug setup check and cleanup
2026-11-12 23:50 [PATCH 0/2] perf/x86/amd: Check CPU hotplug setup and unwind failures Ayush Yaduvanshi
@ 2026-11-12 23:50 ` Ayush Yaduvanshi
2026-11-12 23:50 ` [PATCH 2/2] perf/x86/amd/ibs: Fix missing CPU hotplug cleanup and unchecked init return Ayush Yaduvanshi
2026-12-02 12:58 ` [PATCH 0/2] perf/x86/amd: Check CPU hotplug setup and unwind failures Ayush Yaduvanshi
2 siblings, 0 replies; 4+ messages in thread
From: Ayush Yaduvanshi @ 2026-11-12 23:50 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Borislav Petkov, Dave Hansen, x86
Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, H . Peter Anvin, linux-perf-users,
linux-kernel, Ayush Yaduvanshi
Check the return value of cpuhp_setup_state() and remove the hotplug
state if perf_pmu_register() fails.
Signed-off-by: Ayush Yaduvanshi <ayush37735@gmail.com>
---
arch/x86/events/amd/power.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c
index 66197214b010..2627d5269b52 100644
--- a/arch/x86/events/amd/power.c
+++ b/arch/x86/events/amd/power.c
@@ -282,13 +282,16 @@ static int __init amd_power_pmu_init(void)
}
- cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_POWER_ONLINE,
- "perf/x86/amd/power:online",
- power_cpu_init, power_cpu_exit);
+ ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_POWER_ONLINE,
+ "perf/x86/amd/power:online",
+ power_cpu_init, power_cpu_exit);
+ if (ret)
+ return ret;
ret = perf_pmu_register(&pmu_class, "power", -1);
if (WARN_ON(ret)) {
pr_warn("AMD Power PMU registration failed\n");
+ cpuhp_remove_state(CPUHP_AP_PERF_X86_AMD_POWER_ONLINE);
return ret;
}
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] perf/x86/amd/ibs: Fix missing CPU hotplug cleanup and unchecked init return
2026-11-12 23:50 [PATCH 0/2] perf/x86/amd: Check CPU hotplug setup and unwind failures Ayush Yaduvanshi
2026-11-12 23:50 ` [PATCH 1/2] perf/x86/amd/power: Fix missing CPU hotplug setup check and cleanup Ayush Yaduvanshi
@ 2026-11-12 23:50 ` Ayush Yaduvanshi
2026-12-02 12:58 ` [PATCH 0/2] perf/x86/amd: Check CPU hotplug setup and unwind failures Ayush Yaduvanshi
2 siblings, 0 replies; 4+ messages in thread
From: Ayush Yaduvanshi @ 2026-11-12 23:50 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Borislav Petkov, Dave Hansen, x86
Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, H . Peter Anvin, linux-perf-users,
linux-kernel, Ayush Yaduvanshi
Check the return value of cpuhp_setup_state() and remove the hotplug state
if perf_event_ibs_init() fails. Unregister syscore operations and reset
ibs_caps on initialization failure.
Signed-off-by: Ayush Yaduvanshi <ayush37735@gmail.com>
---
arch/x86/events/amd/ibs.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index 66e67e27224f..2518cc7a24a6 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -2129,6 +2129,7 @@ static int x86_pmu_amd_ibs_dying_cpu(unsigned int cpu)
static __init int amd_ibs_init(void)
{
u32 caps;
+ int ret;
caps = __get_ibs_caps();
if (!caps)
@@ -2156,12 +2157,27 @@ static __init int amd_ibs_init(void)
* x86_pmu_amd_ibs_starting_cpu will be called from core on
* all online cpus.
*/
- cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
- "perf/x86/amd/ibs:starting",
- x86_pmu_amd_ibs_starting_cpu,
- x86_pmu_amd_ibs_dying_cpu);
+ ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
+ "perf/x86/amd/ibs:starting",
+ x86_pmu_amd_ibs_starting_cpu,
+ x86_pmu_amd_ibs_dying_cpu);
+ if (ret)
+ goto err_pm;
+
+ ret = perf_event_ibs_init();
+ if (ret) {
+ cpuhp_remove_state(CPUHP_AP_PERF_X86_AMD_IBS_STARTING);
+ goto err_pm;
+ }
- return perf_event_ibs_init();
+ return 0;
+
+err_pm:
+#ifdef CONFIG_PM
+ unregister_syscore(&perf_ibs_syscore);
+#endif
+ ibs_caps = 0;
+ return ret;
}
/* Since we need the pci subsystem to init ibs we can't do this earlier: */
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] perf/x86/amd: Check CPU hotplug setup and unwind failures
2026-11-12 23:50 [PATCH 0/2] perf/x86/amd: Check CPU hotplug setup and unwind failures Ayush Yaduvanshi
2026-11-12 23:50 ` [PATCH 1/2] perf/x86/amd/power: Fix missing CPU hotplug setup check and cleanup Ayush Yaduvanshi
2026-11-12 23:50 ` [PATCH 2/2] perf/x86/amd/ibs: Fix missing CPU hotplug cleanup and unchecked init return Ayush Yaduvanshi
@ 2026-12-02 12:58 ` Ayush Yaduvanshi
2 siblings, 0 replies; 4+ messages in thread
From: Ayush Yaduvanshi @ 2026-12-02 12:58 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Borislav Petkov, Dave Hansen, x86
Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, H . Peter Anvin, linux-perf-users,
linux-kernel
Hi,
Gentle ping on this 2-patch series for AMD Power and IBS initialization
error paths. Please let me know if this looks good or if any changes are
needed.
Thanks,
Ayush
^ permalink raw reply [flat|nested] 4+ messages in thread