From: Paul Mackerras <paulus@samba.org>
To: akpm@osdl.org, torvalds@osdl.org
Cc: benh@kernel.crashing.org, linux-kernel@vger.kernel.org
Subject: [PATCH] PPC32: Fix cpu voltage change delay
Date: Sun, 10 Oct 2004 13:49:36 +1000 [thread overview]
Message-ID: <16744.45392.781083.565926@cargo.ozlabs.ibm.com> (raw)
This patch fixes a problem where my new powerbook would sometimes hang
or crash when changing CPU speed. We had schedule_timeout(HZ/1000) in
there, intended to provide a delay of one millisecond. However, even
with HZ=1000, it was (I believe) only waiting for the next jiffy
before proceeding, which could be less than a millisecond. Changing
the code to use msleep, and specifying a time of 1 jiffy + 1ms has
fixed the problem. (When I looked at the msleep code, it appeared to
me that msleep(1) with HZ=1000 would sleep for between 0 and 1ms.)
Ben also asked me to remove the code that changes the AACK delay
enable, after looking in the Darwin sources and seeing that Darwin
does not change this in its corresponding code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
diff -urN linux-2.5/arch/ppc/platforms/pmac_cpufreq.c pmac-2.5/arch/ppc/platforms/pmac_cpufreq.c
--- linux-2.5/arch/ppc/platforms/pmac_cpufreq.c 2004-09-24 15:23:06.000000000 +1000
+++ pmac-2.5/arch/ppc/platforms/pmac_cpufreq.c 2004-10-10 11:23:43.000000000 +1000
@@ -140,11 +140,8 @@
if (low_speed == 0) {
/* ramping up, set voltage first */
pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ/1000);
- } else {
- /* ramping down, enable aack delay first */
- pmac_call_feature(PMAC_FTR_AACK_DELAY_ENABLE, NULL, 1, 0);
+ /* Make sure we sleep for at least 1ms */
+ msleep(1 + jiffies_to_msecs(1));
}
/* set frequency */
@@ -153,11 +150,7 @@
if (low_speed == 1) {
/* ramping down, set voltage last */
pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ/1000);
- } else {
- /* ramping up, disable aack delay last */
- pmac_call_feature(PMAC_FTR_AACK_DELAY_ENABLE, NULL, 0, 0);
+ msleep(1 + jiffies_to_msecs(1));
}
return 0;
next reply other threads:[~2004-10-10 3:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-10 3:49 Paul Mackerras [this message]
2004-10-22 18:01 ` Nishanth Aravamudan
2004-10-22 22:34 ` Benjamin Herrenschmidt
2004-10-22 22:49 ` Nishanth Aravamudan
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=16744.45392.781083.565926@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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
all inboxes | Powered by JetHome®