nvme_test: mirror nvme architecture to support multiple submission queues per completion queue #2026
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.
The NVMe specification requires that multiple submission queues be able to target a single completion queue. The main nvme emulator already supports this functionality, but nvme_test had an explicit restriction preventing it.
This change mirrors the complete architecture from commit 722d203 in the main nvme emulator to nvme_test by:
Removing the blocking restriction that prevented completion queue sharing with the comment "Don't allow sharing completion queues. This isn't spec compliant but it simplifies the device significantly"
Updating SubmissionQueue::new signature to take a
&CompletionQueue
reference instead of separate parameters, enabling proper resource sharing of doorbell memory and other queue resourcesComplete architectural overhaul to match the main nvme emulator:
Slab<SqState>
instead of single submission queue to manage multiple submission queues per completion queueIoQueueState
enum and manage individual submission queue state with proper metadata trackinghas_sqs()
,create_sq()
, anddelete_sq()
functions to IoState for proper submission queue lifecycle managementFixing queue management logic to handle the new architecture:
create_sq()
on existing completion queue's IoState and stores the returned indexThe implementation exactly mirrors the main nvme emulator's architecture, ensuring full NVMe specification compliance while maintaining performance through single task management per completion queue. All existing tests continue to pass, ensuring backward compatibility.
This fixes Windows NVMe boot scenarios where the guest expects multiple submission queues to share completion queues based on VM topology.
Fixes #2025.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.