From 7bdcc800b0870bff65de31367c6e6ae37c5b6fd6 Mon Sep 17 00:00:00 2001 From: Thomas Vegas Date: Fri, 2 May 2025 18:55:51 +0300 Subject: [PATCH 1/2] POSIX: Add more logs Signed-off-by: Thomas Vegas --- .gitlab/test_cpp.sh | 1 + src/plugins/posix/posix_backend.cpp | 7 ++++--- src/plugins/posix/posix_backend.h | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitlab/test_cpp.sh b/.gitlab/test_cpp.sh index bba684559b..352d957f1a 100755 --- a/.gitlab/test_cpp.sh +++ b/.gitlab/test_cpp.sh @@ -40,6 +40,7 @@ echo "==== Show system info ====" env nvidia-smi topo -m || true ibv_devinfo || true +uname -a || true apt-get -qq update apt-get -qq install liburing-dev diff --git a/src/plugins/posix/posix_backend.cpp b/src/plugins/posix/posix_backend.cpp index 9a231cd44a..bc409e5587 100644 --- a/src/plugins/posix/posix_backend.cpp +++ b/src/plugins/posix/posix_backend.cpp @@ -67,8 +67,9 @@ uringQueue::uringQueue(int num_entries, io_uring_params params) memset(&uring, 0, sizeof(uring)); int uring_init_status = io_uring_queue_init_params(num_entries, &uring, ¶ms); - if (uring_init_status != 0) - throw UringError::INIT; + if (uring_init_status != 0) { + throw UringError(absl::StrFormat("Failed to init io_uring - errno: %d", errno)); + } } uringQueue::~uringQueue() { @@ -250,7 +251,7 @@ nixl_status_t nixlPosixEngine::prepXfer(const nixl_xfer_op_t &operation, } catch (nixlPosixBackendReqH::OperationError error) { NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_INVALID_PARAM, "Invalid operation type"); } catch (const uringQueue::UringError& e) { - NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_BACKEND, "Failed to init io_uring"); + NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_BACKEND, e.what()); } catch (const std::exception& e) { NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_BACKEND, absl::StrFormat("Unexpected error: %s", e.what())); } diff --git a/src/plugins/posix/posix_backend.h b/src/plugins/posix/posix_backend.h index 1b928abc15..ebc1373f5c 100644 --- a/src/plugins/posix/posix_backend.h +++ b/src/plugins/posix/posix_backend.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "backend/backend_engine.h" class uringQueue { @@ -43,8 +44,9 @@ class uringQueue { nixl_status_t checkCompleted(); struct io_uring_sqe *getSqe(); - enum class UringError { - INIT, + class UringError : public std::runtime_error { + public: + using std::runtime_error::runtime_error; }; }; From 3ef4b3d9696cbfaec40c2baac9fe4c80e582bfaa Mon Sep 17 00:00:00 2001 From: Thomas Vegas Date: Wed, 7 May 2025 06:05:39 +0000 Subject: [PATCH 2/2] POSIX: Add more logs Signed-off-by: Thomas Vegas --- src/plugins/posix/posix_backend.cpp | 10 +++++----- src/plugins/posix/posix_backend.h | 10 ---------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/plugins/posix/posix_backend.cpp b/src/plugins/posix/posix_backend.cpp index bc409e5587..6181597de2 100644 --- a/src/plugins/posix/posix_backend.cpp +++ b/src/plugins/posix/posix_backend.cpp @@ -68,7 +68,7 @@ uringQueue::uringQueue(int num_entries, io_uring_params params) int uring_init_status = io_uring_queue_init_params(num_entries, &uring, ¶ms); if (uring_init_status != 0) { - throw UringError(absl::StrFormat("Failed to init io_uring - errno: %d", errno)); + throw std::runtime_error(absl::StrFormat("Failed to init io_uring - errno: %d", errno)); } } @@ -157,7 +157,7 @@ nixlPosixBackendReqH::nixlPosixBackendReqH(const nixl_xfer_op_t &operation, reinterpret_cast(io_uring_prep_write)), is_prepped(false), status(NIXL_IN_PROG) { if (operation != NIXL_READ && operation != NIXL_WRITE) { - throw OperationError::INVALID_OPERATION; + throw std::invalid_argument(absl::StrFormat("Invalid operation type: %d", operation)); } fillUringParams(); @@ -248,9 +248,9 @@ nixl_status_t nixlPosixEngine::prepXfer(const nixl_xfer_op_t &operation, NIXL_RETURN_IF_NOT_IN_PROG(status); handle = posix_handle.release(); - } catch (nixlPosixBackendReqH::OperationError error) { - NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_INVALID_PARAM, "Invalid operation type"); - } catch (const uringQueue::UringError& e) { + } catch (const std::invalid_argument& e) { + NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_INVALID_PARAM, e.what()); + } catch (const std::runtime_error& e) { NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_BACKEND, e.what()); } catch (const std::exception& e) { NIXL_LOG_AND_RETURN_IF_ERROR(NIXL_ERR_BACKEND, absl::StrFormat("Unexpected error: %s", e.what())); diff --git a/src/plugins/posix/posix_backend.h b/src/plugins/posix/posix_backend.h index ebc1373f5c..9c91746646 100644 --- a/src/plugins/posix/posix_backend.h +++ b/src/plugins/posix/posix_backend.h @@ -22,7 +22,6 @@ #include #include #include -#include #include "backend/backend_engine.h" class uringQueue { @@ -43,11 +42,6 @@ class uringQueue { nixl_status_t submit(); nixl_status_t checkCompleted(); struct io_uring_sqe *getSqe(); - - class UringError : public std::runtime_error { - public: - using std::runtime_error::runtime_error; - }; }; class nixlPosixBackendReqH : public nixlBackendReqH { @@ -81,10 +75,6 @@ class nixlPosixBackendReqH : public nixlBackendReqH { nixl_status_t postXfer(); nixl_status_t prepXfer(); nixl_status_t checkXfer(); - - enum class OperationError { - INVALID_OPERATION - }; }; class nixlPosixEngine : public nixlBackendEngine {