From patchwork Wed May 18 05:57:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 96135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 548B4B6F59 for ; Wed, 18 May 2011 17:51:18 +1000 (EST) Received: from localhost ([::1]:53229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMZkE-00058P-Rw for incoming@patchwork.ozlabs.org; Wed, 18 May 2011 01:56:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMZk4-00058I-3o for qemu-devel@nongnu.org; Wed, 18 May 2011 01:56:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMZk3-000614-Ck for qemu-devel@nongnu.org; Wed, 18 May 2011 01:56:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMZk3-000601-5i for qemu-devel@nongnu.org; Wed, 18 May 2011 01:56:19 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4I5uHUd000838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 18 May 2011 01:56:17 -0400 Received: from dhcp-91-7.nay.redhat.com.englab.nay.redhat.com (dhcp-8-146.nay.redhat.com [10.66.8.146]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4I5uFiT005590; Wed, 18 May 2011 01:56:16 -0400 To: qemu-devel@nongnu.org, mst@redhat.com From: Jason Wang Date: Wed, 18 May 2011 13:57:37 +0800 Message-ID: <20110518055737.10458.65866.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] virtio: correctly initialize vm_running X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Acked-by: Michael S. Tsirkin --- 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;