Fix sensor missing issue.
There is issue for "BMC randomly unable to get sensor readings".
When invoking "ipmitool sdr" from Linux OS (host), it only
returns three sensors like following partial records:
[root@localhost ~]# ipmitool sdr
CPU Power | 0 Watts | ok
Memory Power | 0 Watts | ok
Total Power | 0 Watts | ok
[root@localhost ~]#
There 2 caches sensorTree and sensorDataRecords.
When sensorDataRecords cache and sensorTree cache is not sync,
which causes this issue, like sensorTree cache has 10 sensors
but there are just 5 sensors in sensorDataRecords cache.
Most important sensorDataRecords cache is not necessary,
ipmiStorageGetSDR could get data from dbus directly and
no any performance impact.
Using sensorMapUpdatePeriod(10s) but not sensorMapSdrUpdatePeriod(60s),
60 seconds are too long to answer user with some SDR content
at the first time of BMC bootup.
Tested:
All sensors could be listed even at booting phase.
Could print correct sensor set along with the boot progress.
root@intel-obmc:~# ipmitool sdr
CPU Power | 202 Watts | ok
Memory Power | 0 Watts | ok
Total Power | 312 Watts | ok
root@intel-obmc:~# ipmitool sdr
System Airflow | 14 unspecified | ok
PSU1 In Current | 1.18 Amps | ok
PSU1 Out Current | 20.80 Amps | ok
PSU2 In Current | 0 Amps | ok
PSU2 Out Current | no reading | ns
Pwm 1 | 29.79 unspecifi | ok
Pwm 2 | 29.79 unspecifi | ok
Pwm 3 | 29.79 unspecifi | ok
Pwm 4 | 29.79 unspecifi | ok
Pwm 5 | 29.79 unspecifi | ok
Pwm 6 | 29.79 unspecifi | ok
Pwm 13 | 29.79 unspecifi | ok
Pwm 14 | 29.79 unspecifi | ok
Pwm 15 | 29.79 unspecifi | ok
Pwm 16 | 29.79 unspecifi | ok
Pwm PSU1 Fan 1 | 39.98 unspecifi | ok
Pwm PSU1 Fan 2 | 39.98 unspecifi | ok
.............
PVCCD HV CPU1 | 1.18 Volts | ok
PVCCFA EHV FIVRA | 1.16 Volts | ok
PVCCINFAON CPU1 | 1.11 Volts | ok
PVCCIN CPU1 | 1.68 Volts | ok
PVNN PCH AUX | 1.03 Volts | ok
root@intel-obmc:~#
Change-Id: I729d9bcbf91f0e96c62fb5f5ebe0240a0eaa47df
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
Signed-off-by: Helen Huang <he.huang@linux.intel.com>
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
diff --git a/include/sensorcommands.hpp b/include/sensorcommands.hpp
index a7f9fb2..e3727f2 100644
--- a/include/sensorcommands.hpp
+++ b/include/sensorcommands.hpp
@@ -121,11 +121,11 @@
namespace ipmi
{
extern SensorSubTree sensorTree;
-static ipmi_ret_t getSensorConnection(ipmi::Context::ptr ctx, uint8_t sensnum,
+static ipmi_ret_t getSensorConnection(ipmi::Context::ptr ctx, uint16_t sensnum,
std::string& connection,
std::string& path)
{
- if (sensorTree.empty() && !getSensorSubtree(sensorTree))
+ if (!getSensorSubtree(sensorTree) && sensorTree.empty())
{
return IPMI_CC_RESPONSE_ERROR;
}