nvme: reset shadow doorbell state#4011
Open
jstarks wants to merge 2 commits into
Open
Conversation
Restore and clear the controller-owned doorbell backing after queue workers drain so stale shadow doorbell and event-index mappings do not survive controller reset. Retain the original backing allocation for reuse and cover both the normal and fault-injection emulators. Thanks to @bitranox for identifying the stale mapping and suggesting the reset approach in microsoft#3915.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses NVMe shadow doorbell state surviving a controller reset by restoring the controller-owned (private) doorbell backing and clearing any shadow doorbell / event-index mapping after queue workers drain, preventing post-reset writes into stale guest addresses.
Changes:
- Reset
DoorbellMemoryto its controller-owned backing when NVMe workers fully reset/disable. - Preserve a reusable private doorbell backing allocation and add a
DoorbellMemory::reset()helper to restore/clear it. - Add reset-focused shadow doorbell tests for both the normal and fault-injection NVMe emulators.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vm/devices/storage/nvme/src/workers/coordinator.rs | Resets doorbell backing after workers finish draining during reset. |
| vm/devices/storage/nvme/src/queue.rs | Adds reusable private backing + DoorbellMemory::reset() to restore power-on doorbell state. |
| vm/devices/storage/nvme/src/tests/shadow_doorbell_tests.rs | Adds coverage around reset behavior after configuring shadow doorbells. |
| vm/devices/storage/nvme_test/src/workers/coordinator.rs | Mirrors worker reset doorbell reset behavior in the fault-injection emulator. |
| vm/devices/storage/nvme_test/src/queue.rs | Mirrors private backing + DoorbellMemory::reset() in the fault-injection emulator. |
| vm/devices/storage/nvme_test/src/tests/shadow_doorbell_tests.rs | Mirrors reset-focused shadow doorbell test coverage in the fault-injection emulator. |
This file contains hidden or 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
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.
Restore and clear the controller-owned doorbell backing after queue workers drain so stale shadow doorbell and event-index mappings do not survive controller reset. Retain the original backing allocation for reuse and cover both the normal and fault-injection emulators.
Thanks to @bitranox for identifying the stale mapping and suggesting the reset approach in #3915.