All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] pwmconfig doesn't detect correlations properly
@ 2010-07-28  6:26 Charles Pillar
  2010-08-16  4:19 ` Charles Pillar
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Charles Pillar @ 2010-07-28  6:26 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 2414 bytes --]

Hi all,
   I'm new here. I believe that I have found a bug in pwmconfig. I first
observed this behavior many many months ago and couldn't find anyone else
with the problem so I just assumed it was just me. I've since stumbled on it
again so I decided to look into it myself. I don't know if anyone is aware
of the behavior I am seeing, but here it is...

Take for example a board with two or more PWM controllable fans both which
of which the speed can be measured. Thus I have:

/sys/class/hwmon/hwmon0/pwm1
/sys/class/hwmon/hwmon0/pwm1_enable
/sys/class/hwmon/hwmon0/fan1_input

/sys/class/hwmon/hwmon0/pwm2
/sys/class/hwmon/hwmon0/pwm2_enable
/sys/class/hwmon/hwmon0/fan2_input
(etc...)

pwm1 & pwm1_enable = fan1_input
pwm2 & pwm2_enable = fan2_input
(etc...)

I think this would be a fairly common set up? Indeed I have three machines
that are setup this way (1 has 2 fans, the other 2 have 3 fans)

From what I can see, pwmconfig does this:

pwm1_enable=0
pwm2_enable=0
wait...
for each PWM:
   this pwm_enable=1
   this pwm=0
   for each fan
      compare this fan before / after
      this pwm_enable=0
      check fan returns to normal
   next fan
next pwm

The problem with this logic is that for each PWM, the pwm_enable is set to
1, then the first fan is tested, after the first fan is tested, the pwm is
disabled and never re-enabled (until the next pwm)...
This means the pwm1=fan1 correlation is detected, but pwm2=fan2 is not - but
only because the pwm_enable is still set to 0 when the second and subsequent
fans are tested...

There are several ways to fix this, but after some pondering, I think that
this logic might be most appropriate:

pwm1_enable=0
pwm2_enable=0
wait...
for each PWM:
   for each fan
      this pwm_enable=1
      this pwm=0
      compare this fan before / after
      this pwm_enable=0
      check fan returns to normal
   next fan
next pwm

This causes the given pwm/fan to stop/start once for each fan input, which
might seem bad, but then each fan is individually checked to make sure that
it has begun spinning again after pwm_enable is set to 0... (as compared to
stopping and starting once per pwm...)

I have a patch which I can supply. It fixes the problem for me, but I'm not
100% sure if it introduces any other problems. Let me know if I should email
it or submit somewhere etc...

I would value hearing what others think about this problem...

Thanks

Charles

[-- Attachment #1.2: Type: text/html, Size: 3170 bytes --]

[-- Attachment #2: 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] 13+ messages in thread

end of thread, other threads:[~2010-08-24  5:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  6:26 [lm-sensors] pwmconfig doesn't detect correlations properly Charles Pillar
2010-08-16  4:19 ` Charles Pillar
2010-08-16 15:51 ` Guenter Roeck
2010-08-19  9:06 ` Jean Delvare
2010-08-19  9:37 ` Jean Delvare
2010-08-19 11:23 ` Charles Pillar
2010-08-19 13:16 ` Jean Delvare
2010-08-19 13:37 ` Jean Delvare
2010-08-19 14:31 ` Guenter Roeck
2010-08-22 12:11 ` Jean Delvare
2010-08-22 12:58 ` Charles Pillar
2010-08-22 16:26 ` Jean Delvare
2010-08-24  5:52 ` Charles Pillar

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.