On Thu, Jun 9, 2016 at 9:47 AM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Thu, Jun 9, 2016 at 9:25 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: >> On 09/06/2016 09:35, Stefan Hajnoczi wrote: >>> >>> if (s->dataplane) { >>> virtio_blk_data_plane_stop(s->dataplane); >>> } >>> >>> virtio_save(vdev, f); >>> } >>> >>> We reach the situation I described where BDS AioContext changes but >>> mirror_run() is still in the IOThread AioContext. >> >> Why is the virtio_blk_data_plane_stop necessary? It used to sync >> between vring and virtio state, but that's not required anymore---and we >> know that the virtqueues are quiescent at this point... > > I agree. It doesn't seem necessary anymore unless I'm missing a race > condition with ioeventfd. > > It was introduced so that the savevm command (without live migration!) works: > > commit 10a06fd65f667a972848ebbbcac11bdba931b544 > Author: Pavel Butsykin <pbutsy...@virtuozzo.com> > Date: Mon Oct 26 14:42:57 2015 +0300 > > virtio: sync the dataplane vring state to the virtqueue before virtio_save > > We can remove it now.
BTW this doesn't mean that the blockjobs AioContext following problem is solved. AioContexts can still change if the guest resets the virtio device, for example. I suspect we'll still hit undefined behavior when that happens. Stefan