qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v2 06/13] spapr_iommu: Implement free_table(


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [RFC PATCH v2 06/13] spapr_iommu: Implement free_table() helper
Date: Tue, 26 Aug 2014 17:04:25 +1000
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

On 08/26/2014 04:16 PM, David Gibson wrote:
> On Fri, Aug 15, 2014 at 08:12:28PM +1000, Alexey Kardashevskiy wrote:
>> Every sPAPRTCETable object holds an IOMMU memory region which holds
>> a referenced to the sPAPRTCETable instance. So if we want to free
>> an sPAPRTCETable instance, calling object_unref() will not be enough
>> as embedded memory region will hold the reference and we need to break
>> the loop.
>>
>> This adds a spapr_tce_free_table() helper which destroys the embedded
>> memory region and then calls object_unref() on the sPAPRTCETable instance
>> which will succeed now. The helper adds a new child under unique name
>> derived from LIOBN.
>>
>> As we are here, fix spapr_tce_new_table() callers.
>> At the moment spapr_tce_new_table() references sPAPRTCETable twice -
>> once in object_new() and second time in object_property_add_child().
>> The callers of spapr_tce_new_table() should take care of correct
>> referencing.
> 
> So I've been trying to determine if there's any way to avoid this by
> not constructing the reference loop in the first place, but all the
> qom is breaking my brain.

Well. I could have added an additional object to sPAPRTCETable (just a
pointer in the struct but not a QOM-child!) and use it as an owner for
MemoryRegion. It would not hold reference to the table. But since I do not
grasp the idea of having an owner for a MemoryRegion, this can break
something which I cannot even imagine :)



-- 
Alexey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]