RE: [PATCH] cpufreq: Fix the driver can not be unloaded issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: cpufreq-owner@xxxxxxxxxxxxxxx [mailto:cpufreq-owner@xxxxxxxxxxxxxxx]
> On Behalf Of Viresh Kumar
> Sent: 2013年4月24日 18:15
> To: Tang Yuantian-B29983
> Cc: rjw@xxxxxxx; cpufreq@xxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] cpufreq: Fix the driver can not be unloaded issue
> 
> On 24 April 2013 13:58,  <Yuantian.Tang@xxxxxxxxxxxxx> wrote:
> > From: Tang Yuantian <yuantian.tang@xxxxxxxxxxxxx>
> >
> > The driver compiled as a module can not be unloaded if there are more
> > than one cpu in policy->cpus. That's caused by
> > cpufreq_cpu_get() in cpufreq_add_dev_symlink(); It keep increasing the
> > module reference count.
> > This patch splites the module and policy reference count. It keeps the
> > module reference count unchanged and uses the policy reference count
> > to track the resource.
> >
> > Signed-off-by: Tang Yuantian <Yuantian.Tang@xxxxxxxxxxxxx>
> > ---
> >  drivers/cpufreq/cpufreq.c | 16 +++-------------
> >  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> I didn't quite get the problem you mentioned.. I haven't seen any issues
> with the core as of now.
> 
> When we unload a module we must call cpufreq_unregister_driver(), which
> will eventually call subsys_interface_unregister() and so
> cpufreq_remove_dev() will be called for each cpu. And so all the counts
> should be fine and eventually module should get unloaded.
> 

It happened when policy->cpus contains *MORE THEN ONE CPU*.
Taking my board T4240 for example, it has 3 cluster, 8 CPUs for each cluster.
The log is:
# insmod ppc-corenet-cpufreq.ko
ppc_corenet_cpufreq: Freescale PowerPC corenet CPU frequency scaling driver
# rmmod ppc-corenet-cpufreq.ko
ERROR: Module ppc_corenet_cpufreq is in use
# lsmod
Module         		Size  Used by
ppc_corenet_cpufreq     6542  9
# uname -a
Linux T4240 3.9.0-rc1-11081-g34642bb-dirty #44 SMP Thu Apr 25 08:58:26 CST 2013 ppc64 unknown

I am not using the newest kernel (since new t4240 board has not included yet),
but the issue is still there.
The reason is just like what I said in patch.

Regards,
Yuantian

> --
> viresh
> --
> To unsubscribe from this list: send the line "unsubscribe cpufreq" in the
> body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
> http://vger.kernel.org/majordomo-info.html

?韬{.n?????%??檩??w?{.n???珉z??^n?■???h?璀?{?夸z罐?+€?zf"?????i?????_璁?:+v??撸?





[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux