Received: from eggs.gnu.org ([2001:4830:134:3::10]:53499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKICa-0002TJ-2L for qemu-devel@nongnu.org; Tue, 05 Jul 2016 00:43:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKICX-0005oG-6d for qemu-devel@nongnu.org; Tue, 05 Jul 2016 00:43:16 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:17563 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKICX-0005nS-27 for qemu-devel@nongnu.org; Tue, 05 Jul 2016 00:43:13 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u654dR6o107115 for ; Tue, 5 Jul 2016 00:43:09 -0400 Received: from e28smtp08.in.ibm.com (e28smtp08.in.ibm.com [125.16.236.8]) by mx0b-001b2d01.pphosted.com with ESMTP id 23x9rm8sff-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Jul 2016 00:43:09 -0400 Received: from localhost by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Jul 2016 10:13:05 +0530 From: Bharata B Rao Date: Tue, 5 Jul 2016 10:12:47 +0530 Message-Id: <1467693772-7391-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH v0 0/5] sPAPR: Fix migration when CPUs are removed in random order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, imammedo@redhat.com, groug@kaod.org, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com, Bharata B Rao device_add/del based CPU hotplug and unplug support is upstream for sPAPR PowerPC and is under development for x86. Both of these will support CPU device removal in random order (and not necessarily in LIFO order). Random order removal will result in holes in cpu_index range which causes migration to fail. This needs fixes in both generic code as well as arch specific code. - We need to use arch_id as the instance_id when registering CPU devices using vmstate_register. To support forward migration, as per Igor's suggestion, this needs to be done conditionally based on machine type version. - From pseries-2.7 onwards, we start using arch_id for migration as well as in XICS code. In fact, Igor even suggested to move the vmstate registration calls into cpu_common_realizefn and yet-to-be-introduced cpu_common_unrealizefn. But I haven't done that in this patchset as I am hitting an unrelated issue with that movement. This patchset depends on Greg Kurz's patchset where among other things, he is deriving cpu_dt_it (arch_id) based on core-id. (https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg00210.html) Tested changes to XICS code with both kernel_irqchip=on/off. This applies on ppc-for-2.7 branch of David's tree. Bharata B Rao (5): cpu: Factor out cpu vmstate_[un]register into separate routines cpu: Optionally use arch_id instead of cpu_index in cpu vmstate_register() spapr: Implement CPUClass.get_arch_id() for PowerPC CPUs xics: Use arch_id instead of cpu_index in XICS code spapr: Prefer arch_id over cpu_index exec.c | 53 +++++++++++++++++++++++++++++---------------- hw/intc/xics.c | 14 ++++++++---- hw/intc/xics_kvm.c | 12 +++++----- hw/intc/xics_spapr.c | 33 ++++++++++++++++++++++------ hw/ppc/spapr.c | 2 ++ hw/ppc/spapr_cpu_core.c | 5 +++++ include/hw/boards.h | 1 + include/qom/cpu.h | 4 ++++ target-ppc/translate_init.c | 8 +++++++ 9 files changed, 96 insertions(+), 36 deletions(-) -- 2.7.4