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

Commit 20acc7fd authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta
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>
parent 2bf0c60e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1391,9 +1391,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
@@ -1370,7 +1370,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
@@ -11307,7 +11307,7 @@ check_hotplug_start_event(struct perf_event *event)
		event->pmu->start(event, 0);
}

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;
@@ -11457,25 +11457,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;
@@ -11502,8 +11483,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);