From: Christian Borntraeger <borntraeger@de.ibm.com>
To: John Snow <jsnow@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Fam Zheng <famz@redhat.com>,
qemu-block@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Max Reitz <mreitz@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PULL 7/7] vl: introduce vm_shutdown()
Date: Fri, 16 Mar 2018 15:52:00 +0100 [thread overview]
Message-ID: <25e34cdb-813b-3ada-61d5-b3136e24472b@de.ibm.com> (raw)
In-Reply-To: <e8734962-9e78-6061-09fc-5f2eb663695f@redhat.com>
On 03/12/2018 08:05 PM, John Snow wrote:
>
>
> On 03/09/2018 08:19 AM, Stefan Hajnoczi wrote:
>> Commit 00d09fdbbae5f7864ce754913efc84c12fdf9f1a ("vl: pause vcpus before
>> stopping iothreads") and commit dce8921b2baaf95974af8176406881872067adfa
>> ("iothread: Stop threads before main() quits") tried to work around the
>> fact that emulation was still active during termination by stopping
>> iothreads. They suffer from race conditions:
>> 1. virtio_scsi_handle_cmd_vq() racing with iothread_stop_all() hits the
>> virtio_scsi_ctx_check() assertion failure because the BDS AioContext
>> has been modified by iothread_stop_all().
>> 2. Guest vq kick racing with main loop termination leaves a readable
>> ioeventfd that is handled by the next aio_poll() when external
>> clients are enabled again, resulting in unwanted emulation activity.
>>
>> This patch obsoletes those commits by fully disabling emulation activity
>> when vcpus are stopped.
>>
>> Use the new vm_shutdown() function instead of pause_all_vcpus() so that
>> vm change state handlers are invoked too. Virtio devices will now stop
>> their ioeventfds, preventing further emulation activity after vm_stop().
>>
>> Note that vm_stop(RUN_STATE_SHUTDOWN) cannot be used because it emits a
>> QMP STOP event that may affect existing clients.
>>
>> It is no longer necessary to call replay_disable_events() directly since
>> vm_shutdown() does so already.
>>
>> Drop iothread_stop_all() since it is no longer used.
>>
>> Cc: Fam Zheng <famz@redhat.com>
>> Cc: Kevin Wolf <kwolf@redhat.com>
>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Reviewed-by: Fam Zheng <famz@redhat.com>
>> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
>> Message-id: 20180307144205.20619-5-stefanha@redhat.com
>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Stefan, I see the same iotest regression that was reported by John Snow also
on s390. I can confirm that it works with this patch reverted.
Christian
next prev parent reply other threads:[~2018-03-16 14:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 13:19 [Qemu-devel] [PULL 0/7] Block patches Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 1/7] block: Fix qemu crash when using scsi-block Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 2/7] README: Fix typo 'git-publish' Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 3/7] virtio-blk: dataplane: Don't batch notifications if EVENT_IDX is present Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 4/7] block: add aio_wait_bh_oneshot() Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 5/7] virtio-blk: fix race between .ioeventfd_stop() and vq handler Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 6/7] virtio-scsi: " Stefan Hajnoczi
2018-03-09 13:19 ` [Qemu-devel] [PULL 7/7] vl: introduce vm_shutdown() Stefan Hajnoczi
2018-03-12 19:05 ` John Snow
2018-03-16 14:52 ` Christian Borntraeger [this message]
2018-03-09 18:49 ` [Qemu-devel] [PULL 0/7] Block patches Peter Maydell
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=25e34cdb-813b-3ada-61d5-b3136e24472b@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=crosthwaite.peter@gmail.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--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).