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

Commit 25c2dd34 authored by Arun KS's avatar Arun KS
Browse files

cpufreq_stats: Disable cpu hotplug during stats table creation



During boot there is a possibility for two execution context to create
stats percpu variable concurrently. One called from cpufreq_stats_init
context and other as a part of policy notifier call back. This will
result in corrupted stats variable.

Disable cpu hotplug to avoid corruption.

Change-Id: Iefe2d6b370f6ec303286afc139fa9913fa9a4099
Suggested-by: default avatarSaravana Kannan <skannan@codeaurora.org>
Signed-off-by: default avatarArun KS <arunks@codeaurora.org>
parent dd0af8d2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -682,16 +682,20 @@ static int __init cpufreq_stats_init(void)
	if (ret)
		return ret;

	get_online_cpus();
	for_each_online_cpu(cpu)
		cpufreq_stats_create_table(cpu);
	put_online_cpus();

	ret = cpufreq_register_notifier(&notifier_trans_block,
				CPUFREQ_TRANSITION_NOTIFIER);
	if (ret) {
		cpufreq_unregister_notifier(&notifier_policy_block,
				CPUFREQ_POLICY_NOTIFIER);
		get_online_cpus();
		for_each_online_cpu(cpu)
			cpufreq_stats_free_table(cpu);
		put_online_cpus();
		return ret;
	}