From nobody Wed Nov 27 13:08:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1698263159; cv=none; d=zohomail.com; s=zohoarc; b=NIiI2Wtjc1Qm60U/aqzxB2Fd7KpvyNsBgFxPUdDNne73H3yO1Xef5LOE+Zv+7El1AN9hDcpBymvlYBffGYp0cS8hkoAxo0RblBPXYwcPYECFMMmcz90xsZf2exkbJ+T28xEQ+2DBtq66eGDFxC0TbvV4vZAVpAyiWwHvwd4at+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698263159; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AvsPNs2nKBgjZO8o7etnM9p3prd+ESnf6kjTqDI2cA4=; b=YXiBOrWYbFY5JbYw5Q2XTWovxGSVA0ZRZUeZXrniZYGczH9dLSQXWibcpwIlcgKzqI9LFEU21ebwR+z7R4CKISNfK3o65LcpekBnaFPiKNwnL4ZnHRu29mb+3M+0v/OTK7y0PWYT6ByUcTx5XBlfXLiglaKLJuHmXz7MXhhE38E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698263159124599.0276665408113; Wed, 25 Oct 2023 12:45:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvjo1-0002tj-1L; Wed, 25 Oct 2023 15:44:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnw-0002su-M4 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:36 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnu-00074A-FX for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:36 -0400 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39PEwGti006251; Wed, 25 Oct 2023 19:44:33 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv6pd0p5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:32 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39PJfdcd034651; Wed, 25 Oct 2023 19:44:31 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tv5374bs1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:31 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39PJiUNN037154; Wed, 25 Oct 2023 19:44:30 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tv5374bqp-2; Wed, 25 Oct 2023 19:44:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=AvsPNs2nKBgjZO8o7etnM9p3prd+ESnf6kjTqDI2cA4=; b=ntoTG75vrdjMIxmvSUZCGRkatuGmvKZPNzkkdAkdaPitxvqswss9YyQVOApT9BQKtEiQ iYghpnQu5LPXqZBOuN/eisk9xRwo/aFL8SWCOtEB+3p3Dds3rci0CqKuonJpnaFs5GMq f84IghxZeFAsO9s30nYly93FJsKSVFlibyhhy8WtS10FbQJ+LRYDzMg9sq7MUm3I9R0y iqZnXqwmI+TpysgUZSLcoHkSD0Sb3y6d9rU2zKE49kX4zU/F4sQ2SnZjA5PnOKhDVKh/ EbBsjKkzCMiV7cTXLeSHd4Cx94MnZtkHhGUN/QpWbFMBWf3Sw7JhXQejwj5wM3NNLWSY KQ== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras , "Daniel P. Berrange" , Steve Sistare Subject: [PATCH V2 1/6] migration: mode parameter Date: Wed, 25 Oct 2023 12:44:24 -0700 Message-Id: <1698263069-406971-2-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> References: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_09,2023-10-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250169 X-Proofpoint-GUID: BwLzbo40MFtZ0iZt8fvgdx5m3X4pqeAw X-Proofpoint-ORIG-GUID: BwLzbo40MFtZ0iZt8fvgdx5m3X4pqeAw Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1698263159650100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Create a mode migration parameter that can be used to select alternate migration algorithms. The default mode is normal, representing the current migration algorithm, and does not need to be explicitly set. No functional change until a new mode is added, except that the mode is shown by the 'info migrate' command. Signed-off-by: Steve Sistare Reviewed-by: Juan Quintela --- hw/core/qdev-properties-system.c | 14 ++++++++++++++ include/hw/qdev-properties-system.h | 4 ++++ include/migration/misc.h | 1 + migration/migration-hmp-cmds.c | 9 +++++++++ migration/options.c | 21 +++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 27 ++++++++++++++++++++++++--- 7 files changed, 74 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 6883406..07a848d 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -673,6 +673,20 @@ const PropertyInfo qdev_prop_multifd_compression =3D { .set_default_value =3D qdev_propinfo_set_default_value_enum, }; =20 +/* --- MigMode --- */ + +QEMU_BUILD_BUG_ON(sizeof(MigMode) !=3D sizeof(int)); + +const PropertyInfo qdev_prop_mig_mode =3D { + .name =3D "MigMode", + .description =3D "mig_mode values, " + "normal", + .enum_table =3D &MigMode_lookup, + .get =3D qdev_propinfo_get_enum, + .set =3D qdev_propinfo_set_enum, + .set_default_value =3D qdev_propinfo_set_default_value_enum, +}; + /* --- Reserved Region --- */ =20 /* diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properti= es-system.h index 0ac327a..1418801 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -7,6 +7,7 @@ extern const PropertyInfo qdev_prop_chr; extern const PropertyInfo qdev_prop_macaddr; extern const PropertyInfo qdev_prop_reserved_region; extern const PropertyInfo qdev_prop_multifd_compression; +extern const PropertyInfo qdev_prop_mig_mode; extern const PropertyInfo qdev_prop_losttickpolicy; extern const PropertyInfo qdev_prop_blockdev_on_error; extern const PropertyInfo qdev_prop_bios_chs_trans; @@ -41,6 +42,9 @@ extern const PropertyInfo qdev_prop_pcie_link_width; #define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ MultiFDCompression) +#define DEFINE_PROP_MIG_MODE(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_mig_mode, \ + MigMode) #define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy) diff --git a/include/migration/misc.h b/include/migration/misc.h index 673ac49..1bc8902 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -15,6 +15,7 @@ #define MIGRATION_MISC_H =20 #include "qemu/notify.h" +#include "qapi/qapi-types-migration.h" #include "qapi/qapi-types-net.h" =20 /* migration/ram.c */ diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index a82597f..35e57b8 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -387,6 +387,11 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), params->vcpu_dirty_limit); + + assert(params->has_mode); + monitor_printf(mon, "%s: %s\n", + MigrationParameter_str(MIGRATION_PARAMETER_MODE), + qapi_enum_lookup(&MigMode_lookup, params->mode)); } =20 qapi_free_MigrationParameters(params); @@ -661,6 +666,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_vcpu_dirty_limit =3D true; visit_type_size(v, param, &p->vcpu_dirty_limit, &err); break; + case MIGRATION_PARAMETER_MODE: + p->has_mode =3D true; + visit_type_MigMode(v, param, &p->mode, &err); + break; default: assert(0); } diff --git a/migration/options.c b/migration/options.c index 42fb818..cbede3f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -175,6 +175,9 @@ Property migration_properties[] =3D { DEFINE_PROP_UINT64("vcpu-dirty-limit", MigrationState, parameters.vcpu_dirty_limit, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT), + DEFINE_PROP_MIG_MODE("mode", MigrationState, + parameters.mode, + MIG_MODE_NORMAL), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -803,6 +806,13 @@ uint64_t migrate_max_postcopy_bandwidth(void) return s->parameters.max_postcopy_bandwidth; } =20 +MigMode migrate_mode(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.mode; +} + int migrate_multifd_channels(void) { MigrationState *s =3D migrate_get_current(); @@ -975,6 +985,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; params->has_vcpu_dirty_limit =3D true; params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; + params->has_mode =3D true; + params->mode =3D s->parameters.mode; =20 return params; } @@ -1010,6 +1022,7 @@ void migrate_params_init(MigrationParameters *params) params->has_announce_step =3D true; params->has_x_vcpu_dirty_limit_period =3D true; params->has_vcpu_dirty_limit =3D true; + params->has_mode =3D true; } =20 /* @@ -1307,6 +1320,10 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, if (params->has_vcpu_dirty_limit) { dest->vcpu_dirty_limit =3D params->vcpu_dirty_limit; } + + if (params->has_mode) { + dest->mode =3D params->mode; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1437,6 +1454,10 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) if (params->has_vcpu_dirty_limit) { s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; } + + if (params->has_mode) { + s->parameters.mode =3D params->mode; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) diff --git a/migration/options.h b/migration/options.h index 237f2d6..246c160 100644 --- a/migration/options.h +++ b/migration/options.h @@ -83,6 +83,7 @@ uint8_t migrate_max_cpu_throttle(void); uint64_t migrate_max_bandwidth(void); uint64_t migrate_avail_switchover_bandwidth(void); uint64_t migrate_max_postcopy_bandwidth(void); +MigMode migrate_mode(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); diff --git a/qapi/migration.json b/qapi/migration.json index db3df12..f99904e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -616,6 +616,15 @@ { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] } =20 ## +# @MigMode: +# +# @normal: the original form of migration. (since 8.2) +# +## +{ 'enum': 'MigMode', + 'data': [ 'normal' ] } + +## # @BitmapMigrationBitmapAliasTransform: # # @persistent: If present, the bitmap will be made persistent or @@ -833,6 +842,9 @@ # @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. # Defaults to 1. (Since 8.1) # +# @mode: Migration mode. See description in @MigMode. Default is 'normal'. +# (Since 8.2) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -857,7 +869,8 @@ 'multifd-zlib-level', 'multifd-zstd-level', 'block-bitmap-mapping', { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= }, - 'vcpu-dirty-limit'] } + 'vcpu-dirty-limit', + 'mode'] } =20 ## # @MigrateSetParameters: @@ -1009,6 +1022,9 @@ # @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. # Defaults to 1. (Since 8.1) # +# @mode: Migration mode. See description in @MigMode. Default is 'normal'. +# (Since 8.2) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -1051,7 +1067,8 @@ '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], '*x-vcpu-dirty-limit-period': { 'type': 'uint64', 'features': [ 'unstable' ] }, - '*vcpu-dirty-limit': 'uint64'} } + '*vcpu-dirty-limit': 'uint64', + '*mode': 'MigMode'} } =20 ## # @migrate-set-parameters: @@ -1223,6 +1240,9 @@ # @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. # Defaults to 1. (Since 8.1) # +# @mode: Migration mode. See description in @MigMode. Default is 'normal'. +# (Since 8.2) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -1262,7 +1282,8 @@ '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], '*x-vcpu-dirty-limit-period': { 'type': 'uint64', 'features': [ 'unstable' ] }, - '*vcpu-dirty-limit': 'uint64'} } + '*vcpu-dirty-limit': 'uint64', + '*mode': 'MigMode'} } =20 ## # @query-migrate-parameters: --=20 1.8.3.1 From nobody Wed Nov 27 13:08:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1698263159; cv=none; d=zohomail.com; s=zohoarc; b=KAeXjynV/vuDbz20Fpr5w3XsQGJh/K8JxSAinZjpjc+qyYEvGIFf3OSnt6f+4Y7fvWh4Sv9QZ+d6EvfKYY5eTe7heB9Tt7eExEouVgPFoV1wAzUKPve5J7mABxvHCBTMUTPviEJiTUksWJl2x0gn6BvKxSGd6g54o6GXO82jELM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698263159; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D/fwwIW1ANeTA1KdqAle5D+G6L4iCHzY6a0qgjXAmrg=; b=JBDNXEuK1IemO+vSFJuWjw7ASQoO5swKACAS0U5bfgDYDjNR+JvVqrDZ7jBJTPtXRBiZTjRqwwFaHe+ten+0GdcbsX5QrANItNBw0eDIR4A3zunW6KdxTslXXGKB2mnED3DKnRLzI7HJgFn85mVxxrnMBRrJnPZr1OYWxr+6K1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698263159166997.6289319477597; Wed, 25 Oct 2023 12:45:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvjo4-0002zv-Oz; Wed, 25 Oct 2023 15:44:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjny-0002tQ-Io for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:38 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnu-00074E-Fj for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:38 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39PEwIUY026237; Wed, 25 Oct 2023 19:44:33 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv52e0p41-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:33 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39PIjFRs034583; Wed, 25 Oct 2023 19:44:32 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tv5374bsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:32 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39PJiUNP037154; Wed, 25 Oct 2023 19:44:31 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tv5374bqp-3; Wed, 25 Oct 2023 19:44:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=D/fwwIW1ANeTA1KdqAle5D+G6L4iCHzY6a0qgjXAmrg=; b=nSVTiCxYQgaBVH7nEAm4DEd2EH1hGdXabprP3YtBTl/+sCUc9TIOTzCYB1v+HZIu2h5W Gh2XYScrh6GadC9x+lFVCzRcfshXQLtO8lr8FcarRMsUqNqVZ6a3EpIgVBV5zVoz0EYv FbsSf4jKo5X8IpIHmJ9/monJeoZRD/56p73NxHsrqhsE5XM7SSQMGBWedjemG7VqcPqd +NJEivRuARu21qdTuvPUMNNn32NHdK/RfIesKtLXhXbltDQcU6j1+TgG0c9Q+OSSV2CU S97eCOUyKDjLj6QhtC+mROww8ONtMrEyhkihxeQxnjFMNcdIiBDo+WAz5p48U1n0pSxC /A== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras , "Daniel P. Berrange" , Steve Sistare Subject: [PATCH V2 2/6] migration: per-mode blockers Date: Wed, 25 Oct 2023 12:44:25 -0700 Message-Id: <1698263069-406971-3-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> References: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_09,2023-10-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250169 X-Proofpoint-ORIG-GUID: V_mVtryPa9-K0aMHo-grndFv9W1fZaO3 X-Proofpoint-GUID: V_mVtryPa9-K0aMHo-grndFv9W1fZaO3 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1698263159655100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Extend the blocker interface so that a blocker can be registered for one or more migration modes. The existing interfaces register a blocker for all modes, and the new interfaces take a varargs list of modes. Internally, maintain a separate blocker list per mode. The same Error object may be added to multiple lists. When a block is deleted, it is removed from every list, and the Error is freed. No functional change until a new mode is added. Signed-off-by: Steve Sistare Reviewed-by: Juan Quintela --- include/migration/blocker.h | 44 +++++++++++++++++++-- migration/migration.c | 95 ++++++++++++++++++++++++++++++++++++++---= ---- stubs/migr-blocker.c | 10 +++++ 3 files changed, 132 insertions(+), 17 deletions(-) diff --git a/include/migration/blocker.h b/include/migration/blocker.h index b048f30..a687ac0 100644 --- a/include/migration/blocker.h +++ b/include/migration/blocker.h @@ -14,8 +14,12 @@ #ifndef MIGRATION_BLOCKER_H #define MIGRATION_BLOCKER_H =20 +#include "qapi/qapi-types-migration.h" + +#define MIG_MODE_ALL MIG_MODE__MAX + /** - * @migrate_add_blocker - prevent migration from proceeding + * @migrate_add_blocker - prevent all modes of migration from proceeding * * @reasonp - address of an error to be returned whenever migration is att= empted * @@ -30,8 +34,8 @@ int migrate_add_blocker(Error **reasonp, Error **errp); =20 /** - * @migrate_add_blocker_internal - prevent migration from proceeding witho= ut - * only-migrate implications + * @migrate_add_blocker_internal - prevent all modes of migration from + * proceeding, but ignore -only-migratable * * @reasonp - address of an error to be returned whenever migration is att= empted * @@ -50,7 +54,7 @@ int migrate_add_blocker(Error **reasonp, Error **errp); int migrate_add_blocker_internal(Error **reasonp, Error **errp); =20 /** - * @migrate_del_blocker - remove a blocking error from migration and free = it. + * @migrate_del_blocker - remove a migration blocker from all modes and fr= ee it. * * @reasonp - address of the error blocking migration * @@ -58,4 +62,36 @@ int migrate_add_blocker_internal(Error **reasonp, Error = **errp); */ void migrate_del_blocker(Error **reasonp); =20 +/** + * @migrate_add_blocker_normal - prevent normal migration mode from procee= ding + * + * @reasonp - address of an error to be returned whenever migration is att= empted + * + * @errp - [out] The reason (if any) we cannot block migration right now. + * + * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. + * + * *@reasonp is freed and set to NULL if failure is returned. + * On success, the caller must not free @reasonp, except by + * calling migrate_del_blocker. + */ +int migrate_add_blocker_normal(Error **reasonp, Error **errp); + +/** + * @migrate_add_blocker_modes - prevent some modes of migration from proce= eding + * + * @reasonp - address of an error to be returned whenever migration is att= empted + * + * @errp - [out] The reason (if any) we cannot block migration right now. + * + * @mode - one or more migration modes to be blocked. The list is termina= ted + * by -1 or MIG_MODE_ALL. For the latter, all modes are blocked. + * + * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. + * + * *@reasonp is freed and set to NULL if failure is returned. + * On success, the caller must not free *@reasonp before the blocker is re= moved. + */ +int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...); + #endif diff --git a/migration/migration.c b/migration/migration.c index 67547eb..b8b54e6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -92,7 +92,7 @@ enum mig_rp_message_type { static MigrationState *current_migration; static MigrationIncomingState *current_incoming; =20 -static GSList *migration_blockers; +static GSList *migration_blockers[MIG_MODE__MAX]; =20 static bool migration_object_check(MigrationState *ms, Error **errp); static int migration_maybe_pause(MigrationState *s, @@ -1011,7 +1011,7 @@ static void fill_source_migration_info(MigrationInfo = *info) { MigrationState *s =3D migrate_get_current(); int state =3D qatomic_read(&s->state); - GSList *cur_blocker =3D migration_blockers; + GSList *cur_blocker =3D migration_blockers[migrate_mode()]; =20 info->blocked_reasons =3D NULL; =20 @@ -1475,38 +1475,105 @@ int migrate_init(MigrationState *s, Error **errp) return 0; } =20 -int migrate_add_blocker_internal(Error **reasonp, Error **errp) +static bool is_busy(Error **reasonp, Error **errp) { + ERRP_GUARD(); + /* Snapshots are similar to migrations, so check RUN_STATE_SAVE_VM too= . */ if (runstate_check(RUN_STATE_SAVE_VM) || !migration_is_idle()) { error_propagate_prepend(errp, *reasonp, "disallowing migration blocker " "(migration/snapshot in progress) for: "); *reasonp =3D NULL; - return -EBUSY; + return true; } - - migration_blockers =3D g_slist_prepend(migration_blockers, *reasonp); - return 0; + return false; } =20 -int migrate_add_blocker(Error **reasonp, Error **errp) +static bool is_only_migratable(Error **reasonp, Error **errp, int modes) { - if (only_migratable) { + ERRP_GUARD(); + + if (only_migratable && (modes & BIT(MIG_MODE_NORMAL))) { error_propagate_prepend(errp, *reasonp, "disallowing migration blocker " "(--only-migratable) for: "); *reasonp =3D NULL; + return true; + } + return false; +} + +static int get_modes(MigMode mode, va_list ap) +{ + int modes =3D 0; + + while (mode !=3D -1 && mode !=3D MIG_MODE_ALL) { + assert(mode >=3D MIG_MODE_NORMAL && mode < MIG_MODE__MAX); + modes |=3D BIT(mode); + mode =3D va_arg(ap, MigMode); + } + if (mode =3D=3D MIG_MODE_ALL) { + modes =3D BIT(MIG_MODE__MAX) - 1; + } + return modes; +} + +static int add_blockers(Error **reasonp, Error **errp, int modes) +{ + for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { + if (modes & BIT(mode)) { + migration_blockers[mode] =3D g_slist_prepend(migration_blocker= s[mode], + *reasonp); + } + } + return 0; +} + +int migrate_add_blocker(Error **reasonp, Error **errp) +{ + return migrate_add_blocker_modes(reasonp, errp, MIG_MODE_ALL); +} + +int migrate_add_blocker_normal(Error **reasonp, Error **errp) +{ + return migrate_add_blocker_modes(reasonp, errp, MIG_MODE_NORMAL, -1); +} + +int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...) +{ + int modes; + va_list ap; + + va_start(ap, mode); + modes =3D get_modes(mode, ap); + va_end(ap); + + if (is_only_migratable(reasonp, errp, modes)) { return -EACCES; + } else if (is_busy(reasonp, errp)) { + return -EBUSY; } + return add_blockers(reasonp, errp, modes); +} =20 - return migrate_add_blocker_internal(reasonp, errp); +int migrate_add_blocker_internal(Error **reasonp, Error **errp) +{ + int modes =3D BIT(MIG_MODE__MAX) - 1; + + if (is_busy(reasonp, errp)) { + return -EBUSY; + } + return add_blockers(reasonp, errp, modes); } =20 void migrate_del_blocker(Error **reasonp) { if (*reasonp) { - migration_blockers =3D g_slist_remove(migration_blockers, *reasonp= ); + for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { + migration_blockers[mode] =3D g_slist_remove(migration_blockers= [mode], + *reasonp); + } error_free(*reasonp); *reasonp =3D NULL; } @@ -1602,12 +1669,14 @@ void qmp_migrate_pause(Error **errp) =20 bool migration_is_blocked(Error **errp) { + GSList *blockers =3D migration_blockers[migrate_mode()]; + if (qemu_savevm_state_blocked(errp)) { return true; } =20 - if (migration_blockers) { - error_propagate(errp, error_copy(migration_blockers->data)); + if (blockers) { + error_propagate(errp, error_copy(blockers->data)); return true; } =20 diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c index 17a5dbf..11cbff2 100644 --- a/stubs/migr-blocker.c +++ b/stubs/migr-blocker.c @@ -6,6 +6,16 @@ int migrate_add_blocker(Error **reasonp, Error **errp) return 0; } =20 +int migrate_add_blocker_normal(Error **reasonp, Error **errp) +{ + return 0; +} + +int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...) +{ + return 0; +} + void migrate_del_blocker(Error **reasonp) { } --=20 1.8.3.1 From nobody Wed Nov 27 13:08:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1698263159; cv=none; d=zohomail.com; s=zohoarc; b=luE79xFg/8uOz3uWn+mwdkrAcApUmffhWKHe9MhuHMXRpREWV5C+DRhoPktlqJh2hvdWvbulLJnifFWXuZ8DK/58nhw7eFvIIDvkX7xXulqiAt9TgKg4ffeS5Bwwt0YGEHVAHYxhjuvl89uEhXxNAc2xNk+TzpKiTFCfJwCd3JM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698263159; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6IngbwvX5QRx2Ju6S7ksW7OMH5fcan0CqFrRSV+XBCM=; b=gz55mRHhfTiNGc4ZVdgrvF9plVIDIIjVSGFokB3m8rFEhUkp2teessGRMDQsks32QyoDPGi9qgtkzpKtZK93YU2fbPlOyQBRlp6M6e8ZYMsR78T7uCpOci6MnLE9btdTyIeZ965FBv9A/RN3qOBCmx1zTa9Whov2jSNj/SM9EcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698263159856891.6768176246992; Wed, 25 Oct 2023 12:45:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvjo1-0002wh-Pl; Wed, 25 Oct 2023 15:44:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjny-0002tO-IP for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:38 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnu-00074N-JM for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:37 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39PEwIUZ026237; Wed, 25 Oct 2023 19:44:33 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv52e0p42-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:33 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39PIB16B034777; Wed, 25 Oct 2023 19:44:32 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tv5374bsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:32 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39PJiUNR037154; Wed, 25 Oct 2023 19:44:32 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tv5374bqp-4; Wed, 25 Oct 2023 19:44:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=6IngbwvX5QRx2Ju6S7ksW7OMH5fcan0CqFrRSV+XBCM=; b=SO77BQEAjmDoqtEz9WufPRmJ41b+DvIyPisXD1QiwTpHXgrjci04a37WZJcwwaAp3yYq i7EnWg/nMaPKqRJPh7U7HLQrFmm2xVgDuy6fU6YTm1FQhsy7SLTlOJNHrgE2cfqBKmAy UHhhGM0eu9JvkEO5lPWtFyZL4DrKwZdznM00fztj8Cqp01SVArUaHEXD5rzg8dxaZZAG 01Sib7obHBpJMWhzTPkPjK86W6nmeaQpHKGT7gEqAj2Ihls86cgOciLcex4FmbkpPfji MrvNzsmu8J3siyr76PKynK4BgIPTdbogPEYJGrmydyTcFTQmk8aEiQ0x55gVeU+lVTlA Rg== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras , "Daniel P. Berrange" , Steve Sistare Subject: [PATCH V2 3/6] cpr: relax blockdev migration blockers Date: Wed, 25 Oct 2023 12:44:26 -0700 Message-Id: <1698263069-406971-4-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> References: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_09,2023-10-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=766 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250169 X-Proofpoint-ORIG-GUID: wqm0768kJRM2Q_YUK0zI7deixrfMoKRV X-Proofpoint-GUID: wqm0768kJRM2Q_YUK0zI7deixrfMoKRV Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1698263161694100015 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some blockdevs block migration because they do not support sharing across hosts and/or do not support dirty bitmaps. These prohibitions do not apply if the old and new qemu processes do not run concurrently, and if new qemu starts on the same host as old, which is the case for cpr. Narrow the scope of these blockers so they only apply to normal mode. They will not block cpr modes when they are added in subsequent patches. No functional change until a new mode is added. Signed-off-by: Steve Sistare Reviewed-by: Juan Quintela --- block/parallels.c | 2 +- block/qcow.c | 2 +- block/vdi.c | 2 +- block/vhdx.c | 2 +- block/vmdk.c | 2 +- block/vpc.c | 2 +- block/vvfat.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 1697a2e..8a520db 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1369,7 +1369,7 @@ static int parallels_open(BlockDriverState *bs, QDict= *options, int flags, bdrv_get_device_or_node_name(bs)); bdrv_graph_rdunlock_main_loop(); =20 - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { error_setg(errp, "Migration blocker error"); goto fail; diff --git a/block/qcow.c b/block/qcow.c index fdd4c83..eab68e3 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -307,7 +307,7 @@ static int qcow_open(BlockDriverState *bs, QDict *optio= ns, int flags, bdrv_get_device_or_node_name(bs)); bdrv_graph_rdunlock_main_loop(); =20 - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { goto fail; } diff --git a/block/vdi.c b/block/vdi.c index fd7e365..c647d72 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -498,7 +498,7 @@ static int vdi_open(BlockDriverState *bs, QDict *option= s, int flags, bdrv_get_device_or_node_name(bs)); bdrv_graph_rdunlock_main_loop(); =20 - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { goto fail_free_bmap; } diff --git a/block/vhdx.c b/block/vhdx.c index e37f8c0..a9d0874 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1096,7 +1096,7 @@ static int vhdx_open(BlockDriverState *bs, QDict *opt= ions, int flags, error_setg(&s->migration_blocker, "The vhdx format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { goto fail; } diff --git a/block/vmdk.c b/block/vmdk.c index 1335d39..85864b8 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1386,7 +1386,7 @@ static int vmdk_open(BlockDriverState *bs, QDict *opt= ions, int flags, error_setg(&s->migration_blocker, "The vmdk format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { goto fail; } diff --git a/block/vpc.c b/block/vpc.c index c30cf86..aa1a48a 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -452,7 +452,7 @@ static int vpc_open(BlockDriverState *bs, QDict *option= s, int flags, bdrv_get_device_or_node_name(bs)); bdrv_graph_rdunlock_main_loop(); =20 - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { goto fail; } diff --git a/block/vvfat.c b/block/vvfat.c index 266e036..9d050ba 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1268,7 +1268,7 @@ static int vvfat_open(BlockDriverState *bs, QDict *op= tions, int flags, "The vvfat (rw) format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); - ret =3D migrate_add_blocker(&s->migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&s->migration_blocker, errp); if (ret < 0) { goto fail; } --=20 1.8.3.1 From nobody Wed Nov 27 13:08:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1698263107; cv=none; d=zohomail.com; s=zohoarc; b=FDqlTVXznONFb+cUbMiwlzhBwVLevg7bpV8EGSwyYxh/6yR12Qmi4CCF4SDMlkw8O2xWipkVWU/cx11kHe2/6mulJTCVejuDPNIlYR22KQmMSbNzqPDxK8OrGS1YN/Ec0n9Em73cfJvOnvIC1i4t5S2bNLNDtD9tAJy8+EjRSY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698263107; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0Tm/GYd2BWb6llQIM5XRrWXbqf9w8dr19lzEtwsICBw=; b=IEbzNf8riqUzavZ4LwpNK8a+3UbzBpn3nY6Ik4XwBjLgLqCdEaAd99WLu5wf7d4f+bZvSvJzBYas3lZ3w4N/LNG3idjcabBiRdmsF94THvZ1BBDMyXk84FvyfXb6Hq6fRxLXf6kP3e5Y5Fe64xyqVmKSzX1+rYMhW6k6LuytOfc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698263107204861.9225954389259; Wed, 25 Oct 2023 12:45:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvjo2-0002xV-EY; Wed, 25 Oct 2023 15:44:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjny-0002tE-1D for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:38 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnv-00074W-TJ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:37 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39PEwkob004627; Wed, 25 Oct 2023 19:44:34 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv5e38mnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:34 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39PI4bB3034564; Wed, 25 Oct 2023 19:44:33 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tv5374bte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:33 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39PJiUNT037154; Wed, 25 Oct 2023 19:44:32 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tv5374bqp-5; Wed, 25 Oct 2023 19:44:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=0Tm/GYd2BWb6llQIM5XRrWXbqf9w8dr19lzEtwsICBw=; b=d+GA5Kji+tjktr10LM8xBVZa3WQa17uj9PEb6lbO8opZD9ZNofhaMaUYb0ZpX9lT7U0H T8q48KU0lrujomMoNw/FWR6R5JZmwVOUjkCh2gwkvGmcRqa8xNbs5y4wqlUgSp0t2YQZ JvAWj98U6YiPRDlZ8dfwoT/eBv7ADVoTUKRMzl3pi4RhQOlCxj57t6d8+IUg73wVUj24 SDUxDCp3sMGa1/rYhWvPyMPt8SQE1MnLXrk7X/8dN8eA1xGcm42NOsj11wJHCUQBFtew aCKE5/jN80vBBvoJ11ycFRlb/H7kSRa93Nl24BAZInrvFAMSejq2cQ2X/3B+TrV5kGgh 7w== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras , "Daniel P. Berrange" , Steve Sistare Subject: [PATCH V2 4/6] cpr: relax vhost migration blockers Date: Wed, 25 Oct 2023 12:44:27 -0700 Message-Id: <1698263069-406971-5-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> References: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_09,2023-10-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250169 X-Proofpoint-GUID: 43rLyxjUaOq89Hr08VJ4JUnjA5_3rDs6 X-Proofpoint-ORIG-GUID: 43rLyxjUaOq89Hr08VJ4JUnjA5_3rDs6 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1698263109442100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" vhost blocks migration if logging is not supported to track dirty memory, and vhost-user blocks it if the log cannot be saved to a shm fd. vhost-vdpa blocks migration if both hosts do not support all the device's features using a shadow VQ, for tracking requests and dirty memory. vhost-scsi blocks migration if storage cannot be shared across hosts, or if state cannot be migrated. None of these conditions apply if the old and new qemu processes do not run concurrently, and if new qemu starts on the same host as old, which is the case for cpr. Narrow the scope of these blockers so they only apply to normal mode. They will not block cpr modes when they are added in subsequent patches. No functional change until a new mode is added. Signed-off-by: Steve Sistare Reviewed-by: Juan Quintela --- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 14e23cc..bf528d5 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -208,7 +208,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error = **errp) "When external environment supports it (Orchestrator migra= tes " "target SCSI device state or use shared storage over netwo= rk), " "set 'migratable' property to true to enable migration."); - if (migrate_add_blocker(&vsc->migration_blocker, errp) < 0) { + if (migrate_add_blocker_normal(&vsc->migration_blocker, errp) < 0)= { goto free_virtio; } } diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index d737671..f5e9625 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1527,7 +1527,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, } =20 if (hdev->migration_blocker !=3D NULL) { - r =3D migrate_add_blocker(&hdev->migration_blocker, errp); + r =3D migrate_add_blocker_normal(&hdev->migration_blocker, errp); if (r < 0) { goto fail_busyloop; } --=20 1.8.3.1 From nobody Wed Nov 27 13:08:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1698263114; cv=none; d=zohomail.com; s=zohoarc; b=RmzYapDMAborbBjy5uuhCka8buqgZfiqVK+EPqRKcBlmiW911nogAAVffpYwm4Tf73lnAMmhDE9/hqW0RDyLNSOPUKbrCdBCUYZuQXfN0l5vyLVTv3EXoFA0v9JHMxrTHHRJ+x6ilTWoCSPk0SNdgH+xBo5EWonroUYLa2vKgeg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698263114; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VUwHrzv+fk6mKENUtY6aYA7eVgZcpa1bLZZsvUQ3kwg=; b=SN+eBwM3/4BFNuzvZPawpHaQJRHIUUV5EKyzS22QLlk6hwAUBIqtESxrpuCC6usKBRSZzxksPTrBv/0Inm9ukHMpRGgOuGp1kNrU8nIICRUJyG7DETaM+yZ5KVStaJ/eVuGkFh3qSulbQasTsVBLQEw4IHPJ3Rjw/1yiexMlYuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698263114259876.8634008380083; Wed, 25 Oct 2023 12:45:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvjo2-0002xU-EB; Wed, 25 Oct 2023 15:44:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjny-0002tP-Ie for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:38 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnv-00074g-Ui for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:37 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39PEwkn7004619; Wed, 25 Oct 2023 19:44:35 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv5e38mnf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:34 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39PIIVre034524; Wed, 25 Oct 2023 19:44:33 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tv5374bu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:33 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39PJiUNV037154; Wed, 25 Oct 2023 19:44:33 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tv5374bqp-6; Wed, 25 Oct 2023 19:44:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=VUwHrzv+fk6mKENUtY6aYA7eVgZcpa1bLZZsvUQ3kwg=; b=isMnnj0VKD062+N8JEPHAzdmvCthWcZMsMmHk2Iq4LVz7XInG3AR2VD+ic2sZaIjG/bX n4wh22LWaXkHUJsou1+Ob20XXeECE4cE5ImO2qVy9VxthQpd/ZKbBuqzWsFJcyCn8TUS HJ0ahAFEb/7WwOIo72jQqx/8h1eraDJzyG1JieWzHvSp8UiaOIsO9wnEsEXW1mL8B/qE 21TrGoDAZrcBprxMMw5pHYdmxSBGJd5VrFyI9QzPuEGsJtH4QhfLa5xm0rgQjeMpDL7/ m6LrHra/L5P6v52oQkQ0zvKlsS5zg5a/AVd9k0B65sIkgqcOiZ/cMlNM9NmNQpt0a2W4 dw== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras , "Daniel P. Berrange" , Steve Sistare Subject: [PATCH V2 5/6] cpr: reboot mode Date: Wed, 25 Oct 2023 12:44:28 -0700 Message-Id: <1698263069-406971-6-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> References: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_09,2023-10-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250169 X-Proofpoint-GUID: X-JCjWqRkJFdN_SB4pNSGwm2w-lX97cn X-Proofpoint-ORIG-GUID: X-JCjWqRkJFdN_SB4pNSGwm2w-lX97cn Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1698263115422100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add the cpr-reboot migration mode. Usage: $ qemu-system-$arch -monitor stdio ... QEMU 8.1.50 monitor - type 'help' for more information (qemu) migrate_set_capability x-ignore-shared on (qemu) migrate_set_parameter mode cpr-reboot (qemu) migrate -d file:vm.state (qemu) info status VM status: paused (postmigrate) (qemu) quit $ qemu-system-$arch -monitor stdio -incoming defer ... QEMU 8.1.50 monitor - type 'help' for more information (qemu) migrate_set_capability x-ignore-shared on (qemu) migrate_set_parameter mode cpr-reboot (qemu) migrate_incoming file:vm.state (qemu) info status VM status: running In this mode, the migrate command saves state to a file, allowing one to quit qemu, reboot to an updated kernel, and restart an updated version of qemu. The caller must specify a migration URI that writes to and reads from a file. Unlike normal mode, the use of certain local storage options does not block the migration, but the caller must not modify guest block devices between the quit and restart. To avoid saving guest RAM to the file, the memory backend must be shared, and the @x-ignore-shared migration capability must be set. Guest RAM must be non-volatile across reboot, such as by backing it with a dax device, but this is not enforced. The restarted qemu arguments must match those used to initially start qemu, plus the -incoming option. Signed-off-by: Steve Sistare Reviewed-by: Juan Quintela --- hw/core/qdev-properties-system.c | 2 +- qapi/migration.json | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 07a848d..d961404 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -680,7 +680,7 @@ QEMU_BUILD_BUG_ON(sizeof(MigMode) !=3D sizeof(int)); const PropertyInfo qdev_prop_mig_mode =3D { .name =3D "MigMode", .description =3D "mig_mode values, " - "normal", + "normal,cpr-reboot", .enum_table =3D &MigMode_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, diff --git a/qapi/migration.json b/qapi/migration.json index f99904e..795182f 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -620,9 +620,22 @@ # # @normal: the original form of migration. (since 8.2) # +# @cpr-reboot: The migrate command saves state to a file, allowing one to +# quit qemu, reboot to an updated kernel, and restart an upda= ted +# version of qemu. The caller must specify a migration URI +# that writes to and reads from a file. Unlike normal mode, +# the use of certain local storage options does not block the +# migration, but the caller must not modify guest block devic= es +# between the quit and restart. To avoid saving guest RAM to= the +# file, the memory backend must be shared, and the @x-ignore-= shared +# migration capability must be set. Guest RAM must be non-vo= latile +# across reboot, such as by backing it with a dax device, but= this +# is not enforced. The restarted qemu arguments must match t= hose +# used to initially start qemu, plus the -incoming option. +# (since 8.2) ## { 'enum': 'MigMode', - 'data': [ 'normal' ] } + 'data': [ 'normal', 'cpr-reboot' ] } =20 ## # @BitmapMigrationBitmapAliasTransform: --=20 1.8.3.1 From nobody Wed Nov 27 13:08:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1698263158; cv=none; d=zohomail.com; s=zohoarc; b=LunNLW45Z9Tu5qaVVI3lUHrMmN56rCqoOUDIJ77aK1T1IqGd72sAaW6ybYEvTlKHI63GLitkF6Rjlh0tW8D40nFGfjMfYfYTWCjE/ACQLO7L3esudlyxnnYClgH9ivcqZlEL7bHTd9fwu+4pc6DZxi3siPPDT5zUOLVUfTDQKdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698263158; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uQZvqoTHzmxTeWDtHXjYGiz+2ZUfqj5ff1vqKzPGPi8=; b=CMpNkvFwcpD5NNfHUdXzCninmx+pl/b1l2nl5/n4Euexag/dFljtC+XSTeGQPnP/hUEEieYsg9TQz3HPbwsMqKM1g3aB+91zuIoeg0yP215UJzWFUrekyatGiYGe+kf9GGVj4BZ0ncvUkWznlr6noSCIFxcf9q+43lImMCem42E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698263158932293.3861922412282; Wed, 25 Oct 2023 12:45:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvjo4-0002yE-4A; Wed, 25 Oct 2023 15:44:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjny-0002tN-IV for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:38 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvjnw-00074r-Fa for qemu-devel@nongnu.org; Wed, 25 Oct 2023 15:44:37 -0400 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39PEwFPj006209; Wed, 25 Oct 2023 19:44:35 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv6pd0p66-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:35 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39PIjFRu034583; Wed, 25 Oct 2023 19:44:34 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tv5374bum-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Oct 2023 19:44:34 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39PJiUNX037154; Wed, 25 Oct 2023 19:44:33 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tv5374bqp-7; Wed, 25 Oct 2023 19:44:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=uQZvqoTHzmxTeWDtHXjYGiz+2ZUfqj5ff1vqKzPGPi8=; b=HB6NIFa/MTMDaNofPkUK5QNqr9YxFx2U3px3pstDox0Pk8Z43rBKfszue9d42ziRSehf aCThDaMkAE7snfLeTBS31kpyzgOV04UPbEo/PtiNaw+OemZKvf9yElx1RUri9YqWpxI5 OfG2FnTL4BDFehDzhFpkMBWBRGOW+e8WZqE7cqTxmkp+R7LlLUgn9RRRB+c2++8LSiSA T1HUzChB/Gj40wJYs2/oS8LgBSI2W8I9OcJ14MtEFvSiXDNRgZ/K9qNKj8/ml2pbYjEf yQn3RZBTJmb2/juHBp3po6vd5W/fbWfGs0mKEcBJvo42m6JcJKwhMXzreWFmXNpul67P GQ== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras , "Daniel P. Berrange" , Steve Sistare Subject: [PATCH V2 6/6] tests/qtest: migration: add reboot mode test Date: Wed, 25 Oct 2023 12:44:29 -0700 Message-Id: <1698263069-406971-7-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> References: <1698263069-406971-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_09,2023-10-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250169 X-Proofpoint-GUID: n8Bn_vEivO4HIhCCKt5bl3joDcsYbvTf X-Proofpoint-ORIG-GUID: n8Bn_vEivO4HIhCCKt5bl3joDcsYbvTf Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1698263159644100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Steve Sistare Reviewed-by: Juan Quintela --- tests/qtest/migration-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e1c1105..de29fc5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2001,6 +2001,31 @@ static void test_precopy_file_offset_bad(void) test_file_common(&args, false); } =20 +static void *test_mode_reboot_start(QTestState *from, QTestState *to) +{ + migrate_set_parameter_str(from, "mode", "cpr-reboot"); + migrate_set_parameter_str(to, "mode", "cpr-reboot"); + + migrate_set_capability(from, "x-ignore-shared", true); + migrate_set_capability(to, "x-ignore-shared", true); + + return NULL; +} + +static void test_mode_reboot(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, + FILE_TEST_FILENAME); + MigrateCommon args =3D { + .start.use_shmem =3D true, + .connect_uri =3D uri, + .listen_uri =3D "defer", + .start_hook =3D test_mode_reboot_start + }; + + test_file_common(&args, true); +} + static void test_precopy_tcp_plain(void) { MigrateCommon args =3D { @@ -3056,6 +3081,8 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/file/offset/bad", test_precopy_file_offset_bad); =20 + qtest_add_func("/migration/mode/reboot", test_mode_reboot); + #ifdef CONFIG_GNUTLS qtest_add_func("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); --=20 1.8.3.1