[Qemu-devel] [PATCH 05/22] main: free root container

Marc-André Lureau posted 22 patches 8 years, 5 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 05/22] main: free root container
Posted by Marc-André Lureau 8 years, 5 months ago
This should eventually free all objects that are only referenced by
their parents.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vl.c b/vl.c
index 0b72b12878..945df1d17f 100644
--- a/vl.c
+++ b/vl.c
@@ -4640,6 +4640,7 @@ int main(int argc, char **argv, char **envp)
     audio_cleanup();
     monitor_cleanup();
     qemu_chr_cleanup();
+    object_unref(object_get_root());
 
     return 0;
 }
-- 
2.11.0.295.gd7dffce1c.dirty


Re: [Qemu-devel] [PATCH 05/22] main: free root container
Posted by Paolo Bonzini 8 years, 5 months ago

On 02/02/2017 15:51, Marc-André Lureau wrote:
> This should eventually free all objects that are only referenced by
> their parents.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  vl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/vl.c b/vl.c
> index 0b72b12878..945df1d17f 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4640,6 +4640,7 @@ int main(int argc, char **argv, char **envp)
>      audio_cleanup();
>      monitor_cleanup();
>      qemu_chr_cleanup();
> +    object_unref(object_get_root());

This seems dangerous.  I'm pretty sure that a lot of non-hot-unpluggable
devices would leak or crash.

Paolo

Re: [Qemu-devel] [PATCH 05/22] main: free root container
Posted by Marc-André Lureau 8 years, 5 months ago
Hi

----- Original Message -----
> 
> 
> On 02/02/2017 15:51, Marc-André Lureau wrote:
> > This should eventually free all objects that are only referenced by
> > their parents.
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  vl.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/vl.c b/vl.c
> > index 0b72b12878..945df1d17f 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -4640,6 +4640,7 @@ int main(int argc, char **argv, char **envp)
> >      audio_cleanup();
> >      monitor_cleanup();
> >      qemu_chr_cleanup();
> > +    object_unref(object_get_root());
> 
> This seems dangerous.  I'm pretty sure that a lot of non-hot-unpluggable
> devices would leak or crash.

make check is ok. Any suggestion what else to check?

This patch was added so that /chardevs container is cleaned up (with the following patches). Perhaps I could be more conservative and only unref (oops unparent) /chardevs.

Re: [Qemu-devel] [PATCH 05/22] main: free root container
Posted by Paolo Bonzini 8 years, 5 months ago

On 07/02/2017 21:01, Marc-André Lureau wrote:
> Hi
> 
> ----- Original Message -----
>>
>>
>> On 02/02/2017 15:51, Marc-André Lureau wrote:
>>> This should eventually free all objects that are only referenced by
>>> their parents.
>>>
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> ---
>>>  vl.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/vl.c b/vl.c
>>> index 0b72b12878..945df1d17f 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -4640,6 +4640,7 @@ int main(int argc, char **argv, char **envp)
>>>      audio_cleanup();
>>>      monitor_cleanup();
>>>      qemu_chr_cleanup();
>>> +    object_unref(object_get_root());
>>
>> This seems dangerous.  I'm pretty sure that a lot of non-hot-unpluggable
>> devices would leak or crash.
> 
> make check is ok. Any suggestion what else to check?

Not sure...  I would have to try with some logging to see what this
does.  But it doesn't seem safe, most devices are really not meant to be
hot-removed.

> This patch was added so that /chardevs container is cleaned up (with
> the following patches). Perhaps I could be more conservative and only
> unref (oops unparent) /chardevs.

Yeah, that would work.

Paolo