qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/1] virtio-blk: fix race on guest notifiers
Date: Thu, 2 Mar 2017 16:55:37 +0100	[thread overview]
Message-ID: <9a67d492-5bda-4b2a-0732-4034176d0d28@linux.vnet.ibm.com> (raw)
In-Reply-To: <b12c69aa-67ee-ffbc-cd89-716c24889167@redhat.com>



On 03/02/2017 04:32 PM, Paolo Bonzini wrote:
> 
> 
> On 02/03/2017 15:49, Cornelia Huck wrote:
>> On Thu,  2 Mar 2017 14:04:22 +0100
>> Halil Pasic <pasic@linux.vnet.ibm.com> wrote:
>>
>>> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
>>> index 5556f0e..13dd14d 100644
>>> --- a/hw/block/dataplane/virtio-blk.c
>>> +++ b/hw/block/dataplane/virtio-blk.c
>>> @@ -258,9 +258,16 @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
>>>          virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, NULL);
>>>      }
>>>
>>> -    /* Drain and switch bs back to the QEMU main loop */
>>> +    /* Drain and switch bs back to the QEMU main loop. After drain, the
>>> +     * device will not submit (nor comple) any requests until dataplane
>>
>> s/comple/complete/
>>

Will fix.

>>> +     * starts again.
>>> +     */
>>>      blk_set_aio_context(s->conf->conf.blk, qemu_get_aio_context());

I'm wondering if synchronization is needed for batch_notify_vqs. I think
the set_bit can be from the iothread, but the notify_guest_bh below is main
event loop. Is it OK like this (could we miss bits set in other thread)?
Does blk_set_aio_context include a barrier?

>>>
>>> +    /* Notify guest before the guest notifiers get cleaned up */
>>> +    qemu_bh_cancel(s->bh);
>>> +    notify_guest_bh(s);
>>> +
>>
>> Hm... does virtio-scsi dataplane need a similar treatment? Or am I
>> missing something?
> 
> No, the BH optimization is specific to virtio-blk.  Thanks for the patch
> Halil!
> 

You are welcome ;)!

Regards,
Halil

  reply	other threads:[~2017-03-02 15:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 13:04 [Qemu-devel] [PATCH 1/1] virtio-blk: fix race on guest notifiers Halil Pasic
2017-03-02 14:49 ` Cornelia Huck
2017-03-02 15:32   ` Paolo Bonzini
2017-03-02 15:55     ` Halil Pasic [this message]
2017-03-02 16:21       ` Paolo Bonzini
2017-03-03 19:43         ` Halil Pasic
2017-03-06 14:55           ` Paolo Bonzini
2017-03-06 22:27             ` Halil Pasic

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=9a67d492-5bda-4b2a-0732-4034176d0d28@linux.vnet.ibm.com \
    --to=pasic@linux.vnet.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@redhat.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).