Re: Regression on cpufreq in v3.12-rc1

From: Viresh Kumar
Date: Fri Sep 20 2013 - 04:49:41 EST


On 20 September 2013 14:11, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> Any other idea why this patch is causing the issue?

I went into looking that patch in more detail
after my first reply, not as if I ran away from answering that :)

Probably yes.. I know what's causing it:

unsigned int cpufreq_get(unsigned int cpu)
{
unsigned int ret_freq = 0;
- struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);

- if (!policy)
- goto out;
+ if (!down_read_trylock(&cpufreq_rwsem))
+ return 0;

if (unlikely(lock_policy_rwsem_read(cpu)))
goto out_policy;
@@ -1438,8 +1413,8 @@ unsigned int cpufreq_get(unsigned int cpu)
unlock_policy_rwsem_read(cpu);

out_policy:
- cpufreq_cpu_put(policy);
-out:
+ up_read(&cpufreq_rwsem);
+
return ret_freq;
}

---------x---------------x--------------

We used to return early in case policy isn't found, but now we went
and took the lock..

Hmm... Remember I told you last time that I have another way of fixing
it up, probably we need that now..

I wanted to add another variable to reflect if a cpufreq_driver is registered
or not, and if not then return early from these routines..

I will get that in now, please see if you can give it a try..

But I am still surprised how are we reaching this place before your cpufreq
driver gets registered..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/