All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn
@ 2018-07-19 13:02 Thomas Huth
  2018-07-20  2:35 ` Max Filippov
  2018-08-07  9:09 ` Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2018-07-19 13:02 UTC (permalink / raw)
  To: qemu-devel, Max Filippov; +Cc: Peter Maydell, Paolo Bonzini

The instance_init function of the xtensa CPUs creates a memory region,
but does not set an owner, so the memory region is not destroyed
correctly when the CPU object is removed. This can happen when
introspecting the CPU devices, so introspecting the CPU device will
leave a dangling memory region object in the QOM tree. Make sure to
set the right owner here to fix this issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/xtensa/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index b50c840..590813d 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -149,7 +149,7 @@ static void xtensa_cpu_initfn(Object *obj)
 #ifndef CONFIG_USER_ONLY
     env->address_space_er = g_malloc(sizeof(*env->address_space_er));
     env->system_er = g_malloc(sizeof(*env->system_er));
-    memory_region_init_io(env->system_er, NULL, NULL, env, "er",
+    memory_region_init_io(env->system_er, obj, NULL, env, "er",
                           UINT64_C(0x100000000));
     address_space_init(env->address_space_er, env->system_er, "ER");
 #endif
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn
  2018-07-19 13:02 [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn Thomas Huth
@ 2018-07-20  2:35 ` Max Filippov
  2018-08-07  9:09 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2018-07-20  2:35 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, Peter Maydell, Paolo Bonzini

On Thu, Jul 19, 2018 at 6:02 AM, Thomas Huth <thuth@redhat.com> wrote:
> The instance_init function of the xtensa CPUs creates a memory region,
> but does not set an owner, so the memory region is not destroyed
> correctly when the CPU object is removed. This can happen when
> introspecting the CPU devices, so introspecting the CPU device will
> leave a dangling memory region object in the QOM tree. Make sure to
> set the right owner here to fix this issue.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  target/xtensa/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn
  2018-07-19 13:02 [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn Thomas Huth
  2018-07-20  2:35 ` Max Filippov
@ 2018-08-07  9:09 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-08-07  9:09 UTC (permalink / raw)
  To: Thomas Huth; +Cc: QEMU Developers, Max Filippov, Paolo Bonzini

On 19 July 2018 at 14:02, Thomas Huth <thuth@redhat.com> wrote:
> The instance_init function of the xtensa CPUs creates a memory region,
> but does not set an owner, so the memory region is not destroyed
> correctly when the CPU object is removed. This can happen when
> introspecting the CPU devices, so introspecting the CPU device will
> leave a dangling memory region object in the QOM tree. Make sure to
> set the right owner here to fix this issue.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  target/xtensa/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
> index b50c840..590813d 100644
> --- a/target/xtensa/cpu.c
> +++ b/target/xtensa/cpu.c
> @@ -149,7 +149,7 @@ static void xtensa_cpu_initfn(Object *obj)
>  #ifndef CONFIG_USER_ONLY
>      env->address_space_er = g_malloc(sizeof(*env->address_space_er));
>      env->system_er = g_malloc(sizeof(*env->system_er));
> -    memory_region_init_io(env->system_er, NULL, NULL, env, "er",
> +    memory_region_init_io(env->system_er, obj, NULL, env, "er",
>                            UINT64_C(0x100000000));
>      address_space_init(env->address_space_er, env->system_er, "ER");
>  #endif
> --

Applied to master for rc4, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-07  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 13:02 [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn Thomas Huth
2018-07-20  2:35 ` Max Filippov
2018-08-07  9:09 ` Peter Maydell

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.