-
Notifications
You must be signed in to change notification settings - Fork 306
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
DAOS-16971 cart: add RPC origin address #15820
Changes from 1 commit
6d0153b
86270c6
b7d4b59
c036a00
ee2ba3f
584f8b1
c58851e
ef94ca5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* (C) Copyright 2016-2024 Intel Corporation. | ||
* (C) Copyright 2025 Google LLC | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause-Patent | ||
*/ | ||
|
@@ -26,6 +27,34 @@ | |
#include "crt_self_test.h" | ||
#include "crt_swim.h" | ||
|
||
static inline char * | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should go into crt_internal_fns.h for declaration and crt_rpc.c for the implementation. I don't think there is much benefit from inlining this function anyway There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is embeded into the D_DEBUG/RPC_TRACE, inline function at least reduce the overhead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, but organizationally it should still be in crt_interal_fns.h -- similar to how we have all other functions there. See crt_opc_decode() which is also used in RPC_* macros. I don't think an overhead of a function call matters too much in debug case (compared to all the slowdown generated by emitting and logging messages) |
||
crt_rpc_priv_get_origin_addr(struct crt_rpc_priv *rpc_priv) | ||
{ | ||
const struct hg_info *hg_info; | ||
char addr[48]; | ||
hg_size_t addr_size = 48; | ||
int rc; | ||
|
||
if (rpc_priv->crp_orig_uri != NULL) | ||
return rpc_priv->crp_orig_uri; | ||
|
||
hg_info = HG_Get_info(rpc_priv->crp_hg_hdl); | ||
if (hg_info == NULL) | ||
return "None"; | ||
|
||
rc = HG_Addr_to_string(hg_info->hg_class, addr, (hg_size_t *)&addr_size, hg_info->addr); | ||
if (rc != 0) | ||
return "None"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should either print an error for each case or somehow differentiate None's. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. client side RPC trace should have no origin address, so I put None here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, but the other 2 errors are return 'None', so if you see 'None' you dont know if this call failed or 2 others. Maybe return 'ERR' or something else in other error cases |
||
|
||
D_ALLOC(rpc_priv->crp_orig_uri, addr_size); | ||
if (rpc_priv->crp_orig_uri == NULL) | ||
return "None"; | ||
|
||
memcpy(rpc_priv->crp_orig_uri, addr, addr_size); | ||
|
||
return rpc_priv->crp_orig_uri; | ||
} | ||
|
||
/* A wrapper around D_TRACE_DEBUG that ensures the ptr option is a RPC */ | ||
#define RPC_TRACE(mask, rpc, fmt, ...) \ | ||
do { \ | ||
|
@@ -36,10 +65,11 @@ | |
break; \ | ||
\ | ||
crt_opc_decode((rpc)->crp_pub.cr_opc, &_module, &_opc); \ | ||
D_TRACE_DEBUG(mask, (rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d] " fmt, \ | ||
D_TRACE_DEBUG(mask, (rpc), \ | ||
"[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d orig=%s] " fmt, \ | ||
(rpc)->crp_pub.cr_opc, _module, _opc, (rpc)->crp_req_hdr.cch_rpcid, \ | ||
(rpc)->crp_pub.cr_ep.ep_rank, (rpc)->crp_pub.cr_ep.ep_tag, \ | ||
##__VA_ARGS__); \ | ||
crt_rpc_priv_get_origin_addr((rpc)), ##__VA_ARGS__); \ | ||
} while (0) | ||
|
||
/* Log an error with an RPC descriptor */ | ||
|
@@ -49,10 +79,10 @@ | |
char *_opc; \ | ||
\ | ||
crt_opc_decode((rpc)->crp_pub.cr_opc, &_module, &_opc); \ | ||
D_TRACE_ERROR((rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d] " fmt, \ | ||
D_TRACE_ERROR((rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d orig=%s] " fmt, \ | ||
(rpc)->crp_pub.cr_opc, _module, _opc, (rpc)->crp_req_hdr.cch_rpcid, \ | ||
(rpc)->crp_pub.cr_ep.ep_rank, (rpc)->crp_pub.cr_ep.ep_tag, \ | ||
##__VA_ARGS__); \ | ||
crt_rpc_priv_get_origin_addr((rpc)), ##__VA_ARGS__); \ | ||
} while (0) | ||
|
||
/* Log a warning with an RPC descriptor */ | ||
|
@@ -62,10 +92,10 @@ | |
char *_opc; \ | ||
\ | ||
crt_opc_decode((rpc)->crp_pub.cr_opc, &_module, &_opc); \ | ||
D_TRACE_WARN((rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d] " fmt, \ | ||
D_TRACE_WARN((rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d orig=%s] " fmt, \ | ||
(rpc)->crp_pub.cr_opc, _module, _opc, (rpc)->crp_req_hdr.cch_rpcid, \ | ||
(rpc)->crp_pub.cr_ep.ep_rank, (rpc)->crp_pub.cr_ep.ep_tag, \ | ||
##__VA_ARGS__); \ | ||
crt_rpc_priv_get_origin_addr((rpc)), ##__VA_ARGS__); \ | ||
} while (0) | ||
|
||
/* Log an info message with an RPC descriptor */ | ||
|
@@ -75,11 +105,12 @@ | |
char *_opc; \ | ||
\ | ||
crt_opc_decode((rpc)->crp_pub.cr_opc, &_module, &_opc); \ | ||
D_TRACE_INFO((rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d] " fmt, \ | ||
D_TRACE_INFO((rpc), "[opc=%#x (%s:%s) rpcid=%#lx rank:tag=%d:%d orig=%s] " fmt, \ | ||
(rpc)->crp_pub.cr_opc, _module, _opc, (rpc)->crp_req_hdr.cch_rpcid, \ | ||
(rpc)->crp_pub.cr_ep.ep_rank, (rpc)->crp_pub.cr_ep.ep_tag, \ | ||
##__VA_ARGS__); \ | ||
crt_rpc_priv_get_origin_addr((rpc)), ##__VA_ARGS__); \ | ||
} while (0) | ||
|
||
/** | ||
* If \a cond is false, this is equivalent to an RPC_ERROR (i.e., \a mask is | ||
* ignored). If \a cond is true, this is equivalent to an RPC_TRACE. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* (C) Copyright 2016-2024 Intel Corporation. | ||
* (C) Copyright 2025 Google LLC | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause-Patent | ||
*/ | ||
|
@@ -2375,6 +2376,15 @@ int crt_context_quota_limit_get(crt_context_t crt_ctx, crt_quota_type_t quota, i | |
int | ||
crt_req_get_proto_ver(crt_rpc_t *req); | ||
|
||
/** | ||
* Get the rpc original address. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/original/origin/ ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still a typo:) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, ok |
||
* | ||
* \param[in] rpc pointer to RPC request | ||
* \return the origin address of the RPC | ||
*/ | ||
char * | ||
crt_rpc_get_origin_addr(crt_rpc_t *rpc); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The api functions follow format of crt_[module][verb] (see crt_context_quota_limit_get, crt_context_create and others) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, ok |
||
|
||
/** @} | ||
*/ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to remove "\n" from the message as DL_ERROR will append one on its own
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, sure