From nobody Mon May 6 02:23:02 2024 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.zoho.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 1498473018980130.38057493200938; Mon, 26 Jun 2017 03:30:18 -0700 (PDT) Received: from localhost ([::1]:45794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPRHc-0005X6-Fg for importer@patchew.org; Mon, 26 Jun 2017 06:30:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPRGV-0004vM-KY for qemu-devel@nongnu.org; Mon, 26 Jun 2017 06:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPRGT-0002i9-2s for qemu-devel@nongnu.org; Mon, 26 Jun 2017 06:29:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37188) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dPRGS-0002hM-Q0 for qemu-devel@nongnu.org; Mon, 26 Jun 2017 06:29:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD6DD83F42 for ; Mon, 26 Jun 2017 10:29:03 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-70.pek2.redhat.com [10.72.12.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CCDA80E9B; Mon, 26 Jun 2017 10:28:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BD6DD83F42 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BD6DD83F42 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 26 Jun 2017 18:28:55 +0800 Message-Id: <1498472935-14461-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 26 Jun 2017 10:29:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] migration: add "return-path" capability 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: Laurent Vivier , "Dr . David Alan Gilbert" , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When this capability is enabled, QEMU will use the return path even for precopy migration. This is helpful at least in one case when destination failed to load the image while source quited without confirmation. With return path, source will wait for the last response from destination, and if destination fails, it'll fail the migration on source, then the guest can be run again on the source (rather than assuming to be good, then the guest will be lost after source quits). It needs to be enabled explicitly on source, otherwise disabled. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela --- migration/migration.c | 16 +++++++++++++--- migration/migration.h | 1 + qapi-schema.json | 5 ++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f588329..66fd81e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1304,6 +1304,15 @@ bool migrate_use_block(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK]; } =20 +bool migrate_use_return_path(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->enabled_capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; +} + bool migrate_use_block_incremental(void) { MigrationState *s; @@ -1968,10 +1977,11 @@ void migrate_fd_connect(MigrationState *s) notifier_list_notify(&migration_state_notifiers, s); =20 /* - * Open the return path; currently for postcopy but other things might - * also want it. + * Open the return path. For postcopy, it is used exclusively. For + * precopy, only if user specified "return-path" capability would + * QEMU uses the return path. */ - if (migrate_postcopy_ram()) { + if (migrate_postcopy_ram() || migrate_use_return_path()) { if (open_return_path_on_source(s)) { error_report("Unable to open return-path for postcopy"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, diff --git a/migration/migration.h b/migration/migration.h index d9a268a..e41fb68 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -144,6 +144,7 @@ bool migrate_colo_enabled(void); =20 bool migrate_use_block(void); bool migrate_use_block_incremental(void); +bool migrate_use_return_path(void); =20 bool migrate_use_compression(void); int migrate_compress_level(void); diff --git a/qapi-schema.json b/qapi-schema.json index 4b50b65..9e34cf7 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -900,12 +900,15 @@ # offers more flexibility. # (Since 2.10) # +# @return-path: If enabled, migration will use the return path even +# for precopy. (since 2.10) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', - 'block' ] } + 'block', 'return-path' ] } =20 ## # @MigrationCapabilityStatus: --=20 2.7.4