qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Asias He <asias@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	Gleb Natapov <gleb@redhat.com>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Subject: Re: [Qemu-devel] qemu seabios issue with vhost-scsi
Date: Thu, 23 May 2013 17:30:35 +0200	[thread overview]
Message-ID: <519E361B.9070702@redhat.com> (raw)
In-Reply-To: <20130523152758.GA21158@hj.localdomain>

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

  reply	other threads:[~2013-05-23 15:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23  0:36 [Qemu-devel] qemu seabios issue with vhost-scsi Badari
2013-05-23  0:53 ` Asias He
2013-05-23  9:48   ` Gleb Natapov
2013-05-23 13:32     ` Stefan Hajnoczi
2013-05-23 14:48       ` Badari Pulavarty
2013-05-23 14:58         ` Paolo Bonzini
2013-05-23 15:27           ` Asias He
2013-05-23 15:30             ` Paolo Bonzini [this message]
2013-05-23 16:11               ` Badari Pulavarty
2013-05-23 16:19                 ` Paolo Bonzini
2013-05-23 16:38                   ` Badari Pulavarty
2013-05-23 16:47                     ` Paolo Bonzini
2013-05-23 17:18                       ` Stefan Hajnoczi
2013-05-23 17:31                         ` Paolo Bonzini
2013-05-24  0:02                           ` Asias He
2013-05-23 16:08           ` Badari Pulavarty
2013-05-23 12:45 ` Stefan Hajnoczi

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=519E361B.9070702@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=asias@redhat.com \
    --cc=gleb@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=pbadari@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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 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).