qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323
@ 2017-03-23 10:10 David Gibson
  2017-03-23 10:10 ` [Qemu-devel] [PULL 1/1] numa, spapr: align default numa node memory size to 256MB David Gibson
  2017-03-23 17:29 ` [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2017-03-23 10:10 UTC (permalink / raw)
  To: peter.maydell
  Cc: qemu-devel, qemu-ppc, lvivier, thuth, ehabkost, mdroth, aik,
	David Gibson

The following changes since commit 55a19ad8b2d0797e3a8fe90ab99a9bb713824059:

  Update version for v2.9.0-rc1 release (2017-03-21 17:13:29 +0000)

are available in the git repository at:

  git://github.com/dgibson/qemu.git tags/ppc-for-2.9-20170323

for you to fetch changes up to 55641213fc81cdfc3bcd56c9e9991faa119201b2:

  numa,spapr: align default numa node memory size to 256MB (2017-03-22 11:32:42 +1100)

----------------------------------------------------------------
ppc patch queue for 2017-03-23

Just a single bugfix in this batch.  It's not strictly in ppc code,
though it's for the pseries machine's benefit.  Eduardo suggested it
go through my tree however.

----------------------------------------------------------------
Laurent Vivier (1):
      numa,spapr: align default numa node memory size to 256MB

 hw/core/machine.c   | 5 +++++
 hw/ppc/spapr.c      | 6 ++++++
 include/hw/boards.h | 1 +
 numa.c              | 6 +++---
 4 files changed, 15 insertions(+), 3 deletions(-)

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

* [Qemu-devel] [PULL 1/1] numa, spapr: align default numa node memory size to 256MB
  2017-03-23 10:10 [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323 David Gibson
@ 2017-03-23 10:10 ` David Gibson
  2017-03-23 17:29 ` [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-03-23 10:10 UTC (permalink / raw)
  To: peter.maydell
  Cc: qemu-devel, qemu-ppc, lvivier, thuth, ehabkost, mdroth, aik,
	David Gibson

From: Laurent Vivier <lvivier@redhat.com>

Since commit 224245b ("spapr: Add LMB DR connectors"), NUMA node
memory size must be aligned to 256MB (SPAPR_MEMORY_BLOCK_SIZE).

But when "-numa" option is provided without "mem" parameter,
the memory is equally divided between nodes, but 8MB aligned.
This can be not valid for pseries.

In that case we can have:
$ ./ppc64-softmmu/qemu-system-ppc64 -m 4G -numa node -numa node -numa node
qemu-system-ppc64: Node 0 memory size 0x55000000 is not aligned to 256 MiB

With this patch, we have:
(qemu) info numa
3 nodes
node 0 cpus: 0
node 0 size: 1280 MB
node 1 cpus:
node 1 size: 1280 MB
node 2 cpus:
node 2 size: 1536 MB

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/core/machine.c   | 5 +++++
 hw/ppc/spapr.c      | 6 ++++++
 include/hw/boards.h | 1 +
 numa.c              | 6 +++---
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 0d92672..ada9eea 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -396,6 +396,11 @@ static void machine_class_init(ObjectClass *oc, void *data)
     mc->default_ram_size = 128 * M_BYTE;
     mc->rom_file_has_mr = true;
 
+    /* numa node memory size aligned on 8MB by default.
+     * On Linux, each node's border has to be 8MB aligned
+     */
+    mc->numa_mem_align_shift = 23;
+
     object_class_property_add_str(oc, "accel",
         machine_get_accel, machine_set_accel, &error_abort);
     object_class_property_set_description(oc, "accel",
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6ee566d..8aecea3 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3096,6 +3096,11 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
     xic->ics_resend = spapr_ics_resend;
     xic->icp_get = spapr_icp_get;
     ispc->print_info = spapr_pic_print_info;
+    /* Force NUMA node memory size to be a multiple of
+     * SPAPR_MEMORY_BLOCK_SIZE (256M) since that's the granularity
+     * in which LMBs are represented and hot-added
+     */
+    mc->numa_mem_align_shift = 28;
 }
 
 static const TypeInfo spapr_machine_info = {
@@ -3180,6 +3185,7 @@ static void spapr_machine_2_8_class_options(MachineClass *mc)
 {
     spapr_machine_2_9_class_options(mc);
     SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_8);
+    mc->numa_mem_align_shift = 23;
 }
 
 DEFINE_SPAPR_MACHINE(2_8, "2.8", false);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 269d0ba..31d9c72 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -135,6 +135,7 @@ struct MachineClass {
     bool rom_file_has_mr;
     int minimum_page_bits;
     bool has_hotpluggable_cpus;
+    int numa_mem_align_shift;
 
     HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
                                            DeviceState *dev);
diff --git a/numa.c b/numa.c
index e01cb54..6fc2393 100644
--- a/numa.c
+++ b/numa.c
@@ -338,12 +338,12 @@ void parse_numa_opts(MachineClass *mc)
         if (i == nb_numa_nodes) {
             uint64_t usedmem = 0;
 
-            /* On Linux, each node's border has to be 8MB aligned,
-             * the final node gets the rest.
+            /* Align each node according to the alignment
+             * requirements of the machine class
              */
             for (i = 0; i < nb_numa_nodes - 1; i++) {
                 numa_info[i].node_mem = (ram_size / nb_numa_nodes) &
-                                        ~((1 << 23UL) - 1);
+                                        ~((1 << mc->numa_mem_align_shift) - 1);
                 usedmem += numa_info[i].node_mem;
             }
             numa_info[i].node_mem = ram_size - usedmem;
-- 
2.9.3

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

* Re: [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323
  2017-03-23 10:10 [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323 David Gibson
  2017-03-23 10:10 ` [Qemu-devel] [PULL 1/1] numa, spapr: align default numa node memory size to 256MB David Gibson
@ 2017-03-23 17:29 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2017-03-23 17:29 UTC (permalink / raw)
  To: David Gibson
  Cc: QEMU Developers, qemu-ppc@nongnu.org, Laurent Vivier, Thomas Huth,
	Eduardo Habkost, Michael Roth, Alexey Kardashevskiy

On 23 March 2017 at 10:10, David Gibson <david@gibson.dropbear.id.au> wrote:
> The following changes since commit 55a19ad8b2d0797e3a8fe90ab99a9bb713824059:
>
>   Update version for v2.9.0-rc1 release (2017-03-21 17:13:29 +0000)
>
> are available in the git repository at:
>
>   git://github.com/dgibson/qemu.git tags/ppc-for-2.9-20170323
>
> for you to fetch changes up to 55641213fc81cdfc3bcd56c9e9991faa119201b2:
>
>   numa,spapr: align default numa node memory size to 256MB (2017-03-22 11:32:42 +1100)
>
> ----------------------------------------------------------------
> ppc patch queue for 2017-03-23
>
> Just a single bugfix in this batch.  It's not strictly in ppc code,
> though it's for the pseries machine's benefit.  Eduardo suggested it
> go through my tree however.
>
> ----------------------------------------------------------------
> Laurent Vivier (1):
>       numa,spapr: align default numa node memory size to 256MB
>

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2017-03-23 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 10:10 [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323 David Gibson
2017-03-23 10:10 ` [Qemu-devel] [PULL 1/1] numa, spapr: align default numa node memory size to 256MB David Gibson
2017-03-23 17:29 ` [Qemu-devel] [PULL 0/1] ppc-for-2.9 queue 20170323 Peter Maydell

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