All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
@ 2016-08-15 12:54 Stefan Hajnoczi
  2016-08-15 12:54 ` [Qemu-devel] [PATCH 1/2] virtio: recalculate vq->inuse after migration Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2016-08-15 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Cornelia Huck, Fam Zheng, Stefan Hajnoczi

The VirtQueue->inuse field is not always updated correctly.  These patches fix
it.

Originally this series was called "virtio-balloon: fix stats vq migration" but
Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating guest
memory status".  I dropped the virtio-balloon patches.

Changes from previous series:
 * Missing comma in error formatting [Fam]
 * virtio_descard() -> virtio_discard() [Michael]
 * Multi-line comment style [Cornelia]

Stefan Hajnoczi (2):
  virtio: recalculate vq->inuse after migration
  virtio: decrement vq->inuse in virtqueue_discard()

 hw/virtio/virtio.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 1/2] virtio: recalculate vq->inuse after migration
  2016-08-15 12:54 [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
@ 2016-08-15 12:54 ` Stefan Hajnoczi
  2016-08-15 12:54 ` [Qemu-devel] [PATCH 2/2] virtio: decrement vq->inuse in virtqueue_discard() Stefan Hajnoczi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2016-08-15 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Cornelia Huck, Fam Zheng, Stefan Hajnoczi

The vq->inuse field is not migrated.  Many devices don't hold
VirtQueueElements across migration so it doesn't matter that vq->inuse
starts at 0 on the destination QEMU.

At least virtio-serial, virtio-blk, and virtio-balloon migrate while
holding VirtQueueElements.  For these devices we need to recalculate
vq->inuse upon load so the value is correct.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/virtio/virtio.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 15ee3a7..6105c6e 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1648,6 +1648,21 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
             }
             vdev->vq[i].used_idx = vring_used_idx(&vdev->vq[i]);
             vdev->vq[i].shadow_avail_idx = vring_avail_idx(&vdev->vq[i]);
+
+            /*
+             * Some devices migrate VirtQueueElements that have been popped
+             * from the avail ring but not yet returned to the used ring.
+             */
+            vdev->vq[i].inuse = vdev->vq[i].last_avail_idx -
+                                vdev->vq[i].used_idx;
+            if (vdev->vq[i].inuse > vdev->vq[i].vring.num) {
+                error_report("VQ %d size 0x%x < last_avail_idx 0x%x - "
+                             "used_idx 0x%x",
+                             i, vdev->vq[i].vring.num,
+                             vdev->vq[i].last_avail_idx,
+                             vdev->vq[i].used_idx);
+                return -1;
+            }
         }
     }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 2/2] virtio: decrement vq->inuse in virtqueue_discard()
  2016-08-15 12:54 [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
  2016-08-15 12:54 ` [Qemu-devel] [PATCH 1/2] virtio: recalculate vq->inuse after migration Stefan Hajnoczi
@ 2016-08-15 12:54 ` Stefan Hajnoczi
  2016-08-17 13:58 ` [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
  2016-08-22 14:00 ` [Qemu-devel] " Denis V. Lunev
  3 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2016-08-15 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Cornelia Huck, Fam Zheng, Stefan Hajnoczi

virtqueue_discard() moves vq->last_avail_idx back so the element can be
popped again.  It's necessary to decrement vq->inuse to avoid "leaking"
the element count.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/virtio/virtio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6105c6e..74c085c 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -268,6 +268,7 @@ void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
                        unsigned int len)
 {
     vq->last_avail_idx--;
+    vq->inuse--;
     virtqueue_unmap_sg(vq, elem, len);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-15 12:54 [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
  2016-08-15 12:54 ` [Qemu-devel] [PATCH 1/2] virtio: recalculate vq->inuse after migration Stefan Hajnoczi
  2016-08-15 12:54 ` [Qemu-devel] [PATCH 2/2] virtio: decrement vq->inuse in virtqueue_discard() Stefan Hajnoczi
@ 2016-08-17 13:58 ` Stefan Hajnoczi
  2016-08-23  6:49   ` [Qemu-devel] [Qemu-stable] " Peter Lieven
  2016-08-22 14:00 ` [Qemu-devel] " Denis V. Lunev
  3 siblings, 1 reply; 12+ messages in thread
From: Stefan Hajnoczi @ 2016-08-17 13:58 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-devel, Cornelia Huck, Fam Zheng, Michael S. Tsirkin,
	qemu-stable, Peter Maydell, marc.deslauriers

[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]

On Mon, Aug 15, 2016 at 01:54:14PM +0100, Stefan Hajnoczi wrote:
> The VirtQueue->inuse field is not always updated correctly.  These patches fix
> it.
> 
> Originally this series was called "virtio-balloon: fix stats vq migration" but
> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating guest
> memory status".  I dropped the virtio-balloon patches.
> 
> Changes from previous series:
>  * Missing comma in error formatting [Fam]
>  * virtio_descard() -> virtio_discard() [Michael]
>  * Multi-line comment style [Cornelia]
> 
> Stefan Hajnoczi (2):
>   virtio: recalculate vq->inuse after migration
>   virtio: decrement vq->inuse in virtqueue_discard()
> 
>  hw/virtio/virtio.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

I should mention this is for QEMU 2.7.  These fixes are needed if the
CVE-2016-5403 patch has been applied.

Without these patches any device that holds VirtQueueElements across
live migration will terminate with a "Virtqueue size exceeded" error
message.  virtio-balloon and virtio-scsi are affected.  virtio-blk
probably too but I haven't tested it.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-15 12:54 [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2016-08-17 13:58 ` [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
@ 2016-08-22 14:00 ` Denis V. Lunev
  2016-08-22 18:23   ` Denis V. Lunev
  2016-08-30 19:54   ` Stefan Hajnoczi
  3 siblings, 2 replies; 12+ messages in thread
From: Denis V. Lunev @ 2016-08-22 14:00 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Cornelia Huck, Fam Zheng, Michael S. Tsirkin

On 08/15/2016 08:54 AM, Stefan Hajnoczi wrote:
> The VirtQueue->inuse field is not always updated correctly.  These patches fix
> it.
>
> Originally this series was called "virtio-balloon: fix stats vq migration" but
> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating guest
> memory status".  I dropped the virtio-balloon patches.
>
> Changes from previous series:
>   * Missing comma in error formatting [Fam]
>   * virtio_descard() -> virtio_discard() [Michael]
>   * Multi-line comment style [Cornelia]
>
> Stefan Hajnoczi (2):
>    virtio: recalculate vq->inuse after migration
>    virtio: decrement vq->inuse in virtqueue_discard()
>
>   hw/virtio/virtio.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
>
these patches break 'make check' with the following:

GTESTER check-qtest-x86_64
Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
qemu-system-x86_64: VQ 1 size 0x100 < last_avail_idx 0x0 - used_idx 0x1
qemu-system-x86_64: error while loading state for instance 0x0 of device 
'0000:00:03.0/virtio-net'
qemu-system-x86_64: load of migration failed: Operation not permitted
Broken pipe
qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12. 
Original request 11.
GTester: last random seed: R02S122f07a3fc35cfd5b0204e3eb45c61e6
qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12. 
Original request 11.
Warning: path not on HugeTLBFS: /tmp/vhost-test-60WtDz
blkdebug: Suspended request 'A'
blkdebug: Resuming request 'A'
main-loop: WARNING: I/O thread spun for 1000 iterations
main-loop: WARNING: I/O thread spun for 1000 iterations
/home/den/src/git/qemu/tests/Makefile:400: recipe for target 
'check-qtest-x86_64' failed
make: *** [check-qtest-x86_64] Error 1
iris ~/src/git/qemu $

Sorry, if I have missed the fix in the list.

Den

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-22 14:00 ` [Qemu-devel] " Denis V. Lunev
@ 2016-08-22 18:23   ` Denis V. Lunev
  2016-08-30 19:54   ` Stefan Hajnoczi
  1 sibling, 0 replies; 12+ messages in thread
From: Denis V. Lunev @ 2016-08-22 18:23 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Cornelia Huck, Fam Zheng, Michael S. Tsirkin

On 08/22/2016 10:00 AM, Denis V. Lunev wrote:
> On 08/15/2016 08:54 AM, Stefan Hajnoczi wrote:
>> The VirtQueue->inuse field is not always updated correctly.  These 
>> patches fix
>> it.
>>
>> Originally this series was called "virtio-balloon: fix stats vq 
>> migration" but
>> Ladi Prosek posted a nicer fix called "balloon: Fix failure of 
>> updating guest
>> memory status".  I dropped the virtio-balloon patches.
>>
>> Changes from previous series:
>>   * Missing comma in error formatting [Fam]
>>   * virtio_descard() -> virtio_discard() [Michael]
>>   * Multi-line comment style [Cornelia]
>>
>> Stefan Hajnoczi (2):
>>    virtio: recalculate vq->inuse after migration
>>    virtio: decrement vq->inuse in virtqueue_discard()
>>
>>   hw/virtio/virtio.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
> these patches break 'make check' with the following:
>
> GTESTER check-qtest-x86_64
> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> qemu-system-x86_64: VQ 1 size 0x100 < last_avail_idx 0x0 - used_idx 0x1
> qemu-system-x86_64: error while loading state for instance 0x0 of 
> device '0000:00:03.0/virtio-net'
> qemu-system-x86_64: load of migration failed: Operation not permitted
> Broken pipe
> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12. 
> Original request 11.
> GTester: last random seed: R02S122f07a3fc35cfd5b0204e3eb45c61e6
> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12. 
> Original request 11.
> Warning: path not on HugeTLBFS: /tmp/vhost-test-60WtDz
> blkdebug: Suspended request 'A'
> blkdebug: Resuming request 'A'
> main-loop: WARNING: I/O thread spun for 1000 iterations
> main-loop: WARNING: I/O thread spun for 1000 iterations
> /home/den/src/git/qemu/tests/Makefile:400: recipe for target 
> 'check-qtest-x86_64' failed
> make: *** [check-qtest-x86_64] Error 1
> iris ~/src/git/qemu $
>
> Sorry, if I have missed the fix in the list.
>
> Den
>
VERY sorry, pls disregard. This is my mistake :(

Den

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-stable] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-17 13:58 ` [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
@ 2016-08-23  6:49   ` Peter Lieven
  2016-08-23 15:57     ` Stefan Hajnoczi
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Lieven @ 2016-08-23  6:49 UTC (permalink / raw)
  To: Stefan Hajnoczi, Stefan Hajnoczi
  Cc: Peter Maydell, Michael S. Tsirkin, qemu-stable, qemu-devel,
	Cornelia Huck, marc.deslauriers

Am 17.08.2016 um 15:58 schrieb Stefan Hajnoczi:
> On Mon, Aug 15, 2016 at 01:54:14PM +0100, Stefan Hajnoczi wrote:
>> The VirtQueue->inuse field is not always updated correctly.  These patches fix
>> it.
>>
>> Originally this series was called "virtio-balloon: fix stats vq migration" but
>> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating guest
>> memory status".  I dropped the virtio-balloon patches.
>>
>> Changes from previous series:
>>   * Missing comma in error formatting [Fam]
>>   * virtio_descard() -> virtio_discard() [Michael]
>>   * Multi-line comment style [Cornelia]
>>
>> Stefan Hajnoczi (2):
>>    virtio: recalculate vq->inuse after migration
>>    virtio: decrement vq->inuse in virtqueue_discard()
>>
>>   hw/virtio/virtio.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
> I should mention this is for QEMU 2.7.  These fixes are needed if the
> CVE-2016-5403 patch has been applied.
>
> Without these patches any device that holds VirtQueueElements across
> live migration will terminate with a "Virtqueue size exceeded" error
> message.  virtio-balloon and virtio-scsi are affected.  virtio-blk
> probably too but I haven't tested it.
>
> Stefan

I noticed that these patches are not in master yet and therefore
not included in the 2.7.0-rc4 tagges yesterday. Is there any issue with them?

Peter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-stable] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-23  6:49   ` [Qemu-devel] [Qemu-stable] " Peter Lieven
@ 2016-08-23 15:57     ` Stefan Hajnoczi
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2016-08-23 15:57 UTC (permalink / raw)
  To: Peter Lieven
  Cc: Stefan Hajnoczi, Peter Maydell, Michael S. Tsirkin, qemu-stable,
	qemu-devel, Cornelia Huck, marc.deslauriers

[-- Attachment #1: Type: text/plain, Size: 1625 bytes --]

On Tue, Aug 23, 2016 at 08:49:35AM +0200, Peter Lieven wrote:
> Am 17.08.2016 um 15:58 schrieb Stefan Hajnoczi:
> > On Mon, Aug 15, 2016 at 01:54:14PM +0100, Stefan Hajnoczi wrote:
> > > The VirtQueue->inuse field is not always updated correctly.  These patches fix
> > > it.
> > > 
> > > Originally this series was called "virtio-balloon: fix stats vq migration" but
> > > Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating guest
> > > memory status".  I dropped the virtio-balloon patches.
> > > 
> > > Changes from previous series:
> > >   * Missing comma in error formatting [Fam]
> > >   * virtio_descard() -> virtio_discard() [Michael]
> > >   * Multi-line comment style [Cornelia]
> > > 
> > > Stefan Hajnoczi (2):
> > >    virtio: recalculate vq->inuse after migration
> > >    virtio: decrement vq->inuse in virtqueue_discard()
> > > 
> > >   hw/virtio/virtio.c | 16 ++++++++++++++++
> > >   1 file changed, 16 insertions(+)
> > I should mention this is for QEMU 2.7.  These fixes are needed if the
> > CVE-2016-5403 patch has been applied.
> > 
> > Without these patches any device that holds VirtQueueElements across
> > live migration will terminate with a "Virtqueue size exceeded" error
> > message.  virtio-balloon and virtio-scsi are affected.  virtio-blk
> > probably too but I haven't tested it.
> > 
> > Stefan
> 
> I noticed that these patches are not in master yet and therefore
> not included in the 2.7.0-rc4 tagges yesterday. Is there any issue with them?

I think Michael Tsirkin is offline.  This series is waiting on him to
merge.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-22 14:00 ` [Qemu-devel] " Denis V. Lunev
  2016-08-22 18:23   ` Denis V. Lunev
@ 2016-08-30 19:54   ` Stefan Hajnoczi
  2016-08-30 20:02     ` Denis V. Lunev
                       ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2016-08-30 19:54 UTC (permalink / raw)
  To: Denis V. Lunev, Roman Kagan
  Cc: Stefan Hajnoczi, qemu-devel, Cornelia Huck, Fam Zheng,
	Michael S. Tsirkin

On Mon, Aug 22, 2016 at 10:00 AM, Denis V. Lunev
<den-lists@virtuozzo.com> wrote:
> On 08/15/2016 08:54 AM, Stefan Hajnoczi wrote:
>>
>> The VirtQueue->inuse field is not always updated correctly.  These patches
>> fix
>> it.
>>
>> Originally this series was called "virtio-balloon: fix stats vq migration"
>> but
>> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating
>> guest
>> memory status".  I dropped the virtio-balloon patches.
>>
>> Changes from previous series:
>>   * Missing comma in error formatting [Fam]
>>   * virtio_descard() -> virtio_discard() [Michael]
>>   * Multi-line comment style [Cornelia]
>>
>> Stefan Hajnoczi (2):
>>    virtio: recalculate vq->inuse after migration
>>    virtio: decrement vq->inuse in virtqueue_discard()
>>
>>   hw/virtio/virtio.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
> these patches break 'make check' with the following:
>
> GTESTER check-qtest-x86_64
> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> qemu-system-x86_64: VQ 1 size 0x100 < last_avail_idx 0x0 - used_idx 0x1
> qemu-system-x86_64: error while loading state for instance 0x0 of device
> '0000:00:03.0/virtio-net'
> qemu-system-x86_64: load of migration failed: Operation not permitted
> Broken pipe
> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
> Original request 11.
> GTester: last random seed: R02S122f07a3fc35cfd5b0204e3eb45c61e6
> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
> Original request 11.
> Warning: path not on HugeTLBFS: /tmp/vhost-test-60WtDz
> blkdebug: Suspended request 'A'
> blkdebug: Resuming request 'A'
> main-loop: WARNING: I/O thread spun for 1000 iterations
> main-loop: WARNING: I/O thread spun for 1000 iterations
> /home/den/src/git/qemu/tests/Makefile:400: recipe for target
> 'check-qtest-x86_64' failed
> make: *** [check-qtest-x86_64] Error 1
> iris ~/src/git/qemu $
>
> Sorry, if I have missed the fix in the list.

I hit this issue when backporting to a QEMU 2.3-based source tree.
This doesn't happen in qemu.git/master.

To save anyone doing a backport a lot of time:

If you enable vhost-user-test in a QEMU 2.3-based source tree with the
migration test case, make sure you also backport
8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate
ioeventfd").

Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-30 19:54   ` Stefan Hajnoczi
@ 2016-08-30 20:02     ` Denis V. Lunev
  2016-08-31  9:25     ` Roman Kagan
  2016-08-31 17:06     ` Denis V. Lunev
  2 siblings, 0 replies; 12+ messages in thread
From: Denis V. Lunev @ 2016-08-30 20:02 UTC (permalink / raw)
  To: Stefan Hajnoczi, Roman Kagan
  Cc: Stefan Hajnoczi, qemu-devel, Cornelia Huck, Fam Zheng,
	Michael S. Tsirkin

On 08/30/2016 10:54 PM, Stefan Hajnoczi wrote:
> On Mon, Aug 22, 2016 at 10:00 AM, Denis V. Lunev
> <den-lists@virtuozzo.com> wrote:
>> On 08/15/2016 08:54 AM, Stefan Hajnoczi wrote:
>>> The VirtQueue->inuse field is not always updated correctly.  These patches
>>> fix
>>> it.
>>>
>>> Originally this series was called "virtio-balloon: fix stats vq migration"
>>> but
>>> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating
>>> guest
>>> memory status".  I dropped the virtio-balloon patches.
>>>
>>> Changes from previous series:
>>>   * Missing comma in error formatting [Fam]
>>>   * virtio_descard() -> virtio_discard() [Michael]
>>>   * Multi-line comment style [Cornelia]
>>>
>>> Stefan Hajnoczi (2):
>>>    virtio: recalculate vq->inuse after migration
>>>    virtio: decrement vq->inuse in virtqueue_discard()
>>>
>>>   hw/virtio/virtio.c | 16 ++++++++++++++++
>>>   1 file changed, 16 insertions(+)
>>>
>> these patches break 'make check' with the following:
>>
>> GTESTER check-qtest-x86_64
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
>> qemu-system-x86_64: VQ 1 size 0x100 < last_avail_idx 0x0 - used_idx 0x1
>> qemu-system-x86_64: error while loading state for instance 0x0 of device
>> '0000:00:03.0/virtio-net'
>> qemu-system-x86_64: load of migration failed: Operation not permitted
>> Broken pipe
>> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
>> Original request 11.
>> GTester: last random seed: R02S122f07a3fc35cfd5b0204e3eb45c61e6
>> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
>> Original request 11.
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-60WtDz
>> blkdebug: Suspended request 'A'
>> blkdebug: Resuming request 'A'
>> main-loop: WARNING: I/O thread spun for 1000 iterations
>> main-loop: WARNING: I/O thread spun for 1000 iterations
>> /home/den/src/git/qemu/tests/Makefile:400: recipe for target
>> 'check-qtest-x86_64' failed
>> make: *** [check-qtest-x86_64] Error 1
>> iris ~/src/git/qemu $
>>
>> Sorry, if I have missed the fix in the list.
> I hit this issue when backporting to a QEMU 2.3-based source tree.
> This doesn't happen in qemu.git/master.
>
> To save anyone doing a backport a lot of time:
>
> If you enable vhost-user-test in a QEMU 2.3-based source tree with the
> migration test case, make sure you also backport
> 8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate
> ioeventfd").
>
> Stefan
thanks a lot! We will give this a try tomorrow.

Den

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-30 19:54   ` Stefan Hajnoczi
  2016-08-30 20:02     ` Denis V. Lunev
@ 2016-08-31  9:25     ` Roman Kagan
  2016-08-31 17:06     ` Denis V. Lunev
  2 siblings, 0 replies; 12+ messages in thread
From: Roman Kagan @ 2016-08-31  9:25 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Denis V. Lunev, Stefan Hajnoczi, qemu-devel, Cornelia Huck,
	Fam Zheng, Michael S. Tsirkin

On Tue, Aug 30, 2016 at 03:54:39PM -0400, Stefan Hajnoczi wrote:
> On Mon, Aug 22, 2016 at 10:00 AM, Denis V. Lunev
> <den-lists@virtuozzo.com> wrote:
> > On 08/15/2016 08:54 AM, Stefan Hajnoczi wrote:
> >>
> >> The VirtQueue->inuse field is not always updated correctly.  These patches
> >> fix
> >> it.
> >>
> >> Originally this series was called "virtio-balloon: fix stats vq migration"
> >> but
> >> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating
> >> guest
> >> memory status".  I dropped the virtio-balloon patches.
> >>
> >> Changes from previous series:
> >>   * Missing comma in error formatting [Fam]
> >>   * virtio_descard() -> virtio_discard() [Michael]
> >>   * Multi-line comment style [Cornelia]
> >>
> >> Stefan Hajnoczi (2):
> >>    virtio: recalculate vq->inuse after migration
> >>    virtio: decrement vq->inuse in virtqueue_discard()
> >>
> >>   hw/virtio/virtio.c | 16 ++++++++++++++++
> >>   1 file changed, 16 insertions(+)
> >>
> > these patches break 'make check' with the following:
> >
> > GTESTER check-qtest-x86_64
> > Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> > Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> > Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
> > qemu-system-x86_64: VQ 1 size 0x100 < last_avail_idx 0x0 - used_idx 0x1
> > qemu-system-x86_64: error while loading state for instance 0x0 of device
> > '0000:00:03.0/virtio-net'
> > qemu-system-x86_64: load of migration failed: Operation not permitted
> > Broken pipe
> > qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
> > Original request 11.
> > GTester: last random seed: R02S122f07a3fc35cfd5b0204e3eb45c61e6
> > qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
> > Original request 11.
> > Warning: path not on HugeTLBFS: /tmp/vhost-test-60WtDz
> > blkdebug: Suspended request 'A'
> > blkdebug: Resuming request 'A'
> > main-loop: WARNING: I/O thread spun for 1000 iterations
> > main-loop: WARNING: I/O thread spun for 1000 iterations
> > /home/den/src/git/qemu/tests/Makefile:400: recipe for target
> > 'check-qtest-x86_64' failed
> > make: *** [check-qtest-x86_64] Error 1
> > iris ~/src/git/qemu $
> >
> > Sorry, if I have missed the fix in the list.
> 
> I hit this issue when backporting to a QEMU 2.3-based source tree.
> This doesn't happen in qemu.git/master.
> 
> To save anyone doing a backport a lot of time:
> 
> If you enable vhost-user-test in a QEMU 2.3-based source tree with the
> migration test case, make sure you also backport
> 8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate
> ioeventfd").

That did it, thanks!

Roman.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field
  2016-08-30 19:54   ` Stefan Hajnoczi
  2016-08-30 20:02     ` Denis V. Lunev
  2016-08-31  9:25     ` Roman Kagan
@ 2016-08-31 17:06     ` Denis V. Lunev
  2 siblings, 0 replies; 12+ messages in thread
From: Denis V. Lunev @ 2016-08-31 17:06 UTC (permalink / raw)
  To: Stefan Hajnoczi, Roman Kagan
  Cc: Stefan Hajnoczi, qemu-devel, Cornelia Huck, Fam Zheng,
	Michael S. Tsirkin

On 08/30/2016 10:54 PM, Stefan Hajnoczi wrote:
> On Mon, Aug 22, 2016 at 10:00 AM, Denis V. Lunev
> <den-lists@virtuozzo.com> wrote:
>> On 08/15/2016 08:54 AM, Stefan Hajnoczi wrote:
>>> The VirtQueue->inuse field is not always updated correctly.  These patches
>>> fix
>>> it.
>>>
>>> Originally this series was called "virtio-balloon: fix stats vq migration"
>>> but
>>> Ladi Prosek posted a nicer fix called "balloon: Fix failure of updating
>>> guest
>>> memory status".  I dropped the virtio-balloon patches.
>>>
>>> Changes from previous series:
>>>   * Missing comma in error formatting [Fam]
>>>   * virtio_descard() -> virtio_discard() [Michael]
>>>   * Multi-line comment style [Cornelia]
>>>
>>> Stefan Hajnoczi (2):
>>>    virtio: recalculate vq->inuse after migration
>>>    virtio: decrement vq->inuse in virtqueue_discard()
>>>
>>>   hw/virtio/virtio.c | 16 ++++++++++++++++
>>>   1 file changed, 16 insertions(+)
>>>
>> these patches break 'make check' with the following:
>>
>> GTESTER check-qtest-x86_64
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-hRYeTb
>> qemu-system-x86_64: VQ 1 size 0x100 < last_avail_idx 0x0 - used_idx 0x1
>> qemu-system-x86_64: error while loading state for instance 0x0 of device
>> '0000:00:03.0/virtio-net'
>> qemu-system-x86_64: load of migration failed: Operation not permitted
>> Broken pipe
>> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
>> Original request 11.
>> GTester: last random seed: R02S122f07a3fc35cfd5b0204e3eb45c61e6
>> qemu-system-x86_64: Failed to read msg header. Read 0 instead of 12.
>> Original request 11.
>> Warning: path not on HugeTLBFS: /tmp/vhost-test-60WtDz
>> blkdebug: Suspended request 'A'
>> blkdebug: Resuming request 'A'
>> main-loop: WARNING: I/O thread spun for 1000 iterations
>> main-loop: WARNING: I/O thread spun for 1000 iterations
>> /home/den/src/git/qemu/tests/Makefile:400: recipe for target
>> 'check-qtest-x86_64' failed
>> make: *** [check-qtest-x86_64] Error 1
>> iris ~/src/git/qemu $
>>
>> Sorry, if I have missed the fix in the list.
> I hit this issue when backporting to a QEMU 2.3-based source tree.
> This doesn't happen in qemu.git/master.
>
> To save anyone doing a backport a lot of time:
>
> If you enable vhost-user-test in a QEMU 2.3-based source tree with the
> migration test case, make sure you also backport
> 8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate
> ioeventfd").
>
> Stefan
and, in addition to this, 4eae2a657d1ff5ada56eb9b4966eae0eff333b0b is
also necessary.
Without it scenario with suspend/resume after guest reboot fails.

Thank you Roma for this finding.

Den

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-08-31 17:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15 12:54 [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
2016-08-15 12:54 ` [Qemu-devel] [PATCH 1/2] virtio: recalculate vq->inuse after migration Stefan Hajnoczi
2016-08-15 12:54 ` [Qemu-devel] [PATCH 2/2] virtio: decrement vq->inuse in virtqueue_discard() Stefan Hajnoczi
2016-08-17 13:58 ` [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
2016-08-23  6:49   ` [Qemu-devel] [Qemu-stable] " Peter Lieven
2016-08-23 15:57     ` Stefan Hajnoczi
2016-08-22 14:00 ` [Qemu-devel] " Denis V. Lunev
2016-08-22 18:23   ` Denis V. Lunev
2016-08-30 19:54   ` Stefan Hajnoczi
2016-08-30 20:02     ` Denis V. Lunev
2016-08-31  9:25     ` Roman Kagan
2016-08-31 17:06     ` Denis V. Lunev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.