2001-12-13 09:38:32

by Borsenkow Andrej

[permalink] [raw]
Subject: APM idle problems - how to check if BIOS halts CPU?

Many people (me including) are bothered by monitoring tools like
gkrellm/top showing kapm_idled consuming excessive amount CPU time
(reports vary from 50% to 70%). In my case I was concerned by the fact
that CPU was *not* cooled, the temperature stayed above minimal value
even when system was completely idle (it did not rocket up still it was
noticeably above low limit).

The only possible explanation to me was that BIOS neither slows nor
halts CPU. I have ASUS CUSL2 motherboard (BIOS 1011 beta 5) that reports
that it does not slow CPU (bit 2 == 0), so I tried to check if CPU was
really halted.

If I understand it correctly, if BIOS halts CPU during Idle call and no
other activity takes place it is clock interrupt that resumes CPU
activity. In this case jiffies should be advanced, because we return
into apm_do_idle() after clock interrupt has finished. I tried to count
number of times when jiffies stayed the same in apm_do_idle() and hot
nice result - in 99.9% of calls to apm_do_idle() jiffies value did not
change after return fro BIOS Idle call.

Then I tried to replace call to apm_do_idle() with call to
apm_cpu_idle() that directly executes HLT instead of calling BIOS. Lo
and behold - I got expected picture of cool CPU and 0% CPU time during
idle times.

Unfortunately, APM does not specify any way to find out if BIOS halts
CPU or simply does nothing. It may also be a BIOS bug, because with
original apm_do_idle() I _sometimes_ got the same picture (cooled CPU
and 0% CPU usage), so it seems that sometimes BIOS correctly does its
job. Still, as it seems to be broken most of the time, I thought about
adding run-time parameter to use apm_cpu_idle() instead. Would such
patch be acceptable?

TIA

-andrej


2001-12-13 11:51:48

by Andreas Steinmetz

[permalink] [raw]
Subject: RE: APM idle problems - how to check if BIOS halts CPU?

I posted an apm patch and asked Marcelo to apply it. What you do see is
kapm-idled and the idle task both racing for idle time. There's even more
problems (search lkml for subject kapm-idled and have a look at the reply from
Alan Cox on Dec 5 which does contain my original mail and the patch). With the
patch e.g. the fan control of my laptop works properly which it never did
before. If you really do have a broken bios there's no other way than to
contact your system's vendor.

On 13-Dec-2001 Borsenkow Andrej wrote:
> Many people (me including) are bothered by monitoring tools like
> gkrellm/top showing kapm_idled consuming excessive amount CPU time
> (reports vary from 50% to 70%). In my case I was concerned by the fact
> that CPU was *not* cooled, the temperature stayed above minimal value
> even when system was completely idle (it did not rocket up still it was
> noticeably above low limit).
>
> The only possible explanation to me was that BIOS neither slows nor
> halts CPU. I have ASUS CUSL2 motherboard (BIOS 1011 beta 5) that reports
> that it does not slow CPU (bit 2 == 0), so I tried to check if CPU was
> really halted.
>
> If I understand it correctly, if BIOS halts CPU during Idle call and no
> other activity takes place it is clock interrupt that resumes CPU
> activity. In this case jiffies should be advanced, because we return
> into apm_do_idle() after clock interrupt has finished. I tried to count
> number of times when jiffies stayed the same in apm_do_idle() and hot
> nice result - in 99.9% of calls to apm_do_idle() jiffies value did not
> change after return fro BIOS Idle call.
>
> Then I tried to replace call to apm_do_idle() with call to
> apm_cpu_idle() that directly executes HLT instead of calling BIOS. Lo
> and behold - I got expected picture of cool CPU and 0% CPU time during
> idle times.
>
> Unfortunately, APM does not specify any way to find out if BIOS halts
> CPU or simply does nothing. It may also be a BIOS bug, because with
> original apm_do_idle() I _sometimes_ got the same picture (cooled CPU
> and 0% CPU usage), so it seems that sometimes BIOS correctly does its
> job. Still, as it seems to be broken most of the time, I thought about
> adding run-time parameter to use apm_cpu_idle() instead. Would such
> patch be acceptable?
>
> TIA
>
> -andrej
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

Andreas Steinmetz
D.O.M. Datenverarbeitung GmbH

2001-12-13 18:31:40

by Borsenkow Andrej

[permalink] [raw]
Subject: RE: APM idle problems - how to check if BIOS halts CPU?

Oh, my! I am ashamed. I totally missed the fact that default idle task
alredy halts CPU. I must be getting old :(


On ???, 2001-12-13 at 14:39, Andreas Steinmetz wrote:
> I posted an apm patch and asked Marcelo to apply it. What you do see is
> kapm-idled and the idle task both racing for idle time. There's even more
> problems (search lkml for subject kapm-idled and have a look at the reply from
> Alan Cox on Dec 5 which does contain my original mail and the patch). With the
> patch e.g. the fan control of my laptop works properly which it never did
> before.


Unfortunately, this patch does not works as I'd expected. This patch
does hide systime, but it does not cool CPU. With this patch system runs
4C hotter than it run when I replaced apm_do_idle() with apm_cpu_idle()
in original apm.c

I'll try to get a closer look at weekend; any hints how to debug it are
welcome.

If you really do have a broken bios there's no other way than to
> contact your system's vendor.
>

Well, my vendor is ASUS and it is notorious for never answering bug
reports from mere mortals. I also do not know how important Linux market
is for them and Windows runs fine with ACPI (and Linux with ACPI does
not have this problem as well. But I run Mandrake and they currently do
not want to enable ACPI for different reasons). But I'll try anyway.

Thank you

-andrej

2001-12-13 20:50:14

by Andreas Steinmetz

[permalink] [raw]
Subject: RE: APM idle problems - how to check if BIOS halts CPU?


On 13-Dec-2001 Borsenkow Andrej wrote:
> Oh, my! I am ashamed. I totally missed the fact that default idle task
> alredy halts CPU. I must be getting old :(
>
>
> On ???, 2001-12-13 at 14:39, Andreas Steinmetz wrote:
>> I posted an apm patch and asked Marcelo to apply it. What you do see is
>> kapm-idled and the idle task both racing for idle time. There's even more
>> problems (search lkml for subject kapm-idled and have a look at the reply
>> from
>> Alan Cox on Dec 5 which does contain my original mail and the patch). With
>> the
>> patch e.g. the fan control of my laptop works properly which it never did
>> before.
>
>
> Unfortunately, this patch does not works as I'd expected. This patch
> does hide systime, but it does not cool CPU. With this patch system runs
> 4C hotter than it run when I replaced apm_do_idle() with apm_cpu_idle()
> in original apm.c
>

In this case you may try to disable idle calls when idle in the kernel
configuration. This defaults then to the idle task which does halt the
cpu and should be a nice workaround for a buggy bios.

> I'll try to get a closer look at weekend; any hints how to debug it are
> welcome.
>
> If you really do have a broken bios there's no other way than to
>> contact your system's vendor.
>>
>
> Well, my vendor is ASUS and it is notorious for never answering bug
> reports from mere mortals. I also do not know how important Linux market
> is for them and Windows runs fine with ACPI (and Linux with ACPI does
> not have this problem as well. But I run Mandrake and they currently do
> not want to enable ACPI for different reasons). But I'll try anyway.
>
> Thank you
>
> -andrej
>

Andreas Steinmetz
D.O.M. Datenverarbeitung GmbH