Bug 10259

Summary: /sys/class/hwmon/hwmon0 is missing a device link
Product: Drivers Reporter: Jean-Luc Coulon (jean.luc.coulon)
Component: Hardware MonitoringAssignee: Jean Delvare (jdelvare)
Status: CLOSED CODE_FIX    
Severity: normal CC: bunk, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.25-rc5-git4 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 9832    
Attachments: Ignore hwmon devices with no device link

Description Jean-Luc Coulon 2008-03-16 04:56:33 UTC
Latest working kernel version: 2.6.25-rc5-git3
Earliest failing kernel version: 2.6.25-rc5-git4
Distribution: Debian/Sid
Hardware Environment: ASUS A8V, Atnlon 64 x2 4200+
Software Environment: 
Problem Description: "sensors" command returns "sensors_init: Kernel interface error" while the correct modules are loaded

Steps to reproduce: boot the system, run snesors or libsensors related applications

With git3, I've the following tree:
/sys/class/hwmon/hwmon0/
|-- device -> ../../../devices/pci0000:00/0000:00:18.3
|-- power
|   `-- wakeup
|-- subsystem -> ../../hwmon
`-- uevent

with git4, I get:
/sys/class/hwmon/hwmon0/
|-- name
|-- power
|   `-- wakeup
|-- subsystem -> ../../hwmon
`-- ueven

"sensors" complains about the missing device link:
<snip>
open("/sys/class/hwmon", O_RDONLY|O_NONBLOCK|O_DIRECTORY|0x80000) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
getdents(3, /* 5 entries */, 4096)      = 144
readlink("/sys/class/hwmon/hwmon0/device", 0x7fffe7b98f60, 254) = -1 ENOENT (No such file or directory)
close(3)                                = 0
write(2, "sensors_init: Kernel interface e"..., 37sensors_init: Kernel interface error
) = 37
<snip/>
Comment 1 Jean Delvare 2008-03-16 07:13:27 UTC
With git4, what are the contents of the "name" attribute? Don't you have an additional "hwmon1" device with git4? I suspect that "hwmon0" is the new ACPI thermal zones virtual device with git4 and you have "hwmon1" which is equivalent to git3's "hwmon0".
Comment 2 Jean-Luc Coulon 2008-03-16 07:36:08 UTC
[jean-luc@tangerine] % cat /sys/class/hwmon/hwmon0/name
thermal_sys_class

Yes, hwmon0 contents has been moved to hwmon1 (and hwmon1 to hwmon2).

Here is the whole tree for git2 ("name" attribut doesnt exist in git3) :

/sys/class/hwmon/
|-- hwmon0
|   |-- device -> ../../../devices/pci0000:00/0000:00:18.3
|   |-- power
|   |   `-- wakeup
|   |-- subsystem -> ../../hwmon
|   `-- uevent
`-- hwmon1
    |-- device -> ../../../devices/platform/w83627hf.656
    |-- power
    |   `-- wakeup
    |-- subsystem -> ../../hwmon
    `-- uevent

and the whole tree with git4:

/sys/class/hwmon/
|-- hwmon0
|   |-- name
|   |-- power
|   |   `-- wakeup
|   |-- subsystem -> ../../hwmon
|   `-- uevent
|-- hwmon1
|   |-- device -> ../../../devices/pci0000:00/0000:00:18.3
|   |-- power
|   |   `-- wakeup
|   |-- subsystem -> ../../hwmon
|   `-- uevent
`-- hwmon2
    |-- device -> ../../../devices/platform/w83627hf.656
    |-- power
    |   `-- wakeup
    |-- subsystem -> ../../hwmon
    `-- uevent
Comment 3 Jean Delvare 2008-03-16 11:34:18 UTC
Created attachment 15301 [details]
Ignore hwmon devices with no device link

This patch to lm-sensors 3.0.x works around the problem by ignoring hwmon devices with no device link. I'll discuss the actual fix with the author of the new generic thermal zone driver.

A similar patch has already been applied to the lm-sensors 2.10.x tree:
http://www.lm-sensors.org/changeset/5147
Comment 4 Jean-Luc Coulon 2008-03-16 12:36:13 UTC
I've rebuilt the lm-sensor package after applying the patch.
Everything went fine.

Thanks

Jean-Luc
Comment 5 Rafael J. Wysocki 2008-03-16 15:12:40 UTC
This entry is being used for tracking a regression from 2.6.24.  Please don't
close it until the problem is fixed in the mainline.

Handled-By : Jean Delvare <khali@linux-fr.org>
Patch : http://bugzilla.kernel.org/attachment.cgi?id=15301&action=view
Comment 6 Jean Delvare 2008-03-19 12:59:18 UTC
The problematic patch has been reverted from mainline:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=91f57fa1215952af579f304821a15cc6c656042c

We now have some time to discuss how to implement this feature in 2.6.26, and to update libsensors accordingly.