From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Toralf Förster" <toralf.foerster@gmx.de>
Cc: cpufreq@vger.kernel.org, Linux PM list <linux-pm@vger.kernel.org>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Subject: Re: stable 3-10-3: strange output of "lsmod | grep ^acpi_cpufreq"
Date: Mon, 29 Jul 2013 00:11:18 +0200 [thread overview]
Message-ID: <2111514.pxW5saG1J3@vostro.rjw.lan> (raw)
In-Reply-To: <51F4F0A2.1070705@gmx.de>
On Sunday, July 28, 2013 12:21:22 PM Toralf Förster wrote:
> On 07/28/2013 01:39 AM, Rafael J. Wysocki wrote:
> > On Saturday, July 27, 2013 07:40:34 PM Toralf Förster wrote:
> >> it gives at a ThinkPad T420:
> >>
> >> tfoerste@n22 ~/tmp $ lsmod | grep ^acpi_cpufreq
> >> acpi_cpufreq 12902 2147483647
> >
> > That is -1, which indicates some module refcount woes.
>
> yes, ofc.
>
> The issue apears after 1 s2ram/resume cycle, before s2ram the refcount is 1.
>
> > I definitely can't see that with the mainline on my machines.
>
> It is in mainline too.
Does the appended patch help?
Rafael
---
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: cpufreq: Fix cpufreq driver module refcount balance after suspend/resume
Since cpufreq_cpu_put() called by __cpufreq_remove_dev() drops the
driver module refcount, the latter has to bump up that refcount to
start with to balance the drop, or the cpufreq driver refcount will
become negative after a suspend/resume cycle.
Reported-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/cpufreq.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq.c
+++ linux-pm/drivers/cpufreq/cpufreq.c
@@ -1016,6 +1016,9 @@ static int __cpufreq_remove_dev(struct d
pr_debug("%s: unregistering CPU %u\n", __func__, cpu);
+ if (!try_module_get(cpufreq_driver->owner))
+ return -EINVAL;
+
write_lock_irqsave(&cpufreq_driver_lock, flags);
data = per_cpu(cpufreq_cpu_data, cpu);
@@ -1025,7 +1028,8 @@ static int __cpufreq_remove_dev(struct d
if (!data) {
pr_debug("%s: No cpu_data found\n", __func__);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
}
if (cpufreq_driver->target)
@@ -1063,9 +1067,9 @@ static int __cpufreq_remove_dev(struct d
unlock_policy_rwsem_write(cpu);
- ret = sysfs_create_link(&cpu_dev->kobj, &data->kobj,
+ sysfs_create_link(&cpu_dev->kobj, &data->kobj,
"cpufreq");
- return -EINVAL;
+ goto err;
}
WARN_ON(lock_policy_rwsem_write(cpu));
@@ -1110,6 +1114,10 @@ static int __cpufreq_remove_dev(struct d
per_cpu(cpufreq_policy_cpu, cpu) = -1;
return 0;
+
+ err:
+ module_put(cpufreq_driver->owner);
+ return ret;
}
next prev parent reply other threads:[~2013-07-28 22:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-27 17:40 stable 3-10-3: strange output of "lsmod | grep ^acpi_cpufreq" Toralf Förster
2013-07-27 23:39 ` Rafael J. Wysocki
2013-07-28 8:08 ` Toralf Förster
2013-07-28 8:08 ` Srivatsa S. Bhat
2013-07-28 10:21 ` Toralf Förster
2013-07-28 22:11 ` Rafael J. Wysocki [this message]
2013-07-28 22:43 ` Rafael J. Wysocki
2013-07-28 23:20 ` Rafael J. Wysocki
2013-07-29 7:51 ` Viresh Kumar
2013-07-29 9:44 ` Srivatsa S. Bhat
2013-07-29 9:41 ` Srivatsa S. Bhat
2013-07-29 11:22 ` Viresh Kumar
2013-07-29 11:54 ` Rafael J. Wysocki
2013-07-29 11:48 ` Srivatsa S. Bhat
2013-07-29 17:23 ` Toralf Förster
2013-07-29 20:19 ` Rafael J. Wysocki
2013-07-30 5:23 ` Viresh Kumar
2013-07-29 11:49 ` Rafael J. Wysocki
2013-07-29 11:44 ` Srivatsa S. Bhat
2013-07-29 12:04 ` Rafael J. Wysocki
2013-07-29 15:27 ` Srivatsa S. Bhat
2013-07-29 20:28 ` Rafael J. Wysocki
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=2111514.pxW5saG1J3@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=cpufreq@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=toralf.foerster@gmx.de \
/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