public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borsenkow Andrej <Andrej.Borsenkow@mow.siemens.ru>
To: Mandrake kernel list <kernel@mandrakesoft.com>
Cc: linux-kernel list <linux-kernel@vger.kernel.org>,
	Cooker list <cooker@linux-mandrake.com>
Subject: PATCH: apm.c - runtime parameter for APM Idle call
Date: 16 Dec 2001 21:45:18 +0300	[thread overview]
Message-ID: <1008528319.2243.5.camel@localhost.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]

After investigating kapm_idled problem here it turned out quite simple -
BIOS neither slows down CPU nor halts it so kapm_idled enters busy loop
doing basically

while !system_busy
  do nothing

eating away CPU. This applies to patch of Andreas as well.

I do not like an option of recompiling without CONFIG_APM_CPU_IDLE
because I think about distribution kernel in the first place. I have
ASUS CUSL2 motherboard - it is not unusual brand and obviously many
people have the same problem and you cannot expect all of them to
recompile kernel. So this patch adds runtime parameter (no-)apm-idle
that has the same effect - enabling/disabling usage of APM Idle BIOS
calls. It is initialised according to CONFIG_APM_CPU_IDLE and should be
100% compatible.

If Andreas patch is accepted it needs the same treatment.

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?

Patch is agains 2.4.16-9.dk but should apply to any version I guess.

-andrej




[-- Attachment #2: apm-idle.diff --]
[-- Type: text/x-diff, Size: 1106 bytes --]

--- arch/i386/kernel/apm.c.org	Sat Nov 10 00:58:02 2001
+++ arch/i386/kernel/apm.c	Sun Dec 16 21:23:27 2001
@@ -383,6 +383,11 @@
 static int			allow_ints;
 #endif
 static int			broken_psr;
+#ifdef CONFIG_APM_CPU_IDLE
+static int			apm_idle_enabled = 1;
+#else
+static int			apm_idle_enabled;
+#endif
 
 static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
 static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
@@ -1366,7 +1371,8 @@
 		 */
 		set_current_state(TASK_INTERRUPTIBLE);
 		apm_event_handler();
-#ifdef CONFIG_APM_CPU_IDLE
+		if (!apm_idle_enabled)
+			continue;
 		if (!system_idle())
 			continue;
 		
@@ -1393,7 +1399,6 @@
 			apm_event_handler();
 			timeout = 1;
 		}
-#endif
 	}
 	remove_wait_queue(&apm_waitqueue, &wait);
 }
@@ -1814,6 +1819,8 @@
 		if ((strncmp(str, "realmode-power-off", 18) == 0) ||
 		    (strncmp(str, "realmode_power_off", 18) == 0))
 			apm_info.realmode_power_off = !invert;
+		if (strncmp(str, "apm-idle", 8) == 0)
+			apm_idle_enabled = !invert;
 		str = strchr(str, ',');
 		if (str != NULL)
 			str += strspn(str, ", \t");

             reply	other threads:[~2001-12-16 18:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-16 18:45 Borsenkow Andrej [this message]
2001-12-17  3:34 ` PATCH: apm.c - runtime parameter for APM Idle call Dave Jones
2001-12-18 17:54   ` PATCH: apm.c - detection of brokern APM Idle call implementation Borsenkow Andrej

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=1008528319.2243.5.camel@localhost.localdomain \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=cooker@linux-mandrake.com \
    --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