From nobody Wed Jan 15 11:46:46 2025 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704470264953659.8499352794947; Fri, 5 Jan 2024 07:57:44 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D8D951A6D; Fri, 5 Jan 2024 10:57:43 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 28E111976; Fri, 5 Jan 2024 10:54:09 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4C51F18CA; Fri, 5 Jan 2024 10:53:52 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E187E18B8 for ; Fri, 5 Jan 2024 10:53:50 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-ApvjCQANOoapPNIAHXFdfw-1; Fri, 05 Jan 2024 10:53:49 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0E8329ABA09 for ; Fri, 5 Jan 2024 15:53:48 +0000 (UTC) Received: from orkuz (unknown [10.45.224.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94F902166B31 for ; Fri, 5 Jan 2024 15:53:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: ApvjCQANOoapPNIAHXFdfw-1 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [libvirt PATCH 3/3] qemu_migration: Implement VIR_MIGRATE_POSTCOPY_PREEMPT Date: Fri, 5 Jan 2024 16:53:39 +0100 Message-ID: <04574e867957c8845e54bb2661ce4059a9ed7ba4.1704469030.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: MYPSJNAM3CGQ7A4LR5U6ORDDFY46US3E X-Message-ID-Hash: MYPSJNAM3CGQ7A4LR5U6ORDDFY46US3E X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704470265884100001 Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 21 ++++++++++++++++++--- src/qemu/qemu_migration.h | 1 + src/qemu/qemu_migration_params.c | 6 ++++++ src/qemu/qemu_migration_params.h | 1 + 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3ba0aa502b..09445354a9 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2611,6 +2611,13 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, return NULL; } =20 + if (flags & VIR_MIGRATE_POSTCOPY_PREEMPT && + !(flags & VIR_MIGRATE_POSTCOPY)) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("post-copy preemption can only be enabled for pos= t-copy migration")); + return NULL; + } + if (flags & VIR_MIGRATE_OFFLINE) { if (flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)) { @@ -3605,6 +3612,13 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver, return -1; } =20 + if (flags & VIR_MIGRATE_POSTCOPY_PREEMPT && + !(flags & VIR_MIGRATE_POSTCOPY)) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("post-copy preemption can only be enabled for pos= t-copy migration")); + return -1; + } + if (cfg->migrateTLSForce && !(flags & VIR_MIGRATE_TUNNELLED) && !(flags & VIR_MIGRATE_TLS)) { @@ -5210,10 +5224,11 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver, =20 spec.dest.socket.path =3D uribits->path; } else { - /* RDMA and multi-fd migration requires QEMU to connect to the des= tination - * itself. + /* RDMA, multi-fd, and postcopy-preempt migration requires QEMU to + * connect to the destination itself. */ - if (STREQ(uribits->scheme, "rdma") || (flags & VIR_MIGRATE_PARALLE= L)) + if (STREQ(uribits->scheme, "rdma") || + flags & (VIR_MIGRATE_PARALLEL | VIR_MIGRATE_POSTCOPY_PREEMPT)) spec.destType =3D MIGRATION_DEST_HOST; else spec.destType =3D MIGRATION_DEST_CONNECT_HOST; diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index ed62fd4a91..27fb783359 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -62,6 +62,7 @@ VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES | \ VIR_MIGRATE_POSTCOPY_RESUME | \ VIR_MIGRATE_ZEROCOPY | \ + VIR_MIGRATE_POSTCOPY_PREEMPT | \ 0) =20 /* All supported migration parameters and their types. */ diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 79fe6e97c8..35eafd8f0d 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -99,6 +99,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability, "dirty-bitmaps", "return-path", "zero-copy-send", + "postcopy-preempt", ); =20 =20 @@ -194,6 +195,11 @@ static const qemuMigrationParamsFlagMapItem qemuMigrat= ionParamsFlagMap[] =3D { VIR_MIGRATE_ZEROCOPY, QEMU_MIGRATION_CAP_ZERO_COPY_SEND, QEMU_MIGRATION_SOURCE}, + + {QEMU_MIGRATION_FLAG_REQUIRED, + VIR_MIGRATE_POSTCOPY_PREEMPT, + QEMU_MIGRATION_CAP_POSTCOPY_PREEMPT, + QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, }; =20 /* Translation from VIR_MIGRATE_PARAM_* typed parameters to diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index 5857673227..74f1680e9e 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -40,6 +40,7 @@ typedef enum { QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS, QEMU_MIGRATION_CAP_RETURN_PATH, QEMU_MIGRATION_CAP_ZERO_COPY_SEND, + QEMU_MIGRATION_CAP_POSTCOPY_PREEMPT, =20 QEMU_MIGRATION_CAP_LAST } qemuMigrationCapability; --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org