PATCH: apm.c - detection of brokern APM Idle call implementation

PATCH: apm.c - detection of brokern APM Idle call implementation

Post by Borsenkow Andre » Thu, 20 Dec 2001 03:00:15





> > 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

  apm-idle-2.diff
< 1K Download
 
 
 

1. PATCH: apm.c - runtime parameter for APM Idle call

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

  apm-idle.diff
1K Download

2. Core dump and setuid-root

3. Noise and APM idle CPU call

4. Doom net games?

5. apm -z vs apm -Z

6. ALI Aladin V Board Support

7. 2.4.19-ac1 and later: kernel BUG in apm.c:899 (SMP, apm=power-off)

8. nfs_mountroot failure during jumpstart

9. APM vs. ACPI status detection

10. New APM BIOS patches

11. APM driver patch summary

12. APM patch for sysvinit (poweroff)

13. APM patch for idle_period handling