[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 0/2] memory/vfio: notify region_del() when unregis
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 0/2] memory/vfio: notify region_del() when unregister listeners |
Date: |
Fri, 19 Jan 2018 12:41:01 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 19/01/2018 09:42, Peter Xu wrote:
> I encountered an event loss problem during unplugging vfio devices:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1531393
>
> I thought it should be a simple VT-d issue but I was wrong. The whole
> debugging leads me to these patches.
>
> Basically I think what we missed is that when unregistering memory
> listeners, we don't really call region_del() at all. Instead we just
> remove ourselves from the listener list. IMHO that's not enough. A
> clean unregister should undo all possible changes that have done
> during region_add(). That's patch 1.
>
> Patch 2 fixes a vfio issue when patch 1 is applied.
It makes sense, though of course patch 1 must come second for
bisectability. Of the other listeners, most do not implement
region_del, but commit must be audited as well. What matters is whether
the listener is unregistered, and only few are:
- kvm_arm_machine_init_done must unregister the listener after the
QSLIST_FOREACH_SAFE loop.
- Xen seems okay
- vhost needs to remove the memory_region_unref loop after unregistering
the listener - and this must be done at the same time as patch 1, not before
- virtio seems okay
Thanks,
Paolo