* [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt
@ 2016-01-23 11:36 Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 1/5] ARM: Virt: Add /distance-map node for NUMA Shannon Zhao
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Shannon Zhao @ 2016-01-23 11:36 UTC (permalink / raw)
To: qemu-arm, peter.maydell
Cc: hangaohuai, peter.huangpeng, qemu-devel, shannon.zhao,
ganapatrao.kulkarni, hanjun.guo
From: Shannon Zhao <shannon.zhao@linaro.org>
Add NUMA support for machine virt. Tested successfully running a guest
Linux kernel with the following patch applied:
- [PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms
https://lwn.net/Articles/672329/
- [PATCH v2 0/4] ACPI based NUMA support for ARM64
http://www.spinics.net/lists/linux-acpi/msg61795.html
Changes since v3:
* based on new kernel driver and device bindings
* add ACPI part
Changes since v2:
* update to use NUMA node property arm,associativity.
Changes since v1:
Take into account Peter's comments:
* rename virt_memory_init to arm_generate_memory_dtb
* move arm_generate_memory_dtb to boot.c and make it a common func
* use a struct numa_map to generate numa dtb
Example qemu command line:
qemu-system-aarch64 \
-enable-kvm -smp 4\
-kernel Image \
-m 512 -machine virt,kernel_irqchip=on \
-initrd guestfs.cpio.gz \
-cpu host -nographic \
-numa node,mem=256M,cpus=0-1,nodeid=0 \
-numa node,mem=256M,cpus=2-3,nodeid=1 \
-append "console=ttyAMA0 root=/dev/ram"
Shannon Zhao (5):
ARM: Virt: Add /distance-map node for NUMA
ARM: Virt: Set numa-node-id for CPUs
ARM: Add numa-node-id for /memory node
include/hw/acpi/acpi-defs: Add GICC Affinity Structure
hw/arm/virt-acpi-build: Generate SRAT table
hw/arm/boot.c | 29 ++++++++++++++++++++++-
hw/arm/virt-acpi-build.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
hw/arm/virt.c | 37 +++++++++++++++++++++++++++++
hw/i386/acpi-build.c | 2 +-
include/hw/acpi/acpi-defs.h | 15 +++++++++++-
5 files changed, 138 insertions(+), 3 deletions(-)
--
2.0.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 1/5] ARM: Virt: Add /distance-map node for NUMA
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
@ 2016-01-23 11:36 ` Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 2/5] ARM: Virt: Set numa-node-id for CPUs Shannon Zhao
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Shannon Zhao @ 2016-01-23 11:36 UTC (permalink / raw)
To: qemu-arm, peter.maydell
Cc: hangaohuai, peter.huangpeng, qemu-devel, shannon.zhao,
ganapatrao.kulkarni, hanjun.guo
From: Shannon Zhao <shannon.zhao@linaro.org>
This /distance-map node is used to describe the accessing distance
between NUMA nodes.
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/arm/virt.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 15658f4..c725e29 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -39,6 +39,7 @@
#include "sysemu/device_tree.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
+#include "sysemu/numa.h"
#include "hw/boards.h"
#include "hw/loader.h"
#include "exec/address-spaces.h"
@@ -183,6 +184,9 @@ static VirtBoardInfo *find_machine_info(const char *cpu)
static void create_fdt(VirtBoardInfo *vbi)
{
+ unsigned int i, j, number, count;
+ uint64_t *matrix;
+
void *fdt = create_device_tree(&vbi->fdt_size);
if (!fdt) {
@@ -219,6 +223,32 @@ static void create_fdt(VirtBoardInfo *vbi)
"clk24mhz");
qemu_fdt_setprop_cell(fdt, "/apb-pclk", "phandle", vbi->clock_phandle);
+ if (nb_numa_nodes <= 0) {
+ return;
+ }
+
+ /* Add /distance-map node for NUMA */
+ qemu_fdt_add_subnode(fdt, "/distance-map");
+ qemu_fdt_setprop_string(fdt, "/distance-map", "compatible",
+ "numa,distance-map-v1");
+
+ number = nb_numa_nodes * nb_numa_nodes * 6;
+ matrix = g_malloc0(number * sizeof(uint64_t));
+ for (i = 0; i < nb_numa_nodes; i++) {
+ for (j = 0; j < nb_numa_nodes; j++) {
+ count = (i * nb_numa_nodes + j) * 6;
+ matrix[count++] = 1;
+ matrix[count++] = i;
+ matrix[count++] = 1;
+ matrix[count++] = j;
+ matrix[count++] = 1;
+ matrix[count++] = (i == j) ? 10 : 20;
+ }
+ }
+ qemu_fdt_setprop_sized_cells_from_array(fdt, "/distance-map",
+ "distance-matrix", number / 2,
+ matrix);
+ g_free(matrix);
}
static void fdt_add_psci_node(const VirtBoardInfo *vbi)
--
2.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 2/5] ARM: Virt: Set numa-node-id for CPUs
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 1/5] ARM: Virt: Add /distance-map node for NUMA Shannon Zhao
@ 2016-01-23 11:36 ` Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 3/5] ARM: Add numa-node-id for /memory node Shannon Zhao
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Shannon Zhao @ 2016-01-23 11:36 UTC (permalink / raw)
To: qemu-arm, peter.maydell
Cc: hangaohuai, peter.huangpeng, qemu-devel, shannon.zhao,
ganapatrao.kulkarni, hanjun.guo
From: Shannon Zhao <shannon.zhao@linaro.org>
Add a numa-node-id property to specify NUMA information for CPUs.
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/arm/virt.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index c725e29..14265b1 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -335,6 +335,7 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi)
{
int cpu;
int addr_cells = 1;
+ unsigned int i;
/*
* From Documentation/devicetree/bindings/arm/cpus.txt
@@ -384,6 +385,12 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi)
armcpu->mp_affinity);
}
+ for (i = 0; i < nb_numa_nodes; i++) {
+ if (test_bit(cpu, numa_info[i].node_cpu)) {
+ qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i);
+ }
+ }
+
g_free(nodename);
}
}
--
2.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 3/5] ARM: Add numa-node-id for /memory node
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 1/5] ARM: Virt: Add /distance-map node for NUMA Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 2/5] ARM: Virt: Set numa-node-id for CPUs Shannon Zhao
@ 2016-01-23 11:36 ` Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 4/5] include/hw/acpi/acpi-defs: Add GICC Affinity Structure Shannon Zhao
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Shannon Zhao @ 2016-01-23 11:36 UTC (permalink / raw)
To: qemu-arm, peter.maydell
Cc: hangaohuai, peter.huangpeng, qemu-devel, shannon.zhao,
ganapatrao.kulkarni, hanjun.guo
From: Shannon Zhao <shannon.zhao@linaro.org>
When specifying NUMA for ARM machine, generate /memory node according to
NUMA topology.
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/arm/boot.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 7742dd3..10f3615 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -13,6 +13,7 @@
#include "hw/arm/linux-boot-if.h"
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
+#include "sysemu/numa.h"
#include "hw/boards.h"
#include "hw/loader.h"
#include "elf.h"
@@ -353,6 +354,9 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
void *fdt = NULL;
int size, rc;
uint32_t acells, scells;
+ char *nodename;
+ unsigned int i;
+ hwaddr mem_base, mem_len;
if (binfo->dtb_filename) {
char *filename;
@@ -402,14 +406,37 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
goto fail;
}
+ mem_len = (nb_numa_nodes > 0) ? numa_info[0].node_mem : binfo->ram_size;
rc = qemu_fdt_setprop_sized_cells(fdt, "/memory", "reg",
acells, binfo->loader_start,
- scells, binfo->ram_size);
+ scells, mem_len);
if (rc < 0) {
fprintf(stderr, "couldn't set /memory/reg\n");
goto fail;
}
+ if (nb_numa_nodes > 0) {
+ /* create /memory node and set properties for other memory numa nodes */
+ mem_base = binfo->loader_start + mem_len;
+ for (i = 1; i < nb_numa_nodes; i++) {
+ mem_len = numa_info[i].node_mem;
+ nodename = g_strdup_printf("/memory@%" PRIx64, mem_base);
+ qemu_fdt_add_subnode(fdt, nodename);
+ qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory");
+ rc = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg",
+ acells, mem_base,
+ scells, mem_len);
+ if (rc < 0) {
+ fprintf(stderr, "couldn't set /memory/reg\n");
+ goto fail;
+ }
+
+ qemu_fdt_setprop_cell(fdt, nodename, "numa-node-id", i);
+ mem_base += mem_len;
+ g_free(nodename);
+ }
+ }
+
if (binfo->kernel_cmdline && *binfo->kernel_cmdline) {
rc = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
binfo->kernel_cmdline);
--
2.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 4/5] include/hw/acpi/acpi-defs: Add GICC Affinity Structure
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
` (2 preceding siblings ...)
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 3/5] ARM: Add numa-node-id for /memory node Shannon Zhao
@ 2016-01-23 11:36 ` Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 5/5] hw/arm/virt-acpi-build: Generate SRAT table Shannon Zhao
2016-01-29 6:32 ` [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Ashok Kumar
5 siblings, 0 replies; 9+ messages in thread
From: Shannon Zhao @ 2016-01-23 11:36 UTC (permalink / raw)
To: qemu-arm, peter.maydell
Cc: hangaohuai, peter.huangpeng, qemu-devel, shannon.zhao,
Igor Mammedov, ganapatrao.kulkarni, hanjun.guo
From: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
CC: Igor Mammedov <imammedo@redhat.com>
---
hw/i386/acpi-build.c | 2 +-
include/hw/acpi/acpi-defs.h | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 78758e2..0f0b88f 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2300,7 +2300,7 @@ build_srat(GArray *table_data, GArray *linker, PcGuestInfo *guest_info)
for (i = 0; i < guest_info->apic_id_limit; ++i) {
core = acpi_data_push(table_data, sizeof *core);
- core->type = ACPI_SRAT_PROCESSOR;
+ core->type = ACPI_SRAT_PROCESSOR_APIC;
core->length = sizeof(*core);
core->local_apic_id = i;
curnode = guest_info->node_cpu[i];
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index c7a03d4..bcf5c3f 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -455,8 +455,10 @@ struct AcpiSystemResourceAffinityTable
} QEMU_PACKED;
typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable;
-#define ACPI_SRAT_PROCESSOR 0
+#define ACPI_SRAT_PROCESSOR_APIC 0
#define ACPI_SRAT_MEMORY 1
+#define ACPI_SRAT_PROCESSOR_x2APIC 2
+#define ACPI_SRAT_PROCESSOR_GICC 3
struct AcpiSratProcessorAffinity
{
@@ -483,6 +485,17 @@ struct AcpiSratMemoryAffinity
} QEMU_PACKED;
typedef struct AcpiSratMemoryAffinity AcpiSratMemoryAffinity;
+struct AcpiSratProcessorGiccAffinity
+{
+ ACPI_SUB_HEADER_DEF
+ uint32_t proximity;
+ uint32_t acpi_processor_uid;
+ uint32_t flags;
+ uint32_t clock_domain;
+} QEMU_PACKED;
+
+typedef struct AcpiSratProcessorGiccAffinity AcpiSratProcessorGiccAffinity;
+
/* PCI fw r3.0 MCFG table. */
/* Subtable */
struct AcpiMcfgAllocation {
--
2.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 5/5] hw/arm/virt-acpi-build: Generate SRAT table
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
` (3 preceding siblings ...)
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 4/5] include/hw/acpi/acpi-defs: Add GICC Affinity Structure Shannon Zhao
@ 2016-01-23 11:36 ` Shannon Zhao
2016-01-29 6:32 ` [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Ashok Kumar
5 siblings, 0 replies; 9+ messages in thread
From: Shannon Zhao @ 2016-01-23 11:36 UTC (permalink / raw)
To: qemu-arm, peter.maydell
Cc: hangaohuai, peter.huangpeng, qemu-devel, shannon.zhao,
Igor Mammedov, ganapatrao.kulkarni, hanjun.guo
From: Shannon Zhao <shannon.zhao@linaro.org>
To support NUMA, it needs to generate SRAT ACPI table.
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
CC: Igor Mammedov <imammedo@redhat.com>
---
hw/arm/virt-acpi-build.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 87fbe7c..8438028 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -42,6 +42,7 @@
#include "hw/acpi/aml-build.h"
#include "hw/pci/pcie_host.h"
#include "hw/pci/pci.h"
+#include "sysemu/numa.h"
#define ARM_SPI_BASE 32
#define ACPI_POWER_BUTTON_DEVICE "PWRB"
@@ -412,6 +413,58 @@ build_spcr(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
}
static void
+build_srat(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
+{
+ AcpiSystemResourceAffinityTable *srat;
+ AcpiSratProcessorGiccAffinity *core;
+ AcpiSratMemoryAffinity *numamem;
+ int i, j, srat_start;
+ uint64_t mem_len, mem_base;
+ uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof *cpu_node);
+
+ for (i = 0; i < guest_info->smp_cpus; i++) {
+ for (j = 0; j < nb_numa_nodes; j++) {
+ if (test_bit(i, numa_info[j].node_cpu)) {
+ cpu_node[i] = j;
+ break;
+ }
+ }
+ }
+
+ srat_start = table_data->len;
+ srat = acpi_data_push(table_data, sizeof *srat);
+ srat->reserved1 = cpu_to_le32(1);
+
+ for (i = 0; i < guest_info->smp_cpus; ++i) {
+ core = acpi_data_push(table_data, sizeof *core);
+ core->type = ACPI_SRAT_PROCESSOR_GICC;
+ core->length = sizeof(*core);
+ core->proximity = cpu_node[i];
+ core->acpi_processor_uid = i;
+ core->flags = cpu_to_le32(1);
+ }
+ g_free(cpu_node);
+
+ mem_base = guest_info->memmap[VIRT_MEM].base;
+ for (i = 0; i < nb_numa_nodes; ++i) {
+ mem_len = numa_info[i].node_mem;
+ numamem = acpi_data_push(table_data, sizeof *numamem);
+ numamem->type = ACPI_SRAT_MEMORY;
+ numamem->length = sizeof(*numamem);
+ memset(numamem->proximity, 0, 4);
+ numamem->proximity[0] = i;
+ numamem->flags = cpu_to_le32(1);
+ numamem->base_addr = cpu_to_le64(mem_base);
+ numamem->range_length = cpu_to_le64(mem_len);
+ mem_base += mem_len;
+ }
+
+ build_header(linker, table_data,
+ (void *)(table_data->data + srat_start), "SRAT",
+ table_data->len - srat_start, 3, NULL);
+}
+
+static void
build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
{
AcpiTableMcfg *mcfg;
@@ -641,6 +694,11 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
acpi_add_table(table_offsets, tables_blob);
build_spcr(tables_blob, tables->linker, guest_info);
+ if (nb_numa_nodes > 0) {
+ acpi_add_table(table_offsets, tables_blob);
+ build_srat(tables_blob, tables->linker, guest_info);
+ }
+
/* RSDT is pointed to by RSDP */
rsdt = tables_blob->len;
build_rsdt(tables_blob, tables->linker, table_offsets);
--
2.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
` (4 preceding siblings ...)
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 5/5] hw/arm/virt-acpi-build: Generate SRAT table Shannon Zhao
@ 2016-01-29 6:32 ` Ashok Kumar
2016-01-29 6:52 ` Shannon Zhao
5 siblings, 1 reply; 9+ messages in thread
From: Ashok Kumar @ 2016-01-29 6:32 UTC (permalink / raw)
To: Shannon Zhao
Cc: peter.maydell, hangaohuai, peter.huangpeng, qemu-devel, qemu-arm,
shannon.zhao, ganapatrao.kulkarni, hanjun.guo
Hi,
On Sat, Jan 23, 2016 at 07:36:41PM +0800, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Add NUMA support for machine virt. Tested successfully running a guest
> Linux kernel with the following patch applied:
>
> - [PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms
> https://lwn.net/Articles/672329/
> - [PATCH v2 0/4] ACPI based NUMA support for ARM64
> http://www.spinics.net/lists/linux-acpi/msg61795.html
>
> Changes since v3:
> * based on new kernel driver and device bindings
> * add ACPI part
>
> Changes since v2:
> * update to use NUMA node property arm,associativity.
>
> Changes since v1:
> Take into account Peter's comments:
> * rename virt_memory_init to arm_generate_memory_dtb
> * move arm_generate_memory_dtb to boot.c and make it a common func
> * use a struct numa_map to generate numa dtb
>
> Example qemu command line:
> qemu-system-aarch64 \
> -enable-kvm -smp 4\
> -kernel Image \
> -m 512 -machine virt,kernel_irqchip=on \
> -initrd guestfs.cpio.gz \
> -cpu host -nographic \
> -numa node,mem=256M,cpus=0-1,nodeid=0 \
> -numa node,mem=256M,cpus=2-3,nodeid=1 \
> -append "console=ttyAMA0 root=/dev/ram"
>
> Shannon Zhao (5):
> ARM: Virt: Add /distance-map node for NUMA
> ARM: Virt: Set numa-node-id for CPUs
> ARM: Add numa-node-id for /memory node
> include/hw/acpi/acpi-defs: Add GICC Affinity Structure
> hw/arm/virt-acpi-build: Generate SRAT table
>
> hw/arm/boot.c | 29 ++++++++++++++++++++++-
> hw/arm/virt-acpi-build.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
> hw/arm/virt.c | 37 +++++++++++++++++++++++++++++
> hw/i386/acpi-build.c | 2 +-
> include/hw/acpi/acpi-defs.h | 15 +++++++++++-
> 5 files changed, 138 insertions(+), 3 deletions(-)
>
> --
> 2.0.4
>
Don't we need to populate the NUMA node in the Affinity byte of MPIDR?
Linux uses the Affinity information in MPIDR to build topology which
might go wrong for the guest in this case.
Maybe a non Linux OS might be impacted more?
distance-map compatible string has been changed from
"numa,distance-map-v1" to "numa-distance-map-v1"
Thanks,
Ashok
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt
2016-01-29 6:32 ` [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Ashok Kumar
@ 2016-01-29 6:52 ` Shannon Zhao
2016-01-29 11:32 ` Andrew Jones
0 siblings, 1 reply; 9+ messages in thread
From: Shannon Zhao @ 2016-01-29 6:52 UTC (permalink / raw)
To: Ashok Kumar
Cc: peter.maydell, hangaohuai, peter.huangpeng, qemu-devel, qemu-arm,
shannon.zhao, ganapatrao.kulkarni, hanjun.guo
On 2016/1/29 14:32, Ashok Kumar wrote:
> Hi,
>
> On Sat, Jan 23, 2016 at 07:36:41PM +0800, Shannon Zhao wrote:
>> > From: Shannon Zhao <shannon.zhao@linaro.org>
>> >
>> > Add NUMA support for machine virt. Tested successfully running a guest
>> > Linux kernel with the following patch applied:
>> >
>> > - [PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms
>> > https://lwn.net/Articles/672329/
>> > - [PATCH v2 0/4] ACPI based NUMA support for ARM64
>> > http://www.spinics.net/lists/linux-acpi/msg61795.html
>> >
>> > Changes since v3:
>> > * based on new kernel driver and device bindings
>> > * add ACPI part
>> >
>> > Changes since v2:
>> > * update to use NUMA node property arm,associativity.
>> >
>> > Changes since v1:
>> > Take into account Peter's comments:
>> > * rename virt_memory_init to arm_generate_memory_dtb
>> > * move arm_generate_memory_dtb to boot.c and make it a common func
>> > * use a struct numa_map to generate numa dtb
>> >
>> > Example qemu command line:
>> > qemu-system-aarch64 \
>> > -enable-kvm -smp 4\
>> > -kernel Image \
>> > -m 512 -machine virt,kernel_irqchip=on \
>> > -initrd guestfs.cpio.gz \
>> > -cpu host -nographic \
>> > -numa node,mem=256M,cpus=0-1,nodeid=0 \
>> > -numa node,mem=256M,cpus=2-3,nodeid=1 \
>> > -append "console=ttyAMA0 root=/dev/ram"
>> >
>> > Shannon Zhao (5):
>> > ARM: Virt: Add /distance-map node for NUMA
>> > ARM: Virt: Set numa-node-id for CPUs
>> > ARM: Add numa-node-id for /memory node
>> > include/hw/acpi/acpi-defs: Add GICC Affinity Structure
>> > hw/arm/virt-acpi-build: Generate SRAT table
>> >
>> > hw/arm/boot.c | 29 ++++++++++++++++++++++-
>> > hw/arm/virt-acpi-build.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
>> > hw/arm/virt.c | 37 +++++++++++++++++++++++++++++
>> > hw/i386/acpi-build.c | 2 +-
>> > include/hw/acpi/acpi-defs.h | 15 +++++++++++-
>> > 5 files changed, 138 insertions(+), 3 deletions(-)
>> >
>> > --
>> > 2.0.4
>> >
> Don't we need to populate the NUMA node in the Affinity byte of MPIDR?
> Linux uses the Affinity information in MPIDR to build topology which
> might go wrong for the guest in this case.
> Maybe a non Linux OS might be impacted more?
>
Ah, yes. It needs to update the MPIDR. But currently QEMU uses the value
from KVM when using KVM. It needs to call kvm_set_one_reg to set the
MPIDR and I'm not sure if this will affect KVM by looking at following
comments:
/*
* When KVM is in use, PSCI is emulated in-kernel and not by qemu.
* Currently KVM has its own idea about MPIDR assignment, so we
* override our defaults with what we get from KVM.
*/
Peter, do you have any suggestion?
> distance-map compatible string has been changed from
> "numa,distance-map-v1" to "numa-distance-map-v1"
Will update this.
Thanks,
--
Shannon
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt
2016-01-29 6:52 ` Shannon Zhao
@ 2016-01-29 11:32 ` Andrew Jones
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Jones @ 2016-01-29 11:32 UTC (permalink / raw)
To: Shannon Zhao
Cc: peter.maydell, hangaohuai, peter.huangpeng, qemu-devel, qemu-arm,
shannon.zhao, Ashok Kumar, ganapatrao.kulkarni, hanjun.guo
On Fri, Jan 29, 2016 at 02:52:35PM +0800, Shannon Zhao wrote:
>
>
> On 2016/1/29 14:32, Ashok Kumar wrote:
> > Hi,
> >
> > On Sat, Jan 23, 2016 at 07:36:41PM +0800, Shannon Zhao wrote:
> >> > From: Shannon Zhao <shannon.zhao@linaro.org>
> >> >
> >> > Add NUMA support for machine virt. Tested successfully running a guest
> >> > Linux kernel with the following patch applied:
> >> >
> >> > - [PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms
> >> > https://lwn.net/Articles/672329/
> >> > - [PATCH v2 0/4] ACPI based NUMA support for ARM64
> >> > http://www.spinics.net/lists/linux-acpi/msg61795.html
> >> >
> >> > Changes since v3:
> >> > * based on new kernel driver and device bindings
> >> > * add ACPI part
> >> >
> >> > Changes since v2:
> >> > * update to use NUMA node property arm,associativity.
> >> >
> >> > Changes since v1:
> >> > Take into account Peter's comments:
> >> > * rename virt_memory_init to arm_generate_memory_dtb
> >> > * move arm_generate_memory_dtb to boot.c and make it a common func
> >> > * use a struct numa_map to generate numa dtb
> >> >
> >> > Example qemu command line:
> >> > qemu-system-aarch64 \
> >> > -enable-kvm -smp 4\
> >> > -kernel Image \
> >> > -m 512 -machine virt,kernel_irqchip=on \
> >> > -initrd guestfs.cpio.gz \
> >> > -cpu host -nographic \
> >> > -numa node,mem=256M,cpus=0-1,nodeid=0 \
> >> > -numa node,mem=256M,cpus=2-3,nodeid=1 \
> >> > -append "console=ttyAMA0 root=/dev/ram"
> >> >
> >> > Shannon Zhao (5):
> >> > ARM: Virt: Add /distance-map node for NUMA
> >> > ARM: Virt: Set numa-node-id for CPUs
> >> > ARM: Add numa-node-id for /memory node
> >> > include/hw/acpi/acpi-defs: Add GICC Affinity Structure
> >> > hw/arm/virt-acpi-build: Generate SRAT table
> >> >
> >> > hw/arm/boot.c | 29 ++++++++++++++++++++++-
> >> > hw/arm/virt-acpi-build.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
> >> > hw/arm/virt.c | 37 +++++++++++++++++++++++++++++
> >> > hw/i386/acpi-build.c | 2 +-
> >> > include/hw/acpi/acpi-defs.h | 15 +++++++++++-
> >> > 5 files changed, 138 insertions(+), 3 deletions(-)
> >> >
> >> > --
> >> > 2.0.4
> >> >
> > Don't we need to populate the NUMA node in the Affinity byte of MPIDR?
> > Linux uses the Affinity information in MPIDR to build topology which
> > might go wrong for the guest in this case.
> > Maybe a non Linux OS might be impacted more?
> >
> Ah, yes. It needs to update the MPIDR. But currently QEMU uses the value
> from KVM when using KVM. It needs to call kvm_set_one_reg to set the
> MPIDR and I'm not sure if this will affect KVM by looking at following
> comments:
> /*
> * When KVM is in use, PSCI is emulated in-kernel and not by qemu.
> * Currently KVM has its own idea about MPIDR assignment, so we
> * override our defaults with what we get from KVM.
> */
>
> Peter, do you have any suggestion?
>
> > distance-map compatible string has been changed from
> > "numa,distance-map-v1" to "numa-distance-map-v1"
> Will update this.
Sigh... I've had the MPIDR rework (to let QEMU dictate it0 on my TODO list
for a loooooong time. I'll pick it up today and hopefully have something to
discuss next week. I'll keep this series in mind too.
Thanks,
drew
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-01-29 11:32 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-23 11:36 [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 1/5] ARM: Virt: Add /distance-map node for NUMA Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 2/5] ARM: Virt: Set numa-node-id for CPUs Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 3/5] ARM: Add numa-node-id for /memory node Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 4/5] include/hw/acpi/acpi-defs: Add GICC Affinity Structure Shannon Zhao
2016-01-23 11:36 ` [Qemu-devel] [PATCH v4 5/5] hw/arm/virt-acpi-build: Generate SRAT table Shannon Zhao
2016-01-29 6:32 ` [Qemu-devel] [PATCH v4 0/5] ARM: Add NUMA support for machine virt Ashok Kumar
2016-01-29 6:52 ` Shannon Zhao
2016-01-29 11:32 ` Andrew Jones
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).