From patchwork Fri Nov 16 16:48:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10686707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3B4117DE for ; Fri, 16 Nov 2018 16:53:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85DA02CA64 for ; Fri, 16 Nov 2018 16:53:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76F952CF48; Fri, 16 Nov 2018 16:53:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 064A62CA64 for ; Fri, 16 Nov 2018 16:53:06 +0000 (UTC) Received: from localhost ([::1]:45784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNhMf-0001Yl-QX for patchwork-qemu-devel@patchwork.kernel.org; Fri, 16 Nov 2018 11:53:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNhI2-0006W2-7c for qemu-devel@nongnu.org; Fri, 16 Nov 2018 11:48:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNhHu-0007hN-Rg for qemu-devel@nongnu.org; Fri, 16 Nov 2018 11:48:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNhHu-0007fG-Lj for qemu-devel@nongnu.org; Fri, 16 Nov 2018 11:48:10 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 013443001953 for ; Fri, 16 Nov 2018 16:48:10 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 380A9614DB for ; Fri, 16 Nov 2018 16:48:08 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 16 Nov 2018 17:48:06 +0100 Message-Id: <20181116164806.26929-2-pbonzini@redhat.com> In-Reply-To: <20181116164806.26929-1-pbonzini@redhat.com> References: <20181116164806.26929-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 16 Nov 2018 16:48:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] migration: savevm: consult migration blockers 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There is really no difference between live migration and savevm, except that savevm does not require bdrv_invalidate_cache to be implemented by all disks. However, it is unlikely that savevm is used with anything except qcow2 disks, so the penalty is small and worth the improvement in catching bad usage of savevm. Only one place was taking care of savevm when adding a migration blocker, and it can be removed. Signed-off-by: Paolo Bonzini --- migration/savevm.c | 4 ++++ target/i386/kvm.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index ef707b8c43..1c49776a91 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2455,6 +2455,10 @@ int save_snapshot(const char *name, Error **errp) struct tm tm; AioContext *aio_context; + if (migration_is_blocked(errp)) { + return false; + } + if (!replay_can_snapshot()) { error_setg(errp, "Record/replay does not allow making snapshot " "right now. Try once more later."); diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 3b6fbd3f20..d222b68fe4 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1284,7 +1284,6 @@ int kvm_arch_init_vcpu(CPUState *cs) if (!env->user_tsc_khz) { if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) && invtsc_mig_blocker == NULL) { - /* for migration */ error_setg(&invtsc_mig_blocker, "State blocked by non-migratable CPU device" " (invtsc flag)"); @@ -1294,8 +1293,6 @@ int kvm_arch_init_vcpu(CPUState *cs) error_free(invtsc_mig_blocker); return r; } - /* for savevm */ - vmstate_x86_cpu.unmigratable = 1; } }