Skip to content

Conversation

mattkur
Copy link
Contributor

@mattkur mattkur commented Oct 17, 2025

Add a test to ensure that the NVMe driver correctly handles allocation failures (they should
be non-fatal to secondary IO issuer create).

@mattkur mattkur requested review from a team, amy-microsoft, Copilot and gurasinghMS and removed request for Copilot October 17, 2025 23:31
@mattkur mattkur requested review from a team as code owners October 17, 2025 23:31
@Copilot Copilot AI review requested due to automatic review settings October 18, 2025 14:20
Copy link
Contributor

@Copilot Copilot AI left a 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

mattkur added a commit that referenced this pull request Oct 20, 2025
I explored the problem space for dealing with allocation characteristics
in #2087. I've split
out a few PRs from this, and added tests to verify that the driver
behaves as expected (see #2206).

All that's left is a couple behavioral comment updates. Those are
included here.
Copy link
Contributor

@gurasinghMS gurasinghMS left a 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,

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?

Copy link

@amy-microsoft amy-microsoft left a 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

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.

4 participants