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

Commit 8b04088a authored by Patrick Fay's avatar Patrick Fay
Browse files

Perf: arm64: enable idle_update at end of probe



Currently armv8pmu_idle_update is enabled before
arm_pmu_device_probe has completed. arm_pmu_device_probe
initializes some structures need by armv8pmu_idle_update.
armv8pmu_idle_update can get called before these structures
are complete leading to seg faults. Set a flag to prevent
armv8pmu_idle_update from trying to access these structures
until arm_pmu_device_probe is finished. Also move the call
to perf_event_cpu_hp_init after arm_pmu_device_probe so
that hotplug doesn't overwrite the flag.

Change-Id: I695eaa396d4df23dcee72dda41f342d865a27d08
Signed-off-by: default avatarPatrick Fay <pfay@codeaurora.org>
parent 2d19be1f
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -1189,20 +1189,24 @@ static int armv8_pmu_device_probe(struct platform_device *pdev)
{
	int ret, cpu;

	/* set to true so armv8pmu_idle_update doesn't try to load
	 * hw_events before arm_pmu_device_probe has initialized it.
	 */
	for_each_possible_cpu(cpu) {
		per_cpu(is_hotplugging, cpu) = true;
	}

	ret = arm_pmu_device_probe(pdev, armv8_pmu_of_device_ids,
		(acpi_disabled ?  NULL : armv8_pmu_probe_table));

	if (!ret) {
		for_each_possible_cpu(cpu)
			per_cpu(is_hotplugging, cpu) = false;

		ret = perf_event_cpu_hp_init();
	}

	if (ret)
	return ret;

	if (acpi_disabled)
		return arm_pmu_device_probe(pdev, armv8_pmu_of_device_ids,
					    NULL);

	return arm_pmu_device_probe(pdev, armv8_pmu_of_device_ids,
				    armv8_pmu_probe_table);
}

static struct platform_driver armv8_pmu_driver = {