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

allow IOBuf::append_user_data_with_meta to specify the lkey of rdma memory region #2005

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

Tuvie
Copy link
Contributor

@Tuvie Tuvie commented Nov 20, 2022

What problem does this PR solve?

Issue Number: 1995

Problem Summary: When using IOBuf::append_user_data, if the application specify a buffer with an offset over the base address registered with rdma::RegisterMemoryForRdma, brpc reports a failure for invalid memory region.

What is changed and the side effects?

Changed: Add a new function named append_user_data_with_meta in IOBuf. Allow application specifying the lkey as meta to explicitly inform brpc. This removes the necessity to lookup the lkey for the IOBuf Block in rpc processing.

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性): To store the meta/lkey in IOBuf Block, the portal_next field is reused when flags is non-0. It is acceptable because portal_next is only used for tls cache of IOBuf, which does not work for user defined Blocks.


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@Tuvie Tuvie changed the title allow IOBuf::attach_user_data specify any valid address in registered rdma memory region allow IOBuf::append_user_data_with_meta to specify the lkey of rdma memory region Nov 20, 2022
@wwbmmm
Copy link
Contributor

wwbmmm commented Nov 21, 2022

append_user_data_with_meta not found in files changed

src/butil/iobuf.h Outdated Show resolved Hide resolved
src/butil/iobuf.cpp Outdated Show resolved Hide resolved
src/butil/iobuf.h Outdated Show resolved Hide resolved
test/brpc_rdma_unittest.cpp Outdated Show resolved Hide resolved
uint64_t meta) {
if (size == 0) {
LOG(WARNING) << "data_size should not be 0";
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did size == 0 have any side effect? If not, can we return 0 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be unexpected. return -1 is a better choice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwbmmm
Copy link
Contributor

wwbmmm commented Nov 23, 2022

LGTM

@Tuvie
Copy link
Contributor Author

Tuvie commented Nov 24, 2022

@wwbmmm is this PR qualified to be merged? It seems that the Travis often fails due to some irrelevant reason.

@Tuvie
Copy link
Contributor Author

Tuvie commented Dec 2, 2022

Has resolved conflict. Any plan to merge?

@wwbmmm wwbmmm merged commit 1043b79 into apache:master Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants