All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/7] NUMA code cleanup
@ 2015-02-08 18:51 Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h Eduardo Habkost
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

This cleans up some of the NUMA code: moves declarations to numa.h, rename some
functions, and remove some existing code that was inside main().

Eduardo Habkost (7):
  numa: Move NUMA declarations from sysemu.h to numa.h
  vl.c: Remove unnecessary zero-initialization of NUMA globals
  numa: Move NUMA globals to numa.c
  numa: Make max_numa_nodeid static
  numa: Move QemuOpts parsing to set_numa_nodes()
  numa: Rename option parsing functions
  numa: Rename set_numa_modes() to numa_post_machine_init()

 hw/i386/pc.c            |  1 +
 hw/mem/pc-dimm.c        |  1 +
 hw/ppc/spapr.c          |  1 +
 include/sysemu/numa.h   | 24 ++++++++++++++++++++++++
 include/sysemu/sysemu.h | 18 ------------------
 monitor.c               |  1 +
 numa.c                  | 20 ++++++++++++++++----
 vl.c                    | 22 +++-------------------
 8 files changed, 47 insertions(+), 41 deletions(-)
 create mode 100644 include/sysemu/numa.h

-- 
2.1.0

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

* [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-09 16:17   ` Michael S. Tsirkin
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 2/7] vl.c: Remove unnecessary zero-initialization of NUMA globals Eduardo Habkost
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Not all sysemu.h users need the NUMA declarations, and keeping them in a
separate file makes easier to see what are the interfaces provided by
numa.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc.c            |  1 +
 hw/mem/pc-dimm.c        |  1 +
 hw/ppc/spapr.c          |  1 +
 include/sysemu/numa.h   | 28 ++++++++++++++++++++++++++++
 include/sysemu/sysemu.h | 18 ------------------
 monitor.c               |  1 +
 numa.c                  |  2 +-
 vl.c                    |  1 +
 8 files changed, 34 insertions(+), 19 deletions(-)
 create mode 100644 include/sysemu/numa.h

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c7af6aa..0b31c14 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -41,6 +41,7 @@
 #include "hw/pci/msi.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/numa.h"
 #include "sysemu/kvm.h"
 #include "kvm_i386.h"
 #include "hw/xen/xen.h"
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 18cdc54..f27a087 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -22,6 +22,7 @@
 #include "qemu/config-file.h"
 #include "qapi/visitor.h"
 #include "qemu/range.h"
+#include "sysemu/numa.h"
 
 typedef struct pc_dimms_capacity {
      uint64_t size;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b560459..e754262 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -25,6 +25,7 @@
  *
  */
 #include "sysemu/sysemu.h"
+#include "sysemu/numa.h"
 #include "hw/hw.h"
 #include "hw/fw-path-provider.h"
 #include "elf.h"
diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
new file mode 100644
index 0000000..514914f
--- /dev/null
+++ b/include/sysemu/numa.h
@@ -0,0 +1,28 @@
+#ifndef SYSEMU_NUMA_H
+#define SYSEMU_NUMA_H
+
+#include <stdint.h>
+#include "qemu/bitmap.h"
+#include "qemu/option.h"
+#include "sysemu/sysemu.h"
+#include "sysemu/hostmem.h"
+
+extern int nb_numa_nodes;   /* Number of NUMA nodes */
+extern int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
+                             * For all nodes, nodeid < max_numa_nodeid
+                             */
+
+typedef struct node_info {
+    uint64_t node_mem;
+    DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS);
+    struct HostMemoryBackend *node_memdev;
+    bool present;
+} NodeInfo;
+extern NodeInfo numa_info[MAX_NODES];
+void set_numa_nodes(void);
+void set_numa_modes(void);
+void query_numa_node_mem(uint64_t node_mem[]);
+extern QemuOptsList qemu_numa_opts;
+int numa_init_func(QemuOpts *opts, void *opaque);
+
+#endif
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 748d059..a726659 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -147,24 +147,6 @@ extern int mem_prealloc;
  */
 #define MAX_CPUMASK_BITS 255
 
-extern int nb_numa_nodes;   /* Number of NUMA nodes */
-extern int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
-                             * For all nodes, nodeid < max_numa_nodeid
-                             */
-
-typedef struct node_info {
-    uint64_t node_mem;
-    DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS);
-    struct HostMemoryBackend *node_memdev;
-    bool present;
-} NodeInfo;
-extern NodeInfo numa_info[MAX_NODES];
-void set_numa_nodes(void);
-void set_numa_modes(void);
-void query_numa_node_mem(uint64_t node_mem[]);
-extern QemuOptsList qemu_numa_opts;
-int numa_init_func(QemuOpts *opts, void *opaque);
-
 #define MAX_OPTION_ROMS 16
 typedef struct QEMUOptionRom {
     const char *name;
diff --git a/monitor.c b/monitor.c
index 5a24311..4de3a8c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -35,6 +35,7 @@
 #include "sysemu/char.h"
 #include "ui/qemu-spice.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/numa.h"
 #include "monitor/monitor.h"
 #include "qemu/readline.h"
 #include "ui/console.h"
diff --git a/numa.c b/numa.c
index afd2866..40f3d36 100644
--- a/numa.c
+++ b/numa.c
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 
-#include "sysemu/sysemu.h"
+#include "sysemu/numa.h"
 #include "exec/cpu-common.h"
 #include "qemu/bitmap.h"
 #include "qom/cpu.h"
diff --git a/vl.c b/vl.c
index 983259b..63ec996 100644
--- a/vl.c
+++ b/vl.c
@@ -78,6 +78,7 @@ int main(int argc, char **argv)
 #include "monitor/monitor.h"
 #include "ui/console.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/numa.h"
 #include "exec/gdbstub.h"
 #include "qemu/timer.h"
 #include "sysemu/char.h"
-- 
2.1.0

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

* [Qemu-devel] [PATCH 2/7] vl.c: Remove unnecessary zero-initialization of NUMA globals
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 3/7] numa: Move NUMA globals to numa.c Eduardo Habkost
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

There's no need to zero-initialize globals, they are automatically
initialized to zero.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/vl.c b/vl.c
index 63ec996..8a32a4b 100644
--- a/vl.c
+++ b/vl.c
@@ -2818,14 +2818,6 @@ int main(int argc, char **argv, char **envp)
     cyls = heads = secs = 0;
     translation = BIOS_ATA_TRANSLATION_AUTO;
 
-    for (i = 0; i < MAX_NODES; i++) {
-        numa_info[i].node_mem = 0;
-        numa_info[i].present = false;
-        bitmap_zero(numa_info[i].node_cpu, MAX_CPUMASK_BITS);
-    }
-
-    nb_numa_nodes = 0;
-    max_numa_nodeid = 0;
     nb_nics = 0;
 
     bdrv_init_with_whitelist();
-- 
2.1.0

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

* [Qemu-devel] [PATCH 3/7] numa: Move NUMA globals to numa.c
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 2/7] vl.c: Remove unnecessary zero-initialization of NUMA globals Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 4/7] numa: Make max_numa_nodeid static Eduardo Habkost
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 numa.c | 3 +++
 vl.c   | 4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/numa.c b/numa.c
index 40f3d36..61531db 100644
--- a/numa.c
+++ b/numa.c
@@ -45,6 +45,9 @@ QemuOptsList qemu_numa_opts = {
 };
 
 static int have_memdevs = -1;
+int nb_numa_nodes;
+int max_numa_nodeid;
+NodeInfo numa_info[MAX_NODES];
 
 static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
 {
diff --git a/vl.c b/vl.c
index 8a32a4b..5adea75 100644
--- a/vl.c
+++ b/vl.c
@@ -184,10 +184,6 @@ uint8_t qemu_extra_params_fw[2];
 
 int icount_align_option;
 
-int nb_numa_nodes;
-int max_numa_nodeid;
-NodeInfo numa_info[MAX_NODES];
-
 /* The bytes in qemu_uuid[] are in the order specified by RFC4122, _not_ in the
  * little-endian "wire format" described in the SMBIOS 2.6 specification.
  */
-- 
2.1.0

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

* [Qemu-devel] [PATCH 4/7] numa: Make max_numa_nodeid static
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
                   ` (2 preceding siblings ...)
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 3/7] numa: Move NUMA globals to numa.c Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 5/7] numa: Move QemuOpts parsing to set_numa_nodes() Eduardo Habkost
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Now the only code that uses the variable is inside numa.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/numa.h | 3 ---
 numa.c                | 4 +++-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index 514914f..eae881e 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -8,9 +8,6 @@
 #include "sysemu/hostmem.h"
 
 extern int nb_numa_nodes;   /* Number of NUMA nodes */
-extern int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
-                             * For all nodes, nodeid < max_numa_nodeid
-                             */
 
 typedef struct node_info {
     uint64_t node_mem;
diff --git a/numa.c b/numa.c
index 61531db..84d4cb5 100644
--- a/numa.c
+++ b/numa.c
@@ -45,8 +45,10 @@ QemuOptsList qemu_numa_opts = {
 };
 
 static int have_memdevs = -1;
+static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
+                             * For all nodes, nodeid < max_numa_nodeid
+                             */
 int nb_numa_nodes;
-int max_numa_nodeid;
 NodeInfo numa_info[MAX_NODES];
 
 static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
-- 
2.1.0

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

* [Qemu-devel] [PATCH 5/7] numa: Move QemuOpts parsing to set_numa_nodes()
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
                   ` (3 preceding siblings ...)
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 4/7] numa: Make max_numa_nodeid static Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 6/7] numa: Rename option parsing functions Eduardo Habkost
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

This allows us to make numa_init_func() static.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/numa.h | 1 -
 numa.c                | 9 ++++++++-
 vl.c                  | 5 -----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index eae881e..d25ada9 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -20,6 +20,5 @@ void set_numa_nodes(void);
 void set_numa_modes(void);
 void query_numa_node_mem(uint64_t node_mem[]);
 extern QemuOptsList qemu_numa_opts;
-int numa_init_func(QemuOpts *opts, void *opaque);
 
 #endif
diff --git a/numa.c b/numa.c
index 84d4cb5..eb9259b 100644
--- a/numa.c
+++ b/numa.c
@@ -36,6 +36,8 @@
 #include "sysemu/hostmem.h"
 #include "qmp-commands.h"
 #include "hw/mem/pc-dimm.h"
+#include "qemu/option.h"
+#include "qemu/config-file.h"
 
 QemuOptsList qemu_numa_opts = {
     .name = "numa",
@@ -121,7 +123,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
     max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);
 }
 
-int numa_init_func(QemuOpts *opts, void *opaque)
+static int numa_init_func(QemuOpts *opts, void *opaque)
 {
     NumaOptions *object = NULL;
     Error *err = NULL;
@@ -168,6 +170,11 @@ void set_numa_nodes(void)
 {
     int i;
 
+    if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func,
+                          NULL, 1) != 0) {
+        exit(1);
+    }
+
     assert(max_numa_nodeid <= MAX_NODES);
 
     /* No support for sparse NUMA node IDs yet: */
diff --git a/vl.c b/vl.c
index 5adea75..cfce820 100644
--- a/vl.c
+++ b/vl.c
@@ -4154,11 +4154,6 @@ int main(int argc, char **argv, char **envp)
     default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
     default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
 
-    if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func,
-                          NULL, 1) != 0) {
-        exit(1);
-    }
-
     set_numa_nodes();
 
     if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, 1) != 0) {
-- 
2.1.0

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

* [Qemu-devel] [PATCH 6/7] numa: Rename option parsing functions
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
                   ` (4 preceding siblings ...)
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 5/7] numa: Move QemuOpts parsing to set_numa_nodes() Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 7/7] numa: Rename set_numa_modes() to numa_post_machine_init() Eduardo Habkost
  2015-02-09  9:16 ` [Qemu-devel] [PATCH 0/7] NUMA code cleanup Paolo Bonzini
  7 siblings, 0 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Renaming set_numa_nodes() and numa_init_func() to parse_numa_opts() and
parse_numa() makes the purpose of those functions clearer.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/numa.h | 2 +-
 numa.c                | 6 +++---
 vl.c                  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index d25ada9..453b49a 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -16,7 +16,7 @@ typedef struct node_info {
     bool present;
 } NodeInfo;
 extern NodeInfo numa_info[MAX_NODES];
-void set_numa_nodes(void);
+void parse_numa_opts(void);
 void set_numa_modes(void);
 void query_numa_node_mem(uint64_t node_mem[]);
 extern QemuOptsList qemu_numa_opts;
diff --git a/numa.c b/numa.c
index eb9259b..d5b95e1 100644
--- a/numa.c
+++ b/numa.c
@@ -123,7 +123,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
     max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);
 }
 
-static int numa_init_func(QemuOpts *opts, void *opaque)
+static int parse_numa(QemuOpts *opts, void *opaque)
 {
     NumaOptions *object = NULL;
     Error *err = NULL;
@@ -166,11 +166,11 @@ error:
     return -1;
 }
 
-void set_numa_nodes(void)
+void parse_numa_opts(void)
 {
     int i;
 
-    if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func,
+    if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa,
                           NULL, 1) != 0) {
         exit(1);
     }
diff --git a/vl.c b/vl.c
index cfce820..7243216 100644
--- a/vl.c
+++ b/vl.c
@@ -4154,7 +4154,7 @@ int main(int argc, char **argv, char **envp)
     default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
     default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
 
-    set_numa_nodes();
+    parse_numa_opts();
 
     if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, 1) != 0) {
         exit(1);
-- 
2.1.0

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

* [Qemu-devel] [PATCH 7/7] numa: Rename set_numa_modes() to numa_post_machine_init()
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
                   ` (5 preceding siblings ...)
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 6/7] numa: Rename option parsing functions Eduardo Habkost
@ 2015-02-08 18:51 ` Eduardo Habkost
  2015-02-09  9:16 ` [Qemu-devel] [PATCH 0/7] NUMA code cleanup Paolo Bonzini
  7 siblings, 0 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-08 18:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hu Tao, Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

This function does some initialization that needs to be done after
machine init. The function may be eventually removed if we move the
CPUState.numa_node initialization to the CPU init code, but while the
function exists, lets give it a name that makes sense.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/numa.h | 2 +-
 numa.c                | 2 +-
 vl.c                  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index 453b49a..5633b85 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -17,7 +17,7 @@ typedef struct node_info {
 } NodeInfo;
 extern NodeInfo numa_info[MAX_NODES];
 void parse_numa_opts(void);
-void set_numa_modes(void);
+void numa_post_machine_init(void);
 void query_numa_node_mem(uint64_t node_mem[]);
 extern QemuOptsList qemu_numa_opts;
 
diff --git a/numa.c b/numa.c
index d5b95e1..0d15375 100644
--- a/numa.c
+++ b/numa.c
@@ -246,7 +246,7 @@ void parse_numa_opts(void)
     }
 }
 
-void set_numa_modes(void)
+void numa_post_machine_init(void)
 {
     CPUState *cpu;
     int i;
diff --git a/vl.c b/vl.c
index 7243216..f8e516f 100644
--- a/vl.c
+++ b/vl.c
@@ -4213,7 +4213,7 @@ int main(int argc, char **argv, char **envp)
 
     cpu_synchronize_all_post_init();
 
-    set_numa_modes();
+    numa_post_machine_init();
 
     /* init USB devices */
     if (usb_enabled()) {
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH 0/7] NUMA code cleanup
  2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
                   ` (6 preceding siblings ...)
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 7/7] numa: Rename set_numa_modes() to numa_post_machine_init() Eduardo Habkost
@ 2015-02-09  9:16 ` Paolo Bonzini
  2015-02-09 14:53   ` Eduardo Habkost
  7 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2015-02-09  9:16 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: Hu Tao, Igor Mammedov, Michael S. Tsirkin



On 08/02/2015 19:51, Eduardo Habkost wrote:
> This cleans up some of the NUMA code: moves declarations to numa.h, rename some
> functions, and remove some existing code that was inside main().
> 
> Eduardo Habkost (7):
>   numa: Move NUMA declarations from sysemu.h to numa.h
>   vl.c: Remove unnecessary zero-initialization of NUMA globals
>   numa: Move NUMA globals to numa.c
>   numa: Make max_numa_nodeid static
>   numa: Move QemuOpts parsing to set_numa_nodes()
>   numa: Rename option parsing functions
>   numa: Rename set_numa_modes() to numa_post_machine_init()

Nice!

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [Qemu-devel] [PATCH 0/7] NUMA code cleanup
  2015-02-09  9:16 ` [Qemu-devel] [PATCH 0/7] NUMA code cleanup Paolo Bonzini
@ 2015-02-09 14:53   ` Eduardo Habkost
  2015-02-09 16:02     ` Paolo Bonzini
  2015-02-09 16:20     ` Michael S. Tsirkin
  0 siblings, 2 replies; 14+ messages in thread
From: Eduardo Habkost @ 2015-02-09 14:53 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Hu Tao, Igor Mammedov, qemu-devel, Michael S. Tsirkin

On Mon, Feb 09, 2015 at 10:16:08AM +0100, Paolo Bonzini wrote:
> 
> 
> On 08/02/2015 19:51, Eduardo Habkost wrote:
> > This cleans up some of the NUMA code: moves declarations to numa.h, rename some
> > functions, and remove some existing code that was inside main().
> > 
> > Eduardo Habkost (7):
> >   numa: Move NUMA declarations from sysemu.h to numa.h
> >   vl.c: Remove unnecessary zero-initialization of NUMA globals
> >   numa: Move NUMA globals to numa.c
> >   numa: Make max_numa_nodeid static
> >   numa: Move QemuOpts parsing to set_numa_nodes()
> >   numa: Rename option parsing functions
> >   numa: Rename set_numa_modes() to numa_post_machine_init()
> 
> Nice!
> 
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks!

Do you think this should go through Michael's tree, like past NUMA
patches, or through yours?

-- 
Eduardo

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

* Re: [Qemu-devel] [PATCH 0/7] NUMA code cleanup
  2015-02-09 14:53   ` Eduardo Habkost
@ 2015-02-09 16:02     ` Paolo Bonzini
  2015-02-09 16:20     ` Michael S. Tsirkin
  1 sibling, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2015-02-09 16:02 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Hu Tao, Igor Mammedov, qemu-devel, Michael S. Tsirkin



On 09/02/2015 15:53, Eduardo Habkost wrote:
> Thanks!
> 
> Do you think this should go through Michael's tree, like past NUMA
> patches, or through yours?

Through Michael's tree or yours :)

Paolo

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

* Re: [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h
  2015-02-08 18:51 ` [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h Eduardo Habkost
@ 2015-02-09 16:17   ` Michael S. Tsirkin
  0 siblings, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2015-02-09 16:17 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Hu Tao, Paolo Bonzini, qemu-devel, Igor Mammedov

On Sun, Feb 08, 2015 at 04:51:16PM -0200, Eduardo Habkost wrote:
> Not all sysemu.h users need the NUMA declarations, and keeping them in a
> separate file makes easier to see what are the interfaces provided by

s/makes easier/makes it easier/

> numa.c.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  hw/i386/pc.c            |  1 +
>  hw/mem/pc-dimm.c        |  1 +
>  hw/ppc/spapr.c          |  1 +
>  include/sysemu/numa.h   | 28 ++++++++++++++++++++++++++++
>  include/sysemu/sysemu.h | 18 ------------------
>  monitor.c               |  1 +
>  numa.c                  |  2 +-
>  vl.c                    |  1 +
>  8 files changed, 34 insertions(+), 19 deletions(-)
>  create mode 100644 include/sysemu/numa.h
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index c7af6aa..0b31c14 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -41,6 +41,7 @@
>  #include "hw/pci/msi.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
> +#include "sysemu/numa.h"
>  #include "sysemu/kvm.h"
>  #include "kvm_i386.h"
>  #include "hw/xen/xen.h"
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 18cdc54..f27a087 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -22,6 +22,7 @@
>  #include "qemu/config-file.h"
>  #include "qapi/visitor.h"
>  #include "qemu/range.h"
> +#include "sysemu/numa.h"
>  
>  typedef struct pc_dimms_capacity {
>       uint64_t size;
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index b560459..e754262 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -25,6 +25,7 @@
>   *
>   */
>  #include "sysemu/sysemu.h"
> +#include "sysemu/numa.h"
>  #include "hw/hw.h"
>  #include "hw/fw-path-provider.h"
>  #include "elf.h"
> diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
> new file mode 100644
> index 0000000..514914f
> --- /dev/null
> +++ b/include/sysemu/numa.h
> @@ -0,0 +1,28 @@
> +#ifndef SYSEMU_NUMA_H
> +#define SYSEMU_NUMA_H
> +
> +#include <stdint.h>
> +#include "qemu/bitmap.h"
> +#include "qemu/option.h"
> +#include "sysemu/sysemu.h"
> +#include "sysemu/hostmem.h"
> +
> +extern int nb_numa_nodes;   /* Number of NUMA nodes */
> +extern int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
> +                             * For all nodes, nodeid < max_numa_nodeid
> +                             */
> +
> +typedef struct node_info {
> +    uint64_t node_mem;
> +    DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS);
> +    struct HostMemoryBackend *node_memdev;
> +    bool present;
> +} NodeInfo;
> +extern NodeInfo numa_info[MAX_NODES];
> +void set_numa_nodes(void);
> +void set_numa_modes(void);
> +void query_numa_node_mem(uint64_t node_mem[]);
> +extern QemuOptsList qemu_numa_opts;
> +int numa_init_func(QemuOpts *opts, void *opaque);
> +
> +#endif
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 748d059..a726659 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -147,24 +147,6 @@ extern int mem_prealloc;
>   */
>  #define MAX_CPUMASK_BITS 255
>  
> -extern int nb_numa_nodes;   /* Number of NUMA nodes */
> -extern int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
> -                             * For all nodes, nodeid < max_numa_nodeid
> -                             */
> -
> -typedef struct node_info {
> -    uint64_t node_mem;
> -    DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS);
> -    struct HostMemoryBackend *node_memdev;
> -    bool present;
> -} NodeInfo;
> -extern NodeInfo numa_info[MAX_NODES];
> -void set_numa_nodes(void);
> -void set_numa_modes(void);
> -void query_numa_node_mem(uint64_t node_mem[]);
> -extern QemuOptsList qemu_numa_opts;
> -int numa_init_func(QemuOpts *opts, void *opaque);
> -
>  #define MAX_OPTION_ROMS 16
>  typedef struct QEMUOptionRom {
>      const char *name;
> diff --git a/monitor.c b/monitor.c
> index 5a24311..4de3a8c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -35,6 +35,7 @@
>  #include "sysemu/char.h"
>  #include "ui/qemu-spice.h"
>  #include "sysemu/sysemu.h"
> +#include "sysemu/numa.h"
>  #include "monitor/monitor.h"
>  #include "qemu/readline.h"
>  #include "ui/console.h"
> diff --git a/numa.c b/numa.c
> index afd2866..40f3d36 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -22,7 +22,7 @@
>   * THE SOFTWARE.
>   */
>  
> -#include "sysemu/sysemu.h"
> +#include "sysemu/numa.h"
>  #include "exec/cpu-common.h"
>  #include "qemu/bitmap.h"
>  #include "qom/cpu.h"
> diff --git a/vl.c b/vl.c
> index 983259b..63ec996 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -78,6 +78,7 @@ int main(int argc, char **argv)
>  #include "monitor/monitor.h"
>  #include "ui/console.h"
>  #include "sysemu/sysemu.h"
> +#include "sysemu/numa.h"
>  #include "exec/gdbstub.h"
>  #include "qemu/timer.h"
>  #include "sysemu/char.h"
> -- 
> 2.1.0

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

* Re: [Qemu-devel] [PATCH 0/7] NUMA code cleanup
  2015-02-09 14:53   ` Eduardo Habkost
  2015-02-09 16:02     ` Paolo Bonzini
@ 2015-02-09 16:20     ` Michael S. Tsirkin
  2015-02-12 16:49       ` Michael S. Tsirkin
  1 sibling, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2015-02-09 16:20 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, Igor Mammedov, qemu-devel, Hu Tao

On Mon, Feb 09, 2015 at 12:53:37PM -0200, Eduardo Habkost wrote:
> On Mon, Feb 09, 2015 at 10:16:08AM +0100, Paolo Bonzini wrote:
> > 
> > 
> > On 08/02/2015 19:51, Eduardo Habkost wrote:
> > > This cleans up some of the NUMA code: moves declarations to numa.h, rename some
> > > functions, and remove some existing code that was inside main().
> > > 
> > > Eduardo Habkost (7):
> > >   numa: Move NUMA declarations from sysemu.h to numa.h
> > >   vl.c: Remove unnecessary zero-initialization of NUMA globals
> > >   numa: Move NUMA globals to numa.c
> > >   numa: Make max_numa_nodeid static
> > >   numa: Move QemuOpts parsing to set_numa_nodes()
> > >   numa: Rename option parsing functions
> > >   numa: Rename set_numa_modes() to numa_post_machine_init()
> > 
> > Nice!
> > 
> > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Thanks!
> 
> Do you think this should go through Michael's tree, like past NUMA
> patches, or through yours?

kvm tree does not seem appropriate.
I can merge this if you wish, let me know.

> -- 
> Eduardo

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

* Re: [Qemu-devel] [PATCH 0/7] NUMA code cleanup
  2015-02-09 16:20     ` Michael S. Tsirkin
@ 2015-02-12 16:49       ` Michael S. Tsirkin
  0 siblings, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2015-02-12 16:49 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, Igor Mammedov, qemu-devel, Hu Tao

On Mon, Feb 09, 2015 at 05:20:08PM +0100, Michael S. Tsirkin wrote:
> On Mon, Feb 09, 2015 at 12:53:37PM -0200, Eduardo Habkost wrote:
> > On Mon, Feb 09, 2015 at 10:16:08AM +0100, Paolo Bonzini wrote:
> > > 
> > > 
> > > On 08/02/2015 19:51, Eduardo Habkost wrote:
> > > > This cleans up some of the NUMA code: moves declarations to numa.h, rename some
> > > > functions, and remove some existing code that was inside main().
> > > > 
> > > > Eduardo Habkost (7):
> > > >   numa: Move NUMA declarations from sysemu.h to numa.h
> > > >   vl.c: Remove unnecessary zero-initialization of NUMA globals
> > > >   numa: Move NUMA globals to numa.c
> > > >   numa: Make max_numa_nodeid static
> > > >   numa: Move QemuOpts parsing to set_numa_nodes()
> > > >   numa: Rename option parsing functions
> > > >   numa: Rename set_numa_modes() to numa_post_machine_init()
> > > 
> > > Nice!
> > > 
> > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > Thanks!
> > 
> > Do you think this should go through Michael's tree, like past NUMA
> > patches, or through yours?
> 
> kvm tree does not seem appropriate.
> I can merge this if you wish, let me know.

Or if you want to merge it through another tree:
Acked-by: Michael S. Tsirkin <mst@redhat.com>

> > -- 
> > Eduardo

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

end of thread, other threads:[~2015-02-12 16:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-08 18:51 [Qemu-devel] [PATCH 0/7] NUMA code cleanup Eduardo Habkost
2015-02-08 18:51 ` [Qemu-devel] [PATCH 1/7] numa: Move NUMA declarations from sysemu.h to numa.h Eduardo Habkost
2015-02-09 16:17   ` Michael S. Tsirkin
2015-02-08 18:51 ` [Qemu-devel] [PATCH 2/7] vl.c: Remove unnecessary zero-initialization of NUMA globals Eduardo Habkost
2015-02-08 18:51 ` [Qemu-devel] [PATCH 3/7] numa: Move NUMA globals to numa.c Eduardo Habkost
2015-02-08 18:51 ` [Qemu-devel] [PATCH 4/7] numa: Make max_numa_nodeid static Eduardo Habkost
2015-02-08 18:51 ` [Qemu-devel] [PATCH 5/7] numa: Move QemuOpts parsing to set_numa_nodes() Eduardo Habkost
2015-02-08 18:51 ` [Qemu-devel] [PATCH 6/7] numa: Rename option parsing functions Eduardo Habkost
2015-02-08 18:51 ` [Qemu-devel] [PATCH 7/7] numa: Rename set_numa_modes() to numa_post_machine_init() Eduardo Habkost
2015-02-09  9:16 ` [Qemu-devel] [PATCH 0/7] NUMA code cleanup Paolo Bonzini
2015-02-09 14:53   ` Eduardo Habkost
2015-02-09 16:02     ` Paolo Bonzini
2015-02-09 16:20     ` Michael S. Tsirkin
2015-02-12 16:49       ` Michael S. Tsirkin

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.