[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/2] virtio: add missing region cache init in

From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH v2 2/2] virtio: add missing region cache init in virtio_load()
Date: Mon, 27 Feb 2017 15:06:01 +0100

On Wed, 22 Feb 2017 16:37:34 +0000
Stefan Hajnoczi <address@hidden> wrote:

> Commit 97cd965c070152bc626c7507df9fb356bbe1cd81 ("virtio: use
> VRingMemoryRegionCaches for avail and used rings") switched to a memory
> region cache to avoid repeated map/unmap operations.
> The virtio_load() process is a little tricky because vring addresses are
> serialized in two separate places.  VIRTIO 1.0 devices serialize desc
> and then a subsection with used and avail.  Legacy devices only
> serialize desc.
> Live migration of VIRTIO 1.0 devices fails on the destination host with:
>   VQ 0 size 0x80 < last_avail_idx 0x12f8 - used_idx 0x0
>   Failed to load virtio-blk:virtio
>   error while loading state for instance 0x0 of device 
> '0000:00:04.0/virtio-blk'
> This happens because the memory region cache is only initialized after
> desc is loaded and not after the used and avail subsection is loaded.
> If the guest chose memory addresses that don't match the legacy ring
> layout then the wrong guest memory location is accessed.
> Wait until all ring addresses are known before trying to initialize the
> region cache.  Also clarify the incomplete comment about VIRTIO-1 ring
> address subsection.
> Cc: Dr. David Alan Gilbert <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  hw/virtio/virtio.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)

Reviewed-by: Cornelia Huck <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]