[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 36/51] pc: acpi: SRAT: create only valid processor
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 36/51] pc: acpi: SRAT: create only valid processor lapic entries |
Date: |
Tue, 15 Mar 2016 17:02:21 +0200 |
From: Igor Mammedov <address@hidden>
When APIC IDs are sparse*, in addition to valid LAPIC
entries the SRAT is also filled invalid ones for non
possible APIC IDs.
Fix it by asking machine for all possible APIC IDs
instead of wrongly assuming that all APIC IDs in
range 0..apic_id_limit are possible.
* sparse lapic topology CLI:
-smp x,sockets=2,cores=3,maxcpus=6
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/i386/acpi-build.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index be6d0a9..a7aeb2f 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2453,6 +2453,8 @@ build_srat(GArray *table_data, GArray *linker,
MachineState *machine)
uint64_t curnode;
int srat_start, numa_start, slots;
uint64_t mem_len, mem_base, next_base;
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
+ CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(machine);
PCMachineState *pcms = PC_MACHINE(machine);
ram_addr_t hotplugabble_address_space_size =
object_property_get_int(OBJECT(pcms), PC_MACHINE_MEMHP_REGION_SIZE,
@@ -2463,12 +2465,14 @@ build_srat(GArray *table_data, GArray *linker,
MachineState *machine)
srat = acpi_data_push(table_data, sizeof *srat);
srat->reserved1 = cpu_to_le32(1);
- for (i = 0; i < pcms->apic_id_limit; ++i) {
+ for (i = 0; i < apic_ids->len; i++) {
+ int apic_id = apic_ids->cpus[i].arch_id;
+
core = acpi_data_push(table_data, sizeof *core);
core->type = ACPI_SRAT_PROCESSOR;
core->length = sizeof(*core);
- core->local_apic_id = i;
- curnode = pcms->node_cpu[i];
+ core->local_apic_id = apic_id;
+ curnode = pcms->node_cpu[apic_id];
core->proximity_lo = curnode;
memset(core->proximity_hi, 0, 3);
core->local_sapic_eid = 0;
@@ -2533,6 +2537,7 @@ build_srat(GArray *table_data, GArray *linker,
MachineState *machine)
(void *)(table_data->data + srat_start),
"SRAT",
table_data->len - srat_start, 1, NULL, NULL);
+ g_free(apic_ids);
}
static void
--
MST
- [Qemu-devel] [PULL v2 25/51] nvdimm acpi: emulate dsm method, (continued)
- [Qemu-devel] [PULL v2 25/51] nvdimm acpi: emulate dsm method, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 29/51] qemu-char: remove all msgfds on disconnect, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 28/51] qemu-char: avoid potential double-free, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 27/51] vhost-user: remove useless is_server field, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 32/51] pc: acpi: remove NOP assignment, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 30/51] qemu-char: make tcp_chr_disconnect() reentrant-safe, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 31/51] pxb: cleanup, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 33/51] pc: init pcms->apic_id_limit once and use it throughout pc.c, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 35/51] pc: acpi: cleanup qdev_get_machine() calls, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 34/51] machine: introduce MachineClass.possible_cpu_arch_ids() hook, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 36/51] pc: acpi: SRAT: create only valid processor lapic entries,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 37/51] pc: acpi: create MADT.lapic entries only for valid lapics, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 38/51] pc: acpi: create Processor and Notify objects only for valid lapics, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 39/51] pc: acpi: drop cpu->found_cpus bitmap, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 41/51] MAINTAINERS: Add an entry for virtio header files, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 40/51] pc: acpi: clarify why possible LAPIC entries must be present in MADT, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 42/51] MAINTAINERS: machine core, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 43/51] ipmi: remove IPMI_CHECK_CMD_LEN() macro, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 45/51] ipmi: remove IPMI_CHECK_RESERVATION() macro, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 47/51] ipmi: add a realize function to the device class, Michael S. Tsirkin, 2016/03/15
- [Qemu-devel] [PULL v2 44/51] ipmi: replace IPMI_ADD_RSP_DATA() macro with inline helpers, Michael S. Tsirkin, 2016/03/15