Skip to content

[vsock] better handle Lifecycle#1104

Open
papertigers wants to merge 4 commits intomasterfrom
spr/papertigers/vsock-better-handle-lifecycle
Open

[vsock] better handle Lifecycle#1104
papertigers wants to merge 4 commits intomasterfrom
spr/papertigers/vsock-better-handle-lifecycle

Conversation

@papertigers
Copy link
Copy Markdown
Contributor

@papertigers papertigers commented Apr 6, 2026

This PR extends the VsockPoller event loop so that it complies with the Lifecycle trait within propolis.

The virtio device now requests a pause to the event-loop by sending a VsockEvent::Pause via port_send(3C).
When the event loop receives this event it finishes processing any tasks and then waits on a mpsc channel. This channel is responsible for processing follow up events driven by the virtio device lifecycle such as resume, reset, and halt. The reset event takes care of cleaning up all state internal to VsockPoller in addition to removing the cached descriptor chain in VsockVq. It's important we drop this cached descriptor as using it across device resets would cause propolis to scribble data into a random location in guest memory depending on where the GuestAddr points.

Finally with this work in place it should make solving #1065 trivial.

Created using jj-spr 0.1.0
/// This MUST be called when reseting the virtio-socket device so
/// that we don't use stale `GuestAddr`s across device resets.
pub(crate) fn clear_rx_chain(&mut self) {
self.rx_chain = None;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future I would like to eliminate this RxPermit by possibly extending the VirtQueue to allow peek() or a method that checks if the chain has a descriptor available.

@morlandi7 morlandi7 added this to the 19 milestone Apr 6, 2026
Created using jj-spr 0.1.0
Created using jj-spr 0.1.0
Created using jj-spr 0.1.0
@papertigers papertigers marked this pull request as ready for review April 6, 2026 17:15
@papertigers papertigers requested a review from iximeow April 6, 2026 17:16
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