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

Commit 0e144da4 authored by Olav Haugan's avatar Olav Haugan Committed by Gerrit - the friendly Code Review server
Browse files

sched: Ensure proper synch between isolation, hotplug, and suspend



Isolation code needs to be synchronized with both hotplug and suspend.
Ensure this by taking the lock that is taken by both paths and ensure
hotplug notifiers are processed for suspend/resume.

Change-Id: Ibc1762bba9fa2310a7443b4afa39c84b3b4c7534
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent a5e669b8
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -5788,7 +5788,7 @@ int sched_isolate_cpu(int cpu)
	if (trace_sched_isolate_enabled())
		start_time = sched_clock();

	lock_device_hotplug();
	cpu_maps_update_begin();

	cpumask_andnot(&avail_cpus, cpu_online_mask, cpu_isolated_mask);

@@ -5820,7 +5820,7 @@ int sched_isolate_cpu(int cpu)
	sched_update_group_capacities(cpu);

out:
	unlock_device_hotplug();
	cpu_maps_update_done();
	trace_sched_isolate(cpu, cpumask_bits(cpu_isolated_mask)[0],
			    start_time, 1);
	return ret_code;
@@ -5841,8 +5841,6 @@ int sched_unisolate_cpu_unlocked(int cpu)
	if (trace_sched_isolate_enabled())
		start_time = sched_clock();

	lock_device_hotplug_assert();

	if (!cpu_isolation_vote[cpu]) {
		ret_code = -EINVAL;
		goto out;
@@ -5881,9 +5879,9 @@ int sched_unisolate_cpu(int cpu)
{
	int ret_code;

	lock_device_hotplug();
	cpu_maps_update_begin();
	ret_code = sched_unisolate_cpu_unlocked(cpu);
	unlock_device_hotplug();
	cpu_maps_update_done();
	return ret_code;
}

+3 −7
Original line number Diff line number Diff line
@@ -831,14 +831,10 @@ static int __ref cpu_callback(struct notifier_block *nfb,
	unsigned int need;
	int ret = NOTIFY_OK;

	/* Don't affect suspend resume */
	if (action & CPU_TASKS_FROZEN)
		return NOTIFY_OK;

	if (unlikely(!cluster || !cluster->inited))
		return NOTIFY_OK;

	switch (action) {
	switch (action & ~CPU_TASKS_FROZEN) {
	case CPU_UP_PREPARE:

		/* If online state of CPU somehow got out of sync, fix it. */
@@ -1033,7 +1029,7 @@ static int __init core_ctl_init(void)
	cpufreq_register_notifier(&cpufreq_pol_nb, CPUFREQ_POLICY_NOTIFIER);
	cpufreq_register_notifier(&cpufreq_gov_nb, CPUFREQ_GOVINFO_NOTIFIER);

	lock_device_hotplug();
	cpu_maps_update_begin();
	for_each_online_cpu(cpu) {
		struct cpufreq_policy *policy;
		int ret;
@@ -1047,7 +1043,7 @@ static int __init core_ctl_init(void)
			cpufreq_cpu_put(policy);
		}
	}
	unlock_device_hotplug();
	cpu_maps_update_done();
	initialized = true;
	return 0;
}