Skip to content

Commit dca6145

Browse files
authored
Merge pull request #131 from garlick/rdma_buildfix
tidy up experimental RDMA feature
2 parents 1420354 + d666304 commit dca6145

File tree

8 files changed

+68
-42
lines changed

8 files changed

+68
-42
lines changed

.github/workflows/main.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
run: |
1818
sudo apt-get update
1919
sudo apt-get install -y \
20-
libpopt-dev ncurses-dev automake autoconf pkgconf \
21-
lua5.3 liblua5.3-dev libmunge-dev libwrap0-dev libcap-dev \
20+
ncurses-dev automake autoconf pkgconf \
21+
lua5.3 liblua5.3-dev libmunge-dev libcap-dev \
2222
libattr1-dev dbench attr scrub valgrind ${{matrix.cc}}
2323
- name: Display configuration
2424
run: |
@@ -46,3 +46,22 @@ jobs:
4646
run: sudo make check -C tests/kern
4747
- name: make distcheck
4848
run: make distcheck
49+
50+
build-rdma:
51+
name: build-only check for RDMA (experimental)
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v2
55+
- name: Install dependencies
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y \
59+
ncurses-dev automake autoconf pkgconf \
60+
lua5.3 liblua5.3-dev libmunge-dev libcap-dev \
61+
libattr1-dev libibverbs-dev librdmacm-dev gcc
62+
- name: autogen
63+
run: ./autogen.sh
64+
- name: configure
65+
run: ./configure --enable-rdma
66+
- name: make
67+
run: make

config/x_ac_rdma.m4

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
AC_DEFUN([X_AC_RDMA], [
2+
3+
got_rdma=no
4+
AC_ARG_ENABLE([rdma],
5+
[AS_HELP_STRING([--enable-rdma],
6+
[build Infiniband RDMA transport (experimental)])],
7+
[want_rdma=yes], [want_rdma=no])
8+
9+
if test x$want_rdma == xyes; then
10+
X_AC_CHECK_COND_LIB(rdmacm, rdma_accept)
11+
X_AC_CHECK_COND_LIB(ibverbs, ibv_alloc_pd)
12+
AC_CHECK_HEADER([infiniband/verbs.h])
13+
AC_CHECK_HEADER([rdma/rdma_cma.h])
14+
if test x$ac_cv_lib_rdmacm_rdma_accept == xyes -a \
15+
x$ac_cv_lib_ibverbs_ibv_alloc_pd == xyes -a \
16+
x$ac_cv_header_infiniband_verbs_h == xyes -a \
17+
x$ac_cv_header_rdma_rdma_cma_h == xyes; then
18+
got_rdma=yes
19+
AC_DEFINE([WITH_RDMA], [1], [build Infiniband RDMA transport])
20+
else
21+
AC_MSG_ERROR([Could not configure RDMA: missing ibverbs/rdmacm packages])
22+
fi
23+
fi
24+
25+
AM_CONDITIONAL([RDMA], [test "x$got_rdma" != xno])
26+
27+
])

config/x_ac_rdmatrans.m4

-26
This file was deleted.

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ X_AC_CHECK_PTHREADS
7878
X_AC_CHECK_COND_LIB(munge, munge_ctx_create)
7979
X_AC_CHECK_COND_LIB(cap, cap_get_proc)
8080
X_AC_TCMALLOC
81-
X_AC_RDMATRANS
81+
X_AC_RDMA
8282

8383
##
8484
# For list.c, hostlist.c, hash.c

src/cmd/diod.c

+15-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "src/libdiod/diod_log.h"
4343
#include "src/libdiod/diod_conf.h"
4444
#include "src/libdiod/diod_sock.h"
45-
#if WITH_RDMATRANS
45+
#if WITH_RDMA
4646
#include "src/libdiod/diod_rdma.h"
4747
#endif
4848

@@ -344,7 +344,7 @@ struct svc_struct {
344344
pthread_t t;
345345
int shutdown;
346346
int reload;
347-
#if WITH_RDMATRANS
347+
#if WITH_RDMA
348348
diod_rdma_t rdma;
349349
pthread_t rdma_t;
350350
#endif
@@ -421,7 +421,7 @@ _service_loop (void *arg)
421421
return NULL;
422422
}
423423

424-
#if WITH_RDMATRANS
424+
#if WITH_RDMA
425425
static void *
426426
_service_loop_rdma (void *arg)
427427
{
@@ -541,10 +541,6 @@ _service_run (srvmode_t mode, int rfdno, int wfdno)
541541
case SRV_SOCKTEST:
542542
if (!diod_sock_listen (l, &ss.fds, &ss.nfds))
543543
msg_exit ("failed to set up listener");
544-
#if WITH_RDMATRANS
545-
ss.rdma = diod_rdma_create ();
546-
diod_rdma_listen (ss.rdma);
547-
#endif
548544
break;
549545
}
550546

@@ -603,6 +599,16 @@ _service_run (srvmode_t mode, int rfdno, int wfdno)
603599
#endif
604600
}
605601

602+
#if WITH_RDMA
603+
/* RDMA needs to be initialized after user transitions.
604+
* See chaos/diod#107.
605+
*/
606+
if (mode == SRV_NORMAL) {
607+
ss.rdma = diod_rdma_create ();
608+
diod_rdma_listen (ss.rdma);
609+
}
610+
#endif
611+
606612
/* Process dumpable flag may have been cleared by uid manipulation above.
607613
* Set it here, then maintain it in user.c::np_setfsid () as uids are
608614
* further manipulated.
@@ -621,7 +627,7 @@ _service_run (srvmode_t mode, int rfdno, int wfdno)
621627

622628
if ((n = pthread_create (&ss.t, NULL, _service_loop, NULL)))
623629
errn_exit (n, "pthread_create _service_loop");
624-
#if WITH_RDMATRANS
630+
#if WITH_RDMA
625631
if ((n = pthread_create (&ss.rdma_t, NULL, _service_loop_rdma, NULL)))
626632
errn_exit (n, "pthread_create _service_loop_rdma");
627633
#endif
@@ -636,7 +642,7 @@ _service_run (srvmode_t mode, int rfdno, int wfdno)
636642
}
637643
if ((n = pthread_join (ss.t, NULL)))
638644
errn_exit (n, "pthread_join _service_loop");
639-
#if WITH_RDMATRANS
645+
#if WITH_RDMA
640646
if ((n = pthread_join (ss.rdma_t, NULL)))
641647
errn_exit (n, "pthread_join _service_loop_rdma");
642648
#endif

src/libdiod/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ libdiod_a_SOURCES = \
2727
diod_ops.h \
2828
lsderr.c
2929

30-
if RDMATRANS
30+
if RDMA
3131
libdiod_a_SOURCES += diod_rdma.c diod_rdma.h
3232
endif
3333

src/libdiod/diod_rdma.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
#include <infiniband/verbs.h>
3636
#include <rdma/rdma_cma.h>
3737

38-
#include "npfs.h"
39-
#include "list.h"
38+
#include "src/libnpfs/npfs.h"
39+
#include "src/liblsd/list.h"
4040

4141
#include "diod_log.h"
4242
#include "diod_rdma.h"

src/libnpfs/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ libnpfs_a_SOURCES += user-stub.c
3434
endif
3535
endif
3636

37-
if RDMATRANS
37+
if RDMA
3838
libnpfs_a_SOURCES += rdmatrans.c
3939
endif
4040

0 commit comments

Comments
 (0)