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
lib/posix-poll: Fix epoll missing events #1297
lib/posix-poll: Fix epoll missing events #1297
Conversation
Previously epoll would miss events when configured for edge-polling and unable to return all captured events in a single call to epoll_wait, by erroneously marking the epoll fd as not ready, even though it may still have pending events. This change fixes this oversight, restoring expected behavior to epoll_wait. Signed-off-by: Andrei Tatar <andrei@unikraft.io>
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.
All good, thanks.
Reviewed-by: Stefan Jumarea stefanjumarea02@gmail.com
/* If lvlev, update pollin back in */ | ||
if (lvlev) | ||
/* If lvlev or limited by maxevents, update pollin back in */ | ||
if (lvlev || nout == maxevents) | ||
uk_file_event_set(epf, UKFD_POLLIN); |
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.
Doesn't this function return something? Is there a reasion we are not checking for return values?
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.
In fact I don't see its return values being checked at any of its callsite 🤔
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.
uk_file_event_*
functions return the previous events, as a convenience due to the fact that event setting is done atomically so there's no other way to get that previous value. This is not needed often, but is needed sometimes, thus the need to return it.
In this case we don't care what the previous events were. I used to cast such invocations to void, but this turned out to be everywhere, visually polluting the code, not to mention increasing the pressure on keeping everything within 80 cols with size 8 tabs 😛 ; so I stopped that.
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.
Oh well I guess we also call printf
while ignoring return value...
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.
Reviewed-by: Sergiu Moga sergiu@unikraft.io
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.
Approved-by: Razvan Deaconescu razvand@unikraft.io
Previously epoll would miss events when configured for edge-polling and unable to return all captured events in a single call to epoll_wait, by erroneously marking the epoll fd as not ready, even though it may still have pending events. This change fixes this oversight, restoring expected behavior to epoll_wait. Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Sergiu Moga <sergiu@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1297
Description of changes
Previously epoll would miss events when configured for edge-polling and unable to return all captured events in a single call to epoll_wait, by erroneously marking the epoll fd as not ready, even though it may still have pending events.
This change fixes this oversight, restoring expected behavior to epoll_wait.
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
Trigger/test snippet:
Output should be
On both Linux and Unikraft; previously unikraft would miss one of the messages (most likely
b
).