History log of /openbmc/dbus-sensors/src/Thresholds.cpp (Results 1 – 25 of 60)
Revision Date Author Comments
# eacbfdd1 04-Apr-2024 Ed Tanous <ed@tanous.net>

Enable misc-include-cleaner

Change-Id: I22099a0f95b2eb884dec7d95cee0bdd0c159fd1f
Signed-off-by: Ed Tanous <ed@tanous.net>


# a327923d 24-Apr-2023 Chris Sides <christopher.sides@hpe.com>

add hysteresis param to parseThresholdsFromAttr()

Parameter 'hysteresis' with a default = NaN, is added to the header for
parseThresholdsFromAttr(), and existing calls to it now explicitly
specify a

add hysteresis param to parseThresholdsFromAttr()

Parameter 'hysteresis' with a default = NaN, is added to the header for
parseThresholdsFromAttr(), and existing calls to it now explicitly
specify a hysteresis value.

This is an alternative to having calls to parseThresholdFromAttr() use
a hardcoded Intel-specific value of '0.'

The 'NaN' value was chosen as default because it reflects the value
that was being written before a device-specific value was hardcoded in
to solve a specific issue.

Change was created based on the discussion here:
https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/61744/comments/38f6a
221_58a39817a

Tested: Confirmed the code builds and doesn't throw errors with OBMC
'local CI' testing. I believe heavier testing with actual Intel HW
isn't needed because this change simple moves where a value is specified
(from hardcode in function body to passed-in parameter) without
affecting any existing in-use functionality.

Change-Id: I1240b951d6e37adc1aad5ad3b19144f6baa64998
Signed-off-by: Chris Sides <christopher.sides@hpe.com>

show more ...


# 597e8423 20-Oct-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I73acd9daf41b52bcc3f6af9a1c38c5f162ae76b2
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# 779c96a2 10-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I0d10afa582342818b9d90b168f6f39f71ce4e0f4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
[AJ: regenerate using .clang-format from openbmc/docs@f44abd66eca8]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 03f93acd 21-Mar-2023 Jeff Lin <JeffLin2@quantatw.com>

IntelCPUSensor: Fix threshold hysteresis is nan

Threshold's hysteresis is set to nan as default in constructor, the
function parseThresholdsFromAttr will forcely update threshold's
hysteresis as nan

IntelCPUSensor: Fix threshold hysteresis is nan

Threshold's hysteresis is set to nan as default in constructor, the
function parseThresholdsFromAttr will forcely update threshold's
hysteresis as nan[1].

Because IntelCPUSensor will run parseThresholdsFromAttr in
IntelCPUSensor::handleResponse, this nan will not be updated by
hysteresisTrigger in function setInitialProperties[2].

When the threshold's hysteresis is always nan, the condition of
deassert will never be satisfied.

Update theshold's hysteresis to be 0 base on max/min chosed in
IntelCPUSensor[3] because the function parseThresholdsFromAttr is only
used by IntelCPUSensor for now.

Refs:
```
[1] https://github.com/openbmc/dbus-sensors/blob/master/src/Thresholds.cpp#L519
[2] https://github.com/openbmc/dbus-sensors/blob/master/src/sensor.hpp#L277
[3] https://github.com/openbmc/dbus-sensors/blob/master/src/IntelCPUSensor.cpp#L46
```

Tested:
DIMM_B0_CPU0 sensor with threshold 93/95 as UWT/UCT, respectively.
Enable flag 'insecure-sensor-override' and then set sensor value to
100 on dbus and then set sensor value to 50 on dbus.

Before change:
```
root@qbmc:~# busctl introspect xyz.openbmc_project.IntelCPUSensor /xyz/openbmc_project/sensors/temperature/DIMM_B0_CPU0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Peer interface - - -
.GetMachineId method - s -
.Ping method - - -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as - -
xyz.openbmc_project.Association.Definitions interface - - -
.Associations property a(sss) 1 "chassis" "all_sensors" "/xyz/openb... emits-change
xyz.openbmc_project.Sensor.Threshold.Critical interface - - -
.CriticalAlarmHigh property b true emits-change
.CriticalAlarmLow property b false emits-change
.CriticalHigh property d 95 emits-change writable
.CriticalLow property d nan emits-change writable
xyz.openbmc_project.Sensor.Threshold.Warning interface - - -
.WarningAlarmHigh property b true emits-change
.WarningAlarmLow property b false emits-change
.WarningHigh property d 93 emits-change writable
.WarningLow property d nan emits-change writable
xyz.openbmc_project.Sensor.Value interface - - -
.MaxValue property d 127 emits-change
.MinValue property d -128 emits-change
.Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change
.Value property d 50 emits-change writable
xyz.openbmc_project.State.Decorator.Availability interface - - -
.Available property b true emits-change writable
xyz.openbmc_project.State.Decorator.OperationalStatus interface - - -
.Functional property b true emits-change
```
After:
```
root@qbmc:~# busctl introspect xyz.openbmc_project.IntelCPUSensor /xyz/openbmc_project/sensors/temperature/DIMM_B0_CPU0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Peer interface - - -
.GetMachineId method - s -
.Ping method - - -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as - -
xyz.openbmc_project.Association.Definitions interface - - -
.Associations property a(sss) 1 "chassis" "all_sensors" "/xyz/openb... emits-change
xyz.openbmc_project.Sensor.Threshold.Critical interface - - -
.CriticalAlarmHigh property b false emits-change
.CriticalAlarmLow property b false emits-change
.CriticalHigh property d 95 emits-change writable
.CriticalLow property d nan emits-change writable
xyz.openbmc_project.Sensor.Threshold.Warning interface - - -
.WarningAlarmHigh property b false emits-change
.WarningAlarmLow property b false emits-change
.WarningHigh property d 93 emits-change writable
.WarningLow property d nan emits-change writable
xyz.openbmc_project.Sensor.Value interface - - -
.MaxValue property d 127 emits-change
.MinValue property d -128 emits-change
.Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change
.Value property d 50 emits-change writable
xyz.openbmc_project.State.Decorator.Availability interface - - -
.Available property b true emits-change writable
xyz.openbmc_project.State.Decorator.OperationalStatus interface - - -
.Functional property b true emits-change
```
and the signal "ThresholdAsserted" for deassert is triggered.

Change-Id: I107a2ac587f5791c47b9e7fd5a7c06ef4a312941
Signed-off-by: Jeff Lin <JeffLin2@quantatw.com>

show more ...


# 83db50ca 01-Mar-2023 Ed Tanous <edtanous@google.com>

Don't use deprecated asio functions

This code used a number of asio functions that have been deprecated.
This patch replaces them with their new equivalents, and enabled
BOOST_ASIO_NO_DEPRECATED.

C

Don't use deprecated asio functions

This code used a number of asio functions that have been deprecated.
This patch replaces them with their new equivalents, and enabled
BOOST_ASIO_NO_DEPRECATED.

Change-Id: I98bddba4c7d72a53ceca9455429828e60f06c5e0
Signed-off-by: Ed Tanous <edtanous@google.com>

show more ...


# e73bd0a1 24-Jan-2023 Andrew Jeffery <andrew@aj.id.au>

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an
example of violating this anti-pattern, so fix it.

[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#placing-internal-headers-in-a-parallel-subtree

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I50ecaddd53fa9c9b7a0441af9de5e60bd94e47c6

show more ...


# 9b4a20e9 06-Sep-2022 Ed Tanous <edtanous@google.com>

Move to steady_timer

deadline_timer and steady_timer have one important difference, the
former runs off CLOCK_REALTIME, and the later runs off CLOCK_MONOTONIC.
For a long time we've relied on deadli

Move to steady_timer

deadline_timer and steady_timer have one important difference, the
former runs off CLOCK_REALTIME, and the later runs off CLOCK_MONOTONIC.
For a long time we've relied on deadline_timer incorrectly, given that
dbus-sensors does not care in the least about the calendar time, and
only cares about the difference between sensor scans.

Fortunately, this likely has no effect on the behavior of the sensors
most of the time, and in general, in a time change, the clock generally
moves forward, so all timers would immediately expire, scan all sensors,
and move on. phosphor-pid-control is intentionally designed to handle
this case, so it's quite likely that a user would never notice it, and
even if they did, would have to be looking at a debug console the moment
it happened.

The other effect is that in most cases, sensors call clock_gettime more
than they probably need to, which might slow down the performance.

This commit moves all usages of sensor timing to steady_timer, which
should give us more consistent results, and (in theory at least) be
faster. Because of stdlib compliance things, this also has the effect
of us dropping our dependence on boost::posix_time, and move to
std::chrono::duration objects, per the coding standard.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I69f948fb3f0fc0dfd7fd196d26ba46742a3e15a7

show more ...


# f783c69e 12-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Thresholds: Replace iterator pairs with structured bindings

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Ie6d1aca77258595d8119db3e831c192daa49f61e


# 92f8f515 22-Jul-2022 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ieb6587e32446a758676f67d9c868289cc02e50bf

show more ...


# afd15043 18-Jul-2022 Zev Weiss <zev@bewilderbeest.net>

Use SensorBaseConfigMap where applicable

If we've got a more concise, descriptive name for it, we might as well
use it.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Id2f1bd8f983b4e0c

Use SensorBaseConfigMap where applicable

If we've got a more concise, descriptive name for it, we might as well
use it.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Id2f1bd8f983b4e0c2ca24b24c9fc9b875f4191f5

show more ...


# 2049bd26 09-Jul-2022 Ed Tanous <edtanous@google.com>

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtan

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a

show more ...


# bb67932a 16-May-2022 Ed Tanous <edtanous@google.com>

Apply LambdaBodyIndentation to dbus-sensors

Per the transform being done in bmcweb, do the same for dbus-sensors.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If21489607759f3cdf20fad17

Apply LambdaBodyIndentation to dbus-sensors

Per the transform being done in bmcweb, do the same for dbus-sensors.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If21489607759f3cdf20fad17eede50fb4e228e5e

show more ...


# 17551b8b 26-Jan-2022 Ed Tanous <edtanous@google.com>

Remove isValidLevel()

Every usage of isValidLevel is done after the levels have been parsed
and are already known to be correct. Checking that Level is valid is
wasteful, and in some cases, is alre

Remove isValidLevel()

Every usage of isValidLevel is done after the levels have been parsed
and are already known to be correct. Checking that Level is valid is
wasteful, and in some cases, is already checked by
getThresholdInterface, which can already bounds check this.

This check is not needed.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1d03c1c66ae37ca86a48175ec9c739c2d3966662

show more ...


# c8fed20b 12-Jan-2022 Ed Tanous <edtanous@google.com>

Rearrange thresholds to be pair based

It was pointed out in another review that the way the dbus interfaces
are set up, they are all pair-wise, with a positive and negative end
of the interface. Th

Rearrange thresholds to be pair based

It was pointed out in another review that the way the dbus interfaces
are set up, they are all pair-wise, with a positive and negative end
of the interface. This changes the data structures to match that
reality, inventing a "ThresholdDefinition" object. This reduces the
code, and allows us to promote the level definitions up to a higher
scope in the structure.

This greatly simplifies the thresProp structure to remove a number of
elements that were redundant, and allows adding new thresholds easier
in the future.

Tested: Tested on Vegman system; Thresholds work as designed.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic9d5ba8282f78fe928689cb7fbd98d575a570200

show more ...


# 30eb03f3 26-Jan-2022 Ed Tanous <edtanous@google.com>

Remove redundant empty check

Checking a vector for empty, then immediately iterating it doesn't
change anything. An empty vector will just return immediately.

Tested: No-OP

Signed-off-by: Ed Tano

Remove redundant empty check

Checking a vector for empty, then immediately iterating it doesn't
change anything. An empty vector will just return immediately.

Tested: No-OP

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ibf8b3e5c6481bbd17d24b9b5a43320ebac4b79f4

show more ...


# 62fd8073 19-Jan-2022 Rashmica Gupta <rashmica.g@gmail.com>

thresholds: Fix typo in interface name

Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Change-Id: I784296f04a0a89cb38ced5769e29b0f177153c09


# d2208a90 14-Jan-2022 Rashmica Gupta <rashmica.g@gmail.com>

thresholds: Make variable naming and type the same

So what constitutes a severity value and a level is consistent across
the code.

Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Change-Id: Ie

thresholds: Make variable naming and type the same

So what constitutes a severity value and a level is consistent across
the code.

Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Change-Id: Ie1af1b9b9b207339ca12235f04b95dc2a1e16979

show more ...


# 091c92c0 11-Jan-2022 Jayashree Dhanapal <jayashree-d@hcl.com>

Add Softshutdown and Hardshutdown threshold interface

Added threshold interfaces like Softshutdown and Hardshutdown
interfaces in dbus-sensors. This is similiar to warning and
critical threshold int

Add Softshutdown and Hardshutdown threshold interface

Added threshold interfaces like Softshutdown and Hardshutdown
interfaces in dbus-sensors. This is similiar to warning and
critical threshold interfaces.

To enable this Softshutdown and Hardshutdown interfaces, need to
set the Severity level in EM config. Severity value as 2 for
Softshutdown and Severity value as 3 for Hardshutdown.

TESTED: Tested on Facebook YosemiteV2 hardware. Verified the
Hardshutdown and Softshutdown interfaces are created
and displaying in dbus objects.

Signed-off-by: Jayashree Dhanapal <jayashree-d@hcl.com>
Change-Id: Ic9a6e719a8343321f894bc031688a17a3ed7fd67

show more ...


# 5667808a 04-Jan-2022 Jayashree Dhanapal <jayashree-d@hcl.com>

Move threshold interfaces to common function

Threshold Hardshutdown and Softshutdown interfaces needs to be
created for sensors. Therefore, created a common function
called getInterface() to access

Move threshold interfaces to common function

Threshold Hardshutdown and Softshutdown interfaces needs to be
created for sensors. Therefore, created a common function
called getInterface() to access all the threshold
interfaces from all the sensors source file and removed
hasCriticalInterface(), hasWarningInterface() functions.

Moreover, threshold interfaces from all the sensor constructor has
been refactored to avoid duplicating functions.

TESTED: Tested on Facebook YosemiteV2 hardware. Verified that the
Warning and Critical interfaces are created and displaying in
dbus objects.

Signed-off-by: Jayashree Dhanapal <jayashree-d@hcl.com>
Change-Id: I9c7d049c7d4445d7199bf63d8e729838990880e9

show more ...


# 45f2702d 07-Dec-2021 Jayashree Dhanapal <jayashree-d@hcl.com>

Refactoring threshold properties code.

Multiple threshold interfaces like Hardshutdown and Softshutdown
needs to be created for sensors. Therefore, array has been created
to store multiple propertie

Refactoring threshold properties code.

Multiple threshold interfaces like Hardshutdown and Softshutdown
needs to be created for sensors. Therefore, array has been created
to store multiple properties of thresholds.

Threshold level, direction and properties can be accessed based on
the array created. Moreover, lines of code has been reduced by
refactoring existing threshold code.

TESTED: Tested on Facebook YosemiteV2 hardware. Verified that the
Warning and Critical interfaces and properties are created and
displaying in dbus objects.

Signed-off-by: Jayashree Dhanapal <jayashree-d@hcl.com>
Change-Id: I98be6dd723a6f66336147ec572f161a6c5df3691

show more ...


# 1e34ceca 31-Aug-2021 Rashmica Gupta <rashmica.g@gmail.com>

thresholds: support hysteresis field if supplied

At the moment dbus-sensors that use thresholds use a default hysteresis
of (max - min) * 0.01. If a hysteresis field is specified for a

thresholds: support hysteresis field if supplied

At the moment dbus-sensors that use thresholds use a default hysteresis
of (max - min) * 0.01. If a hysteresis field is specified for a
threshold that is not NaN, use that instead.

Tested by giving a sensor multiple thresholds, with and without
hysteresis, changing the value of the sensor and observing that the
threshold alarms are asserted and deasserted as expected.

Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Change-Id: I9c6c2ef3bb034157b0a6b3bd5c359dae7592d85b

show more ...


# 8a17c303 02-Sep-2021 Ed Tanous <edtanous@google.com>

Make dbus-sensors compile with clang-13

clang-13 finds a lot more warnings for unused variables than it used to,
and also picks up some warnings about errant std::moves that are in
p

Make dbus-sensors compile with clang-13

clang-13 finds a lot more warnings for unused variables than it used to,
and also picks up some warnings about errant std::moves that are in
place.

This commit fixes them.

Tested:
code compiles against clang-13

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I80864287b7131acfe936c4b28afaf34ababb3029

show more ...


# 12c2c0ef 28-Apr-2021 Zhikui Ren <zhikui.ren@intel.com>

ThresholdTimer: use weak_ptr in async callback

Capture weak_ptr to sensor in ThresholdTimer async callback.
which is used to detect destructed sensor in the callback.
Removed raw se

ThresholdTimer: use weak_ptr in async callback

Capture weak_ptr to sensor in ThresholdTimer async callback.
which is used to detect destructed sensor in the callback.
Removed raw sensor pointer inside the ThresholdTimer.

When ADCSensor is destructed, ThresholdTimer is cancelled,
but already queued timer callback is not removed and can be
executed after the sensor is desctructed.

This change prevents accessing the dangling raw sensor pointer
and fixes the occasional ADCSensor service crash while trying to
run createSensors. Any services use ThresholdTimer have
the same issue.

Tested:
ipmitool power cycle 1000 times, ADCSensors get deleted and recreated
for every cycle without crashing.

Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: Ibee7a58a2605992554fb33f4c34ebee502eb38d6

show more ...


# 5636d52b 17-Mar-2021 Matt Spinler <spinler@us.ibm.com>

HwmonTempSensor: Thresholds for multi-temp devices

This commit adds support to be able to create the Threshold interfaces
for the additional temperature sensors on multi-sensor devices.

HwmonTempSensor: Thresholds for multi-temp devices

This commit adds support to be able to create the Threshold interfaces
for the additional temperature sensors on multi-sensor devices.
Previously, there could only be a threshold on the first sensor on
the device. In some sensors, such as the TMP401 family, the remote
sensors which can be wired to other devices are the temp2+_input
values and it's likely those remote values are the interesting ones,
as opposed to just the local temp in temp1_input.

To specify thresholds for multiple sensors on the device, the 'Index'
property is added to the entity-manager JSON for the sensor. When the
index is present, code matches that threshold entry with the sensor that
has an input file with that index number in the tempX prefix. For
example, Index = 2 would be used for the sensor that has temp2_input as
the sensor value file.

Example JSON is:

{
"Index": 1 // This threshold is for the temp1_input sensor
"Direction": "greater than",
"Name": "upper critical",
"Severity": 1,
"Value": 70,
},
{
"Index": 2 // This threshold is for the temp2_input sensor
"Direction": "greater than",
"Name": "upper critical",
"Severity": 1,
"Value": 80,
}

If 'Index' is not present in the threshold data from entity-manager,
then just the first sensor will get the threshold, the same as before.

Tested:
Made sensors for a TMP423 which provides 4 temperature values. Verified
thresholds showed up on each sensor when 'Index' was used. Verified
when less then 4 thresholds were specified that they were placed
appropriately. Also used just a single Threshold entry with no Index
value and verified the threshold just showed up on the first sensor.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: If787364761647088174cb72006727ee4e1d9225f

show more ...


123