From nobody Mon Nov 3 13:44:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506595486600489.3915833098438; Thu, 28 Sep 2017 03:44:46 -0700 (PDT) Received: from localhost ([::1]:58398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxWJ8-0000JH-LC for importer@patchew.org; Thu, 28 Sep 2017 06:44:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxWDX-0004KA-I5 for qemu-devel@nongnu.org; Thu, 28 Sep 2017 06:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxWDT-0007wz-Kw for qemu-devel@nongnu.org; Thu, 28 Sep 2017 06:38:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxWDT-0007wi-B9 for qemu-devel@nongnu.org; Thu, 28 Sep 2017 06:38:51 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8SAcobB081710 for ; Thu, 28 Sep 2017 06:38:50 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d8v752tcn-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 28 Sep 2017 06:38:50 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Sep 2017 06:38:40 -0400 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 28 Sep 2017 06:38:39 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8SAcbOx3539320; Thu, 28 Sep 2017 10:38:37 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81B39B20B7; Thu, 28 Sep 2017 06:35:56 -0400 (EDT) Received: from [127.0.1.1] (unknown [9.84.218.194]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 1872FB20B6; Thu, 28 Sep 2017 06:35:52 -0400 (EDT) From: Aravinda Prasad To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Thu, 28 Sep 2017 16:08:31 +0530 In-Reply-To: <150659494872.25889.2069124544245723984.stgit@aravinda> References: <150659494872.25889.2069124544245723984.stgit@aravinda> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 17092810-0052-0000-0000-00000268FE6F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007804; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000232; SDB=6.00923539; UDB=6.00464295; IPR=6.00703678; BA=6.00005611; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017301; XFM=3.00000015; UTC=2017-09-28 10:38:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092810-0053-0000-0000-000052268878 Message-Id: <150659511184.25889.10868411111377268218.stgit@aravinda> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-28_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709280159 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v5 6/6] migration: Block migration while handling machine check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aik@ozlabs.ru, benh@au1.ibm.com, paulus@samba.org, sam.bobroff@au1.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Block VM migration requests until the machine check error handling is complete as (i) these errors are specific to the source hardware and is irrelevant on the target hardware, (ii) these errors cause data corruption and should be handled before migration. Signed-off-by: Aravinda Prasad --- hw/ppc/spapr_rtas.c | 3 +++ include/hw/ppc/spapr.h | 2 ++ target/ppc/kvm.c | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index d017a67..17f6567 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -47,6 +47,7 @@ #include "trace.h" #include "hw/ppc/fdt.h" #include "kvm_ppc.h" +#include "migration/blocker.h" =20 static void rtas_display_character(PowerPCCPU *cpu, sPAPRMachineState *spa= pr, uint32_t token, uint32_t nargs, @@ -390,6 +391,8 @@ static void rtas_ibm_nmi_interlock(PowerPCCPU *cpu, spapr->mc_status =3D -1; qemu_cond_signal(&spapr->mc_delivery_cond); rtas_st(rets, 0, RTAS_OUT_SUCCESS); + migrate_del_blocker(spapr->migration_blocker); + error_free(spapr->migration_blocker); } } =20 diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index a75e9cf..0890a44 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -7,6 +7,7 @@ #include "hw/ppc/spapr_drc.h" #include "hw/mem/pc-dimm.h" #include "hw/ppc/spapr_ovec.h" +#include "qapi/error.h" =20 struct VIOsPAPRBus; struct sPAPRPHBState; @@ -136,6 +137,7 @@ struct sPAPRMachineState { MemoryHotplugState hotplug_memory; =20 const char *icp_type; + Error *migration_blocker; }; =20 #define H_SUCCESS 0 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 59b3322..58de7ea 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -52,6 +52,7 @@ #endif #include "elf.h" #include "sysemu/kvm_int.h" +#include "migration/blocker.h" =20 //#define DEBUG_KVM =20 @@ -2770,10 +2771,26 @@ int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run = *run) sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); target_ulong msr =3D 0; + Error *local_err =3D NULL; + int ret; bool type, le; =20 cpu_synchronize_state(CPU(cpu)); =20 + error_setg(&spapr->migration_blocker, + "Live migration not supported during machine check error handl= ing"); + ret =3D migrate_add_blocker(spapr->migration_blocker, &local_err); + if (ret < 0) { + /* + * We don't want to abort and let the migration to continue. In a + * rare case, the machine check handler will run on the target + * hardware. Though this is not preferable, it is better than abor= ting + * the migration or killing the VM. + */ + error_free(spapr->migration_blocker); + fprintf(stderr, "Warning: Machine check during VM migration\n"); + } + /* * Properly set bits in MSR before we invoke the handler. * SRR0/1, DAR and DSISR are properly set by KVM