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

Commit f6bc390d authored by David Dai's avatar David Dai Committed by Gerrit - the friendly Code Review server
Browse files

clk: qcom: clk-cpu-osm: move set policy->cpu flag to end of init



In order to circumvent a race condition where one CPU may access the
frequency table of the policy of another CPU while it's hotplugging,
move setting of the policy->cpu flag to the end of the init
osm operator after it initializes its frequency table.

Change-Id: I4b02caa4995387c16a6db8b8eb9de7271f23c2f6
Signed-off-by: default avatarDavid Dai <daidavid1@codeaurora.org>
parent a74cb474
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ struct clk_osm {
	u64 total_cycle_counter;
	u32 prev_cycle_counter;
	unsigned long rate;
	cpumask_t related_cpus;
};

static bool is_sdmshrike;
@@ -560,7 +561,7 @@ static struct clk_osm *osm_configure_policy(struct cpufreq_policy *policy)
		if (parent != c_parent)
			continue;

		cpumask_set_cpu(cpu, policy->cpus);
		cpumask_set_cpu(cpu, &c->related_cpus);
		if (n->core_num == 0)
			first = n;
	}
@@ -688,6 +689,9 @@ static int osm_cpufreq_cpu_init(struct cpufreq_policy *policy)
	policy->dvfs_possible_from_any_cpu = true;
	policy->fast_switch_possible = true;
	policy->driver_data = c;

	cpumask_copy(policy->cpus, &c->related_cpus);

	return 0;

err: