* [Qemu-devel] [PATCH] virtio: don't call device on !vm_running
@ 2014-09-04 10:32 Michael S. Tsirkin
2014-09-04 13:37 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2014-09-04 10:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Jason Wang, qemu-stable, Anthony Liguori
On vm stop, virtio changes vm_running state
too soon, so callbacks can get envoked with
vm_running = false;
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, 8 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5c98180..ac22238 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1108,7 +1108,10 @@ 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);
- vdev->vm_running = running;
+
+ if (running) {
+ vdev->vm_running = running;
+ }
if (backend_run) {
virtio_set_status(vdev, vdev->status);
@@ -1121,6 +1124,10 @@ 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] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: don't call device on !vm_running
2014-09-04 10:32 [Qemu-devel] [PATCH] virtio: don't call device on !vm_running Michael S. Tsirkin
@ 2014-09-04 13:37 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2014-09-04 13:37 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Jason Wang, qemu-devel, Anthony Liguori, qemu-stable
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
On Thu, Sep 04, 2014 at 01:32:54PM +0300, Michael S. Tsirkin wrote:
> On vm stop, virtio changes vm_running state
> too soon, so callbacks can get envoked with
> vm_running = false;
>
> 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, 8 insertions(+), 1 deletion(-)
Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-04 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 10:32 [Qemu-devel] [PATCH] virtio: don't call device on !vm_running Michael S. Tsirkin
2014-09-04 13:37 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).