Skip to content

vmbus_channel: rescind subchannels before primary on revoke#3507

Open
yuqiong6 wants to merge 1 commit into
microsoft:mainfrom
yuqiong6:user/yuqliu/rescindchannels
Open

vmbus_channel: rescind subchannels before primary on revoke#3507
yuqiong6 wants to merge 1 commit into
microsoft:mainfrom
yuqiong6:user/yuqliu/rescindchannels

Conversation

@yuqiong6
Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI review requested due to automatic review settings May 18, 2026 15:50
@yuqiong6 yuqiong6 requested review from a team as code owners May 18, 2026 15:50
Copy link
Copy Markdown
Contributor

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 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.

@github-actions
Copy link
Copy Markdown

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.

2 participants