Skip to content

[PoC] io: add iouring support#22392

Closed
soulxu wants to merge 34 commits intoenvoyproxy:mainfrom
soulxu:new_iouring_version_2
Closed

[PoC] io: add iouring support#22392
soulxu wants to merge 34 commits intoenvoyproxy:mainfrom
soulxu:new_iouring_version_2

Conversation

@soulxu
Copy link
Member

@soulxu soulxu commented Jul 26, 2022

Commit Message: io: add iouring support
Additional Description:
Risk Level: low, it should be enabled by default.
Testing: unit tests and integration tests are expected
Docs Changes: TODO
Release Notes: TODO
Platform Specific Features: Only linux platform support iouring
Runtime guard: (TODO) A runtime flag should be added for this feature.

Signed-off-by: He Jie Xu hejie.xu@intel.com
Signed-off-by: Zhi Hao Xie zhihao.xie@intel.com
Signed-off-by: Dmitry Rozhkov dmitry.rozhkov@intel.com

@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #22392 was opened by soulxu.

see: more, trace.

@soulxu
Copy link
Member Author

soulxu commented Jul 26, 2022

This continues the work of #19082

It is still in the early stage, and a lot of things need to be figured out.

Copy link
Contributor

@zhxie zhxie left a comment

Choose a reason for hiding this comment

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

Leave some comments (undecided or dangerous implementation) in advance.

delete[] reinterpret_cast<const uint8_t*>(data);
delete this_fragment;
});
buffer.addBufferFragment(*fragment);
Copy link
Contributor

Choose a reason for hiding this comment

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

We may not able to do this in readv and sends and will end up in memcpy.


Api::IoCallUint64Result IoUringSocketHandleImpl::recv(void* /*buffer*/, size_t /*length*/,
int /*flags*/) {
PANIC("not implemented");
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not see and equivalent operations of flags in io_uring like MSG_PEEK. We may implement on our own.

}
if (isLeader()) {
io_uring_factory_.getOrCreate().unregisterEventfd();
file_event_adapter_.reset();
Copy link
Contributor

Choose a reason for hiding this comment

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

If the adapter deconstructs since the leading handle closes, what will happen to the remaining existing handles?

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 27, 2022
@soulxu
Copy link
Member Author

soulxu commented Aug 27, 2022

still working on it

@github-actions github-actions bot removed the stale stalebot believes this issue/PR has not been touched recently label Aug 27, 2022
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@intel.com>

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
@soulxu soulxu force-pushed the new_iouring_version_2 branch from 779bcf6 to 435d9ef Compare September 19, 2022 09:08
zhxie and others added 17 commits September 20, 2022 12:52
network: handle io_uring factory safely

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
created

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
back

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
* network: cancel before close

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
zhxie added 7 commits October 27, 2022 14:00
* network: sync write

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
* network: fix writev

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: escape cancel first

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
* network: delay read request

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: add read request after connect

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
* network: escape 0 byte to read in readv

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: error should be constructed with errno

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: escape errors in readv

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: unify read and readv

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: support max read length

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* nit: change member names

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: fix incorrect merge

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: fix wrong write error

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: minor improvement

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
zhxie added 5 commits December 2, 2022 09:59
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
* io: add event for io_uring impl

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: migrate

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: fix early accept

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* io: fix empty callback handling

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: fix accept handling

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: escape completion on closed fds

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* deps: no need to upgrade liburing

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: fix accept preparation

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] network: stop adding read request on read

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* io: stop erasing callback on cancellation

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: delete canceled request

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] network: avoid migrating between io_uring

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] network: drain after writing

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] network: limit write slice size

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* network: minor fix

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] network: fix connect result handling

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] network: move instead of copy

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* io: delay submit

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* nit

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

* [backport] delay read callback

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>

Signed-off-by: Xie Zhihao <zhihao.xie@intel.com>
@soulxu
Copy link
Member Author

soulxu commented Dec 13, 2022

Please reference the second iteration #24305

@soulxu soulxu closed this Dec 13, 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.

2 participants