perf: Fix warning during perf core init
The warning was generated due to the cpu hotplug state
conflict for CPUHP_AP_PERF_ONLINE. The original idea was
to replace the perf_event_init_cpu with perf_event_start_swevents.
The fix replaces the callback in cpu.c and removes the registration
in the perf core.
Change-Id: I5cb20de38b39f3035fa98977b9c280bb20521d28
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: Swetha Chikkaboraiah <schikk@codeaurora.org>
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 7bdbe3c..908556c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1409,9 +1409,11 @@
#ifdef CONFIG_PERF_EVENTS
int perf_event_init_cpu(unsigned int cpu);
int perf_event_exit_cpu(unsigned int cpu);
+int perf_event_start_swevents(unsigned int cpu);
#else
#define perf_event_init_cpu NULL
#define perf_event_exit_cpu NULL
+#define perf_event_start_swevents NULL
#endif
#endif /* _LINUX_PERF_EVENT_H */
diff --git a/kernel/cpu.c b/kernel/cpu.c
index cc2e478..7755c49 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1556,7 +1556,7 @@
},
[CPUHP_AP_PERF_ONLINE] = {
.name = "perf:online",
- .startup.single = perf_event_init_cpu,
+ .startup.single = perf_event_start_swevents,
.teardown.single = perf_event_exit_cpu,
},
[CPUHP_AP_WORKQUEUE_ONLINE] = {
diff --git a/kernel/events/core.c b/kernel/events/core.c
index cf9854d..d59dcc5 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11226,7 +11226,7 @@
spin_unlock(&zombie_list_lock);
}
-static int perf_event_start_swevents(unsigned int cpu)
+int perf_event_start_swevents(unsigned int cpu)
{
struct perf_event_context *ctx;
struct pmu *pmu;
@@ -11370,25 +11370,6 @@
.notifier_call = event_idle_notif,
};
-#ifdef CONFIG_HOTPLUG_CPU
-static int perf_cpu_hp_init(void)
-{
- int ret;
-
- ret = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ONLINE,
- "PERF/CORE/CPUHP_AP_PERF_ONLINE",
- perf_event_start_swevents,
- perf_event_exit_cpu);
- if (ret)
- pr_err("CPU hotplug notifier for perf core could not be registered: %d\n",
- ret);
-
- return ret;
-}
-#else
-static int perf_cpu_hp_init(void) { return 0; }
-#endif
-
void __init perf_event_init(void)
{
int ret, cpu;
@@ -11415,8 +11396,6 @@
perf_event_init_cpu(smp_processor_id());
idle_notifier_register(&perf_event_idle_nb);
register_reboot_notifier(&perf_reboot_notifier);
- ret = perf_cpu_hp_init();
- WARN(ret, "core perf_cpu_hp_init() failed with: %d", ret);
ret = init_hw_breakpoint();
WARN(ret, "hw_breakpoint initialization failed with: %d", ret);