* Race in cpufreq_add_dev()?
@ 2006-07-06 19:35 Jeremy Fitzhardinge
2006-10-03 0:27 ` Dominik Brodowski
0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Fitzhardinge @ 2006-07-06 19:35 UTC (permalink / raw)
To: cpufreq
cpufreq_add_dev contains the test:
#ifdef CONFIG_SMP
/* check whether a different CPU already registered this
* CPU because it is in the same boat. */
policy = cpufreq_cpu_get(cpu);
if (unlikely(policy)) {
cpufreq_cpu_put(policy);
cpufreq_debug_enable_ratelimit();
return 0;
}
#endif
I don't see what prevents two CPUs from racing through here. Both could
perform this test and find that there's no policy for the CPU, and then
both will attempt to add it. Or is there something else which
serializes multiple CPUs through this code?
J
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Race in cpufreq_add_dev()?
2006-07-06 19:35 Race in cpufreq_add_dev()? Jeremy Fitzhardinge
@ 2006-10-03 0:27 ` Dominik Brodowski
0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2006-10-03 0:27 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: cpufreq
On Thu, Jul 06, 2006 at 12:35:37PM -0700, Jeremy Fitzhardinge wrote:
> cpufreq_add_dev contains the test:
>
> #ifdef CONFIG_SMP
> /* check whether a different CPU already registered this
> * CPU because it is in the same boat. */
> policy = cpufreq_cpu_get(cpu);
> if (unlikely(policy)) {
> cpufreq_cpu_put(policy);
> cpufreq_debug_enable_ratelimit();
> return 0;
> }
> #endif
>
> I don't see what prevents two CPUs from racing through here. Both could
> perform this test and find that there's no policy for the CPU, and then
> both will attempt to add it. Or is there something else which
> serializes multiple CPUs through this code?
AFAICS it is protected by sysdev_drivers_lock.
Dominik
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-03 0:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-06 19:35 Race in cpufreq_add_dev()? Jeremy Fitzhardinge
2006-10-03 0:27 ` Dominik Brodowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.