Skip to content

[blk-threaded - 5/12] block: add worker thread activation - #6126

Closed
PierreBertholom wants to merge 6 commits into
pbertho/blk-threaded-04from
pbertho/blk-threaded-05
Closed

PierreBertholom wants to merge 6 commits into
pbertho/blk-threaded-04from
pbertho/blk-threaded-05

Conversation

@PierreBertholom

@PierreBertholom PierreBertholom commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

[5/12] part of the PR stack starting with #6123

Changes

Add inline and threaded active states and transfer runtime resources to
the worker thread during activation.

Keep queue config and interrupt state on the VMM thread and register
runtime events on the thread that owns the data path.

Virtio queues previously bundled transport configuration and runtime
state. The transport only needs to read/modify queue config, not the
full queues, and exposing queues as `&[Queue]` slices assumes all
queues live contiguously in one owner which breaks once queues are
owned by separate per-queue worker threads.
Split out a transport-visible `QueueConfig` and replace the
slice-returning trait methods with per-index accessors.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Keep block configuration in VirtioBlockConfig and remove duplicated
fields.
Move queues, eventfds, disk, and rate-limiter state to BlockResources.
Keep configuration synchronized across runtime updates and snapshot
restore.

This prepares runtime resources to move to a worker thread.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Rate limiter will be shared between worker threads of a same device.
Wrap rate limiter in mutex. Extract rate limiter registration to allow
both inline and threaded paths to register timer_fd on the VMM event
manager.
Make `timer_active` flag an `Arc<AtomicBool>` for fast lookup by workers
without acquiring the rate limiter mutex.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Move queue and completion processing into BlockWorker while keeping
execution on the VMM thread.

Transfer runtime resources to the worker on activation and return them
on deactivation. This prepares the data path for worker thread support.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Add WorkerHandle and ThreadedWorker to manage a block worker
thread and its event loop.

Use a channel+eventfd to start and finish the worker.
Keep the structures disconnected from VirtioBlock until next
commits add lifecycle wiring.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Add inline and threaded active states and transfer runtime resources to
the worker thread during activation.

Keep queue config and interrupt state on the VMM thread and register
runtime events on the thread that owns the data path.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
@codecov

codecov Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 37.67123% with 91 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.95%. Comparing base (5209e74) to head (3e06e8d).

Files with missing lines Patch % Lines
src/vmm/src/devices/virtio/block/virtio/device.rs 36.69% 88 Missing ⚠️
...m/src/devices/virtio/block/virtio/event_handler.rs 50.00% 3 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           pbertho/blk-threaded-04    #6126      +/-   ##
===========================================================
- Coverage                    82.11%   81.95%   -0.16%     
===========================================================
  Files                          278      278              
  Lines                        31225    31314      +89     
===========================================================
+ Hits                         25639    25663      +24     
- Misses                        5586     5651      +65     
Flag Coverage Δ
5.10-m5n.metal 82.10% <37.67%> (-0.18%) ⬇️
5.10-m6a.metal 81.42% <37.67%> (-0.19%) ⬇️
5.10-m6g.metal 78.92% <37.67%> (-0.18%) ⬇️
5.10-m6i.metal 82.10% <37.67%> (-0.18%) ⬇️
5.10-m7a.metal-48xl 81.42% <37.67%> (-0.18%) ⬇️
5.10-m7g.metal 78.93% <37.67%> (-0.17%) ⬇️
5.10-m7i.metal-24xl 82.07% <37.67%> (-0.18%) ⬇️
5.10-m7i.metal-48xl 82.07% <37.67%> (-0.18%) ⬇️
5.10-m8g.metal-24xl 78.92% <37.67%> (-0.17%) ⬇️
5.10-m8g.metal-48xl 78.92% <37.67%> (-0.17%) ⬇️
5.10-m8i.metal-48xl 82.07% <37.67%> (-0.18%) ⬇️
5.10-m8i.metal-96xl 82.07% <37.67%> (-0.18%) ⬇️
6.1-m5n.metal 82.12% <37.67%> (-0.18%) ⬇️
6.1-m6a.metal 81.45% <37.67%> (-0.19%) ⬇️
6.1-m6g.metal 78.92% <37.67%> (-0.17%) ⬇️
6.1-m6i.metal 82.12% <37.67%> (-0.18%) ⬇️
6.1-m7a.metal-48xl 81.44% <37.67%> (-0.18%) ⬇️
6.1-m7g.metal 78.92% <37.67%> (-0.17%) ⬇️
6.1-m7i.metal-24xl 82.13% <37.67%> (-0.17%) ⬇️
6.1-m7i.metal-48xl 82.13% <37.67%> (-0.18%) ⬇️
6.1-m8g.metal-24xl 78.92% <37.67%> (-0.18%) ⬇️
6.1-m8g.metal-48xl 78.93% <37.67%> (-0.17%) ⬇️
6.1-m8i.metal-48xl 82.13% <37.67%> (-0.18%) ⬇️
6.1-m8i.metal-96xl 82.13% <37.67%> (-0.18%) ⬇️
6.18-m5n.metal 82.12% <37.67%> (-0.17%) ⬇️
6.18-m6a.metal 81.45% <37.67%> (-0.18%) ⬇️
6.18-m6g.metal 78.93% <37.67%> (-0.17%) ⬇️
6.18-m6i.metal 82.12% <37.67%> (-0.17%) ⬇️
6.18-m7a.metal-48xl 81.44% <37.67%> (-0.18%) ⬇️
6.18-m7g.metal 78.92% <37.67%> (-0.18%) ⬇️
6.18-m7i.metal-24xl 82.13% <37.67%> (-0.18%) ⬇️
6.18-m7i.metal-48xl 82.13% <37.67%> (-0.18%) ⬇️
6.18-m8g.metal-24xl 78.92% <37.67%> (-0.17%) ⬇️
6.18-m8g.metal-48xl 78.93% <37.67%> (-0.17%) ⬇️
6.18-m8i.metal-48xl 82.13% <37.67%> (-0.18%) ⬇️
6.18-m8i.metal-96xl 82.13% <37.67%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PierreBertholom
PierreBertholom removed this pull request from stack #6135 September 9, 2026 10:07
@PierreBertholom

Copy link
Copy Markdown
Contributor Author

Folded under #6128 after stack rework

@PierreBertholom
PierreBertholom deleted the pbertho/blk-threaded-05 branch September 9, 2026 10:40
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.

1 participant