Re: [PATCH 5/7] cpufreq: balance out cpufreq_cpu_{get,put} forscaling drivers using setpolicy

From: Viresh Kumar
Date: Wed Feb 06 2013 - 11:19:46 EST


On 6 February 2013 21:41, Dirk Brandewie <dirk.brandewie@xxxxxxxxx> wrote:
> our files are clearly out of sync :-) The code in cpufreq_add_dev() is

I was at latest bleeding-edge then, but i still have below code in my HEAD.

> #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);
> return 0;
> }
>
> The reference added by this cpufreq_cpu_get() is finally dropped in
> __cpufreq_remove_dev() with the call to __cpufreq_governor()

__cpufreq_governor() is not calling cpufreq_cpu_put() at all and is dropping
reference for the governor only, not for policy.

> if (driver->target)
> __cpufreq_governor(data, CPUFREQ_GOV_STOP);
>
> Without this change I hang at:
> pr_debug("waiting for dropping of refcount\n");
> wait_for_completion(cmp);

Below should have fixed it for you i believe.

pr_debug("%s: removing link, cpu: %d\n", __func__, cpu);
cpufreq_cpu_put(data);
unlock_policy_rwsem_write(cpu);

--
viresh
--
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/