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
diff --git a/include/PSUEvent.hpp b/include/PSUEvent.hpp
index 93c06c1..2ee7a33 100644
--- a/include/PSUEvent.hpp
+++ b/include/PSUEvent.hpp
@@ -19,10 +19,11 @@
#include <Utils.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/io_service.hpp>
-#include <boost/asio/streambuf.hpp>
+#include <boost/asio/random_access_file.hpp>
#include <boost/container/flat_map.hpp>
#include <sdbusplus/asio/object_server.hpp>
+#include <array>
#include <memory>
#include <set>
#include <string>
@@ -57,11 +58,12 @@
PowerState readState;
boost::asio::deadline_timer waitTimer;
- std::shared_ptr<boost::asio::streambuf> readBuf;
+ std::shared_ptr<std::array<char, 128>> buffer;
void restartRead();
- void handleResponse(const boost::system::error_code& err);
+ void handleResponse(const boost::system::error_code& err,
+ size_t bytesTransferred);
void updateValue(const int& newValue);
- boost::asio::posix::stream_descriptor inputDev;
+ boost::asio::random_access_file inputDev;
std::string psuName;
std::string groupEventName;
std::string fanName;