The bug was introduced when I added support for multiple fans
controlled by the same PWM output, in r6000. lm-sensors versions
affected: 3.3.2 to 3.3.5.
This fixes SUSE bug #903520:
https://bugzilla.suse.com/show_bug.cgi?id=903520
Add support for sysfs attributes temp[1-*]_min_hyst (already
implemented by drivers adt7x10, lm77 and lm92) and
temp[1-*]_lcrit_hyst (no known users yet.)
While there is no longer a hard limit to the number of sensor of a
given type per chip, I feel a little uncomfortable having no limit at
all on the amount of memory we may try to allocate. Add an arbitrary
safety limit so that a design error or a bug in a hwmon driver can't
result into an insane memory allocation.
Make memory pre-allocation steps depend on the sensor type. Things like
voltages, temperatures or fans are typically plenty, however vid and
chassis intrusion are typically only a few, and there can only be one
beep_enable by design. This saves a small amount of temporary memory
for cheap.
max_subfeatures is computed the first time it is needed, we can do
exactly the same with FEATURE_SIZE. Introduce feature_size as a static
variable so that we don't have to recompute it again and again.
When gathering the attributes of each hwmon chip, libsensors uses a
temporary structure in memory to order and group all the attributes
into features. This temporary structure used to be a single array with
room for every possible attribute/subfeature. While simple, this
approach required to predefine a maximum number of per-type sensor
that could be handled.
In order to get rid of this arbitrary limit, which we hit and had to
raise three times already, I changed the temporary structure to an
array of dynamically allocated per-type subattribute arrays. This lets
us not allocate any memory for types which aren't implemented by a
given chip, and more importantly, this lets us reallocate room for
more attributes of a given type as needed.
I decided to allocate chunks of 8 attributes at a time, as this seemed
a good compromise between two frequent reallocations and
over-provisioning. It could be tweaked if needed.
Icing on the cake, I benchmarked this change on two different systems
and it results in performance gains. The total heap usage as reported
by valgrind is down by 50% on average, with peak memory consumption
(as reported by valgrind's massif) also down by 43% on average. The
total instructions count (as reported by valgrind's callgrind) is down
by 11% on average, with measured execution time also down by a few
percents. Valgrind rocks, BTW.
I have some ideas to optimize the memory allocations further, but I do
not expect such a huge gain from them. They may not even improve peak
memory consumption as massif shows the peak is somewhere else now at
least in some cases.
Several kernel drivers have already moved their attributes from the
hardware device to the hwmon class device, and others will follow.
Teach fancontrol about this possibility and let it adjust the attribute
paths transparently.
With recent (>202) systemd release, syslog.target is no longer provided:
services are ensured they are started after logging socket is setup, so
journal will capture all syslog messages and will store them and forward
them to syslog implementation (if running).
Patch from Ville Skyttä.
Based on a report and an original patch from Jaromir Capik:
There's no vendor_id entry in the /proc/cpuinfo file in case of PPC64
systems and consequently the script returns 3 screens full of the
following errors:
Use of uninitialized value in string eq at /usr/sbin/sensors-detect
line 6444
Use of uninitialized value in string eq at /usr/sbin/sensors-detect
line 6459
Use of uninitialized value in string eq at /usr/sbin/sensors-detect
line 6473
sensors_get_adapter_name(). Paul Crawford asked questions about these
as he found the original documentation unclear. I'm including my
answers to his questions here, reformatted, so that other developers
can benefit from them too.
It is better to use option --auto for non-interactive runs of the
sensors-detect script than faking an input to get the default answers
to all questions.
NCT6683D is found on recent Intel mainboards (eg DH87MC, DH87RL).
NCT6681D is mentioned on the Nuvoton web site. NCT6682D is similar
to NCT6681D with added support for current monitoring.
/sys/module doesn't actually contain all built-in modules, only the
ones which have a version or at least one parameter. Better use file
modules.builtin which is generated since kernel 2.6.33, it is complete
and this will let us handle built-in modules properly.