Re: QEMU device refcounting when device creates a container MR

2022-03-18 Thread Igor Mammedov
On Thu, 10 Mar 2022 17:11:14 + Peter Maydell wrote: > On Thu, 10 Mar 2022 at 16:30, Igor Mammedov wrote: > > > > Do On Thu, 10 Mar 2022 16:05:24 + > > Peter Maydell wrote: > > > > > On Thu, 10 Mar 2022 at 15:36, Igor Mammedov wrote: > > > > > > > > On Wed, 9 Mar 2022 16:56:21

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Peter Xu
On Thu, Mar 10, 2022 at 01:45:31PM +, Peter Maydell wrote: > The other theory I had was "maybe if you put an MR into another > MR and they both have the same owner then don't bump the refcount" > but I haven't thought that through at all. Maybe it'll work, it just sounds a bit more tricky. >

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Peter Maydell
On Thu, 10 Mar 2022 at 16:30, Igor Mammedov wrote: > > Do On Thu, 10 Mar 2022 16:05:24 + > Peter Maydell wrote: > > > On Thu, 10 Mar 2022 at 15:36, Igor Mammedov wrote: > > > > > > On Wed, 9 Mar 2022 16:56:21 + > > > Peter Maydell wrote: > > > > ...also, in the device-introspect-test

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Igor Mammedov
Do On Thu, 10 Mar 2022 16:05:24 + Peter Maydell wrote: > On Thu, 10 Mar 2022 at 15:36, Igor Mammedov wrote: > > > > On Wed, 9 Mar 2022 16:56:21 + > > Peter Maydell wrote: > > > ...also, in the device-introspect-test where I see this problem, > > > unrealize is never going to be

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Peter Maydell
On Thu, 10 Mar 2022 at 15:36, Igor Mammedov wrote: > > On Wed, 9 Mar 2022 16:56:21 + > Peter Maydell wrote: > > ...also, in the device-introspect-test where I see this problem, > > unrealize is never going to be called anyway, because the device > > is only put through "instance_init" and

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Igor Mammedov
On Wed, 9 Mar 2022 16:56:21 + Peter Maydell wrote: > On Wed, 9 Mar 2022 at 16:53, Peter Maydell wrote: > > > > On Wed, 9 Mar 2022 at 16:21, Paolo Bonzini wrote: > > > > > > On 3/9/22 11:33, Peter Maydell wrote: > > > > Hi; does anybody know how device reference counting is supposed > >

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Peter Maydell
On Thu, 10 Mar 2022 at 13:19, Peter Xu wrote: > > On Wed, Mar 09, 2022 at 11:40:15AM +0100, Philippe Mathieu-Daudé wrote: > > Cc'ing David / Peter > > > > On 9/3/22 11:33, Peter Maydell wrote: > > > Hi; does anybody know how device reference counting is supposed > > > to work when the device

Re: QEMU device refcounting when device creates a container MR

2022-03-10 Thread Peter Xu
On Wed, Mar 09, 2022 at 11:40:15AM +0100, Philippe Mathieu-Daudé wrote: > Cc'ing David / Peter > > On 9/3/22 11:33, Peter Maydell wrote: > > Hi; does anybody know how device reference counting is supposed > > to work when the device creates a "container" MemoryRegion which > > it then puts some

Re: QEMU device refcounting when device creates a container MR

2022-03-09 Thread Peter Maydell
On Wed, 9 Mar 2022 at 16:21, Paolo Bonzini wrote: > > On 3/9/22 11:33, Peter Maydell wrote: > > Hi; does anybody know how device reference counting is supposed > > to work when the device creates a "container" MemoryRegion which > > it then puts some of its own subregions in to? > > > > As far as

Re: QEMU device refcounting when device creates a container MR

2022-03-09 Thread Peter Maydell
On Wed, 9 Mar 2022 at 16:53, Peter Maydell wrote: > > On Wed, 9 Mar 2022 at 16:21, Paolo Bonzini wrote: > > > > On 3/9/22 11:33, Peter Maydell wrote: > > > Hi; does anybody know how device reference counting is supposed > > > to work when the device creates a "container" MemoryRegion which > > >

Re: QEMU device refcounting when device creates a container MR

2022-03-09 Thread Paolo Bonzini
On 3/9/22 11:33, Peter Maydell wrote: Hi; does anybody know how device reference counting is supposed to work when the device creates a "container" MemoryRegion which it then puts some of its own subregions in to? As far as I can see when you do memory_region_add_subregion it increases the

Re: QEMU device refcounting when device creates a container MR

2022-03-09 Thread Philippe Mathieu-Daudé
Cc'ing David / Peter On 9/3/22 11:33, Peter Maydell wrote: Hi; does anybody know how device reference counting is supposed to work when the device creates a "container" MemoryRegion which it then puts some of its own subregions in to? As far as I can see when you do memory_region_add_subregion

QEMU device refcounting when device creates a container MR

2022-03-09 Thread Peter Maydell
Hi; does anybody know how device reference counting is supposed to work when the device creates a "container" MemoryRegion which it then puts some of its own subregions in to? As far as I can see when you do memory_region_add_subregion it increases the refcount on the owner of the subregion. So