History log of /openbmc/dbus-sensors/src/PSUEvent.cpp (Results 1 – 25 of 43)
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>


# f3fd5248 03-Apr-2024 Ed Tanous <ed@tanous.net>

Enable bugprone-unused-local-non-trivial-variable

And fix the two problems.

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


# 201a1015 03-Apr-2024 Ed Tanous <ed@tanous.net>

Add modernize-redundant-void-arg

Enable this check and fix the failures.

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


# 5b3542ea 31-Oct-2023 George Liu <liuxiwei@inspur.com>

psusensor: Optimize the naming of some variables

Some variable declarations and parameter types use
`boost::container::flat_map`. The long type names make it difficult
for other developers to read.

psusensor: Optimize the naming of some variables

Some variable declarations and parameter types use
`boost::container::flat_map`. The long type names make it difficult
for other developers to read.

This commit makes some minor optimizations, using `using` to declare
an alias to increase the readability of the code.

Tested: built psusensor successfully and works fine.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I9b632c27fc67694d2de384f6e7c88bf66b97f78e

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 ...


# 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 ...


# 1f978631 28-Feb-2023 Ed Tanous <edtanous@google.com>

Change io_service to io_context

This was renamed a while back in boost to be compliant with the
std::executors proposal.

Change-Id: Ib56544a0a7478990d18fe9e0bbbd8db1e52fa5b8
Signed-off-by: Ed Tanou

Change io_service to io_context

This was renamed a while back in boost to be compliant with the
std::executors proposal.

Change-Id: Ib56544a0a7478990d18fe9e0bbbd8db1e52fa5b8
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 ...


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

PSUEvent: Replace iterator pairs with structured bindings

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


# 1ff2e669 02-Aug-2022 Justin Ledford <justinledford@google.com>

psusensor: remove unused fd

After enabling io-uring in [0], the underlying file is managed by the
random_access_file and the raw file descriptor is no longer used.

[0] https://gerrit.openbmc.org/c/

psusensor: remove unused fd

After enabling io-uring in [0], the underlying file is managed by the
random_access_file and the raw file descriptor is no longer used.

[0] https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/46918

Signed-off-by: Justin Ledford <justinledford@google.com>
Change-Id: Ie896f62d75ea9a461179ef807775a25bf517420a

show more ...


# 16966b55 15-Sep-2021 Ed Tanous <edtanous@google.com>

Enable an io-uring build

There exists a bug where calls that we previously thought were
non-blocking, actually do block when used with hwmon or filesystem fds.
This causes high latencies on the dbus

Enable an io-uring build

There exists a bug where calls that we previously thought were
non-blocking, actually do block when used with hwmon or filesystem fds.
This causes high latencies on the dbus interfaces when lots of sensors
are used in a single daemon, as is the case in PSUSensor.

This patchset moves the PSUSensor code over to using io-uring, through
boost asio, using the random_access_file class. This helps with
performance in a number of ways, the largest of which being that sensor
reads are no longer blocking.

Tested:

Booted the sensor system on Tyan S7106; dbus-monitor shows sensors
scanning normally.

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

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 ...


# b429f31d 27-Jun-2022 Ed Tanous <edtanous@google.com>

Fix clang-tidy 14 issues

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


# 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 ...


# 99c4409a 14-Jan-2022 Ed Tanous <edtanous@google.com>

Enable cppcoreguidelines-pro-type-vararg check

We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.

Signed-off-by: Ed

Enable cppcoreguidelines-pro-type-vararg check

We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.

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

show more ...


# 0e68f199 05-Aug-2021 Paul Fertser <fercerpav@gmail.com>

Revert "Add beep support for PSU"

This reverts commit 3046a0242cfde0cbf871f632c2c143b48ac30c71.

Apparently nobody knows what this was meant for, and having useless code
around i

Revert "Add beep support for PSU"

This reverts commit 3046a0242cfde0cbf871f632c2c143b48ac30c71.

Apparently nobody knows what this was meant for, and having useless code
around is confusing.

Citing Ed Tanous: "This is likely leftover cruft from pulling
dbus-sensors into mainline."
(https://lists.ozlabs.org/pipermail/openbmc/2021-August/027166.html)

Change-Id: I92256d594ce7ca37b957fe86a2d99d9cc9c315af
Signed-off-by: Paul Fertser <fercerpav@gmail.com>

show more ...


# 0c42f40e 27-Aug-2021 Patrick Williams <patrick@stwcx.xyz>

logging: replace direct journal calls with lg2

Tested:

Created a bogus journal message equivalent to the one in
TachSensor.hpp as the first line of 'main' in FanMain.cpp:

logging: replace direct journal calls with lg2

Tested:

Created a bogus journal message equivalent to the one in
TachSensor.hpp as the first line of 'main' in FanMain.cpp:

```
auto device = "FooBar";
auto msg = "OpenBMC.0.1.FanInserted";
lg2::error("Fan Inserted", "REDFISH_MESSAGE_ID", msg,
"REDFISH_MESSAGE_ARGS", device);
```

Observed the following in the journal:
```
{
"_MACHINE_ID" : "115e76f3bc47411eb0f20075b13444e9",
"_CMDLINE" : "/usr/bin/fansensor",
"REDFISH_MESSAGE_ID" : "OpenBMC.0.1.FanInserted",
"CODE_LINE" : "463",
"_COMM" : "fansensor",
"_EXE" : "/usr/bin/fansensor",
"_SOURCE_REALTIME_TIMESTAMP" : "33256618",
"__MONOTONIC_TIMESTAMP" : "33256849",
"SYSLOG_IDENTIFIER" : "fansensor",
"PRIORITY" : "3",
"_CAP_EFFECTIVE" : "1ffffffffff",
"_PID" : "296",
"_UID" : "0",
"_SYSTEMD_UNIT" : "xyz.openbmc_project.fansensor.service",
"REDFISH_MESSAGE_ARGS" : "FooBar",
"__REALTIME_TIMESTAMP" : "33256822",
"LOG2_FMTMSG" : "Fan Inserted",
"_SYSTEMD_CGROUP" : "/system.slice/xyz.openbmc_project.fansensor.service",
"_GID" : "0",
"_TRANSPORT" : "journal",
"__CURSOR" : "s=039afc05fc934fe08b77dd73c4092591;i=1ff;b=5ad25f16b9bd424ebe72cf30558fcdc2;m=1fb7591;t=1fb7576;x=617adeeaf1da9edc",
"CODE_FILE" : "../../../../../../../../sync/openbmc-sources/dbus-sensors/src/FanMain.cpp",
"_SYSTEMD_INVOCATION_ID" : "9eef21c4b7784ba2aa2628f162079cd3",
"CODE_FUNC" : "int main()",
"MESSAGE" : "Fan Inserted",
"_HOSTNAME" : "bletchley",
"_SYSTEMD_SLICE" : "system.slice",
"_BOOT_ID" : "5ad25f16b9bd424ebe72cf30558fcdc2"
}
```

Observed the following in /var/log/redfish:
```
1970-01-01T00:00:27.345477+00:00 OpenBMC.0.1.FanInserted,FooBar
```

Observed the following in Redfish:
```
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/27",
"@odata.type": "#LogEntry.v1_4_0.LogEntry",
"Created": "1970-01-01T00:00:27+00:00",
"EntryType": "Event",
"Id": "27",
"Message": "FooBar inserted.",
"MessageArgs": [
"FooBar"
],
"MessageId": "OpenBMC.0.1.FanInserted",
"Name": "System Event Log Entry",
"Severity": "OK"
}
```

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

show more ...


# c7a1ae6b 30-Apr-2021 Konstantin Aladyshev <aladyshev22@gmail.com>

psusensor: Add support for the 'PowerState' parameter

When CPU is powered off, some sensor reading values are expected
to go below low thresholds. To prevent unnecessary sensor readings

psusensor: Add support for the 'PowerState' parameter

When CPU is powered off, some sensor reading values are expected
to go below low thresholds. To prevent unnecessary sensor readings
and redundant threshold event trigger in cases like that add support
for the 'PowerState' JSON configuration parameter similar to other
'dbus-sensors' apps.
Use 'checkThresholdsPowerDelay' function in a threshold check like
it is done in ADCSensor app. This is necessary as PSU data can drop
faster than a change in a power state is noticed.

Tested on the AMD EthanolX CRB with ISL68137:

When the PowerState is set to "On" and the platform is powered off,
no transactions are observed on the corresponding I2C bus.

When the PowerState is set to "Always" monitoring is always enabled
and I2C transactions are always observed regardless the platform
power state.

These commands were used to monitor transactions
on the I2C bus:
$ echo 1 > /sys/kernel/debug/tracing/tracing_on
$ echo 1 > /sys/kernel/debug/tracing/events/i2c/i2c_read/enable
$ cat /sys/kernel/debug/tracing/trace_pipe

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: Ic7b36e48828adf4eb2f7714965a4a1df4eb5ac3e

show more ...


# 3453354b 20-Jul-2021 Paul Fertser <fercerpav@gmail.com>

PSUSensor: improve error logging

PSU sub-events might be asserted by to different alarm flags as returned
by the kernel so when debugging a hardware or driver issue it's
important to

PSUSensor: improve error logging

PSU sub-events might be asserted by to different alarm flags as returned
by the kernel so when debugging a hardware or driver issue it's
important to know what condition exactly triggered.

Same about errors reading data from PMBUS sensors, for debugging it's
essential to learn precisely what happened.

Example output:

System error 11 (Resource temporarily unavailable) reading from /sys/class/hwmon/hwmon12/temp1_input, line: 199
PSUSubEvent asserted by /sys/class/hwmon/hwmon10/curr3_crit_alarm
PSUSubEvent asserted by /sys/class/hwmon/hwmon12/curr3_crit_alarm
System error 6 (No such device or address) reading from /sys/class/hwmon/hwmon8/curr3_input, line: 199
PSUSubEvent asserted by /sys/class/hwmon/hwmon15/curr3_crit_alarm

Monitoring with strace confirms psusensor happily continues to read from
the file descriptors in question after the glitches.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: I2f1adac52ad8393d455c3c1a04e7f9bac479f68f

show more ...


# 7170a235 04-Feb-2021 Lei YU <yulei.sh@bytedance.com>

psusensor: Use configurable read interval

The intervals to read the psusensor value and event were hard-coded to
1000 ms.

For some sensors user may need to use a different inter

psusensor: Use configurable read interval

The intervals to read the psusensor value and event were hard-coded to
1000 ms.

For some sensors user may need to use a different interval to poll, e.g.
it should not poll the voltage of RTC battery because it drains the
battery.
The ADC sensor already has the similar change.

Make them configurable parameters from entity-manager's json, so that
the user could use customized poll rate to poll the specific sensors.
If the "PollRate" is not set in the json config, the behavior is the
same as before that uses the default 1s poll rate.

The config parameters are the same as HwmonTemp and ADC sensor.

E.g. the below json config changes the poll rate to 2.0s for pmbus sensor
at i2c 5-0076.

{
"Address": "0x76",
"Bus": 5,
"Name": "CPU0_VR_0",
"Labels": [
"pin",
"temp1",
"vout1"
],
"PollRate": 2.0,
"Thresholds": [...],
"Type": "pmbus"
}

Tested: Add `PollRate` in pmbus's sensor and verify the related sensors'
poll rate is changed accordingly.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I94109e65455dd5c27509ce89a62ef92738714298

show more ...


# 6cb732a3 18-Feb-2021 Ed Tanous <edtanous@google.com>

Fix bug in name escaping for PSUSensor

PSU sensor has a bug where if the name includes any invalid characters,
it crashes when attempting to launch. This is a problem, and very much

Fix bug in name escaping for PSUSensor

PSU sensor has a bug where if the name includes any invalid characters,
it crashes when attempting to launch. This is a problem, and very much
not expected behavior.

The root cause of this is that PSU combine event is creating a dbus API
path from the object name, but neglects to escape it properly.

The previous method to escape this was inlined inside sensor.hpp, so
that has been promoted to a new utility function, escapeForDbus which
can return an escaped name string to use in paths.

Through the course of adding this to the sensors namespace and including
it, it turns out that "sensors" is overloaded, and including it causes
both compile time errors from the overloaded name, and link time errors
from the lack of "inline" on the utility methods. This commit also as a
matter of cleanup moves everything in SensorPaths.hpp into an
alternative file, SensorPaths.cpp, and includes that file in sensor
utils.

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

show more ...


# 8a57ec09 09-Oct-2020 Ed Tanous <ed@tanous.net>

add clang-tidy

This commit implements a clang-tidy file, and makes some changes to get
it to pass. Most changes are naming or mechanical in nature.

Tested:
Clang-tidy now p

add clang-tidy

This commit implements a clang-tidy file, and makes some changes to get
it to pass. Most changes are naming or mechanical in nature.

Tested:
Clang-tidy now passes.

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

show more ...


# 8086aba0 25-Aug-2020 James Feist <james.feist@linux.intel.com>

Fix missing includes

Likey due to
https://github.com/openbmc/sdbusplus/commit/38ab5ecfe3c51501a9380e2c30dbb5fdd88cf4f9

many boost features that were missing from being included

Fix missing includes

Likey due to
https://github.com/openbmc/sdbusplus/commit/38ab5ecfe3c51501a9380e2c30dbb5fdd88cf4f9

many boost features that were missing from being included
made the build stop working. Fix them.

Change-Id: I0ef7fff6b38bd5589a4955fe8f2d892e366406b2
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...


# 38fb5983 28-May-2020 James Feist <james.feist@linux.intel.com>

Update clang format

Update to clang-format-10

Change-Id: I7fcab706fb384e5fcc07a06c42897a5ddbc4b511
Signed-off-by: James Feist <james.feist@linux.intel.com>


12