Skip to content

Commit

Permalink
DAOS-17000 cart: add cio_progress_busy cart init option
Browse files Browse the repository at this point in the history
This allows to initialize CART in busy wait mode

Required-githooks: true

Signed-off-by: Jerome Soumagne <[email protected]>
  • Loading branch information
soumagne committed Jan 27, 2025
1 parent c5f248b commit 1381826
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 17 deletions.
3 changes: 3 additions & 0 deletions src/cart/README.env
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,6 @@ This file lists the environment variables used in CaRT.
traffic congestion. Available options are: "unspec" (default), "best_effort",
"low_latency", "bulk_data".

D_PROGRESS_BUSY
Force busy polling when progressing, preventing from sleeping when waiting for
new messages.
2 changes: 1 addition & 1 deletion src/cart/crt_hg.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ crt_hg_class_init(crt_provider_t provider, int ctx_idx, bool primary, int iface_

init_info.na_init_info.auth_key = prov_data->cpg_na_config.noc_auth_key;

if (crt_provider_is_block_mode(provider))
if (crt_provider_is_block_mode(provider) && !prov_data->cpg_progress_busy)
init_info.na_init_info.progress_mode = 0;
else
init_info.na_init_info.progress_mode = NA_NO_BLOCK;
Expand Down
8 changes: 8 additions & 0 deletions src/cart/crt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ prov_data_init(struct crt_prov_gdata *prov_data, crt_provider_t provider, bool p
prov_data->cpg_max_unexp_size = max_unexpect_size;
prov_data->cpg_primary = primary;

if (opt && opt->cio_progress_busy) {
prov_data->cpg_progress_busy = opt->cio_progress_busy;
} else {
bool progress_busy = false;
crt_env_get(D_PROGRESS_BUSY, &progress_busy);
prov_data->cpg_progress_busy = progress_busy;
}

for (i = 0; i < CRT_SRV_CONTEXT_NUM; i++)
prov_data->cpg_used_idx[i] = false;

Expand Down
35 changes: 19 additions & 16 deletions src/cart/crt_internal_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,40 @@ enum crt_traffic_class { CRT_TRAFFIC_CLASSES };

struct crt_prov_gdata {
/** NA plugin type */
int cpg_provider;
int cpg_provider;

struct crt_na_config cpg_na_config;
struct crt_na_config cpg_na_config;
/** Context0 URI */
char cpg_addr[CRT_ADDR_STR_MAX_LEN];
char cpg_addr[CRT_ADDR_STR_MAX_LEN];

/** CaRT contexts list */
d_list_t cpg_ctx_list;
d_list_t cpg_ctx_list;
/** actual number of items in CaRT contexts list */
int cpg_ctx_num;
int cpg_ctx_num;
/** maximum number of contexts user wants to create */
uint32_t cpg_ctx_max_num;
uint32_t cpg_ctx_max_num;

/** free-list of indices */
bool cpg_used_idx[CRT_SRV_CONTEXT_NUM];
bool cpg_used_idx[CRT_SRV_CONTEXT_NUM];

/** Hints to mercury/ofi for max expected/unexp sizes */
uint32_t cpg_max_exp_size;
uint32_t cpg_max_unexp_size;
uint32_t cpg_max_exp_size;
uint32_t cpg_max_unexp_size;

/** Number of remote tags */
uint32_t cpg_num_remote_tags;
uint32_t cpg_last_remote_tag;
uint32_t cpg_num_remote_tags;
uint32_t cpg_last_remote_tag;

/** Set of flags */
unsigned int cpg_sep_mode : 1,
cpg_primary : 1,
cpg_contig_ports : 1,
cpg_inited : 1;
unsigned int cpg_sep_mode : 1;
unsigned int cpg_primary : 1;
unsigned int cpg_contig_ports : 1;
unsigned int cpg_inited : 1;

bool cpg_progress_busy;

/** Mutext to protect fields above */
pthread_mutex_t cpg_mutex;
pthread_mutex_t cpg_mutex;
};

#define MAX_NUM_SECONDARY_PROVS 2
Expand Down Expand Up @@ -226,6 +228,7 @@ struct crt_event_cb_priv {
ENV_STR(D_PORT) \
ENV(D_PORT_AUTO_ADJUST) \
ENV(D_THREAD_MODE_SINGLE) \
ENV(D_PROGRESS_BUSY) \
ENV(D_POST_INCR) \
ENV(D_POST_INIT) \
ENV(D_MRECV_BUF) \
Expand Down
4 changes: 4 additions & 0 deletions src/include/cart/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef struct crt_init_options {
/** whether or not to use expected sizes */
cio_use_expected_size:1,
cio_use_unexpected_size:1;

/** overrides the value of the environment variable CRT_CTX_NUM */
int cio_ctx_max_num;

Expand Down Expand Up @@ -94,6 +95,9 @@ typedef struct crt_init_options {

/** use single thread to access context */
bool cio_thread_mode_single;

/** force busy wait (testing only, not in production) */
bool cio_progress_busy;
} crt_init_options_t;

typedef int crt_status_t;
Expand Down

0 comments on commit 1381826

Please sign in to comment.