From nobody Mon Feb 9 02:28:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1561470475; cv=none; d=zoho.com; s=zohoarc; b=X96ZoPLhhLtIPXv+MJK0cgHJiNxPIHRQkXKPXtPnI9VXwrYiLDLM1yQ5ItGUDETkNVBKcGaLR9WB4k+VEEJ+RFUCZybniS868tz1LVQck1aIiuHRsUv/D/rnJeCFI9bKqCTxNxRWExUU/0XMMfeOtNoQRbUj1Nm36mxjSHYR7I4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561470475; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+79mAr/7Gf0QAGwn8jdzz/emVw6D7Ys9kqIb4RtqpPA=; b=E21E13NtiCrGRMV6YDYZ8xlCzGFX4Y6M23gpQ8ihebJNWsMmA9/8vchrdugciYdwDGelsQCyiYlvuyKSNAyx2w2dgjPfSfkRB92qjwVvl6M0RR2gB2nbjFnaf9BBWGOO8c3uIv9vWneZh4WmDV+BpAmQYwV1m28KqMsAZwv6CH4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561470475880296.010002700045; Tue, 25 Jun 2019 06:47:55 -0700 (PDT) Received: from localhost ([::1]:60402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hflnZ-0005A0-SJ for importer@patchew.org; Tue, 25 Jun 2019 09:47:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53869) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hflLD-0001b4-ET for qemu-devel@nongnu.org; Tue, 25 Jun 2019 09:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hflLC-0007N5-C0 for qemu-devel@nongnu.org; Tue, 25 Jun 2019 09:18:31 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:45155) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hflLC-0007MW-50 for qemu-devel@nongnu.org; Tue, 25 Jun 2019 09:18:30 -0400 Received: by mail-pl1-x643.google.com with SMTP id bi6so8836240plb.12 for ; Tue, 25 Jun 2019 06:18:30 -0700 (PDT) Received: from VM_64_241_centos.localdomain ([129.226.57.92]) by smtp.gmail.com with ESMTPSA id f186sm15675814pfb.5.2019.06.25.06.18.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 06:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+79mAr/7Gf0QAGwn8jdzz/emVw6D7Ys9kqIb4RtqpPA=; b=JqOZALO1Juwb7JyBzK6EP5Yx+/dDKgjl2LyjylpMKaPcIh9dQJkYP1PaQO5leyOSYy 6sxQlheubiS/mricv0RNgtCLv4zJPR6crbHDC7PieSD7U8tl5K3om0cOgt0vk186tB5b TaTurwOAPlIRnB8fXwlZ62e2iSvdjJjd4IjchAeup1Iwlh/ndmIjbvtI3ldtIkAUHERM gyJgYvAlIbS3X+eUG0qJU7VjKOfhIZTrBWy1qYBEFRyRldQxp4Kr6ix/YSzGEh3IlpB0 5z9t4iZJ7p6qo2BZx/GZ/oG0z5ntIGexjMlCKtvDpjZYzVEovP3DFevvOf7IsPTHeBlA qRvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+79mAr/7Gf0QAGwn8jdzz/emVw6D7Ys9kqIb4RtqpPA=; b=piGL8kVijHLXnq/JFglucoN6QR1zw5LlbnpS2AhgWc4rIBWnzLTbbt+RHdpI6p5iTR 0yVlfuvnD6QyBD0+NvHeEoaMsvokIk3wDRFBFmzkle5FbXijKspTUQfEHUjCDoOAKc19 y9sRxEYXh0EQ7FVQOCl/0IwTIt1//3qUdmJ/1DaWiibZ71WE3AYfRLO1QpmRO2cigvjJ lFirzsZ1qYmg79h5pH6N1zegnDFVagjdMrjfCV8UuBRNCRfehyNwJALzvy7zfjWPv12L zhkm1iQ76y57/xvQdVBvrC/yS7RTWLkkxU/YWOaQJXjQt+HteoiSYgmnhsXp3IhvH9uW S1Ng== X-Gm-Message-State: APjAAAVRR1Bjhz9HGmswYppjcMhhhFI+9YP0ni6osAVCkhKzekvwFjFv R7EPwQQ5+15K9a+Rc8vEFaTU466FLMJ6ezhY X-Google-Smtp-Source: APXvYqwj+LQR12XsU1rHs7fyRwOhj5+NX6C3Ud951nbg9AzcNh1JvUxPrSSMVsFBScZbPJi3h5PUgQ== X-Received: by 2002:a17:902:e6:: with SMTP id a93mr112356342pla.175.1561468709319; Tue, 25 Jun 2019 06:18:29 -0700 (PDT) From: Ivan Ren X-Google-Original-From: Ivan Ren To: quintela@redhat.com, dgilbert@redhat.com Date: Tue, 25 Jun 2019 21:18:19 +0800 Message-Id: <1561468699-9819-4-git-send-email-ivanren@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1561468699-9819-1-git-send-email-ivanren@tencent.com> References: <1561468699-9819-1-git-send-email-ivanren@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH 3/3] migration: fix migrate_cancel multifd migration leads destination hung forever 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When migrate_cancel a multifd migration, if run sequence like this: [source] [destination] multifd_send_sync_main[finish] multifd_recv_thread wait &p->sem_sync shutdown to_dst_file detect error from_src_file send RAM_SAVE_FLAG_EOS[fail] [no chance to run multifd_recv_sync_mai= n] multifd_load_cleanup join multifd receive thread forever will lead destination qemu hung at following stack: pthread_join qemu_thread_join multifd_load_cleanup process_incoming_migration_co coroutine_trampoline Signed-off-by: Ivan Ren --- migration/ram.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index e4eb9c441f..504c8ccb03 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1291,6 +1291,11 @@ int multifd_load_cleanup(Error **errp) MultiFDRecvParams *p =3D &multifd_recv_state->params[i]; =20 if (p->running) { + /* + * multifd_recv_thread may hung at MULTIFD_FLAG_SYNC handle co= de, + * however try to wakeup it without harm in cleanup phase. + */ + qemu_sem_post(&p->sem_sync); qemu_thread_join(&p->thread); } object_unref(OBJECT(p->c)); --=20 2.17.2 (Apple Git-113)