qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: cornelia.huck@de.ibm.com, tubo@linux.vnet.ibm.com,
	famz@redhat.com, stefanha@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 9/9] virtio: remove starting/stopping checks
Date: Fri, 1 Apr 2016 16:14:22 +0200	[thread overview]
Message-ID: <56FE823E.9000201@de.ibm.com> (raw)
In-Reply-To: <1459516794-23629-10-git-send-email-pbonzini@redhat.com>

On 04/01/2016 03:19 PM, Paolo Bonzini wrote:
> Reentrancy cannot happen while the BQL is being held.
> 
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reverting this patch makes the segfaults go away.





> ---
>  hw/block/dataplane/virtio-blk.c | 12 ++----------
>  hw/scsi/virtio-scsi-dataplane.c |  9 +--------
>  include/hw/virtio/virtio-scsi.h |  2 --
>  3 files changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> index 74c6d37..cb00cdc 100644
> --- a/hw/block/dataplane/virtio-blk.c
> +++ b/hw/block/dataplane/virtio-blk.c
> @@ -27,9 +27,6 @@
>  #include "qom/object_interfaces.h"
> 
>  struct VirtIOBlockDataPlane {
> -    bool starting;
> -    bool stopping;
> -
>      VirtIOBlkConf *conf;
> 
>      VirtIODevice *vdev;
> @@ -203,11 +200,10 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
>      VirtIOBlock *vblk = VIRTIO_BLK(s->vdev);
>      int r;
> 
> -    if (vblk->dataplane_started || s->starting) {
> +    if (vblk->dataplane_started) {
>          return;
>      }
> 
> -    s->starting = true;
>      s->vq = virtio_get_queue(s->vdev, 0);
> 
>      /* Set up guest notifier (irq) */
> @@ -226,7 +222,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
>          goto fail_host_notifier;
>      }
> 
> -    s->starting = false;
>      vblk->dataplane_started = true;
>      trace_virtio_blk_data_plane_start(s);
> 
> @@ -246,7 +241,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
>      k->set_guest_notifiers(qbus->parent, 1, false);
>    fail_guest_notifiers:
>      vblk->dataplane_disabled = true;
> -    s->starting = false;
>      vblk->dataplane_started = true;
>  }
> 
> @@ -257,7 +251,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
>      VirtIOBlock *vblk = VIRTIO_BLK(s->vdev);
> 
> -    if (!vblk->dataplane_started || s->stopping) {
> +    if (!vblk->dataplane_started) {
>          return;
>      }
> 
> @@ -267,7 +261,6 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
>          vblk->dataplane_started = false;
>          return;
>      }
> -    s->stopping = true;
>      trace_virtio_blk_data_plane_stop(s);
> 
>      aio_context_acquire(s->ctx);
> @@ -286,5 +279,4 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
>      k->set_guest_notifiers(qbus->parent, 1, false);
> 
>      vblk->dataplane_started = false;
> -    s->stopping = false;
>  }
> diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
> index 5494dcc..7511447 100644
> --- a/hw/scsi/virtio-scsi-dataplane.c
> +++ b/hw/scsi/virtio-scsi-dataplane.c
> @@ -115,14 +115,11 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
>      VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
> 
>      if (s->dataplane_started ||
> -        s->dataplane_starting ||
>          s->dataplane_fenced ||
>          s->ctx != iothread_get_aio_context(vs->conf.iothread)) {
>          return;
>      }
> 
> -    s->dataplane_starting = true;
> -
>      /* Set up guest notifier (irq) */
>      rc = k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, true);
>      if (rc != 0) {
> @@ -150,7 +147,6 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
>          }
>      }
> 
> -    s->dataplane_starting = false;
>      s->dataplane_started = true;
>      aio_context_release(s->ctx);
>      return;
> @@ -164,7 +160,6 @@ fail_vrings:
>      k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);
>  fail_guest_notifiers:
>      s->dataplane_fenced = true;
> -    s->dataplane_starting = false;
>      s->dataplane_started = true;
>  }
> 
> @@ -176,7 +171,7 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
>      VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
>      int i;
> 
> -    if (!s->dataplane_started || s->dataplane_stopping) {
> +    if (!s->dataplane_started) {
>          return;
>      }
> 
> @@ -186,7 +181,6 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
>          s->dataplane_started = false;
>          return;
>      }
> -    s->dataplane_stopping = true;
>      assert(s->ctx == iothread_get_aio_context(vs->conf.iothread));
> 
>      aio_context_acquire(s->ctx);
> @@ -203,6 +197,5 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
> 
>      /* Clean up guest notifier (irq) */
>      k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);
> -    s->dataplane_stopping = false;
>      s->dataplane_started = false;
>  }
> diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
> index ba2f5ce..d5352d8 100644
> --- a/include/hw/virtio/virtio-scsi.h
> +++ b/include/hw/virtio/virtio-scsi.h
> @@ -89,8 +89,6 @@ typedef struct VirtIOSCSI {
>      QTAILQ_HEAD(, VirtIOSCSIBlkChangeNotifier) remove_notifiers;
> 
>      bool dataplane_started;
> -    bool dataplane_starting;
> -    bool dataplane_stopping;
>      bool dataplane_fenced;
>      Error *blocker;
>      uint32_t host_features;
> 

  reply	other threads:[~2016-04-01 14:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 13:19 [Qemu-devel] [PATCH v2 0/9] virtio: aio handler API Paolo Bonzini
2016-04-01 13:19 ` [Qemu-devel] [PATCH 1/9] virtio-dataplane: pass assign=true to virtio_queue_aio_set_host_notifier_handler Paolo Bonzini
2016-04-01 14:02   ` Cornelia Huck
2016-04-05 10:38   ` Michael S. Tsirkin
2016-04-05 10:42     ` Paolo Bonzini
2016-04-05 10:59       ` Paolo Bonzini
2016-04-01 13:19 ` [Qemu-devel] [PATCH 2/9] virtio: make virtio_queue_notify_vq static Paolo Bonzini
2016-04-01 13:19 ` [Qemu-devel] [PATCH 3/9] virtio-blk: fix disabled mode Paolo Bonzini
2016-04-01 13:19 ` [Qemu-devel] [PATCH 4/9] virtio-scsi: " Paolo Bonzini
2016-04-01 13:19 ` [Qemu-devel] [PATCH 5/9] virtio: add aio handler Paolo Bonzini
2016-04-01 14:04   ` Cornelia Huck
2016-04-01 13:19 ` [Qemu-devel] [PATCH 6/9] virtio-blk: use aio handler for data plane Paolo Bonzini
2016-04-01 14:05   ` Cornelia Huck
2016-04-01 13:19 ` [Qemu-devel] [PATCH 7/9] virtio-scsi: " Paolo Bonzini
2016-04-05  9:06   ` Fam Zheng
2016-04-01 13:19 ` [Qemu-devel] [PATCH 8/9] virtio: merge virtio_queue_aio_set_host_notifier_handler with virtio_queue_set_aio Paolo Bonzini
2016-04-03  9:06   ` Michael S. Tsirkin
2016-04-03 17:13     ` Paolo Bonzini
2016-04-01 13:19 ` [Qemu-devel] [PATCH 9/9] virtio: remove starting/stopping checks Paolo Bonzini
2016-04-01 14:14   ` Christian Borntraeger [this message]
2016-04-01 14:30     ` Cornelia Huck
2016-04-03 10:30       ` Michael S. Tsirkin
2016-04-01 14:02 ` [Qemu-devel] [PATCH v2 0/9] virtio: aio handler API Christian Borntraeger
2016-04-01 15:16   ` Christian Borntraeger
2016-04-03  9:00     ` Michael S. Tsirkin
2016-04-01 14:06 ` Cornelia Huck
2016-04-03  9:29 ` Michael S. Tsirkin
2016-04-05  9:13 ` Fam Zheng
2016-04-05 10:15 ` Christian Borntraeger
  -- strict thread matches above, loose matches on Subject: below --
2016-03-30 12:47 [Qemu-devel] [PATCH resend " Paolo Bonzini
2016-03-30 12:48 ` [Qemu-devel] [PATCH 9/9] virtio: remove starting/stopping checks Paolo Bonzini
2016-03-30 15:36   ` Cornelia Huck

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=56FE823E.9000201@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=famz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=tubo@linux.vnet.ibm.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).