From: Yi Yang <yi.y.yang@intel.com>
To: akpm@linux-foundation.org, torvalds@linux-foundation.org, gregkh@suse.de
Cc: davej@codemonkey.org.uk, mingo@elte.hu,
cpufreq@lists.linux.org.uk, linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
yhlu.kernel@gmail.com, elendil@planet.nl
Subject: [PATCH 2.6.25-rc1] cpufreq: fix cpufreq policy refcount imbalance
Date: Fri, 15 Feb 2008 07:44:29 +0800 [thread overview]
Message-ID: <1203032669.3897.8.camel@yangyi-dev.bj.intel.com> (raw)
In-Reply-To: <1201043126.3861.5.camel@yangyi-dev.bj.intel.com>
When one cpu is set to offline, the caller process will hang, according to
the trace data, the problem lies in the refcount error in cpufreq driver,
cpufreq_cpu_callback will wait for completion policy->kobj_unregister
which is nerver completed because a refcount error in function
__cpufreq_remove_dev in file driver/cpufreq/cpufreq.c results in not
calling kobject release method.
In driver/cpufreq/cpufreq.c, the refcount of data->kobj isn't 1 when it
will be unregistered, this problem didn't exist in 2.6.24 and earlier.
The root cause is kobject API switch, kobject_init_and_add and kobject_put
replace older kobject_register and kobject_unregister in 2.6.25-rc1,
compared to 2.6.24, kobject_unregister is deleted in function
__cpufreq_remove_dev but it isn't replaced with kobject_put.
This patch adds kobject_put to balance refcount. I noticed Greg suggests
it will fix a power-off issue to remove kobject_get statement block, but i
think that isn't the best way because those code block has existed very long
and it is helpful because the successive statements are invoking relevant
data.
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
cpufreq.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/cpufreq/cpufreq.c 2008-02-15 04:41:29.000000000 +0800
+++ b/drivers/cpufreq/cpufreq.c 2008-02-15 06:56:56.000000000 +0800
@@ -1057,12 +1057,17 @@ static int __cpufreq_remove_dev (struct
unlock_policy_rwsem_write(cpu);
+ /* it matches the previous kobject_get */
kobject_put(&data->kobj);
/* we need to make sure that the underlying kobj is actually
* not referenced anymore by anybody before we proceed with
* unloading.
*/
+
+ /* unregister data->kobj, it matches kobject_init_and_add */
+ kobject_put(&data->kobj);
+
dprintk("waiting for dropping of refcount\n");
wait_for_completion(&data->kobj_unregister);
dprintk("wait complete\n");
next parent reply other threads:[~2008-02-15 8:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1199441414.19185.9.camel@yangyi-dev.bj.intel.com>
[not found] ` <1201043126.3861.5.camel@yangyi-dev.bj.intel.com>
2008-02-14 23:44 ` Yi Yang [this message]
2008-02-14 23:48 ` [PATCH 2.6.25-rc1] cpufreq: fix cpufreq policy refcount imbalance Yi Yang
2008-02-15 15:52 ` [linux-pm] " Alan Stern
2008-02-15 18:24 ` Greg KH
2008-02-15 21:01 ` Greg KH
2008-02-25 0:46 ` [PATCH 2.6.25-rc3] cpuidle: fix cpuidle time and usage overflow Yi Yang
2008-02-25 10:15 ` Ingo Molnar
2008-02-25 1:10 ` Yi Yang
2008-03-26 4:46 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1203032669.3897.8.camel@yangyi-dev.bj.intel.com \
--to=yi.y.yang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=cpufreq@lists.linux.org.uk \
--cc=davej@codemonkey.org.uk \
--cc=elendil@planet.nl \
--cc=gregkh@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
--cc=yhlu.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox