Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions daos-9173-ofi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
diff --git a/prov/verbs/src/fi_verbs.h b/prov/verbs/src/fi_verbs.h
index 29ff483..5ccd04b 100644
--- a/prov/verbs/src/fi_verbs.h
+++ b/prov/verbs/src/fi_verbs.h
@@ -577,6 +577,7 @@ struct vrb_ep {
/* Protected by send CQ lock */
uint64_t sq_credits;
uint64_t peer_rq_credits;
+ struct slist sq_list;
/* Protected by recv CQ lock */
int64_t rq_credits_avail;
int64_t threshold;
@@ -619,15 +620,22 @@ struct vrb_ep {
};


-/* Must be cast-able to struct fi_context */
+enum vrb_op_ctx {
+ VRB_POST_SQ,
+ VRB_POST_RQ,
+ VRB_POST_SRQ,
+};
+
struct vrb_context {
- struct vrb_ep *ep;
- struct vrb_srq_ep *srx;
+ struct slist_entry entry;
+ union {
+ struct vrb_ep *ep;
+ struct vrb_srq_ep *srx;
+ };
void *user_ctx;
- uint32_t flags;
+ enum vrb_op_ctx op_ctx;
};

-
#define VERBS_XRC_EP_MAGIC 0x1F3D5B79
struct vrb_xrc_ep {
/* Must be first */
diff --git a/prov/verbs/src/verbs_cq.c b/prov/verbs/src/verbs_cq.c
index 5419824..e8f306b 100644
--- a/prov/verbs/src/verbs_cq.c
+++ b/prov/verbs/src/verbs_cq.c
@@ -239,18 +239,22 @@ int vrb_poll_cq(struct vrb_cq *cq, struct ibv_wc *wc)

ctx = (struct vrb_context *) (uintptr_t) wc->wr_id;
wc->wr_id = (uintptr_t) ctx->user_ctx;
- if (ctx->flags & FI_TRANSMIT) {
+ if (ctx->op_ctx == VRB_POST_SQ) {
+ assert(ctx->ep);
+ assert(!slist_empty(&ctx->ep->sq_list));
+ assert(ctx->ep->sq_list.head == &ctx->entry);
+ (void) slist_remove_head(&ctx->ep->sq_list);
cq->credits++;
ctx->ep->sq_credits++;
}

if (wc->status) {
- if (ctx->flags & FI_RECV)
- wc->opcode |= IBV_WC_RECV;
- else
+ if (ctx->op_ctx == VRB_POST_SQ)
wc->opcode &= ~IBV_WC_RECV;
+ else
+ wc->opcode |= IBV_WC_RECV;
}
- if (ctx->srx) {
+ if (ctx->op_ctx == VRB_POST_SRQ) {
fastlock_acquire(&ctx->srx->ctx_lock);
ofi_buf_free(ctx);
fastlock_release(&ctx->srx->ctx_lock);
diff --git a/prov/verbs/src/verbs_ep.c b/prov/verbs/src/verbs_ep.c
index bae5b15..a60c892 100644
--- a/prov/verbs/src/verbs_ep.c
+++ b/prov/verbs/src/verbs_ep.c
@@ -69,9 +69,9 @@ ssize_t vrb_post_recv(struct vrb_ep *ep, struct ibv_recv_wr *wr)
if (!ctx)
goto unlock;

- ctx->ep = ep;
+ OFI_DBG_SET(ctx->ep, ep);
ctx->user_ctx = (void *) (uintptr_t) wr->wr_id;
- ctx->flags = FI_RECV;
+ ctx->op_ctx = VRB_POST_RQ;
wr->wr_id = (uintptr_t) ctx;

ret = ibv_post_recv(ep->ibv_qp, wr, &bad_wr);
@@ -143,7 +143,7 @@ ssize_t vrb_post_send(struct vrb_ep *ep, struct ibv_send_wr *wr, uint64_t flags)

ctx->ep = ep;
ctx->user_ctx = (void *) (uintptr_t) wr->wr_id;
- ctx->flags = FI_TRANSMIT | flags;
+ ctx->op_ctx = VRB_POST_SQ;
wr->wr_id = (uintptr_t) ctx;

ret = ibv_post_send(ep->ibv_qp, wr, &bad_wr);
@@ -153,6 +153,7 @@ ssize_t vrb_post_send(struct vrb_ep *ep, struct ibv_send_wr *wr, uint64_t flags)
vrb_convert_ret(ret));
goto credits;
}
+ slist_insert_tail(&ctx->entry, &ep->sq_list);
cq->util_cq.cq_fastlock_release(&cq->util_cq.cq_lock);

return 0;
@@ -391,6 +392,7 @@ vrb_alloc_init_ep(struct fi_info *info, struct vrb_domain *domain,
goto err2;
}

+ slist_init(&ep->sq_list);
ep->util_ep.ep_fid.msg = calloc(1, sizeof(*ep->util_ep.ep_fid.msg));
if (!ep->util_ep.ep_fid.msg)
goto err3;
@@ -405,6 +407,41 @@ err1:
return NULL;
}

+/* Generate flush completion entries for any queued send requests.
+ * We only need to record the wr_id and that the entry was not a
+ * receive (indicated by lack of IBV_WC_RECV flag).
+ */
+static void vrb_flush_sq(struct vrb_ep *ep)
+{
+ struct vrb_context *ctx;
+ struct vrb_cq *cq;
+ struct slist_entry *entry;
+ struct ibv_wc wc = {0};
+
+ if (!ep->util_ep.tx_cq)
+ return;
+
+ cq = container_of(ep->util_ep.tx_cq, struct vrb_cq, util_cq);
+ wc.status = IBV_WC_WR_FLUSH_ERR;
+ wc.vendor_err = FI_ECANCELED;
+
+ cq->util_cq.cq_fastlock_acquire(&cq->util_cq.cq_lock);
+ while (!slist_empty(&ep->sq_list)) {
+ entry = slist_remove_head(&ep->sq_list);
+ ctx = container_of(entry, struct vrb_context, entry);
+ assert(ctx->op_ctx == VRB_POST_SQ);
+
+ wc.wr_id = (uintptr_t) ctx->user_ctx;
+ cq->credits++;
+ ctx->ep->sq_credits++;
+ ofi_buf_free(ctx);
+
+ if (wc.wr_id != VERBS_NO_COMP_FLAG)
+ vrb_save_wc(cq, &wc);
+ }
+ cq->util_cq.cq_fastlock_release(&cq->util_cq.cq_lock);
+}
+
static int vrb_close_free_ep(struct vrb_ep *ep)
{
struct vrb_cq *cq;
@@ -478,6 +515,7 @@ static int vrb_ep_close(fid_t fid)
if (ep->eq)
fastlock_release(&ep->eq->lock);
vrb_cleanup_cq(ep);
+ vrb_flush_sq(ep);
break;
case FI_EP_DGRAM:
fab = container_of(&ep->util_ep.domain->fabric->fabric_fid,
@@ -490,6 +528,7 @@ static int vrb_ep_close(fid_t fid)
return -errno;
}
vrb_cleanup_cq(ep);
+ vrb_flush_sq(ep);
break;
default:
VRB_WARN(FI_LOG_DOMAIN, "Unknown EP type\n");
@@ -1464,7 +1503,7 @@ ssize_t vrb_post_srq(struct vrb_srq_ep *ep, struct ibv_recv_wr *wr)

ctx->srx = ep;
ctx->user_ctx = (void *) (uintptr_t) wr->wr_id;
- ctx->flags = FI_RECV;
+ ctx->op_ctx = VRB_POST_SRQ;
wr->wr_id = (uintptr_t) ctx;

ret = ibv_post_srq_recv(ep->srq, wr, &bad_wr);
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
libfabric (1.14.0~rc3-2) unstable; urgency=medium
[ Alexander Oganezov ]
* Apply OFI patch to fix DAOS-9173

-- Alexander Oganezov <alexander.a.oganezov@intel.com> Wed, 8 Dec 2021 13:54:52 -0400

libfabric (1.14.0~rc3-1) unstable; urgency=medium
[ Alexander Oganezov ]
* Update to 1.14.0rc3
Expand Down
6 changes: 5 additions & 1 deletion libfabric.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Name: libfabric
Version: %{major}.%{minor}.%{bugrelease}%{?prerelease:~%{prerelease}}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: User-space RDMA Fabric Interfaces
%if 0%{?suse_version} >= 1315
License: GPL-2.0-only OR BSD-2-Clause
Expand All @@ -19,6 +19,7 @@ License: GPLv2 or BSD
%endif
Url: https://www.github.com/ofiwg/libfabric
Source: https://github.com/ofiwg/%{name}/archive/v%{dl_version}.tar.gz
Patch0: https://github.com/daos-stack/libfabric/daos-9173-ofi.patch

%if 0%{?rhel} >= 7
BuildRequires: librdmacm-devel >= 1.0.16
Expand Down Expand Up @@ -147,6 +148,9 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_mandir}/man7/*

%changelog
* Wed Dec 8 2021 Alexander Oganezov <alexander.a.oganezov@intel.com> - 1.14.0~rc3-2
- Apply patch for DAOS-9173

* Sat Nov 13 2021 Alexander Oganezov <alexander.a.oganezov@intel.com> - 1.14.0~rc3-1
- Update to v1.14.0rc3

Expand Down
5 changes: 4 additions & 1 deletion packaging/Dockerfile.mockbuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Pull base image
FROM fedora:latest
MAINTAINER daos-stack <daos@daos.groups.io>
LABEL maintainer="daos@daos.groups.io>"

# use same UID as host and default value of 1000 if not specified
ARG UID=1000
Expand All @@ -28,3 +28,6 @@ RUN usermod -a -G mock $USER
RUN grep use_nspawn /etc/mock/site-defaults.cfg || \
echo "config_opts['use_nspawn'] = False" >> /etc/mock/site-defaults.cfg

ARG CACHEBUST
RUN dnf -y upgrade && \
dnf clean all
44 changes: 26 additions & 18 deletions packaging/Makefile_distro_vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,38 @@ SPECTOOL := spectool
# DISTRO_BASE (i.e. EL_7)
# from the CHROOT_NAME
ifeq ($(CHROOT_NAME),epel-7-x86_64)
DIST := $(shell rpm $(COMMON_RPM_ARGS) --eval %{?dist})
VERSION_ID := 7
DISTRO_ID := el7
DISTRO_BASE := EL_7
SED_EXPR := 1s/$(DIST)//p
DIST := $(shell rpm $(COMMON_RPM_ARGS) --eval %{?dist})
VERSION_ID := 7
DISTRO_ID := el7
DISTRO_BASE := EL_7
DISTRO_VERSION ?= $(VERSION_ID)
ORIG_TARGET_VER := 7
SED_EXPR := 1s/$(DIST)//p
endif
ifeq ($(CHROOT_NAME),epel-8-x86_64)
DIST := $(shell rpm $(COMMON_RPM_ARGS) --eval %{?dist})
VERSION_ID := 8
DISTRO_ID := el8
DISTRO_BASE := EL_8
SED_EXPR := 1s/$(DIST)//p
DIST := $(shell rpm $(COMMON_RPM_ARGS) --eval %{?dist})
VERSION_ID := 8
DISTRO_ID := el8
DISTRO_BASE := EL_8
DISTRO_VERSION ?= $(VERSION_ID)
ORIG_TARGET_VER := 8
SED_EXPR := 1s/$(DIST)//p
endif
ifeq ($(CHROOT_NAME),opensuse-leap-15.2-x86_64)
VERSION_ID := 15.2
DISTRO_ID := sl15.2
DISTRO_BASE := LEAP_15
SED_EXPR := 1p
VERSION_ID := 15.2
DISTRO_ID := sl15.2
DISTRO_BASE := LEAP_15
DISTRO_VERSION ?= $(VERSION_ID)
ORIG_TARGET_VER := 15.2
SED_EXPR := 1p
endif
ifeq ($(CHROOT_NAME),opensuse-leap-15.3-x86_64)
VERSION_ID := 15.3
DISTRO_ID := sl15.3
DISTRO_BASE := LEAP_15
SED_EXPR := 1p
VERSION_ID := 15.3
DISTRO_ID := sl15.3
DISTRO_BASE := LEAP_15
DISTRO_VERSION ?= $(VERSION_ID)
ORIG_TARGET_VER := 15.2
SED_EXPR := 1p
endif
endif
ifeq ($(ID),centos)
Expand Down
Loading