ACPI and the idle loop - possible bug
Begin forwarded message:
Date: Sat, 25 Jun 2005 14:01:10 -0700
From: Stefan Baums <[email protected]>
To: [email protected]
Subject: ACPI and the idle loop - possible bug
Some Lenove (IBM) ThinkPad models (in my case the ThinkPad X41 2528-6NU) produce irritating high-pitch crackling noises under Linux in certain conditions, see the discussion here:
http://thinkwiki.org/wiki/Problem_with_high_pitch_noises
This noise only occurs when the processor is not busy (with, e.g., compiling or video playback), so it seems to be related to the idle loop (see also below about 'idle=halt'). Furthermore, it seems to be caused by something that ACPI is doing to the
processor: if the 'processor' module (and its dependants:
'speedstep_centrino'/'acpi_cpufreq' and 'thermal') are not loaded, the high-pitch noise does not occur.
If the 'processor' module (and its dependants) _are_ loaded, then the noise can be initially avoided by passing the boot parameter
idle=halt
to the kernel (causing it to halt, not poll, the processor during idle loops), but this workaround _only_ works until either
1) the system resumes from either suspend or hibernation, or
2) the power state changes from battery to plugged-in or vice versa.
whereupon the high-pitch noise makes a return.
Taken all together, it would appear that the ACPI system is doubly at fault:
- First, for causing the high-pitch noise to start with, though it could be argued that this is a hardware defect that is just triggered by ACPI. (However not by Windows XP, on the same computer, so it is definitely avoidable.)
- Second, for apparently not respecting the kernel boot parameter "idle=halt" when it resumes or changes power state:
it seems like ACPI is reverting to idle polling on those occasions.
Do you agree with this analysis? Is it clear what ACPI's root problem ('first' above) is, and will it be solved? (Not loading the 'processor', 'speedstep_centrino'/'acpi_cpufreq' and 'thermal' modules - and losing their features - is not an acceptable solution.)
As for the 'idle=halt' workaround: Is there any way to test whether a running kernel actually uses polling or halt for the idle loop? What can I do to force ACPI never to use idle polling, but halt instead?
My kernel version is Linux 2.6.12, custom-compiled on Ubuntu 5.04. I have enabled all the usual ACPI features as modules. The noise problem occurs both with the 'speedstep_centrino' and the 'acpi_cpufreq' modules. If necessary for diagnosis, I can put up my kernel .config file online somewhere.
Many thanks for your help,
Stefan
PS. Setting the polling frequency to 100 Hz instead of 1000 Hz at compile time, as recommended by some people on the ThinkWiki page, did not have any effect on the noise problem on my computer.
Signature · 15 lines
Stefan Baums Asian Languages and Literature University of Washington - 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/ ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines
Some Lenove (IBM) ThinkPad models (in my case the ThinkPad X41 2528-6NU) produce irritating high-pitch crackling noises under Linux in certain conditions
This Problem also occures on a lot of ASUS Laptops, sounds a bit like the morse alpabet ;-)
Quoted 8 lines
This noise only occurs when the processor is not busy (with, e.g., compiling or video playback), so it seems to be related to the idle loop (see also below about 'idle=halt'). Furthermore, it seems to be caused by something that ACPI is doing to the
processor: if the 'processor' module (and its dependants:
'speedstep_centrino'/'acpi_cpufreq' and 'thermal') are not loaded, the high-pitch noise does not occur.
My suggestion is that this sounds are created by the powerconverters. And it only occurs on my ASUS M6 when the processor is in C3. So the described behaviour is clear, cause if you unload the processor ACPI module, you processor will stop going in C3 and thou the sounds stop.
Quoted 4 lines
If the 'processor' module (and its dependants) _are_ loaded, then the noise can be initially avoided by passing the boot parameter
idle=halt
What exactly does this parameter do ? Using for all C-States the hlt instruction ?
Quoted 5 lines
- First, for causing the high-pitch noise to start with, though it could be argued that this is a hardware defect that is just triggered by ACPI. (However not by Windows XP, on the same computer, so it is definitely avoidable.)
Could also be that XP dosen't use C3 as much as Linux does
Janosch
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
Quoted 2 lines
This Problem also occures on a lot of ASUS Laptops, sounds a bit like the morse alpabet ;-)
Yes, it does. It is rather unpleasant.
Quoted 5 lines
My suggestion is that this sounds are created by the powerconverters. And it only occurs on my ASUS M6 when the processor is in C3. So the described behaviour is clear, cause if you unload the processor ACPI module, you processor will stop going in C3 and thou the sounds stop.
[...]
Quoted 4 lines
Quoted 1 line
idle=halt
What exactly does this parameter do ? Using for all C-States the hlt instruction ?
I have no idea. A contributor to the ThinkWiki page that I referred to had heard 'in several forums' that the problem may have to do with the '"idle"-state (or "C3") of the processor'. That got me googling, I came across the 'idle' kernel boot parameter, and tried it out. The documentation for this parameter in linux-2.6.12/Documentation/kernel-parameters.txt is a two-liner:
idle= [HW]
Format: idle=poll or idle=halt
and I could find no further information about this on the Internet. I guess somebody familiar with that part of the kernel code will have to tell us what the parameter does.
Googling revealed that the C3 state seems to have caused another (unrelated?) problem with the wireless driver on last year's ThinkPad models:
http://www.thinkwiki.org/wiki/Patch_disabling_ACPI_C3
That resulted in a patch to disable C3 (but not C2) entirely, but I don't know if that patch still works with 2.6.12, and to be honest, I'd rather keep my C3. Whatever it is that idle=halt does (until ACPI apparently switches it off) seems preferable.
Stefan
Signature · 10 lines
Stefan Baums Asian Languages and Literature University of Washington ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
Hi,
Quoted 6 lines
If the 'processor' module (and its dependants) _are_ loaded, then the noise can be initially avoided by passing the boot parameter
idle=halt
Quoted 7 lines
to the kernel (causing it to halt, not poll, the processor during idle loops), but this workaround _only_ works until either
1) the system resumes from either suspend or hibernation, or
2) the power state changes from battery to plugged-in or vice versa.
idle=halt will disable acpi idle, so it's not surprising it cures the high noise issue. processor module has a parameter 'max_cstate', setting it to 2 is a better workaround to me if you hate the noise.
Thanks,
Shaohua
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
A message that is not in the archive (sent off-list or not yet received): 16A54BF5D6E14E4D916CE26C9AD3057502698BE3-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 2 lines
processor module has a parameter '
max_cstate', setting it to 2 is a better workaround to me if you hate the noise.
Thank you very much for pointing out that option. I am using it now, and it is indeed a better workaround than idle=halt.
But it is a workaround. On the one hand, it deprives me of C3 and C4 and thus shortens my battery life. On the other, I found it exceedingly difficult to even find out about this option and get it to work. (I tried passing it to the module via /etc/modprobe.d/ and /etc/modules, but neither one worked, and in the end I had to compile the ACPI processor part directly into the kernel and pass the option as a boot parameter 'processor.max_cstate=2'.) But as you can see from the ThinkWiki discussion, and Janosch’s post in this thread, there are indeed quite a lot of users (of at least ThinkPads and Acer laptops) who are affected by this problem and find the noise very unpleasant and distracting. As far as I remember, the noise was not there in Windows XP on my machine (sorry, can’t check now, deleted Windows), and as far as I know Windows XP does use the C3 state. So do you think that you or the ACPI maintainers could try to rewrite the Linux ACPI implementation so that it does not cause this problem in C3? I think it is not very good that on the laptops concerned, a default Linux installation causes a constant irritating noise and the only workaround (not solution) involves finding the 'max_cstate' information, recompile the kernel (with processor compiled in) and reconfigure the boot loader... (In case you do want to fix this and get a chance to test it out on a ThinkPad X41: there the noise emerges from the ventilation vent on the left-hand side of the laptop. You may not hear it clearly in, say, a noisy cafe or other public place, but it is very noticeable in a quiet room.)
Finally, an unrelated problem is that ACPI apparently only honours the idle=halt boot parameter until the first suspend/resume or power state change, and then reenables C2 and above.
Do I need to file a separate formal bug report for these two issues, and if so where? Or is the discussion in this thread sufficient for the ACPI maintainers to work with?
Best regards,
Stefan Baums
Signature · 10 lines
Stefan Baums Asian Languages and Literature University of Washington ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click