* [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop @ 2014-09-11 16:18 Michael S. Tsirkin 2014-09-11 16:18 ` [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" Michael S. Tsirkin 2014-09-12 3:12 ` [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop Jason Wang 0 siblings, 2 replies; 5+ messages in thread From: Michael S. Tsirkin @ 2014-09-11 16:18 UTC (permalink / raw) To: qemu-devel; +Cc: Jason Wang, qemu-stable, Anthony Liguori On vm stop, vm_running state set to stopped before device is notified, so callbacks can get envoked with vm_running = false; and this is not an error. Cc: qemu-stable@nongnu.org Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- hw/net/virtio-net.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 826a2a5..2040eac 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1125,8 +1125,6 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) return num_packets; } - assert(vdev->vm_running); - if (q->async_tx.elem.out_num) { virtio_queue_set_notification(q->tx_vq, 0); return num_packets; -- MST ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" 2014-09-11 16:18 [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop Michael S. Tsirkin @ 2014-09-11 16:18 ` Michael S. Tsirkin 2014-09-12 3:14 ` Jason Wang 2014-09-15 10:37 ` Christian Borntraeger 2014-09-12 3:12 ` [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop Jason Wang 1 sibling, 2 replies; 5+ messages in thread From: Michael S. Tsirkin @ 2014-09-11 16:18 UTC (permalink / raw) To: qemu-devel; +Cc: Jason Wang, qemu-stable, Anthony Liguori, Dietmar Maurer This reverts commit a1bc7b827e422e1ff065640d8ec5347c4aadfcd8. virtio: don't call device on !vm_running It turns out that virtio net assumes that vm_running is updated before device status callback in many places, so this change leads to asserts. Previous commit fixes the root issue that motivated a1bc7b827e422e1ff065640d8ec5347c4aadfcd8 differently, so there's no longer a need for this change. In the future, we might be able to drop checking vm_running completely, and check vm state directly. Reported-by: Dietmar Maurer <dietmar@proxmox.com> Cc: qemu-stable@nongnu.org Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- hw/virtio/virtio.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index ac22238..5c98180 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1108,10 +1108,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK); - - if (running) { - vdev->vm_running = running; - } + vdev->vm_running = running; if (backend_run) { virtio_set_status(vdev, vdev->status); @@ -1124,10 +1121,6 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) if (!backend_run) { virtio_set_status(vdev, vdev->status); } - - if (!running) { - vdev->vm_running = running; - } } void virtio_init(VirtIODevice *vdev, const char *name, -- MST ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" 2014-09-11 16:18 ` [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" Michael S. Tsirkin @ 2014-09-12 3:14 ` Jason Wang 2014-09-15 10:37 ` Christian Borntraeger 1 sibling, 0 replies; 5+ messages in thread From: Jason Wang @ 2014-09-12 3:14 UTC (permalink / raw) To: Michael S. Tsirkin, qemu-devel Cc: qemu-stable, Anthony Liguori, Dietmar Maurer On 09/12/2014 12:18 AM, Michael S. Tsirkin wrote: > This reverts commit a1bc7b827e422e1ff065640d8ec5347c4aadfcd8. > virtio: don't call device on !vm_running > It turns out that virtio net assumes that vm_running > is updated before device status callback in many places, > so this change leads to asserts. > Previous commit fixes the root issue that motivated > a1bc7b827e422e1ff065640d8ec5347c4aadfcd8 differently, > so there's no longer a need for this change. > > In the future, we might be able to drop checking vm_running > completely, and check vm state directly. Acked-by: Jason Wang <jasowang@redhat.com> > Reported-by: Dietmar Maurer <dietmar@proxmox.com> > Cc: qemu-stable@nongnu.org > Cc: Jason Wang <jasowang@redhat.com> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > hw/virtio/virtio.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index ac22238..5c98180 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -1108,10 +1108,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) > BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); > VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK); > - > - if (running) { > - vdev->vm_running = running; > - } > + vdev->vm_running = running; > > if (backend_run) { > virtio_set_status(vdev, vdev->status); > @@ -1124,10 +1121,6 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) > if (!backend_run) { > virtio_set_status(vdev, vdev->status); > } > - > - if (!running) { > - vdev->vm_running = running; > - } > } > > void virtio_init(VirtIODevice *vdev, const char *name, ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" 2014-09-11 16:18 ` [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" Michael S. Tsirkin 2014-09-12 3:14 ` Jason Wang @ 2014-09-15 10:37 ` Christian Borntraeger 1 sibling, 0 replies; 5+ messages in thread From: Christian Borntraeger @ 2014-09-15 10:37 UTC (permalink / raw) To: Michael S. Tsirkin, qemu-devel Cc: Jason Wang, qemu-stable, Anthony Liguori, Dietmar Maurer On 09/11/2014 06:18 PM, Michael S. Tsirkin wrote: > This reverts commit a1bc7b827e422e1ff065640d8ec5347c4aadfcd8. > virtio: don't call device on !vm_running > It turns out that virtio net assumes that vm_running > is updated before device status callback in many places, > so this change leads to asserts. > Previous commit fixes the root issue that motivated > a1bc7b827e422e1ff065640d8ec5347c4aadfcd8 differently, > so there's no longer a need for this change. > > In the future, we might be able to drop checking vm_running > completely, and check vm state directly. > > Reported-by: Dietmar Maurer <dietmar@proxmox.com> > Cc: qemu-stable@nongnu.org > Cc: Jason Wang <jasowang@redhat.com> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > hw/virtio/virtio.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index ac22238..5c98180 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -1108,10 +1108,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) > BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); > VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK); > - > - if (running) { > - vdev->vm_running = running; > - } > + vdev->vm_running = running; > > if (backend_run) { > virtio_set_status(vdev, vdev->status); > @@ -1124,10 +1121,6 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) > if (!backend_run) { > virtio_set_status(vdev, vdev->status); > } > - > - if (!running) { > - vdev->vm_running = running; > - } > } > > void virtio_init(VirtIODevice *vdev, const char *name, > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop 2014-09-11 16:18 [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop Michael S. Tsirkin 2014-09-11 16:18 ` [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" Michael S. Tsirkin @ 2014-09-12 3:12 ` Jason Wang 1 sibling, 0 replies; 5+ messages in thread From: Jason Wang @ 2014-09-12 3:12 UTC (permalink / raw) To: Michael S. Tsirkin, qemu-devel; +Cc: qemu-stable, Anthony Liguori On 09/12/2014 12:18 AM, Michael S. Tsirkin wrote: > On vm stop, vm_running state set to stopped > before device is notified, so callbacks can get envoked with > vm_running = false; and this is not an error. This is consistent with virtio-blk which also has such kinds of callbacks. This fixes the issue of qemu crashing when stop during transmission. Acked-by: Jason Wang <jasowang@redhat.com> > Cc: qemu-stable@nongnu.org > Cc: Jason Wang <jasowang@redhat.com> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > hw/net/virtio-net.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 826a2a5..2040eac 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -1125,8 +1125,6 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) > return num_packets; > } > > - assert(vdev->vm_running); > - > if (q->async_tx.elem.out_num) { > virtio_queue_set_notification(q->tx_vq, 0); > return num_packets; ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-15 10:37 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-09-11 16:18 [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop Michael S. Tsirkin 2014-09-11 16:18 ` [Qemu-devel] [PATCH 2/2] Revert "virtio: don't call device on !vm_running" Michael S. Tsirkin 2014-09-12 3:14 ` Jason Wang 2014-09-15 10:37 ` Christian Borntraeger 2014-09-12 3:12 ` [Qemu-devel] [PATCH 1/2] virtio-net: drop assert on vm stop Jason Wang
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.