nvidia-gpu: publish each power sensor value update
Power sensor values are only updated when the change between the new and
previous reading exceeds the hysteresisPublish threshold. By default,
this threshold is calculated as ((max - min) * 0.0001). Since this
sensor uses theoretical limits for its min/max values, the resulting
hysteresisPublish value is quite large (429.5 watts), which prevents
updates from being sent over D-Bus.
This patch sets the max value to a more reasonable upper limit, allowing
sensor value changes to be published to D-Bus as expected.
Tested: Build an image for gb200nvl-obmc machine with the following
patches cherry picked. This patches are needed to enable the mctp stack.
https://gerrit.openbmc.org/c/openbmc/openbmc/+/79422
Power sensor value is being updated.
```
$ curl -s -k -u 'root:0penBmc' https://10.137.203.137/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/power_NVIDIA_GB200_GPU_0_Power_0
{
"@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/power_NVIDIA_GB200_GPU_0_Power_0",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "power_NVIDIA_GB200_GPU_0_Power_0",
"Name": "NVIDIA GB200 GPU 0 Power 0",
"Reading": 27.705,
"ReadingRangeMax": 5000.0,
"ReadingRangeMin": 0.0,
"ReadingType": "Power",
"ReadingUnits": "W",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}%
$ curl -s -k -u 'root:0penBmc' https://10.137.203.137/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/power_NVIDIA_GB200_GPU_0_Power_0
{
"@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/power_NVIDIA_GB200_GPU_0_Power_0",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "power_NVIDIA_GB200_GPU_0_Power_0",
"Name": "NVIDIA GB200 GPU 0 Power 0",
"Reading": 27.465,
"ReadingRangeMax": 5000.0,
"ReadingRangeMin": 0.0,
"ReadingType": "Power",
"ReadingUnits": "W",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}%
```
Change-Id: I27d18d3f55cf6d3a2ee078ab15a23f6a4c26404c
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuPowerSensor.cpp b/src/nvidia-gpu/NvidiaGpuPowerSensor.cpp
index ffec3ad..756abe6 100644
--- a/src/nvidia-gpu/NvidiaGpuPowerSensor.cpp
+++ b/src/nvidia-gpu/NvidiaGpuPowerSensor.cpp
@@ -35,8 +35,7 @@
// GPU Power Sensor Averaging Interval in seconds, 0 implies default
constexpr uint8_t gpuPowerAveragingIntervalInSec{0};
-static constexpr double gpuPowerSensorMaxReading =
- std::numeric_limits<uint32_t>::max() / 1000.0;
+static constexpr double gpuPowerSensorMaxReading = 5000;
static constexpr double gpuPowerSensorMinReading =
std::numeric_limits<uint32_t>::min();