* [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes
@ 2013-11-25 3:14 Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 1/2] spapr: make sure RMA is in first mode of first memory node Alexey Kardashevskiy
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Alexey Kardashevskiy @ 2013-11-25 3:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf
This fixes a bug in patch#1 and mistype in patch#2, details are in
the commit messages.
Alexey Kardashevsksy (1):
spapr: make sure RMA is in first mode of first memory node
Paul Mackerras (1):
spapr: limit numa memory regions by ram size
hw/ppc/spapr.c | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
--
1.8.4.rc4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v6 1/2] spapr: make sure RMA is in first mode of first memory node
2013-11-25 3:14 [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
@ 2013-11-25 3:14 ` Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 2/2] spapr: limit numa memory regions by ram size Alexey Kardashevskiy
2013-12-03 3:45 ` [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
2 siblings, 0 replies; 6+ messages in thread
From: Alexey Kardashevskiy @ 2013-11-25 3:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf
The SPAPR specification says that the RMA starts at the LPAR's logical
address 0 and is the first logical memory block reported in
the LPAR’s device tree.
So SLOF only maps the first block and that block needs to span
the full RMA.
This makes sure that the RMA area is where SLOF expects it.
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v6:
* fixed a bug with spapr_reset_htab() which used to reset spapr->rma_size
to the entire RAM
v4:
* fixed a bug with preallocated RMA (thanks to Thomas Huth)
v3:
* removed unnecessary RMA fixup from spapr_populate_memory()
v2:
* changed as recommended by Alex Graf
---
hw/ppc/spapr.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7e53a5f..7426518 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -532,9 +532,6 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
/* memory node(s) */
node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
- if (spapr->rma_size > node0_size) {
- spapr->rma_size = node0_size;
- }
/* RMA */
mem_reg_property[0] = 0;
@@ -688,7 +685,8 @@ static void spapr_reset_htab(sPAPREnvironment *spapr)
/* Update the RMA size if necessary */
if (spapr->vrma_adjust) {
- spapr->rma_size = kvmppc_rma_size(ram_size, spapr->htab_shift);
+ hwaddr node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
+ spapr->rma_size = kvmppc_rma_size(node0_size, spapr->htab_shift);
}
}
@@ -1113,6 +1111,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
hwaddr rma_alloc_size;
+ hwaddr node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
uint32_t initrd_base = 0;
long kernel_size = 0, initrd_size = 0;
long load_limit, rtas_limit, fw_size;
@@ -1134,10 +1133,10 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
exit(1);
}
- if (rma_alloc_size && (rma_alloc_size < ram_size)) {
+ if (rma_alloc_size && (rma_alloc_size < node0_size)) {
spapr->rma_size = rma_alloc_size;
} else {
- spapr->rma_size = ram_size;
+ spapr->rma_size = node0_size;
/* With KVM, we don't actually know whether KVM supports an
* unbounded RMA (PR KVM) or is limited by the hash table size
@@ -1154,6 +1153,12 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
}
}
+ if (spapr->rma_size > node0_size) {
+ fprintf(stderr, "Error: Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")\n",
+ spapr->rma_size);
+ exit(1);
+ }
+
/* We place the device tree and RTAS just below either the top of the RMA,
* or just below 2GB, whichever is lowere, so that it can be
* processed with 32-bit real mode code if necessary */
--
1.8.4.rc4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v6 2/2] spapr: limit numa memory regions by ram size
2013-11-25 3:14 [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 1/2] spapr: make sure RMA is in first mode of first memory node Alexey Kardashevskiy
@ 2013-11-25 3:14 ` Alexey Kardashevskiy
2013-12-03 3:45 ` [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
2 siblings, 0 replies; 6+ messages in thread
From: Alexey Kardashevskiy @ 2013-11-25 3:14 UTC (permalink / raw)
To: qemu-devel; +Cc: aik, qemu-ppc, Paul Mackerras, Alexander Graf
From: Paul Mackerras <paulus@samba.org>
This makes sure that all NUMA memory blocks reside within RAM or
have zero length.
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
V6: fixed mistype
---
This is a bugfix for:
-m 500
-smp 8,sockets=2,cores=2,threads=2
-numa node,nodeid=0,cpus=0-3,mem=500
-numa node,nodeid=1,cpus=4-7,mem=500
---
hw/ppc/spapr.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7426518..1239d80 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -526,12 +526,16 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
cpu_to_be32(0x0), cpu_to_be32(0x0),
cpu_to_be32(0x0)};
char mem_name[32];
- hwaddr node0_size, mem_start;
+ hwaddr node0_size, mem_start, node_size;
uint64_t mem_reg_property[2];
int i, off;
/* memory node(s) */
- node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
+ if (nb_numa_nodes > 1 && node_mem[0] < ram_size) {
+ node0_size = node_mem[0];
+ } else {
+ node0_size = ram_size;
+ }
/* RMA */
mem_reg_property[0] = 0;
@@ -563,7 +567,15 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
mem_start = node0_size;
for (i = 1; i < nb_numa_nodes; i++) {
mem_reg_property[0] = cpu_to_be64(mem_start);
- mem_reg_property[1] = cpu_to_be64(node_mem[i]);
+ if (mem_start >= ram_size) {
+ node_size = 0;
+ } else {
+ node_size = node_mem[i];
+ if (node_size > ram_size - mem_start) {
+ node_size = ram_size - mem_start;
+ }
+ }
+ mem_reg_property[1] = cpu_to_be64(node_size);
associativity[3] = associativity[4] = cpu_to_be32(i);
sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start);
off = fdt_add_subnode(fdt, 0, mem_name);
@@ -573,7 +585,7 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
sizeof(mem_reg_property))));
_FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity,
sizeof(associativity))));
- mem_start += node_mem[i];
+ mem_start += node_size;
}
return 0;
--
1.8.4.rc4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes
2013-11-25 3:14 [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 1/2] spapr: make sure RMA is in first mode of first memory node Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 2/2] spapr: limit numa memory regions by ram size Alexey Kardashevskiy
@ 2013-12-03 3:45 ` Alexey Kardashevskiy
2013-12-10 8:32 ` Alexey Kardashevskiy
2 siblings, 1 reply; 6+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-03 3:45 UTC (permalink / raw)
To: Alexander Graf; +Cc: Alexey Kardashevskiy, qemu-ppc, qemu-devel
On 11/25/2013 02:14 PM, Alexey Kardashevskiy wrote:
> This fixes a bug in patch#1 and mistype in patch#2, details are in
> the commit messages.
>
> Alexey Kardashevsksy (1):
> spapr: make sure RMA is in first mode of first memory node
>
> Paul Mackerras (1):
> spapr: limit numa memory regions by ram size
>
> hw/ppc/spapr.c | 35 ++++++++++++++++++++++++++---------
> 1 file changed, 26 insertions(+), 9 deletions(-)
>
Alex, ping? It got ROB from Thomas :)
--
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes
2013-12-03 3:45 ` [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
@ 2013-12-10 8:32 ` Alexey Kardashevskiy
2013-12-18 21:38 ` Alexander Graf
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-10 8:32 UTC (permalink / raw)
To: Alexander Graf; +Cc: Alexey Kardashevskiy, qemu-ppc, qemu-devel
On 12/03/2013 02:45 PM, Alexey Kardashevskiy wrote:
> On 11/25/2013 02:14 PM, Alexey Kardashevskiy wrote:
>> This fixes a bug in patch#1 and mistype in patch#2, details are in
>> the commit messages.
>>
>> Alexey Kardashevsksy (1):
>> spapr: make sure RMA is in first mode of first memory node
>>
>> Paul Mackerras (1):
>> spapr: limit numa memory regions by ram size
>>
>> hw/ppc/spapr.c | 35 ++++++++++++++++++++++++++---------
>> 1 file changed, 26 insertions(+), 9 deletions(-)
>>
>
> Alex, ping? It got ROB from Thomas :)
Ping?
--
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes
2013-12-10 8:32 ` Alexey Kardashevskiy
@ 2013-12-18 21:38 ` Alexander Graf
0 siblings, 0 replies; 6+ messages in thread
From: Alexander Graf @ 2013-12-18 21:38 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: qemu-ppc, QEMU Developers
On 10.12.2013, at 09:32, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> On 12/03/2013 02:45 PM, Alexey Kardashevskiy wrote:
>> On 11/25/2013 02:14 PM, Alexey Kardashevskiy wrote:
>>> This fixes a bug in patch#1 and mistype in patch#2, details are in
>>> the commit messages.
>>>
>>> Alexey Kardashevsksy (1):
>>> spapr: make sure RMA is in first mode of first memory node
>>>
>>> Paul Mackerras (1):
>>> spapr: limit numa memory regions by ram size
>>>
>>> hw/ppc/spapr.c | 35 ++++++++++++++++++++++++++---------
>>> 1 file changed, 26 insertions(+), 9 deletions(-)
>>>
>>
>> Alex, ping? It got ROB from Thomas :)
>
>
> Ping?
Thanks, applied to ppc-next.
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-18 21:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25 3:14 [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 1/2] spapr: make sure RMA is in first mode of first memory node Alexey Kardashevskiy
2013-11-25 3:14 ` [Qemu-devel] [PATCH v6 2/2] spapr: limit numa memory regions by ram size Alexey Kardashevskiy
2013-12-03 3:45 ` [Qemu-devel] [PATCH v6 0/2] spapr: rma and numa nodes fixes Alexey Kardashevskiy
2013-12-10 8:32 ` Alexey Kardashevskiy
2013-12-18 21:38 ` Alexander Graf
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).