* [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread
@ 2022-06-10 14:38 Alex Bennée
2022-06-12 16:29 ` Laurent Vivier
2022-06-21 18:17 ` Laurent Vivier
0 siblings, 2 replies; 4+ messages in thread
From: Alex Bennée @ 2022-06-10 14:38 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, thuth, Alex Bennée, Laurent Vivier
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));
object_unref(OBJECT(cpu));
/*
* At this point the CPU should be unrealized and removed
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread
2022-06-10 14:38 [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread Alex Bennée
@ 2022-06-12 16:29 ` Laurent Vivier
2022-06-21 18:17 ` Laurent Vivier
1 sibling, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2022-06-12 16:29 UTC (permalink / raw)
To: Alex Bennée, qemu-devel; +Cc: peter.maydell, thuth
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));
> object_unref(OBJECT(cpu));
> /*
> * At this point the CPU should be unrealized and removed
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread
2022-06-10 14:38 [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread Alex Bennée
2022-06-12 16:29 ` Laurent Vivier
@ 2022-06-21 18:17 ` Laurent Vivier
2022-06-23 12:08 ` Laurent Vivier
1 sibling, 1 reply; 4+ messages in thread
From: Laurent Vivier @ 2022-06-21 18:17 UTC (permalink / raw)
To: Alex Bennée, qemu-devel; +Cc: peter.maydell, thuth
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));
> object_unref(OBJECT(cpu));
> /*
> * At this point the CPU should be unrealized and removed
Applied to my linux-user-for-7.1 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread
2022-06-21 18:17 ` Laurent Vivier
@ 2022-06-23 12:08 ` Laurent Vivier
0 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2022-06-23 12:08 UTC (permalink / raw)
To: Alex Bennée, qemu-devel; +Cc: peter.maydell, thuth
On 21/06/2022 20:17, Laurent Vivier wrote:
> 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));
>> object_unref(OBJECT(cpu));
>> /*
>> * At this point the CPU should be unrealized and removed
>
> Applied to my linux-user-for-7.1 branch.
>
I remove it from the branch.
It breaks something with arm64 (only) target (any distros: stretch, sid, trusty, bionic),
the following LTP test cases fail:
bind04, bind05, fcntl34, fcntl34_64, fcntl36, fcntl36_64, inotify09, mmap18,
sched_setattr01, sched_getattr01, tgkill01, tgkill02, tgkill03, futex_wake02
For instance:
tst_test.c:1250: TINFO: Timeout per run is 0h 05m 00s
bind04.c:117: TINFO: Testing AF_UNIX pathname stream
bind04.c:150: TPASS: Communication successful
tst_test.c:1300: TBROK: Test killed by SIGSEGV!
Thanks,
Laurent
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-23 12:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 14:38 [RFC PATCH] linux-user: un-parent OBJECT(cpu) when closing thread Alex Bennée
2022-06-12 16:29 ` Laurent Vivier
2022-06-21 18:17 ` Laurent Vivier
2022-06-23 12:08 ` Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.