All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Some doubts with fancontrol
@ 2012-09-01 17:11 Francesco Turco
  2012-09-02 17:32 ` Guenter Roeck
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Francesco Turco @ 2012-09-01 17:11 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]

Hello.

I have a Lenovo Thinkpad R61 laptop and I'm trying to set up correctly 
fancontrol on it.

First of all, I loaded the thinkpad-acpi kernel module with the 
fan_control=1 option, otherwise the following steps don't work.

Then I ran pwmconfig in order to generate the /etc/fancontrol file.

Finally, I started fancontrol via "rc.d start fancontrol" (I'm running 
an Arch Linux system).

When idle, I get:
- fan1: 2604 RPM
- temp1: +40.0C

When busy, I get:
- fan1: 3176 RPM
- temp1: +65.0C

If now I stop fancontrol with "rc.d stop fancontrol" and wait some 
minutes, I get (system is stil busy):
- fan1: 4993 RPM
- temp1: +58.0C

That is, fan speed skyrocketed without any reason.

At http://www.kernel.org/doc/Documentation/laptops/thinkpad-acpi.txt I 
learned this is called "disengaged" mode, and it's not a safe mode to 
use. Let me quote:

 > There is also a "full-speed" level, also known as "disengaged" level.
In this level, the EC disables the speed-locked closed-loop fan control,
and drives the fan as fast as it can go, which might exceed hardware
limits, so use this level with caution.

I also noticed that while fancontrol is running, file 
/sys/class/hwmon/hwmon2/device/pwm1_enable is set to 1 (PWM manual), 
while when it quits that file is set to 0 (PWM disabled) instead of 2 
(PWM automatic). Why?

Beside this, I also tried manually setting PWM values in 
/sys/class/hwmon/hwmon2/device/pwm1, and I found that with values 
between 32 and 255 the fan runs, while with values between 0 and 31 the 
fan stops completely. My question is: MINSTART/MINSTOP should be both 32 
in my case?

Last thing. It seems the only values you can save into 
/sys/class/hwmon/hwmon2/device/pwm1 are: 255, 218, 182, 145, 109, 72, 36 
and 0. Other values get mapped to those previous values. Is this normal?

Thank you and sorry for the long message.

[-- Attachment #2: pwmconfig.txt --]
[-- Type: text/plain, Size: 3658 bytes --]

# pwmconfig revision 5857 (2010-08-22)
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.

We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.

Found the following devices:
   hwmon0 is acpitz
   hwmon1/device is coretemp
   hwmon2/device is thinkpad

Found the following PWM controls:
   hwmon2/device/pwm1
hwmon2/device/pwm1 is currently setup for automatic speed control.
In general, automatic mode is preferred over manual mode, as
it is more efficient and it reacts faster. Are you sure that
you want to setup this output for manual control? (n) 
There are no usable PWM outputs.
[root@laptop ~]# pwmconfig 
# pwmconfig revision 5857 (2010-08-22)
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.

We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.

Found the following devices:
   hwmon0 is acpitz
   hwmon1/device is coretemp
   hwmon2/device is thinkpad

Found the following PWM controls:
   hwmon2/device/pwm1
hwmon2/device/pwm1 is currently setup for automatic speed control.
In general, automatic mode is preferred over manual mode, as
it is more efficient and it reacts faster. Are you sure that
you want to setup this output for manual control? (n) y

Giving the fans some time to reach full speed...
Found the following fan sensors:
   hwmon2/device/fan1_input     current speed: 2733 RPM

Warning!!! This program will stop your fans, one at a time,
for approximately 5 seconds each!!!
This may cause your processor temperature to rise!!!
If you do not want to do this hit control-C now!!!
Hit return to continue: 

Testing pwm control hwmon2/device/pwm1 ...
  hwmon2/device/fan1_input ... speed was 2733 now 0
    It appears that fan hwmon2/device/fan1_input
    is controlled by pwm hwmon2/device/pwm1
Would you like to generate a detailed correlation (y)? y
Note: If you had gnuplot installed, I could generate a graphical plot.
    PWM 255 FAN 2554
    PWM 240 FAN 2896
    PWM 225 FAN 3041
    PWM 210 FAN 3041
    PWM 195 FAN 3070
    PWM 180 FAN 3070
    PWM 165 FAN 2766
    PWM 150 FAN 2766
    PWM 135 FAN 2766
    PWM 120 FAN 2766
    PWM 105 FAN 2766
    PWM 90 FAN 2766
    PWM 75 FAN 2415
    PWM 60 FAN 2415
    PWM 45 FAN 2415
    PWM 30 FAN 0
    Fan Stopped at PWM = 30


Testing is complete.
Please verify that all fans have returned to their normal speed.

The fancontrol script can automatically respond to temperature changes
of your system by changing fanspeeds.
Do you want to set up its configuration file now (y)? y
What should be the path to your fancontrol config file (/etc/fancontrol)? 
Loading configuration from /etc/fancontrol ...

Select fan output to configure, or other action:
1) hwmon2/device/pwm1  3) Just quit	      5) Show configuration
2) Change INTERVAL     4) Save and quit
select (1-n): 4

Saving configuration to /etc/fancontrol...
Configuration saved

[-- Attachment #3: fancontrol.txt --]
[-- Type: text/plain, Size: 374 bytes --]

# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon2=devices/platform/thinkpad_hwmon
DEVNAME=hwmon2=thinkpad
FCTEMPS=hwmon2/device/pwm1=hwmon2/device/temp1_input
FCFANS=hwmon2/device/pwm1=hwmon2/device/fan1_input
MINTEMP=hwmon2/device/pwm1=30
MAXTEMP=hwmon2/device/pwm1=60
MINSTART=hwmon2/device/pwm1=32
MINSTOP=hwmon2/device/pwm1=32

[-- Attachment #4: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [lm-sensors] Some doubts with fancontrol
  2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
@ 2012-09-02 17:32 ` Guenter Roeck
  2012-09-03  7:36 ` Jean Delvare
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2012-09-02 17:32 UTC (permalink / raw)
  To: lm-sensors

On Sat, Sep 01, 2012 at 07:11:32PM +0200, Francesco Turco wrote:
> Hello.
> 
> I have a Lenovo Thinkpad R61 laptop and I'm trying to set up
> correctly fancontrol on it.
> 
> First of all, I loaded the thinkpad-acpi kernel module with the
> fan_control=1 option, otherwise the following steps don't work.
> 
> Then I ran pwmconfig in order to generate the /etc/fancontrol file.
> 
> Finally, I started fancontrol via "rc.d start fancontrol" (I'm
> running an Arch Linux system).
> 
> When idle, I get:
> - fan1: 2604 RPM
> - temp1: +40.0C
> 
> When busy, I get:
> - fan1: 3176 RPM
> - temp1: +65.0C
> 
> If now I stop fancontrol with "rc.d stop fancontrol" and wait some
> minutes, I get (system is stil busy):
> - fan1: 4993 RPM
> - temp1: +58.0C
> 
> That is, fan speed skyrocketed without any reason.
> 
When fancontrol is stopped, it configures manual mode and sets pwm to
the maximum.

> At http://www.kernel.org/doc/Documentation/laptops/thinkpad-acpi.txt
> I learned this is called "disengaged" mode, and it's not a safe mode
> to use. Let me quote:
> 
> > There is also a "full-speed" level, also known as "disengaged" level.
> In this level, the EC disables the speed-locked closed-loop fan control,
> and drives the fan as fast as it can go, which might exceed hardware
> limits, so use this level with caution.
> 
So, either don't stop fancontrol after you started it, restore original
settings manually after stopping it, or don't start it at all.

> I also noticed that while fancontrol is running, file
> /sys/class/hwmon/hwmon2/device/pwm1_enable is set to 1 (PWM manual),
> while when it quits that file is set to 0 (PWM disabled) instead of
> 2 (PWM automatic). Why?
> 
See above. It can not select 2, since values above 1 are driver and hardware
specific. fancontrol does not know about specific hardware and has to play it
safe. Which, again, is to select manual mode and the fastest available fan
speed.

> Beside this, I also tried manually setting PWM values in
> /sys/class/hwmon/hwmon2/device/pwm1, and I found that with values
> between 32 and 255 the fan runs, while with values between 0 and 31
> the fan stops completely. My question is: MINSTART/MINSTOP should be
> both 32 in my case?
> 
Isn't that what you have configured ?

> Last thing. It seems the only values you can save into
> /sys/class/hwmon/hwmon2/device/pwm1 are: 255, 218, 182, 145, 109,
> 72, 36 and 0. Other values get mapped to those previous values. Is
> this normal?
> 
Accepted values depend on the hardware and, of course, on the driver. Some
hardware only accepts specific values and/or ranges. From looking into the
driver, the thinkpad hardware only has 8 speed settings, which are
interpolated into (0, 255).

FWIW, the driver recommends using mode 2 (auto mode). That means you don't
really need fancontrol to start with. If supported, auto mode is preferred
since it works outside the OS: it will keep working even if the OS hangs.

So the real question here is why you try to use fancontrol to start with.

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [lm-sensors] Some doubts with fancontrol
  2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
  2012-09-02 17:32 ` Guenter Roeck
@ 2012-09-03  7:36 ` Jean Delvare
  2012-09-03 10:35 ` Francesco Turco
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2012-09-03  7:36 UTC (permalink / raw)
  To: lm-sensors

Adding Henrique to Cc.

On Sun, 2 Sep 2012 10:32:59 -0700, Guenter Roeck wrote:
> On Sat, Sep 01, 2012 at 07:11:32PM +0200, Francesco Turco wrote:
> > Hello.
> > 
> > I have a Lenovo Thinkpad R61 laptop and I'm trying to set up
> > correctly fancontrol on it.
> > 
> > First of all, I loaded the thinkpad-acpi kernel module with the
> > fan_control=1 option, otherwise the following steps don't work.
> > 
> > Then I ran pwmconfig in order to generate the /etc/fancontrol file.
> > 
> > Finally, I started fancontrol via "rc.d start fancontrol" (I'm
> > running an Arch Linux system).
> > 
> > When idle, I get:
> > - fan1: 2604 RPM
> > - temp1: +40.0C
> > 
> > When busy, I get:
> > - fan1: 3176 RPM
> > - temp1: +65.0C
> > 
> > If now I stop fancontrol with "rc.d stop fancontrol" and wait some
> > minutes, I get (system is stil busy):
> > - fan1: 4993 RPM
> > - temp1: +58.0C
> > 
> > That is, fan speed skyrocketed without any reason.
>
> When fancontrol is stopped, it configures manual mode and sets pwm to
> the maximum.

Not really. If supported by the hardware, it disables PWM control
completely (pwmN_enable=0), which in turn results info the fan spinning
at full speed. For most hardware it is implemented differently (more
efficiently) than pwmN_enable=1, pwmN%5 which you were describing,
but the resulting fan speed is roughly the same. It will fallback to
pwmN_enable=1, pwmN%5 if it has too, though.

The thinkpad_acpi driver is an exception here, as pwm1_enable=0 results
in a much higher speed. This behavior is quite questionable, especially
given the documentation warnings about disengaged mode. It might be
better (as in "safer and less surprising") to not support pwm1_enable=0
at all, and only let the user switch to disengaged mode
through /proc/acpi/ibm/fan. Henrique?

(Alternatively, pwm1_enable=0 could only be supported if the driver is
loaded with fan_control=2.)

> > At http://www.kernel.org/doc/Documentation/laptops/thinkpad-acpi.txt
> > I learned this is called "disengaged" mode, and it's not a safe mode
> > to use. Let me quote:
> > 
> > There is also a "full-speed" level, also known as "disengaged" level.
> > In this level, the EC disables the speed-locked closed-loop fan control,
> > and drives the fan as fast as it can go, which might exceed hardware
> > limits, so use this level with caution.
>
> So, either don't stop fancontrol after you started it, restore original
> settings manually after stopping it, or don't start it at all.

That's a little harsh of a reply IMHO. As a general rule, stopping a
service should do its best to restore the system to its state previous
to said service being started. Failing to do so will legitimately
surprise the user. I don't think we're doing that (see proposal below.)

> > I also noticed that while fancontrol is running, file
> > /sys/class/hwmon/hwmon2/device/pwm1_enable is set to 1 (PWM manual),
> > while when it quits that file is set to 0 (PWM disabled) instead of
> > 2 (PWM automatic). Why?
>
> See above. It can not select 2, since values above 1 are driver and hardware
> specific. fancontrol does not know about specific hardware and has to play it
> safe. Which, again, is to select manual mode and the fastest available fan
> speed.

That's indeed the logic behind the current implementation. That being
said, while the fancontrol script cannot switch to pwmN_enable=2
unconditionally, we could make it remember the pwmN_enable values when
it starts, and restore these values at exit if they are 2 or above.
Guenter, what do you think?

> > Beside this, I also tried manually setting PWM values in
> > /sys/class/hwmon/hwmon2/device/pwm1, and I found that with values
> > between 32 and 255 the fan runs, while with values between 0 and 31
> > the fan stops completely. My question is: MINSTART/MINSTOP should be
> > both 32 in my case?

MINSTOP2 is correct. MINSTART depends if the fan can kick in from
still with value 32. But given that pwm1_enable=1 isn't a true manual
mode for thinkpad_acpi, I susppose the EC takes care of this for you so
MINSTART2 should be OK too. Anyway, the pwmconfig scripts lets you
test these values, so just do that if you aren't sure.

> Isn't that what you have configured ?
> 
> > Last thing. It seems the only values you can save into
> > /sys/class/hwmon/hwmon2/device/pwm1 are: 255, 218, 182, 145, 109,
> > 72, 36 and 0. Other values get mapped to those previous values. Is
> > this normal?
>
> Accepted values depend on the hardware and, of course, on the driver. Some
> hardware only accepts specific values and/or ranges. From looking into the
> driver, the thinkpad hardware only has 8 speed settings, which are
> interpolated into (0, 255).
> 
> FWIW, the driver recommends using mode 2 (auto mode). That means you don't
> really need fancontrol to start with. If supported, auto mode is preferred
> since it works outside the OS: it will keep working even if the OS hangs.
> 
> So the real question here is why you try to use fancontrol to start with.

These were my thoughts exactly. There's no good reason for touching
these settings in general. If your Thinkpad gets noisy, best is to
disassemble it (IBM/Lenovo has wonderful hardware maintenance manuals
for all their laptop lines AFAIK) and remove all the dust inside. I did
that once with two different models, with good results.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [lm-sensors] Some doubts with fancontrol
  2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
  2012-09-02 17:32 ` Guenter Roeck
  2012-09-03  7:36 ` Jean Delvare
@ 2012-09-03 10:35 ` Francesco Turco
  2012-09-03 10:38 ` Francesco Turco
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Francesco Turco @ 2012-09-03 10:35 UTC (permalink / raw)
  To: lm-sensors

> FWIW, the driver recommends using mode 2 (auto mode). That means you don't
> really need fancontrol to start with. If supported, auto mode is preferred
> since it works outside the OS: it will keep working even if the OS hangs.
>
> So the real question here is why you try to use fancontrol to start with.

I tried fancontrol because during previous weeks outside temperature was 
hotter and CPU reached more than 70 degrees when busy and not using 
fancontrol. I was worried I could damage my hardware.

But if you say that it's better to not use fancontrol, I'll follow your 
advice.

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [lm-sensors] Some doubts with fancontrol
  2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
                   ` (2 preceding siblings ...)
  2012-09-03 10:35 ` Francesco Turco
@ 2012-09-03 10:38 ` Francesco Turco
  2012-09-03 15:55 ` Guenter Roeck
  2012-09-03 18:48 ` Henrique de Moraes Holschuh
  5 siblings, 0 replies; 7+ messages in thread
From: Francesco Turco @ 2012-09-03 10:38 UTC (permalink / raw)
  To: lm-sensors

> These were my thoughts exactly. There's no good reason for touching
> these settings in general. If your Thinkpad gets noisy, best is to
> disassemble it (IBM/Lenovo has wonderful hardware maintenance manuals
> for all their laptop lines AFAIK) and remove all the dust inside. I did
> that once with two different models, with good results.

Good suggestion. It's a lot of time I don't remove the dust inside of my 
laptop...

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [lm-sensors] Some doubts with fancontrol
  2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
                   ` (3 preceding siblings ...)
  2012-09-03 10:38 ` Francesco Turco
@ 2012-09-03 15:55 ` Guenter Roeck
  2012-09-03 18:48 ` Henrique de Moraes Holschuh
  5 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2012-09-03 15:55 UTC (permalink / raw)
  To: lm-sensors

On Mon, Sep 03, 2012 at 09:36:48AM +0200, Jean Delvare wrote:
> Adding Henrique to Cc.
> 
[ ... ]

> >
> > See above. It can not select 2, since values above 1 are driver and hardware
> > specific. fancontrol does not know about specific hardware and has to play it
> > safe. Which, again, is to select manual mode and the fastest available fan
> > speed.
> 
> That's indeed the logic behind the current implementation. That being
> said, while the fancontrol script cannot switch to pwmN_enable=2
> unconditionally, we could make it remember the pwmN_enable values when
> it starts, and restore these values at exit if they are 2 or above.
> Guenter, what do you think?
> 
Yes, that would be good idea. After all, it is what we are trying to do in at
least some of the drivers. To be on the safe side, we should probably safe
and restore both the pwm value and and pwm_enable.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [lm-sensors] Some doubts with fancontrol
  2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
                   ` (4 preceding siblings ...)
  2012-09-03 15:55 ` Guenter Roeck
@ 2012-09-03 18:48 ` Henrique de Moraes Holschuh
  5 siblings, 0 replies; 7+ messages in thread
From: Henrique de Moraes Holschuh @ 2012-09-03 18:48 UTC (permalink / raw)
  To: lm-sensors

On Mon, 03 Sep 2012, Guenter Roeck wrote:
> On Mon, Sep 03, 2012 at 09:36:48AM +0200, Jean Delvare wrote:
> > Adding Henrique to Cc.
> [ ... ]
> 
> > >
> > > See above. It can not select 2, since values above 1 are driver and hardware
> > > specific. fancontrol does not know about specific hardware and has to play it
> > > safe. Which, again, is to select manual mode and the fastest available fan
> > > speed.
> > 
> > That's indeed the logic behind the current implementation. That being
> > said, while the fancontrol script cannot switch to pwmN_enable=2
> > unconditionally, we could make it remember the pwmN_enable values when
> > it starts, and restore these values at exit if they are 2 or above.
> > Guenter, what do you think?
> > 
> Yes, that would be good idea. After all, it is what we are trying to do in at
> least some of the drivers. To be on the safe side, we should probably safe
> and restore both the pwm value and and pwm_enable.

Sorry, I missed the rest of the thread, and I had to find it in gmane.

Disabling the thinkpad fan control loop is actually a service fan testing
mode.  Even with the fan chamber unclogged, at sea level, it will still spin
at least 1000rpm faster than the maximum speerds it would normally be
subject to.  At low pressure (e.g. mountain ranges, or air inlet clogged),
the fan will speed up so much I have no idea if it is still operating within
spec.

All that extra torque margin is used by the EC to make sure it can get to
the target RPM as the fan ages and also to combat dust-caused slow downs.
It is also useful when spinning the fan up from a full stop, should it be
slightly stuck.

I *could* change things so that mode 3 becomes pwm disabled, and mode 0
becomes a lie that tries the equivalent of mode 1 with pwm 255.  But that
would be a very visible userspace ABI change, and it will break
thinkpad-specific fan control scripts and user setups out there, so it just
won't happen without an extremely powerful reason.

I'd vote for the fan-control script to trap most signals, and try to restore
the state on exit.  And I also vote for no messing with the fan control of
your thinkpad, unless it is to select between mode 2, and (mode 1, pwm%5)
on a thinkpad you personally verified to work well with mode 1... I find
that to be quite useful on my T43 during long compiling runs, so I have a
script to do it mapped to Fn+F11 :-)

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

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-03 18:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-01 17:11 [lm-sensors] Some doubts with fancontrol Francesco Turco
2012-09-02 17:32 ` Guenter Roeck
2012-09-03  7:36 ` Jean Delvare
2012-09-03 10:35 ` Francesco Turco
2012-09-03 10:38 ` Francesco Turco
2012-09-03 15:55 ` Guenter Roeck
2012-09-03 18:48 ` Henrique de Moraes Holschuh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.