From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfXTh-0005EM-1E for qemu-devel@nongnu.org; Thu, 23 May 2013 11:30:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfXTb-0002gJ-FU for qemu-devel@nongnu.org; Thu, 23 May 2013 11:30:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfXTb-0002fo-0b for qemu-devel@nongnu.org; Thu, 23 May 2013 11:30:47 -0400 Message-ID: <519E361B.9070702@redhat.com> Date: Thu, 23 May 2013 17:30:35 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <519D6478.8060403@us.ibm.com> <20130523005355.GA11949@hj.localdomain> <20130523094809.GM4725@redhat.com> <519E2C21.3000103@us.ibm.com> <519E2E7D.4080502@redhat.com> <20130523152758.GA21158@hj.localdomain> In-Reply-To: <20130523152758.GA21158@hj.localdomain> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] qemu seabios issue with vhost-scsi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Asias He Cc: Stefan Hajnoczi , Gleb Natapov , Badari Pulavarty , qemu-devel , "Nicholas A. Bellinger" Il 23/05/2013 17:27, Asias He ha scritto: > On Thu, May 23, 2013 at 04:58:05PM +0200, Paolo Bonzini wrote: >> Il 23/05/2013 16:48, Badari Pulavarty ha scritto: >>>> The common virtio-scsi code in QEMU should guard against this. In >>>> virtio-blk data plane I hit a similar case and ended up starting the >>>> data plane thread (equivalent to vhost here) *before* the status >>>> register is set to DRIVER_OK. >>> >>> Thats exactly what my debug in vhost_scsi_set_status() shows. >>> >>> set status started 0 val 0 >>> set status started 0 val 0 >>> set status started 0 val 0 >>> set status started 0 val 0 >>> set status started 0 val 0 >>> set status started 0 val 3 >>> Program received signal SIGSEGV, Segmentation fault. >>> >>> We never got a chance to call vhost_scsi_start() as we are waiting >>> for DRIVER_OK. > > Reproduced the SIGSEGV and verified that replacing the bios.bin with the > one from seabios.git makes the guest boot. This should fix it: diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 08dd3f3..3139355 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -266,7 +266,7 @@ fail: static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { - VirtIOSCSI *s = (VirtIOSCSI *)vdev; + VirtIOSCSI *s = VIRTIO_SCSI(vdev); VirtIOSCSIReq *req; while ((req = virtio_scsi_pop_req(s, vq))) { @@ -347,9 +347,8 @@ static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req) static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq) { - /* use non-QOM casts in the data path */ - VirtIOSCSI *s = (VirtIOSCSI *)vdev; - VirtIOSCSICommon *vs = &s->parent_obj; + VirtIOSCSI *s = VIRTIO_SCSI(vdev); + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev); VirtIOSCSIReq *req; int n; Paolo