[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 6/8] memory: Sanity check that no listeners rema
Re: [Qemu-devel] [PATCH 6/8] memory: Sanity check that no listeners remain on a destroyed AddressSpace
Mon, 13 May 2013 21:48:17 +1000
On Mon, May 13, 2013 at 12:10:10PM +0100, Peter Maydell wrote:
> On 13 May 2013 11:54, David Gibson <address@hidden> wrote:
> > At the moment, most AddressSpace objects last as long as the guest system
> > in practice, but that could well change in future. In addition, for VFIO
> > we will be introducing some private per-AdressSpace information, which must
> > be disposed of before the AddressSpace itself is destroyed.
> > To reduce the chances of subtle bugs in this area, this patch adds
> > asssertions to ensure that when an AddressSpace is destroyed, there are no
> > remaining MemoryListeners using that AS as a filter.
> Hmm, is this the ideal semantics? Typically the owner of the
> MemoryListener isn't the owner of the AddressSpace so it isn't
> necessarily in a position to guarantee that it can unregister
> the listener before the address space is destroyed. In fact
> as the listener API is currently documented, the filter
> argument is just an optimisation to save the callbacks having
> to filter out irrelevant information themselves.
If so, then it's broken by design. There's no guarantee that after an
AddressSpace is destroyed another one won't be created at the same
address (in fact, depending on your malloc() implementation, it could
be very likely). So references by pointer to an object *must* be
removed before the object itself is freed.
> Perhaps an "address space being destroyed" callback for
> listeners would be better? Then VFIO could just do the
> necessary disposal operations automatically when the AS
> goes away.
I was originally going to do that instead, but none of the things I
have planned immediately need it, since I think other lifetime
constraints will sort things out (chiefly that PCI devices must be
removed before their host bridge can, which will control the
AddressSpace lifetime). This patch is so that if I'm wrong about
that, it will show up clearly, at which point we can implement such a
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
Description: Digital signature
[Qemu-devel] [PATCH 5/8] pci: Introduce helper to retrieve a PCI device's DMA address space, David Gibson, 2013/05/13
[Qemu-devel] [PATCH 8/8] vfio: Create VFIOAddressSpace objects as needed, David Gibson, 2013/05/13
[Qemu-devel] [PATCH 3/8] pci: Rework PCI iommu lifetime assumptions, David Gibson, 2013/05/13
Re: [Qemu-devel] [0/8] RFC: VFIO and guest side IOMMUs, revisited, Paolo Bonzini, 2013/05/13
- Re: [Qemu-devel] [PATCH 2/8] pci: Don't del_subgregion on a non subregion, (continued)