From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio: correctly initialize vm_running
Date: Wed, 18 May 2011 11:54:40 +0300 [thread overview]
Message-ID: <20110518085440.GI7589@redhat.com> (raw)
In-Reply-To: <20110518055737.10458.65866.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com>
On Wed, May 18, 2011 at 01:57:37PM +0800, Jason Wang wrote:
> Current vm_running was not explicitly initialized and its value was changed by
> vm state notifier, this may confuse the virtio device being hotplugged such as
> virtio-net with vhost backend as it may think the vm was not running. Solve this
> by initialize this value explicitly in virtio_common_init().
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
I think a slightly cleaner way would be to invoke
virtio_vmstate_change after it is registered,
have that update the vm_running field.
> ---
> 0 files changed, 0 insertions(+), 0 deletions(-)
>
> diff --git a/hw/virtio.c b/hw/virtio.c
> index 6e8814c..27d7e50 100644
> --- a/hw/virtio.c
> +++ b/hw/virtio.c
> @@ -789,6 +789,7 @@ VirtIODevice *virtio_common_init(const char *name, uint16_t device_id,
> vdev->queue_sel = 0;
> vdev->config_vector = VIRTIO_NO_VECTOR;
> vdev->vq = qemu_mallocz(sizeof(VirtQueue) * VIRTIO_PCI_QUEUE_MAX);
> + vdev->vm_running = vm_running;
> for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
> vdev->vq[i].vector = VIRTIO_NO_VECTOR;
> vdev->vq[i].vdev = vdev;
next prev parent reply other threads:[~2011-05-18 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-18 5:57 [Qemu-devel] [PATCH] virtio: correctly initialize vm_running Jason Wang
2011-05-18 8:54 ` Michael S. Tsirkin [this message]
2011-05-23 5:57 ` Jason Wang
2011-05-23 11:01 ` Michael S. Tsirkin
2011-06-01 9:55 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110518085440.GI7589@redhat.com \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.