qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [RFC PATCH for 4.1] linux-user: unparent CPU object before unref
Date: Tue, 16 Jul 2019 17:17:23 +0200	[thread overview]
Message-ID: <935ee13e-e980-5831-e048-a6e51f013f79@redhat.com> (raw)
In-Reply-To: <20190716140133.8578-1-alex.bennee@linaro.org>

On 7/16/19 4:01 PM, Alex Bennée wrote:
> When a CPU object is created it is parented during it's realize stage.
> If we don't unparent before the "final" unref we will never finzalize

"finalize"

> the object leading to a memory leak. For most setups you probably
> won't notice but with anything that creates and destroys a lot of
> threads this will add up. This goes especially for architectures which
> allocate a lot of memory in their CPU structures.
> 
> Fixes: https://bugs.launchpad.net/qemu/+bug/1836558
> Cc: 1836558@bugs.launchpad.net
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  linux-user/syscall.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 39a37496fed..4c9313fd9d0 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -7183,6 +7183,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
>                            NULL, NULL, 0);
>              }
>              thread_cpu = NULL;
> +            object_unparent(OBJECT(cpu));
>              object_unref(OBJECT(cpu));
>              g_free(ts);
>              rcu_unregister_thread();
> 


  parent reply	other threads:[~2019-07-16 15:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 10:18 [Qemu-devel] [Bug 1836558] [NEW] Qemu-ppc Memory leak creating threads Daan Scherft
2019-07-15 13:34 ` [Qemu-devel] [Bug 1836558] " Daan Scherft
2019-07-15 14:15 ` Alex Bennée
2019-07-15 15:10 ` Daan Scherft
2019-07-15 15:52 ` Alex Bennée
2019-07-15 16:21 ` Alex Bennée
2019-07-15 16:50 ` Alex Bennée
2019-07-16 12:13 ` [Qemu-devel] [RFC PATCH for 4.1?] target/ppc: move opcode decode tables to PowerPCCPU Alex Bennée
2019-07-16 12:13   ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-16 14:50   ` [Qemu-devel] " Richard Henderson
2019-07-17  1:33   ` David Gibson
2019-07-17  9:41     ` Alex Bennée
2019-07-17  9:41       ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-17 12:13   ` [Qemu-devel] " no-reply
2019-07-16 14:01 ` [Qemu-devel] [RFC PATCH for 4.1] linux-user: unparent CPU object before unref Alex Bennée
2019-07-16 14:01   ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-16 14:43   ` [Qemu-devel] " Peter Maydell
2019-07-16 14:43     ` [Qemu-devel] [Bug 1836558] " Peter Maydell
2019-07-16 15:02     ` [Qemu-devel] " Alex Bennée
2019-07-16 15:02       ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-16 15:17   ` Philippe Mathieu-Daudé [this message]
2020-01-09 13:22 ` [Bug 1836558] Re: Qemu-ppc Memory leak creating threads Thomas Huth
2020-03-10  8:48 ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=935ee13e-e980-5831-e048-a6e51f013f79@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).