Adding userspace support for ipmisensors
Hi Jean & all,
I have a stablish working ipmisensors driver (the bmcsensors re-write for kernel 2.6/hwmon - see
http://bmcsensors-26.sourceforge.net/ipmisensors/ for patches), and I'm tyring to add support to libsensors and sensors for testing. As far as I can tell the following patch should work, however after applying it I still can't see the sensors (yet the entries do appear in /sys/class/hwmon/hwmon0/*). Any help would be appreciated (as you can tell I'm new to the userspace side ;)
I do have some other concerns/ideas on support ipmisensors would be looking for in libsensors, and considering a possible re-write I feel I should list these now.
- fixed number of sensors
ipmisensors has a dynamic ("hotplug" sensors not supported at runtime at the moment) and unknown number of sensors. As far as I can tell libsensors needs to know a fixed number.
- labels given
ipmisensors gives the BMC's labels for each sensors in a "label" entry. This should be easy to add support for (perhaps defaulting to these labels without user configured labels).
- binary sensors
IPMI supports "non-threshold sensors" for things like power status, chassis intrusion, etc, which are basically binary valued. I plan to add support for these to the driver, but do these belong in lm-sensors and how hard would it be to add support for them to libsensors?
Thanks,
Yani
------------------------------------------------
+++ lib/chips.c (working copy)
@@ -5919,6 +5919,7 @@
{ SENSORS_LM92_PREFIX, lm92_features },
{ SENSORS_VT8231_PREFIX, vt8231_features },
{ SENSORS_BMC_PREFIX, bmc_features },
+ { SENSORS_IPMI_PREFIX, bmc_features },
{ SENSORS_LM85_PREFIX, lm85_features },
{ SENSORS_LM85B_PREFIX, lm85_features },
{ SENSORS_LM85C_PREFIX, lm85_features },
Index: lib/chips.h
=================================--- lib/chips.h (revision 4081)
+++ lib/chips.h (working copy)
@@ -1969,6 +1969,7 @@
#define SENSORS_VT8231_VRM 83 /* RW */
#define SENSORS_VT8231_UCH 84 /* RW */
+#define SENSORS_IPMI_PREFIX "ipmi"
#define SENSORS_BMC_PREFIX "bmc"
/* quantity of each sensor is unknown, so just define the
Index: prog/sensors/main.c
=================================--- prog/sensors/main.c (revision 4081)
+++ prog/sensors/main.c (working copy)
@@ -398,6 +398,7 @@
{ "lm92", print_lm92 },
{ "vt8231", print_vt8231 },
{ "bmc", print_bmc },
+ { "ipmi", print_bmc },
{ "adm1026", print_adm1026 },
{ "lm83", print_lm83 },
{ "lm90", print_lm90 },
Hi Yani,
Quoted 5 lines
I have a stablish working ipmisensors driver (the bmcsensors re-write for kernel 2.6/hwmon - see
http://bmcsensors-26.sourceforge.net/ipmisensors/ for patches), and I'm tyring to add support to libsensors and sensors for testing. As far as I can tell the following patch should work,
We can obviously apply this, it's not very intrusive ;) However, may I ask why you didn't simply keep the "bmc" prefix? You would have won compatibility with a few previous releases of lm_sensors, and the name change might also confuse the users.
You missed one bmc -> impi duplication in etc/sensors.conf.eg.
Quoted 4 lines
however after
applying it I still can't see the sensors (yet the entries do appear in/sys/class/hwmon/hwmon0/*). Any help would be appreciated (as you can tell I'm new to the userspace side ;)
If you are usins lm_sensors 2.10.0, it has a known bug that prevents hardware monitoring chips from being properly detected if there isn't at least one i2c chip with a driver loaded. This is fixed in SVN, so you should use that.
Secondly, make sure you created a "name" attribute with the chip type (that would be "ipmi" for you) for your device.
Lastly, libsensors has some bus-specific code to generate chip "names" (like "adm1032-i2c-1-4c"). Depending on where in the sysfs tree your device is, the code might fail to generate a proper name. The code doing that is in lib/sysfs.c:sensors_read_sysfs_bus() if you want to take a look.
strace might come in handy to diagnose the problem.
Quoted 8 lines
I do have some other concerns/ideas on support ipmisensors would be looking for in libsensors, and considering a possible re-write I feel I should list these now.
- fixed number of sensors
ipmisensors has a dynamic ("hotplug" sensors not supported at runtime at the moment) and unknown number of sensors. As far as I can tell libsensors needs to know a fixed number.
For now, yes. However there are plans floating around to have libsensors probe for chip features (Linux 2.6 only) instead of using an internal hard-coded list for every chip. That's what Mark M. Hoffman and I had been discussing at the restaurant in Ottawa, if you remember. I know Hans de Goede has interest in this too, unfortunately I'm a bit too busy right now to go on.
Quoted 4 lines
- labels given
ipmisensors gives the BMC's labels for each sensors in a "label" entry. This should be easy to add support for (perhaps defaulting to these labels without user configured labels).
Yeah, that would be very convenient for the users. Indeed it shouldn't be too hard to implement. Once again I think I read that Hans de Goede has a similar need for his new uGuru2 driver.
Quoted 3 lines
- binary sensors
IPMI supports "non-threshold sensors" for things like power status, chassis intrusion, etc, which are basically binary valued.
You mean _booleans_?
Quoted 3 lines
I plan to
add support for these to the driver, but do these belong in lm-sensors and how hard would it be to add support for them to libsensors?
I see no problem here, booleans are simple integers after all, so this is already support. Attributes like pwm1_enable were booleans too until recently, and it works just fine.
The extra attributes (e.g. chassis intrusion) might lack proper standardization at the moment, though.
Signature · 1 line
Jean Delvare
Hi Jean,
Quoted 4 lines · Jean Delvare
We can obviously apply this, it's not very intrusive ;) However, may I ask why you didn't simply keep the "bmc" prefix? You would have won compatibility with a few previous releases of
lm_sensors, and the name change might also confuse the users.
Yes, I was kind of expecting someone to ask about eventually ;). Lets see if I can explain my rationale without it sounding like an arbitrary decision that sounded good at 4am.
ipmisensors has very little in common with bmcsensors (other than the IPMI messaging code thats stayed the same of course) and is very much a re-write, so much so I decided at some point it would actually be more of a confusion for it to have the same name.
- bmcsensors required i2c-ipmi to load (due to the horrible old client-bus i2c hack), while ipmisensors is a standalone hwmon driver, and I think the new name would reflect that well.
This was the main reason - to clearly show ipmisensors does not require i2c-ipmi. It also means previous lm_sensors releases of sensors-detect would not provide the right instructions for loading ipmisensors even if it had the same name.
- the vast majority of the new features already in bmcsensors (unlimited sensors determined at runtime for example) and any I plan to add to ipmisensors in future will be virtually impossible to back port to bmcsensors unless they are just IPMI messaging related. (hwmon, dynamic callbacks, the extra ipmi subsystem support aren't available in 2.4).
- given the different IPMI implementations that are coming out, mBMC for example I thought ipmisensors was a little bit more clear on the purpose of the driver - querying sensors over a local IPMI interface rather than any specific form of a BMC.
Saying all that though you have a good point in that it could even have a different name but retain the bmc prefix, although I can't think of a different name that sounds any good with the same prefix, I welcome suggestions & opinions on the rename.
Considering that ipmisensors will require 2.6.17 and above, I personally haven't been so concerned on backwards compatibility with older versions of lm_sensors userspace.
Quoted 2 lines
Secondly, make sure you created a "name" attribute with the chip type (that would be "ipmi" for you) for your device.
Ah, I think that's the problem, thanks! I'll be sending you the patch once I get userspace working and a few more people have tested it. There is only one other issue I know of and am trying to track down.
Quoted 6 lines
For now, yes. However there are plans floating around to have libsensors probe for chip features (Linux 2.6 only) instead of using an internal hard-coded list for every chip. That's what Mark M. Hoffman and I had been discussing at the restaurant in Ottawa, if you remember. I know Hans de Goede has interest in this too, unfortunately I'm a bit too busy right now to go on.
Yes, that sounds promising. I'll just use the bmcsensors defines in chips.[ch] then for now.
Quoted 5 lines
Quoted 3 lines
- binary sensors
IPMI supports "non-threshold sensors" for things like power status, chassis intrusion, etc, which are basically binary valued.You mean _booleans_?
Yes.
Quoted 2 lines
The extra attributes (e.g. chassis intrusion) might lack proper standardization at the moment, though.
Something to think of for later then, but I think most people will be happy with just the integer 0/1 being reported for now.
Thanks,
Yani
Quoted 7 lines · Yani Ioannou
Hi Jean,
Quoted 4 lines · Jean Delvare
We can obviously apply this, it's not very intrusive ;) However, may I ask why you didn't simply keep the "bmc" prefix? You would have won compatibility with a few previous releases of
lm_sensors, and the name change might also confuse the users.
Actually just letting the name attribute return "bmc" seems to allow ipmisensors to work with lm-sensors as is (with the exception of sensors-detect as mentioned before). So I think thats the way I'll go for now.
Yani