qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups
@ 2015-04-27 20:00 Eduardo Habkost
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 1/3] cpu: No need to zero-initialize numa_node Eduardo Habkost
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eduardo Habkost @ 2015-04-27 20:00 UTC (permalink / raw)
  To: qemu-devel, Andreas Färber; +Cc: Igor Mammedov

Those patches were submitted and reviewed back in March, and I believe they can
go through the qom-cpu tree.

Patch 3/3 had to be redone because of new code.

Eduardo Habkost (3):
  cpu: No need to zero-initialize numa_node
  cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn()
  cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init

 exec.c    | 14 ++++++--------
 qom/cpu.c |  2 ++
 2 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.1.0

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

* [Qemu-devel] [PATCH 1/3] cpu: No need to zero-initialize numa_node
  2015-04-27 20:00 [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Eduardo Habkost
@ 2015-04-27 20:00 ` Eduardo Habkost
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 2/3] cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn() Eduardo Habkost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2015-04-27 20:00 UTC (permalink / raw)
  To: qemu-devel, Andreas Färber; +Cc: Igor Mammedov

QOM objects are already zero-filled when instantiated, there's no need
to explicitly set numa_node to 0.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 exec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/exec.c b/exec.c
index 874ecfc..3566d8f 100644
--- a/exec.c
+++ b/exec.c
@@ -545,7 +545,6 @@ void cpu_exec_init(CPUArchState *env)
         cpu_index++;
     }
     cpu->cpu_index = cpu_index;
-    cpu->numa_node = 0;
     QTAILQ_INIT(&cpu->breakpoints);
     QTAILQ_INIT(&cpu->watchpoints);
 #ifndef CONFIG_USER_ONLY
-- 
2.1.0

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

* [Qemu-devel] [PATCH 2/3] cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn()
  2015-04-27 20:00 [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Eduardo Habkost
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 1/3] cpu: No need to zero-initialize numa_node Eduardo Habkost
@ 2015-04-27 20:00 ` Eduardo Habkost
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 3/3] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init Eduardo Habkost
  2015-04-27 21:36 ` [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Andreas Färber
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2015-04-27 20:00 UTC (permalink / raw)
  To: qemu-devel, Andreas Färber; +Cc: Igor Mammedov

One small step in the simplification of cpu_exec_init().

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 exec.c    | 2 --
 qom/cpu.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exec.c b/exec.c
index 3566d8f..8d5d844 100644
--- a/exec.c
+++ b/exec.c
@@ -545,8 +545,6 @@ void cpu_exec_init(CPUArchState *env)
         cpu_index++;
     }
     cpu->cpu_index = cpu_index;
-    QTAILQ_INIT(&cpu->breakpoints);
-    QTAILQ_INIT(&cpu->watchpoints);
 #ifndef CONFIG_USER_ONLY
     cpu->as = &address_space_memory;
     cpu->thread_id = qemu_get_thread_id();
diff --git a/qom/cpu.c b/qom/cpu.c
index 108bfa2..56c53a8 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -313,6 +313,8 @@ static void cpu_common_initfn(Object *obj)
     CPUClass *cc = CPU_GET_CLASS(obj);
 
     cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;
+    QTAILQ_INIT(&cpu->breakpoints);
+    QTAILQ_INIT(&cpu->watchpoints);
 }
 
 static int64_t cpu_common_get_arch_id(CPUState *cpu)
-- 
2.1.0

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

* [Qemu-devel] [PATCH 3/3] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init
  2015-04-27 20:00 [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Eduardo Habkost
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 1/3] cpu: No need to zero-initialize numa_node Eduardo Habkost
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 2/3] cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn() Eduardo Habkost
@ 2015-04-27 20:00 ` Eduardo Habkost
  2015-04-27 21:36 ` [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Andreas Färber
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2015-04-27 20:00 UTC (permalink / raw)
  To: qemu-devel, Andreas Färber; +Cc: Igor Mammedov, Paolo Bonzini

Instead of initializing cpu->as, cpu->thread_id, and reloading memory
map while holding cpu_list_lock(), do it earlier, before locking the CPU
list and initializing cpu_index.

This allows the code handling cpu_index and global CPU list to be
isolated from the rest.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Rebased and moved the new cpu_reload_memory_map(cpu) line
  * Reviewed-by from Igor not kept because more complex code is
    now being moved
---
 exec.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index 8d5d844..e2c438a 100644
--- a/exec.c
+++ b/exec.c
@@ -537,6 +537,12 @@ void cpu_exec_init(CPUArchState *env)
     CPUState *some_cpu;
     int cpu_index;
 
+#ifndef CONFIG_USER_ONLY
+    cpu->as = &address_space_memory;
+    cpu->thread_id = qemu_get_thread_id();
+    cpu_reload_memory_map(cpu);
+#endif
+
 #if defined(CONFIG_USER_ONLY)
     cpu_list_lock();
 #endif
@@ -545,11 +551,6 @@ void cpu_exec_init(CPUArchState *env)
         cpu_index++;
     }
     cpu->cpu_index = cpu_index;
-#ifndef CONFIG_USER_ONLY
-    cpu->as = &address_space_memory;
-    cpu->thread_id = qemu_get_thread_id();
-    cpu_reload_memory_map(cpu);
-#endif
     QTAILQ_INSERT_TAIL(&cpus, cpu, node);
 #if defined(CONFIG_USER_ONLY)
     cpu_list_unlock();
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups
  2015-04-27 20:00 [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Eduardo Habkost
                   ` (2 preceding siblings ...)
  2015-04-27 20:00 ` [Qemu-devel] [PATCH 3/3] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init Eduardo Habkost
@ 2015-04-27 21:36 ` Andreas Färber
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2015-04-27 21:36 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: Igor Mammedov, Paolo Bonzini

Am 27.04.2015 um 22:00 schrieb Eduardo Habkost:
> Those patches were submitted and reviewed back in March, and I believe they can
> go through the qom-cpu tree.
> 
> Patch 3/3 had to be redone because of new code.
> 
> Eduardo Habkost (3):
>   cpu: No need to zero-initialize numa_node
>   cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn()
>   cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init

Thanks, applied all to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

>  exec.c    | 14 ++++++--------
>  qom/cpu.c |  2 ++
>  2 files changed, 8 insertions(+), 8 deletions(-)

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)

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

end of thread, other threads:[~2015-04-27 21:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-27 20:00 [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Eduardo Habkost
2015-04-27 20:00 ` [Qemu-devel] [PATCH 1/3] cpu: No need to zero-initialize numa_node Eduardo Habkost
2015-04-27 20:00 ` [Qemu-devel] [PATCH 2/3] cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn() Eduardo Habkost
2015-04-27 20:00 ` [Qemu-devel] [PATCH 3/3] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init Eduardo Habkost
2015-04-27 21:36 ` [Qemu-devel] [PATCH 0/3] cpu_exec_init() cleanups Andreas Färber

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).