From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Race in cpufreq_add_dev()? Date: Thu, 06 Jul 2006 12:35:37 -0700 Message-ID: <44AD6609.1080604@goop.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: cpufreq-bounces@lists.linux.org.uk Errors-To: cpufreq-bounces+glkc-cpufreq=m.gmane.org+glkc-cpufreq=m.gmane.org@lists.linux.org.uk Content-Type: text/plain; charset="us-ascii"; format="flowed" To: cpufreq@lists.linux.org.uk 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