Changelog: since v2: * use 0xFFFFFFFF for UNASSIGNED_APIC_ID instead of UINT32_MAX * add comment why 0xFFFFFFFF could be used for UNASSIGNED_APIC_ID * print topo ids is unsigned * print APIC ID as hex * print topo ids calculated from APIC ID beside it * add extra patch to fix migration failure due to APIC's instance_id mismatch since v1: * s/pc_find_cpu/pc_find_cpu_slot/ + add comment to it * add more sanity checks for socket-id/core-id/thread-id and 'apic' properties * include device_del cpu patches and related fixes to x86 CPU/apic
Series enabling usage of -device/device_add for adding CPUs as devices and device_del for removing them. Using -device/device_add in combination with query-hotpluggable-cpus QMP command allows to hotplug CPUs at any not used possition and then safely migrate QEMU instance by specifying hotadded CPUs on target with help of -device CLI option like with any other device. Having been able to replicate exact topology on taggert with -device CPUs also opens poosibility to hot-remove CPUs, which this series does by enabling to use device_del with x86 CPUs. Series depends on following not yet commited patchsets: 1: [PATCH v2 0/6] cpus: make "-cpu cpux, features" global properties https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg02579.html 2: [PATCH v2 00/10] globals: Clean up validation and error checking https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg05662.html git tree for testing: https://github.com/imammedo/qemu.git dev_del_cpu_v3 for viewing: https://github.com/imammedo/qemu/commits/dev_del_cpu_v3 Tested with RHEL7.2 guest including ping/pong migration with adding/removing CPUs in between. Igor Mammedov (19): target-i386: cpu: use uint32_t for X86CPU.apic_id pc: add x86_topo_ids_from_apicid() pc: extract CPU lookup into a separate function pc: cpu: consolidate apic-id validity checks in pc_cpu_pre_plug() target-i386: cpu: replace custom apic-id setter/getter with static property target-i386: add socket/core/thread properties to X86CPU pc: set APIC ID based on socket/core/thread ids if it's not been set yet pc: implement query-hotpluggable-cpus callback pc: delay setting number of boot CPUs to machine_done time pc: register created initial and hotpluged CPUs in one place pc_cpu_plug() pc: cpu: allow device_add to be used with x86 cpu apic: move MAX_APICS check to 'apic' class apic: drop APICCommonState.idx and use APIC ID as index in local_apics[] (kvm)apic: add unrealize callbacks apic: use apic_id as apic's migration instance_id target-i386: cpu: do not ignore error and fix apic parent target-i386: fix apic object leak when CPU is deleted target-i386: add x86_cpu_unrealizefn() pc: make device_del CPU work for x86 CPUs hw/i386/kvm/apic.c | 5 + hw/i386/pc.c | 233 ++++++++++++++++++++++++++++++++-------- hw/intc/apic.c | 26 ++++- hw/intc/apic_common.c | 33 ++++-- include/hw/i386/apic_internal.h | 5 +- include/hw/i386/pc.h | 5 + include/hw/i386/topology.h | 15 +++ qmp-commands.hx | 15 +++ target-i386/cpu.c | 88 ++++++--------- target-i386/cpu.h | 11 +- 10 files changed, 320 insertions(+), 116 deletions(-) -- 2.7.0