-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix PATCH operation in virtio-block devices backed by asynchronous engine #4286
Merged
bchalios
merged 5 commits into
firecracker-microvm:main
from
bchalios:fix_patch_async_drives
Dec 1, 2023
Merged
Fix PATCH operation in virtio-block devices backed by asynchronous engine #4286
bchalios
merged 5 commits into
firecracker-microvm:main
from
bchalios:fix_patch_async_drives
Dec 1, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4286 +/- ##
==========================================
+ Coverage 81.69% 81.71% +0.02%
==========================================
Files 240 240
Lines 29293 29332 +39
==========================================
+ Hits 23932 23970 +38
- Misses 5361 5362 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
981e88f
to
d0b988c
Compare
ShadowCurse
reviewed
Nov 30, 2023
kalyazin
reviewed
Dec 1, 2023
So far, tests for virtio block devices only used the synchronous engine for testing. This commit, uses the "io_engine" fixture which returns both "Sync" and "Async" (for the kernels > 4.14). It also adds a test the we can mount devices after patching the backing file on the host. Signed-off-by: Babis Chalios <[email protected]>
In test test_send_ctrl_alt_del we send a CTRL+ALT+DEL to the microVM, which, in x86, makes the microVM to shutdown. Then we send a signal to the Firecracker process with `os.kill(firecracker_pid, 0)` and wait for it to fail. This works but logs an error in the test logs which can be confusing. Instead we can call os.waitpid() which waits for the Firecracker process to exit and returns immediately if the process has already exited. Signed-off-by: Babis Chalios <[email protected]>
The asynchronous engine maintains an event file descriptor which passes to the IO uring interface when creating a new ring. IO uring uses this EventFd to notify us about completion of IO requests. When we PATCH an async block device, we create a new asynchronous engine, including a new EventFd. However, we still monitor the old EventFd. This breaks the use of async drives post PATCH requests, because we never get notified about the results of requests we submit to the IO uring engine. This commit changes the implementation along the PATCH code path, to reuse the previous EventFd for the asynchronous engine. Signed-off-by: Babis Chalios <[email protected]>
516e9ed
to
0e29058
Compare
ShadowCurse
approved these changes
Dec 1, 2023
kalyazin
approved these changes
Dec 1, 2023
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Changes the implementation along the PATCH code path for
virtio-block
devices so that, for the case of asynchronous engines (IO uring), it reuses the existingEventFd
for getting completion callback notifications, rather than creating a knew one.It also modifies the
virtio-block
tests to also test the asynchronous engine. It extends a test that verifies the PATCH operation works to also check thatmount
-ing an asynchronous device works.Reason
The asynchronous engine maintains an event file descriptor which passes to the IO uring interface when creating a new ring. IO uring uses this EventFd to notify us about completion of IO requests.
When we PATCH an async block device, we create a new asynchronous engine, including a new EventFd. However, we still monitor the old EventFd. This breaks the use of async drives post PATCH requests, because we never get notified about the results of requests we submit to the IO uring engine.
As a result, mounting a virtio-block device backed from an asynchronous file engine was blocking for ever.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following
Developer Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
CHANGELOG.md
.TODO
s link to an issue.rust-vmm
.