fancontrol script causes hundreds of wakeups per second

View: New views
8 Messages — Rating Filter:   Alert me  

fancontrol script causes hundreds of wakeups per second

by Tino Keitel-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

I tried the fancontrol script from
http://www.thinkwiki.org/wiki/How_to_control_fan_speed and noticed that
it causes 100-200 wakeups per second in powertop. This happens on a
X61s. Can this be avoided somehow?

Regards,
Tino
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad

Re: fancontrol script causes hundreds of wakeups per second

by Henrique de Moraes Holschuh-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 02 Jul 2008, Tino Keitel wrote:
> I tried the fancontrol script from
> http://www.thinkwiki.org/wiki/How_to_control_fan_speed and noticed that
> it causes 100-200 wakeups per second in powertop. This happens on a
> X61s. Can this be avoided somehow?

No.  Unless you are talking about hacking the EC firmware to change its own
fan controller parameters.

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad

Re: fancontrol script causes hundreds of wakeups per second

by Henrique de Moraes Holschuh-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 01 Jul 2008, Henrique de Moraes Holschuh wrote:
> On Wed, 02 Jul 2008, Tino Keitel wrote:
> > I tried the fancontrol script from
> > http://www.thinkwiki.org/wiki/How_to_control_fan_speed and noticed that
> > it causes 100-200 wakeups per second in powertop. This happens on a
> > X61s. Can this be avoided somehow?
>
> No.  Unless you are talking about hacking the EC firmware to change its own
> fan controller parameters.

I better explain it a bit more.

1. Reading the thermal sensors *IS* quite expensive, there are a lot of
them.

2. Setting the fan controller parameters is not the cheapest operation
around, either.

So that means a lot of wakeups in a short burst, while a fan control loop
does a thermal sensor sweep, takes a decision, and updates the fan control
register.

There is also the annoying issue that you need to clobber the internal fan
loop controller regularly to mess with its recalibration (that causes
annoying pulses in the fan unless you fixed the firmware of your thinkpad),
that also means more wakeups and ACPI EC activity.

But you really should be able to leave the firmware alone at least 50% of
the time (pester it now, and you don't need to do anything with it for the
next second).

So, if the applications/scripts are reading the thermal sensors more than
once every 2s, THAT is something you can fix.  It is useless to read them
any faster than 0.5Hz.

One day I will feel bored enough to write a cache layer for thinkpad-acpi.
But until then, your scripts better be well behaved, for thinkpad-acpi will
do exactly what you ask it to, no matter how wasteful of resources it is.

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad

Re: fancontrol script causes hundreds of wakeups per second

by green-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2008.07.01, 183, Henrique de Moraes Holschuh wrote:

> On Tue, 01 Jul 2008, Henrique de Moraes Holschuh wrote:
> > On Wed, 02 Jul 2008, Tino Keitel wrote:
> > > I tried the fancontrol script from
> > > http://www.thinkwiki.org/wiki/How_to_control_fan_speed and noticed that
> > > it causes 100-200 wakeups per second in powertop. This happens on a
> > > X61s. Can this be avoided somehow?
> >
> > No.  Unless you are talking about hacking the EC firmware to change its own
> > fan controller parameters.
>
> I better explain it a bit more.
>
> There is also the annoying issue that you need to clobber the internal fan
> loop controller regularly to mess with its recalibration (that causes
> annoying pulses in the fan unless you fixed the firmware of your thinkpad),
> that also means more wakeups and ACPI EC activity.
I'm using the latest firmware (2.19-1.08) on a T61 and the latest thinkpad-acpi
(0.21-20080629).  Using a script I wrote that checks temperatures every 8
seconds, I get the fan pulsing behavior.  So: what do you mean by "fixed the
firmware"?  Is that sarcasm?

Not that it really matters: I recently made some changes to the script so it
only updates the speed 'pwm1' when it needs to be changed (instead it hits the
watchdog 'fan_watchdog').


signature.asc (196 bytes) Download Attachment

Re: fancontrol script causes hundreds of wakeups per second

by Tino Keitel-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 01, 2008 at 20:16:58 -0300, Henrique de Moraes Holschuh wrote:

[...]

> So, if the applications/scripts are reading the thermal sensors more than
> once every 2s, THAT is something you can fix.  It is useless to read them
> any faster than 0.5Hz.

The fancontrol script reads wakes up every 3 seconds. However, it reads
from /proc/acpi/ibm/fan, thermal, ecdump, and then writes to fan in
every loop. I think this can be optimized.

I tested with a "while true ; do sensors ; sleep 3 ; done" and powertop
shows 10-12 wakeups per second for acpi. This sensors command reads the
fan and thermal sensors. I don't know why the fancontrol script
requires ecdump when fan and thermal data is available in fan and
thermal. Writing the level in every loop could also be optimized, to
write only if changes are required, which isn't too often. Extending
the sleep between loops from 3 to 10 seconds should give 3-4 wakeups
per second.

Regards,
Tino
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad

Re: fancontrol script causes hundreds of wakeups per second

by Henrique de Moraes Holschuh-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 01 Jul 2008, green wrote:
> > annoying pulses in the fan unless you fixed the firmware of your thinkpad),
>
> seconds, I get the fan pulsing behavior.  So: what do you mean by "fixed the
> firmware"?  Is that sarcasm?

No, not sarcasm.  The T40-T42 and T43 had major problems in their fan
control firmware, that made the fan *really* annoying.  IBM changed the
firmware at some point, to correct that.

So, the worst of the fan behaviour was fixed for T40-T42/p, and for the
Intel-video T43.  But someone in IBM botched up the fix for the ATI-based
T43 and T43p, and THAT botched up fix made what should have been a small
pulse that changed RPMs just enough to recalibrate the tachometer, into a
major, very noisy fan pulse every 30s in a LOT of T43s.

So, a few T43 owners hacked their EC firmwares to "fix the fix".  It makes a
T43 act just like a T42.  But since the T43 fan IS louder than the T42 fan,
it will still be louder than a T42.

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad

Re: fancontrol script causes hundreds of wakeups per second

by green-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008.07.02, 184, Henrique de Moraes Holschuh wrote:

> On Tue, 01 Jul 2008, green wrote:
> > > annoying pulses in the fan unless you fixed the firmware of your thinkpad),
> >
> > seconds, I get the fan pulsing behavior.  So: what do you mean by "fixed the
> > firmware"?  Is that sarcasm?
>
> No, not sarcasm.  The T40-T42 and T43 had major problems in their fan
> control firmware, that made the fan *really* annoying.  IBM changed the
> firmware at some point, to correct that.
>
> So, the worst of the fan behaviour was fixed for T40-T42/p, and for the
> Intel-video T43.  But someone in IBM botched up the fix for the ATI-based
> T43 and T43p, and THAT botched up fix made what should have been a small
> pulse that changed RPMs just enough to recalibrate the tachometer, into a
> major, very noisy fan pulse every 30s in a LOT of T43s.
>
> So, a few T43 owners hacked their EC firmwares to "fix the fix".  It makes a
> T43 act just like a T42.  But since the T43 fan IS louder than the T42 fan,
> it will still be louder than a T42.
Okay.  I guess there is still a problem, even for the T61?  This fan will pulse
somewhat if I write to pwm1 too often.  Or maybe the pulsing I notice is less
and caused elseway.


Heh heh: "My ThinkPad has a keyboard light, a touchpad & trackstick, a
fingerprint reader[1], a SMAPI battery interface, accelerometers, (etc.) and
even a _pulse_!"


[1] Actually, no fingerprint reader here; I like the keyboard method better.


signature.asc (196 bytes) Download Attachment

Re: fancontrol script causes hundreds of wakeups per second

by Henrique de Moraes Holschuh-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 02 Jul 2008, green wrote:
> Okay.  I guess there is still a problem, even for the T61?  This fan will pulse
> somewhat if I write to pwm1 too often.  Or maybe the pulsing I notice is less
> and caused elseway.

1. It pulses when you leave it alone, but it should be the kind of thing you
can only hear if you are in a silent room.  The pulses change the RPM just
enough to make sure the limited tachometer is not giving false readings.
This is needed because the thinkpad does closed-loop speed control on the
fan.

2. Any regular fan under PWM control will "pulse" when you change its RPM,
except if you have an actual 4-wire fan (power, gnd, PWM drive input,
tachometer output), AND you change the PWM duty cycle VERY slowly.

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
LightInTheBox - Buy quality products at wholesale price