From patchwork Mon May 11 11:10:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11540317 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 100511668 for ; Mon, 11 May 2020 11:20:27 +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 DAF7720722 for ; Mon, 11 May 2020 11:20:26 +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="Y7kPtTKD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAF7720722 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]:34768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jY6Tx-0004ij-TP for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 May 2020 07:20:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jY6Ko-0004uB-Qg for qemu-devel@nongnu.org; Mon, 11 May 2020 07:10:58 -0400 Received: from mout.web.de ([212.227.17.12]:50661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jY6Kn-0005kp-Vb for qemu-devel@nongnu.org; Mon, 11 May 2020 07:10:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1589195449; bh=fHF36Ki6yNEwvH+HbsyWEOYKs0aX/3g3RLEGn37QNNQ=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=Y7kPtTKDnZLnyyUcEIb1sJ+hrK31f73NOOIdvjgr8TvWU4TzC+WtkkyWS7G9k24yZ imszOWin4ky8ZGMZwp6YaFzy9c2SEBgfwg3wTteU5Ko9u3fL9pFf0bo2pNk90lLTJL B0liIoggwDz7jzZeq/KFyJnmvqAjrUuYs/3U33eM= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([89.247.255.192]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MPpQU-1jUERf2eIc-004zSU; Mon, 11 May 2020 13:10:49 +0200 Date: Mon, 11 May 2020 13:10:48 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH 2/6] migration/colo.c: Use cpu_synchronize_all_states() Message-ID: <9675031ce557b73ebd10e7bd20ebbf57f30b177c.1589193382.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:J4iiaiK1ynPM7Kmwo10bTHc7piCUCoI/HzNwQLPal82GaYiXvum MXqTuslu5KSg59/KDgWm7lhRITLwYcbII/a5Jkn+K2qNDNWL+Td2ma8/T440Itas4KCh4OL UioQxsxtPN5c9dQnjCEQHFrLRd7Q1dIQL6FfUSVsT0UvmnhW43NGcptvQYr391vVcxJnz5V lbU46LzV1EM8Y6iY8DFbA== X-UI-Out-Filterresults: notjunk:1;V03:K0:v8rXSVK0XTY=:K1WWX7lmUKDuUCj1Qpx/kC WqSxI4VeNh37f8/uOyYIRzQb+j0rLG2bwW5T0KGA9sh3jF6N00n4vb1aHDlRthUkuqTO2kOcI kK4DQJd+mBn21qxGy7NQ70eqbbDHEoLzz78pL70yYAXt4OTEzt7mOEL220o5NcPWbYPLBPC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Hs9fdloDg2WPvyDght4 8SvVq6PIzuXKJsDYq Received-SPF: pass client-ip=212.227.17.12; envelope-from=lukasstraub2@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/11 07:10:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 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_H3=0.001, RCVD_IN_MSPIKE_WL=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(-) 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();