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

Commit b9111b7b authored by Dave Jones's avatar Dave Jones
Browse files

[CPUFREQ] Remove preempt_disable from powernow-k8



Via reading the code, my understanding is that powernow-k8 uses
preempt_disable to ensure that driver->target doesn't migrate across cpus
whilst it's accessing per processor registers, however set_cpus_allowed
will provide this for us.  Additionally, remove schedule() calls from
set_cpus_allowed as set_cpus_allowed ensures that you're executing on the
target processor on return.

Signed-off-by: default avatarZwane Mwaikambo <zwane@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent df8b59be
Loading
Loading
Loading
Loading
+2 −14
Original line number Original line Diff line number Diff line
@@ -453,7 +453,6 @@ static int check_supported_cpu(unsigned int cpu)


	oldmask = current->cpus_allowed;
	oldmask = current->cpus_allowed;
	set_cpus_allowed(current, cpumask_of_cpu(cpu));
	set_cpus_allowed(current, cpumask_of_cpu(cpu));
	schedule();


	if (smp_processor_id() != cpu) {
	if (smp_processor_id() != cpu) {
		printk(KERN_ERR "limiting to cpu %u failed\n", cpu);
		printk(KERN_ERR "limiting to cpu %u failed\n", cpu);
@@ -488,9 +487,7 @@ static int check_supported_cpu(unsigned int cpu)


out:
out:
	set_cpus_allowed(current, oldmask);
	set_cpus_allowed(current, oldmask);
	schedule();
	return rc;
	return rc;

}
}


static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid)
static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid)
@@ -904,7 +901,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
	/* only run on specific CPU from here on */
	/* only run on specific CPU from here on */
	oldmask = current->cpus_allowed;
	oldmask = current->cpus_allowed;
	set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
	set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
	schedule();


	if (smp_processor_id() != pol->cpu) {
	if (smp_processor_id() != pol->cpu) {
		printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
		printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
@@ -959,8 +955,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi


err_out:
err_out:
	set_cpus_allowed(current, oldmask);
	set_cpus_allowed(current, oldmask);
	schedule();

	return ret;
	return ret;
}
}


@@ -1017,7 +1011,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
	/* only run on specific CPU from here on */
	/* only run on specific CPU from here on */
	oldmask = current->cpus_allowed;
	oldmask = current->cpus_allowed;
	set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
	set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
	schedule();


	if (smp_processor_id() != pol->cpu) {
	if (smp_processor_id() != pol->cpu) {
		printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
		printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
@@ -1036,7 +1029,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)


	/* run on any CPU again */
	/* run on any CPU again */
	set_cpus_allowed(current, oldmask);
	set_cpus_allowed(current, oldmask);
	schedule();


	pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
	pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
	pol->cpus = cpu_core_map[pol->cpu];
	pol->cpus = cpu_core_map[pol->cpu];
@@ -1071,7 +1063,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)


err_out:
err_out:
	set_cpus_allowed(current, oldmask);
	set_cpus_allowed(current, oldmask);
	schedule();
	powernow_k8_cpu_exit_acpi(data);
	powernow_k8_cpu_exit_acpi(data);


	kfree(data);
	kfree(data);
@@ -1107,7 +1098,6 @@ static unsigned int powernowk8_get (unsigned int cpu)
		set_cpus_allowed(current, oldmask);
		set_cpus_allowed(current, oldmask);
		return 0;
		return 0;
	}
	}
	preempt_disable();


	if (query_current_values_with_pending_wait(data))
	if (query_current_values_with_pending_wait(data))
		goto out;
		goto out;
@@ -1115,9 +1105,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
	khz = find_khz_freq_from_fid(data->currfid);
	khz = find_khz_freq_from_fid(data->currfid);


out:
out:
	preempt_enable_no_resched();
	set_cpus_allowed(current, oldmask);
	set_cpus_allowed(current, oldmask);

	return khz;
	return khz;
}
}