From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>,
Dave Jones <davej@codemonkey.org.uk>
Subject: Re: cpufreq problem wrt suspend/resume on Athlon64
Date: Thu, 3 Feb 2005 01:08:08 +0100 [thread overview]
Message-ID: <200502030108.09508.rjw@sisk.pl> (raw)
In-Reply-To: <20050202133153.GD29579@elf.ucw.cz>
On Wednesday, 2 of February 2005 14:31, Pavel Machek wrote:
> Hi!
>
> > I have noticed that the condition (cur_freq != cpu_policy->cur), which is
> > unlikely() according to cpufreq.c:cpufreq_resume(), occurs on every resume
> > on my box (Athlon64-based Asus). Every time the box resumes, I get a message
> > like that:
> >
> > Warning: CPU frequency out of sync: cpufreq and timing core thinks of 1600000, is 1800000 kHz.
> >
> > (the numbers vary: there may be 800000 vs 1600000 or even 800000 vs 1800000).
> >
> > Also, when the box is suspended on AC power and resumed on batteries, it often
> > reboots.
> >
> > Please let me know if there's anything (relatively simple :-)) that I can do
> > about it.
>
> Introduce _suspend() routine to cpufreq, and force cpu to 800MHz
> during suspend().
Do you mean like that:
--- linux-2.6.11-rc2-orig/drivers/cpufreq/cpufreq.c 2005-01-30 23:30:53.000000000 +0100
+++ linux-2.6.11-rc2/drivers/cpufreq/cpufreq.c 2005-02-03 00:50:05.000000000 +0100
@@ -939,10 +939,42 @@
return ret;
}
+static int cpufreq_suspend(struct sys_device * sysdev, u32 state)
+{
+ int cpu = sysdev->id;
+ struct cpufreq_policy *cpu_policy;
+
+ dprintk("suspending cpu %u\n", cpu);
+
+ if (!cpu_online(cpu))
+ return 0;
+
+ cpu_policy = cpufreq_cpu_get(cpu);
+ if (!cpu_policy)
+ return -EINVAL;
+
+ /* only handle each CPU group once */
+ if (unlikely(cpu_policy->cpu != cpu)) {
+ cpufreq_cpu_put(cpu_policy);
+ return 0;
+ }
+
+ if (cpufreq_driver->target) {
+ dprintk("cpufreq: trying to set CPU frequency to the minimal (%u kHz)\n",
+ cpu_policy->min);
+ cpufreq_driver->target(cpu_policy, cpu_policy->min,
+ CPUFREQ_RELATION_L);
+ }
+
+ cpufreq_cpu_put(cpu_policy);
+ return 0;
+}
+
static struct sysdev_driver cpufreq_sysdev_driver = {
.add = cpufreq_add_dev,
.remove = cpufreq_remove_dev,
.resume = cpufreq_resume,
+ .suspend = cpufreq_suspend,
};
> Put it back to right frequency during resume().
Well, I don't know which one is right, because the box might have been
suspended in different conditions (eg AC power vs batteries). I think it's
better to leave it at the minimal frequency for a while. Moreover, I don't
know if it's not necessary to force the minimal frequency again in resume()
(I imagine that some CPUs may change the frequency on the fly if they
are sufficiently loaded, and eg in swsusp we restore the image between
suspend() and resume(), so this may very well happen sometimes, it
seems).
Greets,
Rafael
--
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"
next prev parent reply other threads:[~2005-02-03 0:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-02 13:28 cpufreq problem wrt suspend/resume on Athlon64 Rafael J. Wysocki
2005-02-02 13:31 ` Pavel Machek
2005-02-03 0:08 ` Rafael J. Wysocki [this message]
2005-02-03 10:41 ` Pavel Machek
2005-02-03 10:56 ` Dominik Brodowski
2005-02-03 10:58 ` Pavel Machek
2005-02-03 11:01 ` Dominik Brodowski
2005-02-03 11:30 ` Rafael J. Wysocki
2005-02-03 12:40 ` Dominik Brodowski
2005-02-03 13:20 ` Rafael J. Wysocki
2005-02-03 14:22 ` Pavel Machek
2005-02-03 23:15 ` Rafael J. Wysocki
2005-02-03 23:34 ` Nigel Cunningham
2005-02-03 23:52 ` Rafael J. Wysocki
2005-02-07 12:38 ` cpufreq problem wrt suspend/resume on Athlon64 [update] Rafael J. Wysocki
2005-02-03 14:20 ` cpufreq problem wrt suspend/resume on Athlon64 Pavel Machek
2005-02-03 21:46 ` Rafael J. Wysocki
2005-02-03 22:00 ` Pavel Machek
2005-02-03 23:37 ` Rafael J. Wysocki
2005-02-03 22:01 ` Pavel Machek
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=200502030108.09508.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=davej@codemonkey.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
/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