From f4c0be18cc89b8df2a347c17634befd0390b4e87 Mon Sep 17 00:00:00 2001 From: Sai Sunku Date: Wed, 27 Dec 2023 22:00:14 +0000 Subject: [PATCH] fabtests/efa: Add simple unexpected test to MR exhaustion test A simple implementation of the unexpected pingpong test that does not do inject and only sends one unexpected message at a time Signed-off-by: Sai Sunku --- .../prov/efa/src/efa_exhaust_mr_reg_common.c | 45 +++++++++++++++++++ .../prov/efa/src/efa_exhaust_mr_reg_common.h | 1 + .../efa/src/efa_exhaust_mr_reg_rdm_pingpong.c | 20 ++++++--- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.c b/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.c index 78b01aea141..f237dc1c887 100644 --- a/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.c +++ b/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.c @@ -91,3 +91,48 @@ int ft_efa_alloc_bufs(void **buffers, size_t buf_size, size_t count) { } return FI_SUCCESS; } + +int ft_efa_unexpected_pingpong(void) +{ + int ret, i; + + opts.options |= FT_OPT_OOB_CTRL; + + ret = ft_sync(); + if (ret) + return ret; + + for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) { + if (i == opts.warmup_iterations) + ft_start(); + + ret = ft_post_tx(ep, remote_fi_addr, opts.transfer_size, NO_CQ_DATA, &tx_ctx); + if (ret) + return ret; + + ft_sync(); + + ret = ft_get_rx_comp(rx_seq); + if (ret) + return ret; + + ret = ft_post_rx(ep, rx_size, &rx_ctx); + if (ret) + return ret; + + ret = ft_get_tx_comp(tx_seq); + if (ret) + return ret; + } + + ft_stop(); + + if (opts.machr) + show_perf_mr(opts.transfer_size, opts.iterations, &start, &end, + 2, opts.argc, opts.argv); + else + show_perf(NULL, opts.transfer_size, opts.iterations, &start, + &end, 2); + + return 0; +} diff --git a/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.h b/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.h index 5e58b40ecbb..c36857c014d 100644 --- a/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.h +++ b/fabtests/prov/efa/src/efa_exhaust_mr_reg_common.h @@ -16,5 +16,6 @@ int ft_efa_register_mr_reg(struct ibv_pd *pd, void **buffers, size_t buf_size, struct ibv_mr **mr_reg_vec, size_t count, size_t *registered); int ft_efa_deregister_mr_reg(struct ibv_mr **mr_reg_vec, size_t count); int ft_efa_alloc_bufs(void **buffers, size_t buf_size, size_t count); +int ft_efa_unexpected_pingpong(void); #endif /* _EFA_EXHAUST_MR_REG_COMMON_H */ diff --git a/fabtests/prov/efa/src/efa_exhaust_mr_reg_rdm_pingpong.c b/fabtests/prov/efa/src/efa_exhaust_mr_reg_rdm_pingpong.c index caa0ee89828..ee55bb0f965 100644 --- a/fabtests/prov/efa/src/efa_exhaust_mr_reg_rdm_pingpong.c +++ b/fabtests/prov/efa/src/efa_exhaust_mr_reg_rdm_pingpong.c @@ -10,7 +10,7 @@ #include "benchmarks/benchmark_shared.h" #include "efa_exhaust_mr_reg_common.h" -static int run(void) +static int run(int (*pingpong_func)(void)) { int i, ret = 0; @@ -20,18 +20,18 @@ static int run(void) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); - ret = pingpong(); + ret = pingpong_func(); if (ret) return ret; } } else { init_test(&opts, test_name, sizeof(test_name)); - ret = pingpong(); + ret = pingpong_func(); if (ret) return ret; } - return ft_finalize(); + return 0; } int main(int argc, char **argv) @@ -110,8 +110,14 @@ int main(int argc, char **argv) ft_sync(); printf("Running pingpong test\n"); - ret = run(); + ret = run(pingpong); + if (ret) + goto out; + + printf("Running unexpected pingpong test\n"); + ret = run(ft_efa_unexpected_pingpong); +out: if (opts.dst_addr) { printf("Deregistering MRs on client\n"); err = ft_efa_deregister_mr_reg(mr_reg_vec, registered); @@ -120,6 +126,10 @@ int main(int argc, char **argv) ft_efa_destroy_ibv_pd(pd); } + free(buffers); + free(mr_reg_vec); + + ft_finalize(); ft_free_res(); return ft_exit_code(ret);