lkml.org 
[lkml]   [2001]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectPATCH: apm.c - runtime parameter for APM Idle call
Date
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



--- 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");
\
 
 \ /
  Last update: 2005-03-22 13:14    [W:0.873 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site