From patchwork Wed May 20 20:42:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11561557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87AE5912 for ; Wed, 20 May 2020 20:45:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E7C92084C for ; Wed, 20 May 2020 20:45:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=web.de header.i=@web.de header.b="APDrhYgA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E7C92084C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=web.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbVaS-00087S-Cg for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 May 2020 16:45:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbVXn-0005jr-GC for qemu-devel@nongnu.org; Wed, 20 May 2020 16:42:27 -0400 Received: from mout.web.de ([212.227.15.14]:37307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbVXm-00074N-Ls for qemu-devel@nongnu.org; Wed, 20 May 2020 16:42:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1590007337; bh=LivmC0T4MlEYh1b0AKhwKgJifO6Iy7vR+p/8U/uGwlM=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=APDrhYgAcyOvuq8G6Q8EMPVtD5yl5wa6fe4wogYdScJ3h2ZKrnoE6Ptv8gjbNfaA+ 2pYCyCpSCKG7KbDXeksgM3eSm9JkiJBYo+P1ChJVXxDf99afeOr/zNzjmaQ0suMPEA SpPHqBUt/choLSMGz8MzfbvRnQtlf74hEsrpwhjA= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([88.130.61.105]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MSJH1-1jVIHa371f-00TTDl; Wed, 20 May 2020 22:42:17 +0200 Date: Wed, 20 May 2020 22:42:16 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v2 2/6] migration/colo.c: Use cpu_synchronize_all_states() Message-ID: <9cacbf2006c8687a983d67ed1565317b58dc55c9.1590007004.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:VspTdd77bpHWFOBfwaUo4LojGXS5krH0gtRO61e3ItG/YdpHPDg AHOesQ8Makmbiy3y6EHPFEbmjJYwvNEkzQBppc92BTDDA9PQM5IZfH80Y/ehwvLxja8AANR A1j3yeBvNe/T5nYmev6gUfcjsleERRKR+EiHStHRcIwUEu8nMNMUr4pLcZ5j4y6YqXdBdQD Z04y4yzGO+UEFTiNvz1Fw== X-UI-Out-Filterresults: notjunk:1;V03:K0:xTmUBPZDSc4=:cSqxp6veOHyfQ7jEWmy+qs FHkotW2YBylVKXXM868kzIouA5FjZIxbzdC3g3gg1hV24T0HY1ORysARLS71DepdXyduDI6xE plevC+UFwP7gkLypjqreQD1HmIYagL8xHCLxOuL6eIizjW0+ea0RynnJHWy9D4Mi6jEp3sVGc EsCmaD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IWWz5E0Y6SHdrrfktk8rDuiUJ8rPY O4k7cg4W6L08QPElQ Received-SPF: pass client-ip=212.227.15.14; envelope-from=lukasstraub2@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 16:42:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" cpu_synchronize_all_pre_loadvm() marks all vcpus as dirty, so the registers are loaded from CPUState before we continue running the vm. However if we failover during checkpoint, CPUState is not initialized and the registers are loaded with garbage. This causes guest hangs and crashes. Fix this by using cpu_synchronize_all_states(), which initializes CPUState from the current cpu registers additionally to marking the vcpus as dirty. Signed-off-by: Lukas Straub Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/migration/colo.c b/migration/colo.c index 09168627bc..6b2ad35aa4 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -696,7 +696,7 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis, } qemu_mutex_lock_iothread(); - cpu_synchronize_all_pre_loadvm(); + cpu_synchronize_all_states(); ret = qemu_loadvm_state_main(mis->from_src_file, mis); qemu_mutex_unlock_iothread();