-
Notifications
You must be signed in to change notification settings - Fork 157
disk_nvme: add specific test for DMA allocation failure handling #2206
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds comprehensive testing for DMA allocation failure handling in the NVMe driver to ensure the driver gracefully handles allocation failures during both initial driver creation and secondary IO issuer creation.
Key Changes:
- Introduced a customizable
DeviceTestDmaClient
that allows tests to inject allocation failures through callback hooks - Added two new test cases: one verifying driver creation fails when DMA allocation fails, and another verifying the driver falls back to bounce buffers when secondary IO issuer allocation fails
- Refactored existing NVMe driver tests to use a unified configuration structure
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
vm/devices/user_driver_emulated_mock/src/lib.rs | Adds DeviceTestDmaClient with callback hooks for customizing DMA allocation behavior in tests |
vm/devices/storage/disk_nvme/nvme_driver/src/tests.rs | Adds two allocation failure tests and refactors existing tests to use configuration structure |
vm/devices/storage/disk_nvme/nvme_driver/Cargo.toml | Adds page_pool_alloc dependency needed for test DMA client implementation |
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.
Took a look again this morning. lgtm
/// Called when the DMA client needs to attach pending buffers. | ||
fn attach_pending_buffers( | ||
&self, | ||
inner: &PagePoolAllocator, |
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.
nit: why the different name for the same type?
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.
Pretty comfy interface :D
Add a test to ensure that the NVMe driver correctly handles allocation failures (they should
be non-fatal to secondary IO issuer create).