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

Commit b55a0de8 authored by Vikram Mulukutla's avatar Vikram Mulukutla Committed by Karthik Parsha
Browse files

PM / devfreq: Workaround cpufreq REMOVE_POLICY versus hotplug lock race



It is not possible to ensure the synchronization of REMOVE_POLICY
notifications with CPU hotplug lock; {get,put}_online_cpus ensures
that hotplug cannot happen, but it is still possible to receive
REMOVE_POLICY notifications asynchronously while checking for online
CPUs within a {get,put}_online_cpus critical section.

Account for this by detecting that we haven't yet setup a local state
when the REMOVE_POLICY notification comes in.

Change-Id: I3cb750f3984ebe078154734444660675e8d8b5bc
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent 53e6e12c
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -189,8 +189,10 @@ static int cpufreq_policy_notifier(struct notifier_block *nb,


	case CPUFREQ_REMOVE_POLICY:
	case CPUFREQ_REMOVE_POLICY:
		mutex_lock(&state_lock);
		mutex_lock(&state_lock);
		if (state[policy->cpu]) {
			state[policy->cpu]->on = false;
			state[policy->cpu]->on = false;
			update_all_devfreqs();
			update_all_devfreqs();
		}
		mutex_unlock(&state_lock);
		mutex_unlock(&state_lock);
		break;
		break;
	}
	}