Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.18.x] Cherry-picked fixes to allow CI build check to pass #9570

Merged
merged 8 commits into from
Nov 16, 2023
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ AS_IF([test -n "$with_lttng" && test x"$with_lttng" != x"no"],
[AC_MSG_ERROR([LTTNG is requested but no found. Please check your prefix])])
])

AS_IF([test "$have_lttng" = "1"],
AS_IF([test "$have_lttng" = "1" && test x"$with_lttng" != x"yes"],
[CPPFLAGS="$CPPFLAGS $lttng_CPPFLAGS"
LDFLAGS="$LDFLAGS $lttng_LDFLAGS"])

Expand Down
14 changes: 7 additions & 7 deletions fabtests/common/hmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct ft_hmem_ops {
int (*alloc_host)(void **buf, size_t size);
int (*free)(void *buf);
int (*free_host)(void *buf);
int (*memset)(uint64_t device, void *buf, int value, size_t size);
int (*mem_set)(uint64_t device, void *buf, int value, size_t size);
int (*copy_to_hmem)(uint64_t device, void *dst, const void *src,
size_t size);
int (*copy_from_hmem)(uint64_t device, void *dst, const void *src,
Expand All @@ -58,7 +58,7 @@ static struct ft_hmem_ops hmem_ops[] = {
.alloc_host = ft_default_alloc_host,
.free = ft_host_free,
.free_host = ft_default_free_host,
.memset = ft_host_memset,
.mem_set = ft_host_memset,
.copy_to_hmem = ft_host_memcpy,
.copy_from_hmem = ft_host_memcpy,
},
Expand All @@ -69,7 +69,7 @@ static struct ft_hmem_ops hmem_ops[] = {
.alloc_host = ft_cuda_alloc_host,
.free = ft_cuda_free,
.free_host = ft_cuda_free_host,
.memset = ft_cuda_memset,
.mem_set = ft_cuda_memset,
.copy_to_hmem = ft_cuda_copy_to_hmem,
.copy_from_hmem = ft_cuda_copy_from_hmem,
},
Expand All @@ -80,7 +80,7 @@ static struct ft_hmem_ops hmem_ops[] = {
.alloc_host = ft_default_alloc_host,
.free = ft_rocr_free,
.free_host = ft_default_free_host,
.memset = ft_rocr_memset,
.mem_set = ft_rocr_memset,
.copy_to_hmem = ft_rocr_memcpy,
.copy_from_hmem = ft_rocr_memcpy,
},
Expand All @@ -91,7 +91,7 @@ static struct ft_hmem_ops hmem_ops[] = {
.alloc_host = ft_default_alloc_host,
.free = ft_ze_free,
.free_host = ft_default_free_host,
.memset = ft_ze_memset,
.mem_set = ft_ze_memset,
.copy_to_hmem = ft_ze_copy,
.copy_from_hmem = ft_ze_copy,
},
Expand All @@ -102,7 +102,7 @@ static struct ft_hmem_ops hmem_ops[] = {
.alloc_host = ft_default_alloc_host,
.free = ft_neuron_free,
.free_host = ft_default_free_host,
.memset = ft_neuron_memset,
.mem_set = ft_neuron_memset,
.copy_to_hmem = ft_neuron_memcpy_to_hmem,
.copy_from_hmem = ft_neuron_memcpy_from_hmem,
},
Expand Down Expand Up @@ -169,7 +169,7 @@ int ft_hmem_free_host(enum fi_hmem_iface iface, void *buf)
int ft_hmem_memset(enum fi_hmem_iface iface, uint64_t device, void *buf,
int value, size_t size)
{
return hmem_ops[iface].memset(device, buf, value, size);
return hmem_ops[iface].mem_set(device, buf, value, size);
}

int ft_hmem_copy_to(enum fi_hmem_iface iface, uint64_t device, void *dst,
Expand Down
42 changes: 32 additions & 10 deletions fabtests/common/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,7 +2317,8 @@ ft_tag_is_valid(struct fid_cq * cq, struct fi_cq_err_entry *comp, uint64_t tag)
* fi_cq_err_entry can be cast to any CQ entry format.
*/
static int ft_spin_for_comp(struct fid_cq *cq, uint64_t *cur,
uint64_t total, int timeout)
uint64_t total, int timeout,
uint64_t tag)
{
struct fi_cq_err_entry comp;
struct timespec a, b;
Expand All @@ -2331,7 +2332,7 @@ static int ft_spin_for_comp(struct fid_cq *cq, uint64_t *cur,
if (ret > 0) {
if (timeout >= 0)
clock_gettime(CLOCK_MONOTONIC, &a);
if (!ft_tag_is_valid(cq, &comp, ft_tag ? ft_tag : rx_cq_cntr))
if (!ft_tag_is_valid(cq, &comp, tag ? tag : rx_cq_cntr))
return -FI_EOTHER;
(*cur)++;
} else if (ret < 0 && ret != -FI_EAGAIN) {
Expand All @@ -2352,15 +2353,16 @@ static int ft_spin_for_comp(struct fid_cq *cq, uint64_t *cur,
* fi_cq_err_entry can be cast to any CQ entry format.
*/
static int ft_wait_for_comp(struct fid_cq *cq, uint64_t *cur,
uint64_t total, int timeout)
uint64_t total, int timeout,
uint64_t tag)
{
struct fi_cq_err_entry comp;
int ret;

while (total - *cur > 0) {
ret = fi_cq_sread(cq, &comp, 1, NULL, timeout);
if (ret > 0) {
if (!ft_tag_is_valid(cq, &comp, ft_tag ? ft_tag : rx_cq_cntr))
if (!ft_tag_is_valid(cq, &comp, tag ? tag : rx_cq_cntr))
return -FI_EOTHER;
(*cur)++;
} else if (ret < 0 && ret != -FI_EAGAIN) {
Expand All @@ -2375,7 +2377,8 @@ static int ft_wait_for_comp(struct fid_cq *cq, uint64_t *cur,
* fi_cq_err_entry can be cast to any CQ entry format.
*/
static int ft_fdwait_for_comp(struct fid_cq *cq, uint64_t *cur,
uint64_t total, int timeout)
uint64_t total, int timeout,
uint64_t tag)
{
struct fi_cq_err_entry comp;
struct fid *fids[1];
Expand All @@ -2394,7 +2397,7 @@ static int ft_fdwait_for_comp(struct fid_cq *cq, uint64_t *cur,

ret = fi_cq_read(cq, &comp, 1);
if (ret > 0) {
if (!ft_tag_is_valid(cq, &comp, ft_tag ? ft_tag : rx_cq_cntr))
if (!ft_tag_is_valid(cq, &comp, tag ? tag : rx_cq_cntr))
return -FI_EOTHER;
(*cur)++;
} else if (ret < 0 && ret != -FI_EAGAIN) {
Expand All @@ -2405,21 +2408,33 @@ static int ft_fdwait_for_comp(struct fid_cq *cq, uint64_t *cur,
return 0;
}

int ft_get_cq_comp(struct fid_cq *cq, uint64_t *cur, uint64_t total, int timeout)
int ft_read_cq(struct fid_cq *cq, uint64_t *cur,
uint64_t total, int timeout,
uint64_t tag)
{
int ret;

switch (opts.comp_method) {
case FT_COMP_SREAD:
case FT_COMP_YIELD:
ret = ft_wait_for_comp(cq, cur, total, timeout);
ret = ft_wait_for_comp(cq, cur, total, timeout, tag);
break;
case FT_COMP_WAIT_FD:
ret = ft_fdwait_for_comp(cq, cur, total, timeout);
ret = ft_fdwait_for_comp(cq, cur, total, timeout, tag);
break;
default:
ret = ft_spin_for_comp(cq, cur, total, timeout);
ret = ft_spin_for_comp(cq, cur, total, timeout, tag);
break;
}
return ret;
}

int ft_get_cq_comp(struct fid_cq *cq, uint64_t *cur,
uint64_t total, int timeout)
{
int ret;

ret = ft_read_cq(cq, cur, total, timeout, ft_tag);

if (ret) {
if (ret == -FI_EAVAIL) {
Expand Down Expand Up @@ -3707,6 +3722,7 @@ void ft_free_string_array(char **s)
free(s);
}

#ifndef __APPLE__
static const char *nexttoken(const char *str, int chr)
{
if (str)
Expand Down Expand Up @@ -3760,6 +3776,12 @@ static int ft_pin_core(const char *core_list)

return sched_setaffinity(0, sizeof(mask), &mask);
}
#else
static int ft_pin_core(const char *core_list)
{
return EXIT_FAILURE;
}
#endif

static int ft_parse_pin_core_opt(char *optarg)
{
Expand Down
15 changes: 15 additions & 0 deletions fabtests/component/sock_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
* SOFTWARE.
*/

#if HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Expand All @@ -43,7 +47,9 @@
#include <netdb.h>
#include <time.h>
#include <poll.h>
#if HAVE_EPOLL == 1
#include <sys/epoll.h>
#endif
#include <errno.h>

#include <shared.h>
Expand All @@ -54,8 +60,10 @@ static int connections = 1000;
uint64_t starttime, endtime;

static struct pollfd *poll_set;
#if HAVE_EPOLL == 1
static struct epoll_event *ep_events;
static int epfd = -1;
#endif


static void show_header(void)
Expand Down Expand Up @@ -323,6 +331,7 @@ static int test_poll(void)
return 0;
}

#if HAVE_EPOLL == 1
static int init_epoll(uint32_t events, int stride)
{
struct epoll_event event;
Expand Down Expand Up @@ -418,6 +427,12 @@ static int test_epoll(void)

return 0;
}
#else
static int test_epoll()
{
return 0;
}
#endif

static void close_conns(void)
{
Expand Down
2 changes: 1 addition & 1 deletion fabtests/functional/rdm_stress.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <pthread.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <wait.h>
#include <sys/wait.h>
#include <unistd.h>

#include <rdma/fi_cm.h>
Expand Down
53 changes: 18 additions & 35 deletions fabtests/functional/rdm_tagged_peek.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ static struct fi_context fi_context;
static int wait_for_send_comp(int count)
{
int ret, completions = 0;
struct fi_cq_tagged_entry comp;
uint64_t cq_cntr;

do {
ret = fi_cq_sread(txcq, &comp, 1, NULL, -1);
if (ret != 1) {
FT_PRINTERR("fi_cq_sread", ret);
cq_cntr = 0;
ret = ft_read_cq(txcq, &cq_cntr, 1, timeout, BASE_TAG + completions + 1);
if (ret != FI_SUCCESS) {
FT_PRINTERR("fi_cq_sread/fi_cq_read", ret);
return ret;
}
completions++;
Expand All @@ -61,14 +62,15 @@ static int wait_for_send_comp(int count)
return 0;
}


static int trecv_op(uint64_t tag, uint64_t flags, bool ignore_nomsg)
{
struct fi_cq_tagged_entry comp;
struct fi_msg_tagged msg = {0};
struct fi_cq_err_entry cq_err;
struct iovec iov;
void *desc;
int ret;
uint64_t cq_cntr;

if (!(flags & (FI_PEEK | FI_DISCARD))) {
iov.iov_base = buf;
Expand All @@ -90,11 +92,10 @@ static int trecv_op(uint64_t tag, uint64_t flags, bool ignore_nomsg)
return ret;
}

ret = fi_cq_sread(rxcq, &comp, 1, NULL, -1);
if (ret == 1) {
ret = 0;
cq_cntr = 0;
ret = ft_read_cq(rxcq, &cq_cntr, 1, timeout, tag);
if (ret == FI_SUCCESS)
break;
}

if (ret == -FI_EAVAIL) {
ret = fi_cq_readerr(rxcq, &cq_err, 0);
Expand All @@ -103,7 +104,7 @@ static int trecv_op(uint64_t tag, uint64_t flags, bool ignore_nomsg)
else
ret = -cq_err.err;
} else {
FT_PRINTERR("fi_cq_sread", ret);
FT_PRINTERR("fi_cq_read/fi_cq_sread", ret);
}
} while (ret == -FI_ENOMSG && ignore_nomsg);

Expand Down Expand Up @@ -282,9 +283,11 @@ static int do_sends(void)
(void) ft_fill_buf(tx_buf, tx_size);

for (i = 1; i <= SEND_CNT; i++) {
ret = fi_tsend(ep, tx_buf, tx_size, mr_desc,
remote_fi_addr, BASE_TAG + i,
&tx_ctx_arr[i].context);
do {
ret = fi_tsend(ep, tx_buf, tx_size, mr_desc,
remote_fi_addr, BASE_TAG + i,
&tx_ctx_arr[i].context);
} while (ret == -FI_EAGAIN);
if (ret)
return ret;
}
Expand All @@ -306,32 +309,13 @@ static int run(void)
ret = do_recvs();
if (ret)
return ret;

/* sync with sender before ft_finalize, since we sent
* and received messages outside of the sequence numbers
* maintained by common code */
ret = fi_tsend(ep, tx_buf, 1, mr_desc,
remote_fi_addr, 0xabc,
&tx_ctx_arr[0].context);
if (ret)
return ret;

ret = wait_for_send_comp(1);
if (ret)
return ret;
} else {
ret = do_sends();
if (ret)
return ret;

ret = trecv_op(0xabc, 0, false);
if (ret) {
FT_PRINTERR("Receive sync", ret);
return ret;
}
}

ft_finalize();
ft_sync();
return 0;
}

Expand All @@ -340,9 +324,8 @@ int main(int argc, char **argv)
int ret, op;

opts = INIT_OPTS;
opts.options |= FT_OPT_SIZE;
opts.options |= FT_OPT_SIZE | FT_OPT_OOB_SYNC;
opts.transfer_size = 64; /* Don't expect receiver buffering */
opts.comp_method = FT_COMP_SREAD;
opts.window_size = SEND_CNT;

hints = fi_allocinfo();
Expand Down
2 changes: 2 additions & 0 deletions fabtests/include/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ static inline bool ft_check_prefix_forced(struct fi_info *info,
return true;
}

int ft_read_cq(struct fid_cq *cq, uint64_t *cur, uint64_t total,
int timeout, uint64_t tag);
int ft_sync(void);
int ft_sync_pair(int status);
int ft_fork_and_pair(void);
Expand Down
1 change: 1 addition & 0 deletions fabtests/regression/sighandler_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include <rdma/fabric.h>
#include <signal.h>
#include "shared.h"

int main(int argc, char **argv)
Expand Down