[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 00/15] attempt to fix CPU topology info on CPU APIC ID
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC 00/15] attempt to fix CPU topology info on CPU APIC IDs |
Date: |
Tue, 7 Aug 2012 16:56:38 -0300 |
First, the bug description:
The CPU APIC IDs generated by QEMU are broken if the number of cores-per-socket
or threads-per-core are not powers of 2, as the bits on the APIC ID do not
correspond to what's expected to reflect the CPU sockets/cores/threads
topology[1].
[1]
http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/
This is an attempt to fix it, but there were some obstacles on the way:
1) The NUMA fw_cfg interface requires the full topology information to be
available even for hotplug CPUs that don't exist yet, so we need to be able to
calculate the APIC ID solely from the CPU index.
2) CPU objects are not qdev objects (yet).
3) We don't have a "list CPUs" object (yet), so we don't have an object where
a compatibility global property could be set, and that would be responsible for
calculating the APIC IDs.
That said, the patches are organized as follows:
- Patches 1 to 3 are just code movements or smaller fixes to prepare for the
actual fix. They should be safe to be applied right now.
- Patches 4 to 6 addresses issue #1 above.
- Patches 7 to 12 change the global property handling code to make it at least
possible to use a global property without requiring QOM or qdev (due to
issues #2 and #3 above). I expect it to be controversial and I would like to
get some feedback.
- Patches 13 and 14 are the actual fix, that changes the APIC ID calculation to
match the requested CPU topology, and use a "SMP.contiguous_apic_ids" global
property to keep compatibility on pc-1.1 and older machine-types.
The fix depends on commit 008c1fc5bd4f1c545c38e07242ad676830ea7785 of SeaBIOS,
that allows CPU APIC IDs to be non-contiguous. However, older SeaBIOS verions
should still work, as long as cores/threads are powers of 2 or you use the
"pc-1.1" machine-type (or older).
I am aware of the coding style warnings from checkpatch.pl (mainly "line over 80
characters" warnings), and I plan to fix them in the final version of the fix.
Eduardo Habkost (15):
cpus.h: include cpu-common.h
hw/apic.c: rename bit functions to not conflict with bitops.h (v2)
kvm: set vcpu_id to APIC ID instead of CPU index
i386: create apic_id_for_cpu() function (v2)
remove FW_CFG_MAX_CPUS from fw_cfg_init()
pc: set FW_CFG data based on APIC ID calculation
qdev: allow qdev_prop_parse() to report errors
move global properties code to global-properties.c
isolate qdev-independent parts of qdev_prop_set_globals()
create object_prop_set_globals()
rename qdev_prop_register_global_list to qemu_globals_register_list
create qemu_global_get() function
tests: support target-specific unit tests
i386: topology & APIC ID utility functions (v2)
generate APIC IDs according to CPU topology (v2)
Makefile.objs | 1 +
cpus.h | 2 +
global-properties.c | 88 ++++++++++++++++++++++++++++++
hw/apic.c | 35 ++++++------
hw/fw_cfg.c | 1 -
hw/pc.c | 23 +++++---
hw/pc_piix.c | 4 ++
hw/ppc_newworld.c | 1 +
hw/ppc_oldworld.c | 1 +
hw/qdev-monitor.c | 6 ++-
hw/qdev-properties.c | 67 ++---------------------
hw/qdev.h | 18 +++++--
hw/sun4m.c | 3 ++
hw/sun4u.c | 1 +
kvm-all.c | 2 +-
target-i386/cpu.c | 40 +++++++++++++-
target-i386/cpu.h | 17 ++++++
target-i386/topology.h | 144 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/.gitignore | 1 +
tests/Makefile | 19 +++++--
tests/test-x86-cpuid.c | 108 +++++++++++++++++++++++++++++++++++++
vl.c | 6 +--
22 files changed, 488 insertions(+), 100 deletions(-)
create mode 100644 global-properties.c
create mode 100644 target-i386/topology.h
create mode 100644 tests/test-x86-cpuid.c
--
1.7.11.2
- [Qemu-devel] [RFC 00/15] attempt to fix CPU topology info on CPU APIC IDs,
Eduardo Habkost <=
- [Qemu-devel] [RFC 05/15] remove FW_CFG_MAX_CPUS from fw_cfg_init(), Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 03/15] kvm: set vcpu_id to APIC ID instead of CPU index, Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 09/15] isolate qdev-independent parts of qdev_prop_set_globals(), Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 10/15] create object_prop_set_globals(), Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 11/15] rename qdev_prop_register_global_list to qemu_globals_register_list, Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 12/15] create qemu_global_get() function, Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 08/15] move global properties code to global-properties.c, Eduardo Habkost, 2012/08/07
- [Qemu-devel] [RFC 04/15] i386: create apic_id_for_cpu() function (v2), Eduardo Habkost, 2012/08/07