From: Borsenkow Andrej <Andrej.Borsenkow@mow.siemens.ru>
To: Dave Jones <davej@suse.de>
Cc: Mandrake kernel list <kernel@mandrakesoft.com>,
linux-kernel list <linux-kernel@vger.kernel.org>,
Cooker list <cooker@linux-mandrake.com>
Subject: PATCH: apm.c - detection of brokern APM Idle call implementation
Date: 18 Dec 2001 20:54:47 +0300 [thread overview]
Message-ID: <1008698004.2273.1.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.33.0112170431060.11563-100000@Appserv.suse.de>
In-Reply-To: <Pine.LNX.4.33.0112170431060.11563-100000@Appserv.suse.de>
[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]
On Пнд, 2001-12-17 at 06:34, Dave Jones wrote:
> On 16 Dec 2001, Borsenkow Andrej wrote:
>
> > I thought once about run-time detection - if BIOS reports that Idle does
> > not slow down CPU try Idle call once and compare jiffies (probably
> > repeat several times to be sure). Is it sensible?
>
> A far simpler way would be to add DMI blacklist entries for the BIOSes
> that don't do this, although this assumes the problem machine has a DMI
> compliant BIOS.
>
Well, the following three-liners (+ comments) seems to do it. It checks
if clock was advanced after return from APM Idle - if not we assume BIOS
did not halt CPU and do it ourselves. The addidional condition &&
!current->need_resched is for the case when BIOS did halt CPU and
non-clock interrupt happened that waked up somebody else. But may be I
am just plain paranoid. The code has no impact for "BIOS slows CPU"
case.
It works here for broken BIOS. I appreciate if people with good BIOS
test it.
-andrej
[-- Attachment #2: apm-idle-2.diff --]
[-- Type: text/x-diff, Size: 813 bytes --]
--- apm.c.bor Tue Dec 18 20:30:08 2001
+++ apm.c Tue Dec 18 20:42:24 2001
@@ -1381,13 +1381,18 @@
*/
if (apm_do_idle() != -1) {
unsigned long start = jiffies;
+ unsigned long before;
while ((!exit_kapmd) && system_idle()) {
- if (apm_do_idle()) {
+ before = jiffies;
+ if (apm_do_idle() || (jiffies == before && !current->need_resched)) {
set_current_state(TASK_INTERRUPTIBLE);
/* APM needs us to snooze .. either
the BIOS call failed (-1) or it
slowed the clock (1). We sleep
- until it talks to us again */
+ until it talks to us again.
+ If clock did not advance CPU was
+ not halted by BIOS so we do it
+ now*/
schedule_timeout(1);
}
if ((jiffies - start) > APM_CHECK_TIMEOUT) {
prev parent reply other threads:[~2001-12-18 17:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-16 18:45 PATCH: apm.c - runtime parameter for APM Idle call Borsenkow Andrej
2001-12-17 3:34 ` Dave Jones
2001-12-18 17:54 ` Borsenkow Andrej [this message]
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=1008698004.2273.1.camel@localhost.localdomain \
--to=andrej.borsenkow@mow.siemens.ru \
--cc=cooker@linux-mandrake.com \
--cc=davej@suse.de \
--cc=kernel@mandrakesoft.com \
--cc=linux-kernel@vger.kernel.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®