Changelog: 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 hotadd arbitrary CPUs and migrate also opens poosibility to hot-remove arbitrary CPUs, which this series enables by permitting using 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 3: [PATCH v2 2/2] qapi: keep names in 'CpuInstanceProperties' in sync with struct CPUCore https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg06972.html git tree for testing: https://github.com/imammedo/qemu.git dev_del_cpu_v2 for viewing: https://github.com/imammedo/qemu/commits/dev_del_cpu_v2 Tested with RHEL7.2 guest including ping/pong migration with adding/removing CPUs in between. CPU removal only slightly tested (~ for a week) so please give it more attention when testing. v1 for referrence: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg06810.html Igor Mammedov (18): 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 target-i386: 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 | 21 ++-- include/hw/i386/apic_internal.h | 4 +- include/hw/i386/topology.h | 15 +++ qmp-commands.hx | 15 +++ target-i386/cpu.c | 88 ++++++--------- target-i386/cpu.h | 8 +- 9 files changed, 300 insertions(+), 115 deletions(-) -- 1.8.3.1