Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c14a51f5 authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarRaghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: default avatarSwetha Chikkaboraiah <schikk@codeaurora.org>
parent 38cd0d65
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1409,9 +1409,11 @@ static struct device_attribute format_attr_##_name = __ATTR_RO(_name)
#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 */
+1 −1
Original line number Diff line number Diff line
@@ -1556,7 +1556,7 @@ static struct cpuhp_step cpuhp_ap_states[] = {
	},
	[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] = {
+1 −22
Original line number Diff line number Diff line
@@ -11226,7 +11226,7 @@ static void perf_event_zombie_cleanup(unsigned int cpu)
	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 @@ static struct notifier_block perf_event_idle_nb = {
	.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 @@ void __init perf_event_init(void)
	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);