[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/29] pc: get numa node mapping from possible_cpus i
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 16/29] pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() |
Date: |
Thu, 11 May 2017 16:18:30 -0300 |
From: Igor Mammedov <address@hidden>
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Andrew Jones <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/acpi/cpu.c | 7 +++----
hw/i386/acpi-build.c | 11 ++++-------
hw/i386/pc.c | 18 ++++++++++--------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 8c719d3f9d..a233fe17cf 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -503,7 +503,6 @@ void build_cpus_aml(Aml *table, MachineState *machine,
CPUHotplugFeatures opts,
/* build Processor object for each processor */
for (i = 0; i < arch_ids->len; i++) {
- int j;
Aml *dev;
Aml *uid = aml_int(i);
GArray *madt_buf = g_array_new(0, 1, 1);
@@ -557,9 +556,9 @@ void build_cpus_aml(Aml *table, MachineState *machine,
CPUHotplugFeatures opts,
* as a result _PXM is required for all CPUs which might
* be hot-plugged. For simplicity, add it for all CPUs.
*/
- j = numa_get_node_for_cpu(i);
- if (j < nb_numa_nodes) {
- aml_append(dev, aml_name_decl("_PXM", aml_int(j)));
+ if (arch_ids->cpus[i].props.has_node_id) {
+ aml_append(dev, aml_name_decl("_PXM",
+ aml_int(arch_ids->cpus[i].props.node_id)));
}
aml_append(cpus_dev, dev);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c7cc45cc4b..cc0418f327 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2335,7 +2335,8 @@ build_srat(GArray *table_data, BIOSLinker *linker,
MachineState *machine)
srat->reserved1 = cpu_to_le32(1);
for (i = 0; i < apic_ids->len; i++) {
- int j = numa_get_node_for_cpu(i);
+ int node_id = apic_ids->cpus[i].props.has_node_id ?
+ apic_ids->cpus[i].props.node_id : 0;
uint32_t apic_id = apic_ids->cpus[i].arch_id;
if (apic_id < 255) {
@@ -2345,9 +2346,7 @@ build_srat(GArray *table_data, BIOSLinker *linker,
MachineState *machine)
core->type = ACPI_SRAT_PROCESSOR_APIC;
core->length = sizeof(*core);
core->local_apic_id = apic_id;
- if (j < nb_numa_nodes) {
- core->proximity_lo = j;
- }
+ core->proximity_lo = node_id;
memset(core->proximity_hi, 0, 3);
core->local_sapic_eid = 0;
core->flags = cpu_to_le32(1);
@@ -2358,9 +2357,7 @@ build_srat(GArray *table_data, BIOSLinker *linker,
MachineState *machine)
core->type = ACPI_SRAT_PROCESSOR_x2APIC;
core->length = sizeof(*core);
core->x2apic_id = cpu_to_le32(apic_id);
- if (j < nb_numa_nodes) {
- core->proximity_domain = cpu_to_le32(j);
- }
+ core->proximity_domain = cpu_to_le32(node_id);
core->flags = cpu_to_le32(1);
}
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 455300f776..e36a375683 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -747,7 +747,9 @@ static FWCfgState *bochs_bios_init(AddressSpace *as,
PCMachineState *pcms)
{
FWCfgState *fw_cfg;
uint64_t *numa_fw_cfg;
- int i, j;
+ int i;
+ const CPUArchIdList *cpus;
+ MachineClass *mc = MACHINE_GET_CLASS(pcms);
fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, as);
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
@@ -782,12 +784,12 @@ static FWCfgState *bochs_bios_init(AddressSpace *as,
PCMachineState *pcms)
*/
numa_fw_cfg = g_new0(uint64_t, 1 + pcms->apic_id_limit + nb_numa_nodes);
numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);
- for (i = 0; i < max_cpus; i++) {
- unsigned int apic_id = x86_cpu_apic_id_from_index(i);
+ cpus = mc->possible_cpu_arch_ids(MACHINE(pcms));
+ for (i = 0; i < cpus->len; i++) {
+ unsigned int apic_id = cpus->cpus[i].arch_id;
assert(apic_id < pcms->apic_id_limit);
- j = numa_get_node_for_cpu(i);
- if (j < nb_numa_nodes) {
- numa_fw_cfg[apic_id + 1] = cpu_to_le64(j);
+ if (cpus->cpus[i].props.has_node_id) {
+ numa_fw_cfg[apic_id + 1] =
cpu_to_le64(cpus->cpus[i].props.node_id);
}
}
for (i = 0; i < nb_numa_nodes; i++) {
@@ -1984,8 +1986,8 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
cs = CPU(cpu);
cs->cpu_index = idx;
- node_id = numa_get_node_for_cpu(cs->cpu_index);
- if (node_id == nb_numa_nodes) {
+ node_id = cpu_slot->props.node_id;
+ if (!cpu_slot->props.has_node_id) {
/* by default CPUState::numa_node was 0 if it's not set via CLI
* keep it this way for now but in future we probably should
* refuse to start up with incomplete numa mapping */
--
2.11.0.259.g40922b1
- [Qemu-devel] [PULL 06/29] hw/arm/virt: extract mp-affinity calculation in separate function, (continued)
- [Qemu-devel] [PULL 06/29] hw/arm/virt: extract mp-affinity calculation in separate function, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 07/29] hw/arm/virt: use machine->possible_cpus for storing possible topology info, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 08/29] hw/arm/virt: explicitly allocate cpu_index for cpus, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 09/29] numa: move source of default CPUs to NUMA node mapping into boards, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 11/29] pc: add node-id property to CPU, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 10/29] spapr: add node-id property to sPAPR core, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 12/29] virt-arm: add node-id property to CPU, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 13/29] numa: add check that board supports cpu_index to node mapping, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 14/29] numa: mirror cpu to node mapping in MachineState::possible_cpus, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 15/29] numa: do default mapping based on possible_cpus instead of node_cpu bitmaps, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 16/29] pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu(),
Eduardo Habkost <=
- [Qemu-devel] [PULL 17/29] spapr: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu(), Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 18/29] virt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu(), Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 19/29] QMP: include CpuInstanceProperties into query_cpus output output, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 20/29] tests: numa: add case for QMP command query-cpus, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 21/29] numa: remove no longer need numa_post_machine_init(), Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 22/29] machine: call machine init from wrapper, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 23/29] numa: use possible_cpus for not mapped CPUs check, Eduardo Habkost, 2017/05/11
- [Qemu-devel] [PULL 24/29] numa: remove node_cpu bitmaps as they are no longer used, Eduardo Habkost, 2017/05/11