mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: fix barrier handling in virtio-blk
When configuring multiple queues for a virtio device, the guest can activate between 1 and the configured amount of queues. The firmware, for example, may activate only one queue, while a Linux guest would likely activate all available queues. The constructor of virtio-blk initializes the `paused_sync` barrier using the configured queue count (plus one for the main thread). This can be wrong if the guest enable a different number of queues at activation time, which can make pause hang. Thus, we now recompute the barrier size from the queues that are actually activated. On-behalf-of: SAP sebastian.eydam@sap.com Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
882f82f04b
commit
5aeb9f55d1
@@ -1087,6 +1087,9 @@ impl VirtioDevice for Block {
|
||||
}
|
||||
self.common.activate(&queues, interrupt_cb.clone())?;
|
||||
|
||||
// Recompute the barrier size from the queues that are actually activated.
|
||||
self.common.paused_sync = Some(Arc::new(Barrier::new(queues.len() + 1)));
|
||||
|
||||
self.update_writeback();
|
||||
|
||||
let mut epoll_threads = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user