vmbus_channel: rescind subchannels before primary on revoke#3507
Open
yuqiong6 wants to merge 1 commit into
Open
vmbus_channel: rescind subchannels before primary on revoke#3507yuqiong6 wants to merge 1 commit into
yuqiong6 wants to merge 1 commit into
Conversation
When a device with subchannels is revoked, the device task previously dropped its server-request senders in index order. Because vmbus_server polls those receivers via SelectAll, the resulting RescindChannelOffer messages could be delivered to the guest in arbitrary order, including the primary's rescind before the subchannels'. Send concurrent Revoke RPCs for all subchannels and await them all via join_all before dropping the primary's sender. This guarantees the guest sees every subchannel rescind before the primary rescind, while still allowing subchannel rescinds to be emitted in any order. Add a vmbus_server test that offers a multi-subchannel device, connects the guest, enables and observes the subchannel offers, then revokes the handle and asserts the primary's RescindChannelOffer arrives only after every subchannel's rescind has been delivered.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes VMBus device revocation ordering so subchannel rescinds are issued before the primary channel rescind, preventing guests from observing the primary removal first.
Changes:
- Explicitly revokes all subchannels concurrently and waits for those revokes before dropping the primary channel sender.
- Adds a VMBus server regression test covering multi-subchannel revoke ordering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
vm/devices/vmbus/vmbus_channel/src/channel.rs |
Updates teardown logic to revoke subchannels before the primary channel. |
vm/devices/vmbus/vmbus_server/src/tests.rs |
Adds a test device and regression test verifying rescind ordering. |
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.
When a device with subchannels is revoked, the device task previously dropped its server-request senders in index order. Because vmbus_server polls those receivers via SelectAll, the resulting RescindChannelOffer messages could be delivered to the guest in arbitrary order, including the primary's rescind before the subchannels'.
Send concurrent Revoke RPCs for all subchannels and await them all via join_all before dropping the primary's sender. This guarantees the guest sees every subchannel rescind before the primary rescind, while still allowing subchannel rescinds to be emitted in any order.
Add a vmbus_server test that offers a multi-subchannel device, connects the guest, enables and observes the subchannel offers, then revokes the handle and asserts the primary's RescindChannelOffer arrives only after every subchannel's rescind has been delivered.