[Top][All Lists]

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

Re: [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread

From: Laurent Vivier
Subject: Re: [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread
Date: Sun, 12 Jun 2022 18:29:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0

Le 10/06/2022 à 16:38, Alex Bennée a écrit :
While forcing the CPU to unrealize by hand does trigger the clean-up
code we never fully free resources because refcount never reaches
zero. This is because QOM automatically added objects without an
explicit parent to /unattached/, incrementing the refcount.

Instead of manually triggering unrealization just unparent the object
and let the device machinery deal with that for us.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
  linux-user/syscall.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f55cdebee5..c413d32311 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8566,7 +8566,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int 
num, abi_long arg1,
          if (CPU_NEXT(first_cpu)) {
              TaskState *ts = cpu->opaque;
- object_property_set_bool(OBJECT(cpu), "realized", false, NULL);
+            object_unparent(OBJECT(cpu));
               * At this point the CPU should be unrealized and removed

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

reply via email to

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