Skip to content

refactor(virtio): bundle worker parameters into WorkerParam - #520

Merged
Lencerf merged 1 commit into
google:mainfrom
Lencerf:push-pwknvxuwmznm
Oct 5, 2026
Merged

Lencerf merged 1 commit into
google:mainfrom
Lencerf:push-pwknvxuwmznm

Conversation

@Lencerf

@Lencerf Lencerf commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Virtio::spawn_worker(), Mio::spawn_worker(), IoUring::spawn_worker() and Worker::spawn() all took the same three arguments: the wake event receiver, the guest memory bus and the queue registers. Every device implementation merely forwarded them, and each new field had to be threaded through every signature and call site.

Introduce WorkerParam, built once by VirtioDevice::new() and passed down as a whole. Context embeds it instead of copying its fields, so adding a shared field only touches WorkerParam and VirtioDevice::new(). Device implementations never look inside.

No functional change.

Assisted-by: Antigravity:Claude-Fable-5.1

Virtio::spawn_worker(), Mio::spawn_worker(), IoUring::spawn_worker()
and Worker::spawn() all took the same three arguments: the wake event
receiver, the guest memory bus and the queue registers. Every device
implementation merely forwarded them, and each new field had to be
threaded through every signature and call site.

Introduce WorkerParam, built once by VirtioDevice::new() and passed
down as a whole. Context embeds it instead of copying its fields, so
adding a shared field only touches WorkerParam and VirtioDevice::new().
Device implementations never look inside.

No functional change.

Assisted-by: Antigravity:Claude-Fable-5.1
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
@Lencerf
Lencerf enabled auto-merge October 5, 2026 08:37
@Lencerf
Lencerf added this pull request to the merge queue Oct 5, 2026
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 37284591117

Coverage increased (+0.05%) to 39.088%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: 24 uncovered changes across 9 files (14 of 38 lines covered, 36.84%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
alioth/src/virtio/dev/dev.rs 12 6 50.0%
alioth/src/virtio/dev/blk.rs 3 0 0.0%
alioth/src/virtio/dev/net/tap.rs 3 0 0.0%
alioth/src/virtio/dev/balloon.rs 2 0 0.0%
alioth/src/virtio/dev/fs/fs.rs 2 0 0.0%
alioth/src/virtio/dev/fs/vu.rs 2 0 0.0%
alioth/src/virtio/dev/net/vmnet.rs 2 0 0.0%
alioth/src/virtio/dev/vsock/vhost_vsock.rs 2 0 0.0%
alioth/src/virtio/vu/frontend.rs 2 0 0.0%
Total (13 files) 38 14 36.84%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15509
Covered Lines: 5890
Line Coverage: 37.98%
Relevant Branches: 1642
Covered Branches: 814
Branch Coverage: 49.57%
Branches in Coverage %: Yes
Coverage Strength: 922.12 hits per line

💛 - Coveralls

Merged via the queue into google:main with commit 3f83f3d Oct 5, 2026
20 checks passed
@Lencerf
Lencerf deleted the push-pwknvxuwmznm branch October 5, 2026 08:42
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