8000 Add io_uring support by mtfriesen · Pull Request #5061 · microsoft/msquic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add io_uring support #5061

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

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft

Add io_uring support #5061

wants to merge 28 commits into from

Conversation

mtfriesen
Copy link
Contributor

Description

Describe the purpose of and changes within this Pull Request.

Testing

Do any existing tests cover this change? Are new tests needed?

Documentation

Is there any documentation impact for this change?

CxPlatFree(Entry, Pool->Tag);
}
CxPlatLockUninitialize(&Pool->Lock);
CxPlatPoolInitializeEx(IsPaged, Size, Tag, NULL, NULL, Pool);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of NULLs and always doing if checks in every alloc/free, should we have defaults that call what we want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might back out this change if I don't get as far as zerocopy TX, which is the only use case for this model.

#ifdef DEBUG
#define CXPLAT_DBG_ASSERT_CMSG(CMsg, type) \
if (CMsg->cmsg_len < CMSG_LEN(sizeof(type))) { \
printf("%u: cmsg[%u:%u] len (%u) < exp_len (%u)\n", \
Copy link
Member

Choose a reason for hiding this comment

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

I never noticed we had a printf assert. We should replace this with a real assert.

Comment on lines +921 to +922
void *Ring;
uint8_t *Buffers;
Copy link
Member

Choose a reason for hiding this comment

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

nit, style puts the * with the type

Suggested change
void *Ring;
uint8_t *Buffers;
void* Ring;
uint8_t* Buffers;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I will have to do one sweep for these after, because they keep creeping in.

Comment on lines 566 to 570
for (uint32_t i = 0; i < CqeCount; ++i) {
CXPLAT_SQE* Sqe = CxPlatCqeGetSqe(&Cqes[i]);
Sqe->Completion(&Cqes[i]);
while (CqeCount > 0) {
CXPLAT_SQE* Sqe = CxPlatCqeGetSqe(CurrentCqe);
Sqe->Completion(&CurrentCqe, &CurrentCqeCount);
Copy link
Member

Choose a reason for hiding this comment

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

Every SQE has its own completion function. Why are you changing that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new completion function supports batching completions, which is better than calling Foo() 100 times, and having Foo() do boilerplate (lock, submit, etc.) each time.

10000 Copy link
Member

Choose a reason for hiding this comment

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

Batching of what exactly though? If you have a list of 10 completion functions to call, what is being batched? The callbacks are all outside of a lock, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CurrentCqe and CurrentCqeCount are both _Inout_ parameters, so the routine can consume [1, CurrentCqeCount] CQEs.

Here's the only routine taking advantage:

(*Cqes)++;
(*CqeCount)--;
if (*CqeCount == 0 ||
CxPlatCqeGetSqe(*Cqes)->Completion != CxPlatSocketContextIoEventComplete) {
break;
}
Sqe = CxPlatCqeGetSqe(*Cqes);
SocketContext =
CXPLAT_CONTAINING_RECORD(Sqe, CXPLAT_SOCKET_CONTEXT, IoSqe);

inline
_IRQL_requires_max_(PASSIVE_LEVEL)
void
CxPlatSqeClassicCompletion(
Copy link
Member

Choose a reason for hiding this comment

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

Why add this interface to just do what the caller was doing anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the other comment (The new completion function supports batching completions) and the comment in this function (it's a hack to avoid updating all code).


Abstract:

QUIC datapath Abstraction Layer.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The abstract should be updated (or removed, if it doesn't provide useful info)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to add some context, this is currently a draft PR.

Copy link
codecov bot commented May 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.00%. Comparing base (54ced5e) to head (8206597).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5061      +/-   ##
==========================================
+ Coverage   85.92%   87.00%   +1.08%     
==========================================
  Files          59       59              
  Lines       18035    18035              
==========================================
+ Hits        15496    15691     +195     
+ Misses       2539     2344     -195     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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
0