Skip to content

Commit

Permalink
DAOS-15884 cart: Cleanup (#14417)
Browse files Browse the repository at this point in the history
crt_launch now correctly sets D_PORT instead of deprecated OFI_PORT
self_test client:
 - For non-daos usage (no agent), use default 0:0 endpoint instead of 0:2, as cart-level
   sample engines might not have tag=2, but are guaranteed to have at least 1 context
 - Remove deprecated singleton and nopmix options

Other:
- Remove crt_phy_addr_t, replace with char*
- Remove CRT_PHY_ADDR_ENV, OFI_PORT, OFI_DOMAIN, OFI_INTERFACE
- Remove sep related stuff
- Remove unimplemented crt_group_info_set/get

Signed-off-by: Alexander A Oganezov <alexander.a.oganezov@intel.com>
Signed-off-by: Jerome Soumagne <jerome.soumagne@intel.com>
Co-authored-by: Jerome Soumagne <jerome.soumagne@intel.com>
  • Loading branch information
frostedcmos and soumagne authored May 29, 2024
1 parent 1d41e05 commit f39b1b5
Show file tree
Hide file tree
Showing 11 changed files with 307 additions and 443 deletions.
4 changes: 2 additions & 2 deletions src/cart/crt_ctl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright 2018-2022 Intel Corporation.
* (C) Copyright 2018-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -47,7 +47,7 @@ static int verify_ctl_in_args(struct crt_ctl_ep_ls_in *in_args)
static int
crt_ctl_fill_buffer_cb(d_list_t *rlink, void *arg)
{
crt_phy_addr_t uri;
char *uri;
struct crt_uri_cache *uri_cache = arg;
struct crt_uri_item *ui;
uint32_t *idx;
Expand Down
54 changes: 15 additions & 39 deletions src/cart/crt_group.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -12,9 +12,8 @@
#include <sys/stat.h>
#include "crt_internal.h"

static int crt_group_primary_add_internal(struct crt_grp_priv *grp_priv,
d_rank_t rank, int tag,
char *uri);
static int
crt_group_primary_add_internal(struct crt_grp_priv *grp_priv, d_rank_t rank, int tag, char *uri);

/* global CRT group list */
D_LIST_HEAD(crt_grp_list);
Expand Down Expand Up @@ -377,8 +376,8 @@ grp_li_uri_set(struct crt_lookup_item *li, int tag, const char *uri)
struct crt_uri_item *ui;
d_list_t *rlink;
struct crt_grp_priv *grp_priv;
crt_phy_addr_t nul_str = NULL;
crt_phy_addr_t uri_dup;
char *nul_str = NULL;
char *uri_dup;
d_rank_t rank;
int rc = 0;
int i;
Expand Down Expand Up @@ -922,9 +921,8 @@ crt_grp_lc_addr_insert(struct crt_grp_priv *passed_grp_priv,
* (base_addr == NULL) means the caller only want to lookup the hg_addr.
*/
void
crt_grp_lc_lookup(struct crt_grp_priv *grp_priv, int ctx_idx,
d_rank_t rank, uint32_t tag,
crt_phy_addr_t *uri, hg_addr_t *hg_addr)
crt_grp_lc_lookup(struct crt_grp_priv *grp_priv, int ctx_idx, d_rank_t rank, uint32_t tag,
char **uri, hg_addr_t *hg_addr)
{
struct crt_lookup_item *li;
d_list_t *rlink;
Expand Down Expand Up @@ -1004,8 +1002,7 @@ crt_grp_lookup_locked(crt_group_id_t grp_id)
bool found = false;

d_list_for_each_entry(grp_priv, &crt_grp_list, gp_link) {
if (crt_grp_id_identical(grp_priv->gp_pub.cg_grpid,
grp_id)) {
if (crt_grp_id_identical(grp_priv->gp_pub.cg_grpid, grp_id)) {
found = true;
break;
}
Expand All @@ -1022,8 +1019,7 @@ crt_grp_lookup_grpid(crt_group_id_t grp_id)

D_RWLOCK_RDLOCK(&crt_grp_list_rwlock);
d_list_for_each_entry(grp_priv, &crt_grp_list, gp_link) {
if (crt_grp_id_identical(grp_priv->gp_pub.cg_grpid,
grp_id)) {
if (crt_grp_id_identical(grp_priv->gp_pub.cg_grpid, grp_id)) {
found = true;
break;
}
Expand Down Expand Up @@ -1172,7 +1168,7 @@ crt_grp_priv_destroy(struct crt_grp_priv *grp_priv)
d_hash_table_destroy_inplace(&grp_priv->gp_s2p_table, true);
}

D_FREE(grp_priv->gp_psr_phy_addr);
D_FREE(grp_priv->gp_psr_uri);
D_FREE(grp_priv->gp_pub.cg_grpid);

D_RWLOCK_DESTROY(&grp_priv->gp_rwlock);
Expand Down Expand Up @@ -1907,7 +1903,7 @@ crt_group_config_save(crt_group_t *grp, bool forall)
char *tmp_name = NULL;
crt_group_id_t grpid;
d_rank_t rank;
crt_phy_addr_t addr = NULL;
char *addr = NULL;
bool addr_free = false;
bool locked = false;
d_rank_list_t *membs = NULL;
Expand Down Expand Up @@ -2086,7 +2082,7 @@ crt_grp_config_psr_load(struct crt_grp_priv *grp_priv, d_rank_t psr_rank)
crt_group_id_t grpid = NULL, grpname = NULL;
char all_or_self[8] = {'\0'};
char fmt[64] = {'\0'};
crt_phy_addr_t addr_str = NULL;
char *addr_str = NULL;
d_rank_t rank;
int grp_size;
int rc = 0;
Expand Down Expand Up @@ -2312,7 +2308,7 @@ int
crt_grp_psr_reload(struct crt_grp_priv *grp_priv)
{
d_rank_t psr_rank;
crt_phy_addr_t uri = NULL;
char *uri = NULL;
int rc = 0;

psr_rank = grp_priv->gp_psr_rank;
Expand Down Expand Up @@ -2619,7 +2615,7 @@ int
crt_rank_uri_get(crt_group_t *group, d_rank_t rank, int tag, char **uri_str)
{
struct crt_grp_priv *grp_priv;
crt_phy_addr_t uri;
char *uri;
hg_addr_t hg_addr;
int rc = 0;

Expand Down Expand Up @@ -2797,20 +2793,6 @@ crt_group_rank_remove(crt_group_t *group, d_rank_t rank)
return rc;
}

int
crt_group_info_get(crt_group_t *group, d_iov_t *grp_info)
{
D_ERROR("API is currently not supported\n");
return -DER_NOSYS;
}

int
crt_group_info_set(d_iov_t *grp_info)
{
D_ERROR("API is currently not supported\n");
return -DER_NOSYS;
}

int
crt_group_ranks_get(crt_group_t *group, d_rank_list_t **list)
{
Expand All @@ -2829,8 +2811,7 @@ crt_group_ranks_get(crt_group_t *group, d_rank_list_t **list)
}

int
crt_group_view_create(crt_group_id_t srv_grpid,
crt_group_t **ret_grp)
crt_group_view_create(crt_group_id_t srv_grpid, crt_group_t **ret_grp)
{
struct crt_grp_gdata *grp_gdata;
struct crt_grp_priv *grp_priv = NULL;
Expand Down Expand Up @@ -3031,11 +3012,6 @@ crt_group_secondary_create(crt_group_id_t grp_name, crt_group_t *primary_grp,
return rc;
}

/*
* TODO: This is a temporary function until switch to non-PMIX
* mode is complete. At that point this function will be
* replaced by the generic crt_group_destroy().
*/
int
crt_group_secondary_destroy(crt_group_t *grp)
{
Expand Down
35 changes: 18 additions & 17 deletions src/cart/crt_group.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright 2016-2022 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -93,8 +93,8 @@ struct crt_grp_priv {
d_rank_list_t *gp_psr_ranks;
/* PSR rank in attached group */
d_rank_t gp_psr_rank;
/* PSR phy addr address in attached group */
crt_phy_addr_t gp_psr_phy_addr;
/* PSR URI address in attached group */
char *gp_psr_uri;
/* address lookup cache, only valid for primary group */
struct d_hash_table *gp_lookup_cache;

Expand Down Expand Up @@ -196,8 +196,7 @@ struct crt_uri_item {
d_list_t ui_link;

/* URI string for each remote tag */
/* TODO: in phase2 change this to hash table */
ATOMIC crt_phy_addr_t ui_uri[CRT_SRV_CONTEXT_NUM];
ATOMIC d_string_t ui_uri[CRT_SRV_CONTEXT_NUM];

/* Primary rank; for secondary groups only */
d_rank_t ui_pri_rank;
Expand Down Expand Up @@ -239,9 +238,9 @@ struct crt_grp_gdata {

void crt_hdlr_uri_lookup(crt_rpc_t *rpc_req);
int crt_grp_detach(crt_group_t *attached_grp);
void crt_grp_lc_lookup(struct crt_grp_priv *grp_priv, int ctx_idx,
d_rank_t rank, uint32_t tag, crt_phy_addr_t *base_addr,
hg_addr_t *hg_addr);
void
crt_grp_lc_lookup(struct crt_grp_priv *grp_priv, int ctx_idx, d_rank_t rank, uint32_t tag,
char **base_addr, hg_addr_t *hg_addr);
int crt_grp_lc_uri_insert(struct crt_grp_priv *grp_priv,
d_rank_t rank, uint32_t tag, const char *uri);
int crt_grp_lc_addr_insert(struct crt_grp_priv *grp_priv,
Expand Down Expand Up @@ -325,25 +324,27 @@ crt_grp_priv_decref(struct crt_grp_priv *grp_priv)
}

static inline int
crt_grp_psr_set(struct crt_grp_priv *grp_priv, d_rank_t psr_rank,
crt_phy_addr_t psr_addr, bool steal)
crt_grp_psr_set(struct crt_grp_priv *grp_priv, d_rank_t psr_rank, char *psr_uri, bool steal)
{
int rc = 0;

D_RWLOCK_WRLOCK(&grp_priv->gp_rwlock);
D_FREE(grp_priv->gp_psr_phy_addr);

D_FREE(grp_priv->gp_psr_uri);
grp_priv->gp_psr_rank = psr_rank;

if (steal) {
grp_priv->gp_psr_phy_addr = psr_addr;
grp_priv->gp_psr_uri = psr_uri;
} else {
D_STRNDUP(grp_priv->gp_psr_phy_addr, psr_addr,
CRT_ADDR_STR_MAX_LEN);
if (grp_priv->gp_psr_phy_addr == NULL)
D_STRNDUP(grp_priv->gp_psr_uri, psr_uri, CRT_ADDR_STR_MAX_LEN);
if (grp_priv->gp_psr_uri == NULL)
rc = -DER_NOMEM;
}

D_RWLOCK_UNLOCK(&grp_priv->gp_rwlock);
D_DEBUG(DB_TRACE, "group %s, set psr rank %d, uri %s.\n",
grp_priv->gp_pub.cg_grpid, psr_rank, psr_addr);

D_DEBUG(DB_TRACE, "group %s, set psr rank %d, uri %s.\n", grp_priv->gp_pub.cg_grpid,
psr_rank, psr_uri);
return rc;
}

Expand Down
Loading

0 comments on commit f39b1b5

Please sign in to comment.