From nobody Tue Nov 11 02:13:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1560331793; cv=none; d=zoho.com; s=zohoarc; b=VT3/XBm2/PN5lLf8VFOuoDcXajDnSQ9MLnALUhXNteMVryO9I66sV3ueZFI5OjaolIEjF6KrYvT2nOh+6MVrulMOBVTu3Xb+4sDR4/J6+JZ+rbXVTUj2ZH3o1KRb89P3jYg4o79gr8boJRUjpCq7d9NBt8O+6JJES0F5N1cNb/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560331793; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xMF8dn5GiV5zK0yykG+4/bKl2dKE5bM+Jb4yLcLo6cI=; b=A877+auxLsLQYSYQK0ngBgE/ZnjK+1NKm2E47xt8K+ccYgZAGU+X3/TEYjmkx/Y6l/vRALibj7A7VksNoKy/SeDZjMyjM7SVGitp9/wg9ZJq/nBdJrtNZbaIZP0z9KvJi56m+MphgBDEMXHu3nArlzYfpSZJHiTshyniMJneEzA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560331793089460.30862772219496; Wed, 12 Jun 2019 02:29:53 -0700 (PDT) Received: from localhost ([::1]:58006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hazZm-0006ES-3C for importer@patchew.org; Wed, 12 Jun 2019 05:29:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39277) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hazRw-0001RU-DG for qemu-devel@nongnu.org; Wed, 12 Jun 2019 05:21:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hazRu-0007xO-31 for qemu-devel@nongnu.org; Wed, 12 Jun 2019 05:21:44 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51182 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hazRt-0007vZ-Sw for qemu-devel@nongnu.org; Wed, 12 Jun 2019 05:21:42 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5C9E8HQ114123 for ; Wed, 12 Jun 2019 05:21:38 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t2vnkwsk2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Jun 2019 05:21:37 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Jun 2019 10:21:36 +0100 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Jun 2019 10:21:34 +0100 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5C9LXeD20316580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:21:33 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A4FBC6055; Wed, 12 Jun 2019 09:21:33 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B35D5C6057; Wed, 12 Jun 2019 09:21:30 +0000 (GMT) Received: from [127.0.1.1] (unknown [9.124.31.35]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 12 Jun 2019 09:21:30 +0000 (GMT) From: Aravinda Prasad To: aik@au1.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 12 Jun 2019 14:51:29 +0530 In-Reply-To: <156033104292.26635.15759339817253067370.stgit@aravinda> References: <156033104292.26635.15759339817253067370.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: 19061209-0036-0000-0000-00000AC9FFB1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011250; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01216839; UDB=6.00639831; IPR=6.00997939; MB=3.00027275; MTD=3.00000008; XFM=3.00000015; UTC=2019-06-12 09:21:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061209-0037-0000-0000-00004C325A8F Message-Id: <156033128952.26635.18407252540270604091.stgit@aravinda> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-12_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120064 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v10 5/6] migration: Include migration support for machine check handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: paulus@ozlabs.org, aravinda@linux.vnet.ibm.com, groug@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This patch includes migration support for machine check handling. Especially this patch blocks 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.c | 27 +++++++++++++++++++++++++++ hw/ppc/spapr_events.c | 14 ++++++++++++++ include/hw/ppc/spapr.h | 2 ++ 3 files changed, 43 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d61905b..3d6d139 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -42,6 +42,7 @@ #include "migration/misc.h" #include "migration/global_state.h" #include "migration/register.h" +#include "migration/blocker.h" #include "mmu-hash64.h" #include "mmu-book3s-v3.h" #include "cpu-models.h" @@ -1812,6 +1813,8 @@ static void spapr_machine_reset(void) =20 /* Signal all vCPUs waiting on this condition */ qemu_cond_broadcast(&spapr->mc_delivery_cond); + + migrate_del_blocker(spapr->fwnmi_migration_blocker); } =20 static void spapr_create_nvram(SpaprMachineState *spapr) @@ -2102,6 +2105,25 @@ static const VMStateDescription vmstate_spapr_dtb = =3D { }, }; =20 +static bool spapr_fwnmi_needed(void *opaque) +{ + SpaprMachineState *spapr =3D (SpaprMachineState *)opaque; + + return spapr->guest_machine_check_addr !=3D -1; +} + +static const VMStateDescription vmstate_spapr_machine_check =3D { + .name =3D "spapr_machine_check", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D spapr_fwnmi_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT64(guest_machine_check_addr, SpaprMachineState), + VMSTATE_INT32(mc_status, SpaprMachineState), + VMSTATE_END_OF_LIST() + }, +}; + static const VMStateDescription vmstate_spapr =3D { .name =3D "spapr", .version_id =3D 3, @@ -2135,6 +2157,7 @@ static const VMStateDescription vmstate_spapr =3D { &vmstate_spapr_dtb, &vmstate_spapr_cap_large_decr, &vmstate_spapr_cap_ccf_assist, + &vmstate_spapr_machine_check, NULL } }; @@ -2919,6 +2942,10 @@ static void spapr_machine_init(MachineState *machine) =20 /* Resize rtas blob to accommodate error log */ spapr->rtas_size =3D RTAS_ERROR_LOG_MAX; + + /* Create the error string for live migration blocker */ + error_setg(&spapr->fwnmi_migration_blocker, + "Live migration not supported during machine check handlin= g"); } =20 spapr->rtas_blob =3D g_malloc(spapr->rtas_size); diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 51c052e..f8ce7f0 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -41,6 +41,7 @@ #include "qemu/bcd.h" #include "hw/ppc/spapr_ovec.h" #include +#include "migration/blocker.h" =20 #define RTAS_LOG_VERSION_MASK 0xff000000 #define RTAS_LOG_VERSION_6 0x06000000 @@ -857,6 +858,19 @@ static void spapr_mce_dispatch_elog(PowerPCCPU *cpu, b= ool recovered) void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered) { SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); + int ret; + Error *local_err =3D NULL; + + ret =3D migrate_add_blocker(spapr->fwnmi_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. + */ + warn_report_err(local_err); + } =20 while (spapr->mc_status !=3D -1) { /* diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index debb57b..0dedf0a 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -214,6 +214,8 @@ struct SpaprMachineState { SpaprCapabilities def, eff, mig; =20 unsigned gpu_numa_id; + + Error *fwnmi_migration_blocker; }; =20 #define H_SUCCESS 0