mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vm-virtio: Restore queues based on used index
On the restore path, using the available and used indexes read from memory to fill the Queue structure was a mistake. Indeed, the available index is written from the guest and it reflects the last available index in the descriptor table. But the driver might have queued a lot of buffers which have not yet been used by the device. This leads to a situation where the next_avail from Queue is completely different from the one we can read from memory. Instead, the right way to determine the next_avail index that should be used by the device is by relying on the used index from the memory. This index represents the correct information we're looking for as it has been updated before the snapshot to let the guest know the next index to process. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
cf707da1a8
commit
03dd24978e
@ -175,7 +175,7 @@ impl MmioDevice {
|
||||
for queue in self.queues.iter_mut() {
|
||||
queue.next_avail = Wrapping(
|
||||
queue
|
||||
.avail_index_from_memory(&mem)
|
||||
.used_index_from_memory(&mem)
|
||||
.map_err(Error::QueueRingIndex)?,
|
||||
);
|
||||
queue.next_used = Wrapping(
|
||||
|
Loading…
x
Reference in New Issue
Block a user