From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] virtio: fallback from irqfd to non-irqfd notify
Date: Thu, 2 Mar 2017 14:14:47 +0100 [thread overview]
Message-ID: <3d3fdae1-e76c-7d49-8e6e-46f680795492@linux.vnet.ibm.com> (raw)
In-Reply-To: <ee3d0300-27c2-8d1e-c29e-51d7165af0ec@redhat.com>
On 03/01/2017 08:53 PM, Paolo Bonzini wrote:
>
>
> On 01/03/2017 17:08, Halil Pasic wrote:
>> applied I do not see the problem any more. I will most likely
>> turn this into a patch tomorrow. I would like to give it some more testing and
>> thinking (see questions below) until tomorrow.
>>
>> I should probably cc stable, or?
>
> Yes, please do!
>
>>
>> Q1. For this to work correctly, it seems to me, we need to be sure that
>> virtio_blk_req_complete can not be happen between the newly added
>> notify_guest_bh(s);
>> and
>> vblk->dataplane_started = false;
>> becomes visible. How is this ensured?
>
> blk_set_aio_context drains the block device, and the event notifiers are
> not active anymore so draining the block device coincides with the last
> call to virtio_blk_req_complete.
>
> Please add a comment - it's a good observation.
>
>> Q2. The virtio_blk_data_plane_stop should be from the thread/context
>> associated with the main event loop, and with that
>> vblk->dataplane_started = false too. But I think dataplane_started
>> may end up being used form a different thread (e.g. req_complete).
>
> 1) virtio_queue_aio_set_host_notifier_handler stops the event notifiers
>
> 2) virtio_bus_set_host_notifier invokes them one last time before exiting
>
> Note that this could call again virtio_queue_notify_vq and hence
> virtio_device_start_ioeventfd, but dataplane won't be reactivated
> because vblk->dataplane_started is still true.
>
>> How does the sequencing work there and/or is it even important?
>
> It is important and not really easy to get right---as shown by the bug
> you found, in fact.
>
Thank you very much for the explanations. I have just sent a patch
based on what we discussed here. I think I roughly understand now, how
this is supposed to work regarding concurrency, but I guess I will
have to just trust you to some extent.
prev parent reply other threads:[~2017-03-02 13:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 11:50 [Qemu-devel] [PATCH 1/1] virtio: fallback from irqfd to non-irqfd notify Halil Pasic
2017-03-01 12:54 ` Michael S. Tsirkin
2017-03-01 13:31 ` Halil Pasic
2017-03-01 12:57 ` Paolo Bonzini
2017-03-01 13:22 ` Halil Pasic
2017-03-01 14:29 ` Paolo Bonzini
2017-03-01 16:08 ` Halil Pasic
2017-03-01 16:53 ` Michael S. Tsirkin
2017-03-01 19:53 ` Paolo Bonzini
2017-03-02 13:14 ` Halil Pasic [this message]
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=3d3fdae1-e76c-7d49-8e6e-46f680795492@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=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).