From patchwork Wed May 20 20:42:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11561575 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 1398590 for ; Wed, 20 May 2020 21:07:03 +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 83E61207E8 for ; Wed, 20 May 2020 21:07:02 +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="d0FVuWdx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83E61207E8 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]:38334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbVvZ-0003Qv-9D for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 May 2020 17:07:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbVY1-0005uR-Lf for qemu-devel@nongnu.org; Wed, 20 May 2020 16:42:41 -0400 Received: from mout.web.de ([212.227.15.14]:38821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbVY0-00079y-Rb for qemu-devel@nongnu.org; Wed, 20 May 2020 16:42:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1590007353; bh=c2L3X4H7w/EoaLKNHwRFS99beuVs7O0gWwWmQO5Q7pQ=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=d0FVuWdx+Rru7Spb+JtjDo8GM10kgJjuZfqUCzW8BCQY/S2m3qeuBCl7OHHrIx26N rECdYCvQ/7CCo/AsHbODlRHs7w9ZD2NaTjynq9zSe+cRPTwCqmo14pLTWab2Cxsu6p aXWKConxVwiFrssqsdnnb4M+2U4GfdK5NVVp3Ta8= 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 0Lj2Cs-1j3pDj0jio-00dGNo; Wed, 20 May 2020 22:42:33 +0200 Date: Wed, 20 May 2020 22:42:32 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v2 6/6] migration/migration.c: Fix hang in ram_save_host_page Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:FEH/aqH+YoSjHjWD+k0jCpanSaUTVOXNqQhtejSVbx26nrKA/WI top37b28OrYTQvNghaFlVP9Q2tyY/fK4tqB3ckW7vytHjBLCMbLkNvzWhc00w1gaqhrFL0s E9xn5sB7pLr4EUbDWOqXFudXv00hdStgbai80agWqW6eC8fMxEGNF9rV6vWxwqNPs9VhriJ OEmb7fSXHIA6oKx2P31RQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:qFJ1REFqSlk=:NLRU0EmffZPPsFFGSJPQYW zfJ3bro42FkzSrpDTXvn9l/gOD7Dgasvfz+AqS6gn/dpguvivTpk4RydQcnwrqmEux9HePXjc oz1Zu/1hJZjXZwpBATzMd/LZbF3FHZ1efACcKDDIRNSDx4w9r6uvv9a46wj8wMt9+s6Ab+Vnp sg2CONFEFefZ7HR0CWR9hAmiuUqxtxsihZTElzPSZ3j0Tf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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" migration_rate_limit will erroneously ratelimit a shutdown socket, which causes the migration thread to hang in ram_save_host_page if the socket is shutdown. Fix this by explicitly testing if the socket has errors or was shutdown in migration_rate_limit. Signed-off-by: Lukas Straub Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.1 diff --git a/migration/migration.c b/migration/migration.c index 187ac0410c..e8bd32d48c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3347,6 +3347,10 @@ bool migration_rate_limit(void) bool urgent = false; migration_update_counters(s, now); if (qemu_file_rate_limit(s->to_dst_file)) { + + if (qemu_file_get_error(s->to_dst_file)) { + return false; + } /* * Wait for a delay to do rate limiting OR * something urgent to post the semaphore.