From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alY1x-0000CQ-OG for qemu-devel@nongnu.org; Thu, 31 Mar 2016 04:32:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alY1s-0008Is-P1 for qemu-devel@nongnu.org; Thu, 31 Mar 2016 04:32:41 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:50738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alY1s-0008Im-IW for qemu-devel@nongnu.org; Thu, 31 Mar 2016 04:32:36 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 Mar 2016 02:32:35 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id A141A1FF004A for ; Thu, 31 Mar 2016 02:20:42 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2V8WX2X40501352 for ; Thu, 31 Mar 2016 01:32:33 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2V8WX93006918 for ; Thu, 31 Mar 2016 02:32:33 -0600 References: <1459342088-24311-1-git-send-email-pbonzini@redhat.com> <1459342088-24311-4-git-send-email-pbonzini@redhat.com> From: tu bo Message-ID: <56FCE09E.1070807@linux.vnet.ibm.com> Date: Thu, 31 Mar 2016 16:32:30 +0800 MIME-Version: 1.0 In-Reply-To: <1459342088-24311-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/9] virtio-blk: fix disabled mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, borntraeger@de.ibm.com, famz@redhat.com, mst@redhat.com Hi Paolo: On 03/30/2016 08:48 PM, Paolo Bonzini wrote: > The missing check on dataplane_disabled caused a segmentation > fault in notify_guest_bh, because s->guest_notifier was NULL. > > Signed-off-by: Paolo Bonzini > --- > hw/block/dataplane/virtio-blk.c | 7 +++---- > hw/block/virtio-blk.c | 2 +- > include/hw/virtio/virtio-blk.h | 1 + > 3 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c > index 0d76110..378feb3 100644 > --- a/hw/block/dataplane/virtio-blk.c > +++ b/hw/block/dataplane/virtio-blk.c > @@ -28,7 +28,6 @@ > struct VirtIOBlockDataPlane { > bool starting; > bool stopping; > - bool disabled; > > VirtIOBlkConf *conf; > > @@ -233,7 +232,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) > fail_host_notifier: > k->set_guest_notifiers(qbus->parent, 1, false); > fail_guest_notifiers: > - s->disabled = true; > + vblk->dataplane_disabled = true; > s->starting = false; > vblk->dataplane_started = true; > } > @@ -250,8 +249,8 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) > } > > /* Better luck next time. */ > - if (s->disabled) { > - s->disabled = false; > + if (vblk->dataplane_disabled) { > + vblk->dataplane_disabled = false; > vblk->dataplane_started = false; > return; > } > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index d0b8248..77221c1 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -53,7 +53,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status) > > stb_p(&req->in->status, status); > virtqueue_push(s->vq, &req->elem, req->in_len); > - if (s->dataplane) { > + if (s->dataplane_started && !s->dataplane_disabled) { > virtio_blk_data_plane_notify(s->dataplane); > } else { > virtio_notify(vdev, s->vq); > diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h > index 5cb66cd..073c632 100644 > --- a/include/hw/virtio/virtio-blk.h > +++ b/include/hw/virtio/virtio-blk.h > @@ -53,6 +53,7 @@ typedef struct VirtIOBlock { > unsigned short sector_mask; > bool original_wce; > VMChangeStateEntry *change; > + bool dataplane_disabled; > bool dataplane_started; > int reentrancy_test; There is no "int reentrancy_test;" in the latest qemu master. thx > struct VirtIOBlockDataPlane *dataplane; >