From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342810; cv=none; d=zohomail.com; s=zohoarc; b=LOp2SKa2rpSR3svT4LyVp6lZ6Gh2v8kP2q5sDPn/hCLZVCAkH3Zahn1XR4EH9lIkkETzcEERpDSseZxo6phXiYZ3Ex/hYKes08LnVSDjlusen9E29Iy5G/NE2JDOyKwJbLT2RgsAy4aTOVJb5YvitANSLeQbUbpnEdCIrpssTec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342810; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M4NEMeHwevL0+UB0KJS07+uty2N/Zh9zpVkTHzGeTTo=; b=LKLPQQXSMimv5jkYOqOS/gpoGy9cKz2nhyShRFvvj1ZmZIPetjJCUmt7g+q0szwTFN27jdPiLHoHWGw1HH2smXzsvuXr6dY27kw+QlF1UjL+2KTvf28bx7fOvMN0QzLn9ef6KdlcP2csWD2sTblelE9Dlf79sRrggfigOZXzN+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342810578327.463831064931; Wed, 3 Jan 2024 20:33:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPE-0000An-GB; Wed, 03 Jan 2024 23:32:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPD-0000AY-L6 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPC-0006XS-0h for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:31 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-60-YseHawpsPFmWdyDN_N8uIw-1; Wed, 03 Jan 2024 23:32:25 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43D693C2B60D; Thu, 4 Jan 2024 04:32:25 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4426C15968; Thu, 4 Jan 2024 04:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M4NEMeHwevL0+UB0KJS07+uty2N/Zh9zpVkTHzGeTTo=; b=VSlYhRrPxrlIS1Iwvh2ZGIFGLYO/4HJXq2vIb0+PITjX3IixMZQT6INfASjHoDmQNhrYvd c89+UzmFRUMnz62wU1KpAQO0IeSMLN9oXkXfdKZuWFd2adG0/j2E3oOqlavI8/WXD2Z4Ed L/ZZfyFP3u/fqdoS0JjXVZlJONe6t0g= X-MC-Unique: YseHawpsPFmWdyDN_N8uIw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , Juan Quintela , Bin Meng Subject: [PULL 01/26] MAINTAINERS: Leaving Migration Date: Thu, 4 Jan 2024 12:31:46 +0800 Message-ID: <20240104043213.431566-2-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342811589100001 From: Juan Quintela I am leaving Red Hat, and as part of that I am leaving Migration maintenarship. You are left in good hands with Peter and Fabiano. Thanks for all the fish. Signed-off-by: Juan Quintela Reviewed-by: Bin Meng Link: https://lore.kernel.org/r/20240102201908.1987-2-quintela@redhat.com [peterx: prefix the subject] Signed-off-by: Peter Xu --- MAINTAINERS | 3 --- .mailmap | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 395f26ba86..56464cd916 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -70,7 +70,6 @@ R: Daniel P. Berrang=C3=A9 R: Thomas Huth R: Markus Armbruster R: Philippe Mathieu-Daud=C3=A9 -R: Juan Quintela W: https://www.qemu.org/docs/master/devel/index.html S: Odd Fixes F: docs/devel/style.rst @@ -3355,7 +3354,6 @@ S: Odd Fixes F: scripts/checkpatch.pl =20 Migration -M: Juan Quintela M: Peter Xu M: Fabiano Rosas R: Leonardo Bras @@ -3375,7 +3373,6 @@ F: util/userfaultfd.c X: migration/rdma* =20 RDMA Migration -M: Juan Quintela R: Li Zhijian R: Peter Xu R: Leonardo Bras diff --git a/.mailmap b/.mailmap index e12e19f691..d94572af05 100644 --- a/.mailmap +++ b/.mailmap @@ -81,6 +81,7 @@ Greg Kurz Huacai Chen Huacai Chen James Hogan +Juan Quintela Leif Lindholm Leif Lindholm Luc Michel --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342913; cv=none; d=zohomail.com; s=zohoarc; b=WP38ihXkmridNtVCC5y5JC+A7Pbq9+8FjWNVq/diAhC1OU3JDdeDu6lLuqZJHsOcxMdFfcptwml9I7gVFedj7pfhbgFyZ579PPczF9Mk2mbyAKMN5b13T+Rix8IFHzPBT4CmMCgRvY9a65dlXhXGSDD/jocCYosQb8dT4fFxjYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342913; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WktZ2LzDhP+W10mjy931IC19R4i2j3WY3KXAO/VI7i8=; b=EvdgVQV4gurBzRfeYlSc7XFvG1FzM+iBK+oZ1mDifUqv+X5arT8BcqRwOoV+QMopd79h1ffVKnHfIX9IOprjSTMdX4SJd6g4vVIYT31kF/lt6Hh6TLnzX4jc4JeDTyLGqx/xnUFptOm3IAbv5VF2zcKcc7nvAr9FF9fPHsqHvDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342913451924.56115834944; Wed, 3 Jan 2024 20:35:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPK-0000Dn-3B; Wed, 03 Jan 2024 23:32:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPI-0000D4-Fe for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPH-0006Xl-0r for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:36 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-c0vyesrWNlqx6CG2U5wQJA-1; Wed, 03 Jan 2024 23:32:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5EE841C2B662; Thu, 4 Jan 2024 04:32:30 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBB30C15968; Thu, 4 Jan 2024 04:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WktZ2LzDhP+W10mjy931IC19R4i2j3WY3KXAO/VI7i8=; b=We+FSNvkc5bB6ydstC766yatvZAATp4w2e4C6XAKIu5kcYQYqwqZE9m2l6pMdOAPoeSkh1 UHIp3Ui5RSn8aY2h9kr5pT54uTa8DaW5eIjy7JLIAi8pOEmbB5UpjszYrwn894eg4XbW+F I3tbKbJ05AqNERx73KNXbQ2RJXWoOTI= X-MC-Unique: c0vyesrWNlqx6CG2U5wQJA-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , Leonardo Bras Subject: [PULL 02/26] MAINTAINERS: Remove myself as reviewer from Live Migration Date: Thu, 4 Jan 2024 12:31:47 +0800 Message-ID: <20240104043213.431566-3-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342913904100001 Content-Type: text/plain; charset="utf-8" From: Leonardo Bras I am currently focusing in kernel development, so I will probably not be of much help in reviewing general Live Migration changes. For above reason I am removing my Reviewer status from Migration and RDMA Migration. Signed-off-by: Leonardo Bras Link: https://lore.kernel.org/r/20231221170739.332378-1-leobras@redhat.com Signed-off-by: Peter Xu --- MAINTAINERS | 2 -- 1 file changed, 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 56464cd916..00ec1f7eca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3356,7 +3356,6 @@ F: scripts/checkpatch.pl Migration M: Peter Xu M: Fabiano Rosas -R: Leonardo Bras S: Maintained F: hw/core/vmstate-if.c F: include/hw/vmstate-if.h @@ -3375,7 +3374,6 @@ X: migration/rdma* RDMA Migration R: Li Zhijian R: Peter Xu -R: Leonardo Bras S: Odd Fixes F: migration/rdma* =20 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342998; cv=none; d=zohomail.com; s=zohoarc; b=JLujzdGg7MMU4uFwfdlP7QUjG3D8Xv9T72y830zb5HtVIf/z2eI7xUT5okdpu0A5A88qpHfw7xr0HrQnIScnBv2+pvgnxA55heptiMRlwmbkkkSmGQESVP1D8B/SDrG6Z6p3GsbHJpA4UBV9/MkP7Rc3hoaVuR4wqARChKE1VvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342998; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HF+47A1lnM8/YjS6desQe6306uTmYoFO3/fohn4jQGw=; b=AdSlRblscv8fOlwfSNQxXt68C0KW0/TpPU8QJzFrc6DzxHGnFGqMd9R1NLGzS2ogwL80z0vU88NfwtI3I/hK+TA9TnFdp+qH9+jsNHQSiJdv/3FMDDKJXa5Xbkr+jXoPTuuKFGX7jg/vMHdyV//yQnkLU/dBvH1ThiLzi6eSCFU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342998065344.35587769505526; Wed, 3 Jan 2024 20:36:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPL-0000E4-TA; Wed, 03 Jan 2024 23:32:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPK-0000Dp-Pc for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPJ-0006YA-Ai for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:38 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-vxNw8MqCOFOGavyS-dYoVQ-1; Wed, 03 Jan 2024 23:32:35 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F25E0836F85; Thu, 4 Jan 2024 04:32:34 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 149C9C15E6A; Thu, 4 Jan 2024 04:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HF+47A1lnM8/YjS6desQe6306uTmYoFO3/fohn4jQGw=; b=X/mn02PwesZ8vVQq4inFIz332KcWsQ1Wq/2r+FE9bDj8DO1zNAJi1qVFF2noyls7hh3SiU 6EGAhYd8ZOluFFcdSJg3NJSdo5zZXSMATPTTYRCgCX9MQIZs9FYIMm/eO8iU/groopxYWZ ZBO+GsNnmjOeI61R830SITs5vZqD1uw= X-MC-Unique: vxNw8MqCOFOGavyS-dYoVQ-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 03/26] cpus: vm_was_suspended Date: Thu, 4 Jan 2024 12:31:48 +0800 Message-ID: <20240104043213.431566-4-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704343000194100009 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Add a state variable to remember if a vm previously transitioned into a suspended state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-2-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- include/sysemu/runstate.h | 2 ++ system/cpus.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index c8c2bd8a61..88a67e22b0 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -51,6 +51,8 @@ int vm_prepare_start(bool step_pending); int vm_stop(RunState state); int vm_stop_force_state(RunState state); int vm_shutdown(void); +void vm_set_suspended(bool suspended); +bool vm_get_suspended(void); =20 typedef enum WakeupReason { /* Always keep QEMU_WAKEUP_REASON_NONE =3D 0 */ diff --git a/system/cpus.c b/system/cpus.c index a444a747f0..9f631ab734 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -259,6 +259,21 @@ void cpu_interrupt(CPUState *cpu, int mask) } } =20 +/* + * True if the vm was previously suspended, and has not been woken or rese= t. + */ +static int vm_was_suspended; + +void vm_set_suspended(bool suspended) +{ + vm_was_suspended =3D suspended; +} + +bool vm_get_suspended(void) +{ + return vm_was_suspended; +} + static int do_vm_stop(RunState state, bool send_stop) { int ret =3D 0; --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342810; cv=none; d=zohomail.com; s=zohoarc; b=mMG62XRj9K1DglaTYi5DEIGyTgY7/s754IE269JmSMVOhe6CUBZKgY10QjimsqdBpJvrQBV3qltDK9gvMDFP/4KmJpdwBu2NkFf8Z6o+az5HTP30HVFn0kFIEwZCehj0b+TGUNa0DZfEu55eugC+qi5aFm3CB7l91QMo5XTS+jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342810; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2y4PqDNz+uiOMvJd4g9dzARaABkeK1CiHVGFkAvIoGE=; b=CrOH+MTfsqk3ZUEE53fFuAG2kQp3beFdelDV0KIKv4cq8NFBx9q4lexlgv+rrc+BtidiMFMGXTn4Jkr5TDd9DOBxb4D6QPXGXne9CIR3W9CbYhvYZrEcdBtwkcK2BDYMIWpGVWrcv4ANjkmvsdzBXu0qD9QAIQol7c3+tAXv5n8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342810768915.5083943232944; Wed, 3 Jan 2024 20:33:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPW-0000Eq-6O; Wed, 03 Jan 2024 23:32:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPU-0000Ee-6k for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPS-0006YY-Ah for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:47 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-lidia0e8PmC8FWgnh0TPYQ-1; Wed, 03 Jan 2024 23:32:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB97F3816D86; Thu, 4 Jan 2024 04:32:39 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id B126BC15968; Thu, 4 Jan 2024 04:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2y4PqDNz+uiOMvJd4g9dzARaABkeK1CiHVGFkAvIoGE=; b=X0nYtkxghiJ5GpeGtTwCcLs020yP0y2+74X10QkRuEjOUckQljy8i3MWZbZeCGfRpvULdw 40R0Bgy96vC5YbCUO7ARcsVtkntdUVW4AWNwf3o6dxcT34skLusuizuzGIbXOARD27aVLQ dFezwLHxfa9HxWFdHX7hWPeM0teiWY4= X-MC-Unique: lidia0e8PmC8FWgnh0TPYQ-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 04/26] cpus: stop vm in suspended runstate Date: Thu, 4 Jan 2024 12:31:49 +0800 Message-ID: <20240104043213.431566-5-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342811612100002 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Currently, a vm in the suspended state is not completely stopped. The VCPUs have been paused, but the cpu clock still runs, and runstate notifiers for the transition to stopped have not been called. This causes problems for live migration. Stale cpu timers_state is saved to the migration stream, causing time errors in the guest when it wakes from suspend, and state that would have been modified by runstate notifiers is wrong. Modify vm_stop to completely stop the vm if the current state is suspended, transition to RUN_STATE_PAUSED, and remember that the machine was suspended. Modify vm_start to restore the suspended state. This affects all callers of vm_stop and vm_start, notably, the qapi stop and cont commands: old behavior: RUN_STATE_SUSPENDED --> stop --> RUN_STATE_SUSPENDED new behavior: RUN_STATE_SUSPENDED --> stop --> RUN_STATE_PAUSED RUN_STATE_PAUSED --> cont --> RUN_STATE_SUSPENDED For example: (qemu) info status VM status: paused (suspended) (qemu) stop (qemu) info status VM status: paused (qemu) system_wakeup Error: Unable to wake up: guest is not in suspended state (qemu) cont (qemu) info status VM status: paused (suspended) (qemu) system_wakeup (qemu) info status VM status: running Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-3-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- qapi/misc.json | 11 +++++++++-- qapi/run-state.json | 6 +++--- include/sysemu/runstate.h | 9 +++++++++ system/cpus.c | 23 +++++++++++++++-------- system/runstate.c | 3 +++ 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index cda2effa81..3622d98d01 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -134,7 +134,7 @@ ## # @stop: # -# Stop all guest VCPU execution. +# Stop guest VM execution. # # Since: 0.14 # @@ -143,6 +143,9 @@ # the guest remains paused once migration finishes, as if the -S # option was passed on the command line. # +# In the "suspended" state, it will completely stop the VM and +# cause a transition to the "paused" state. (Since 9.0) +# # Example: # # -> { "execute": "stop" } @@ -153,7 +156,7 @@ ## # @cont: # -# Resume guest VCPU execution. +# Resume guest VM execution. # # Since: 0.14 # @@ -165,6 +168,10 @@ # guest starts once migration finishes, removing the effect of the # -S command line option if it was passed. # +# If the VM was previously suspended, and not been reset or woken, +# this command will transition back to the "suspended" state. +# (Since 9.0) +# # Example: # # -> { "execute": "cont" } diff --git a/qapi/run-state.json b/qapi/run-state.json index f216ba54ec..ca05502e0a 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -102,7 +102,7 @@ ## # @StatusInfo: # -# Information about VCPU run state +# Information about VM run state # # @running: true if all VCPUs are runnable, false if not runnable # @@ -130,9 +130,9 @@ ## # @query-status: # -# Query the run status of all VCPUs +# Query the run status of the VM # -# Returns: @StatusInfo reflecting all VCPUs +# Returns: @StatusInfo reflecting the VM # # Since: 0.14 # diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 88a67e22b0..618eb491af 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -40,6 +40,15 @@ static inline bool shutdown_caused_by_guest(ShutdownCaus= e cause) return cause >=3D SHUTDOWN_CAUSE_GUEST_SHUTDOWN; } =20 +/* + * In a "live" state, the vcpu clock is ticking, and the runstate notifiers + * think we are running. + */ +static inline bool runstate_is_live(RunState state) +{ + return state =3D=3D RUN_STATE_RUNNING || state =3D=3D RUN_STATE_SUSPEN= DED; +} + void vm_start(void); =20 /** diff --git a/system/cpus.c b/system/cpus.c index 9f631ab734..f162435dd4 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -277,11 +277,15 @@ bool vm_get_suspended(void) static int do_vm_stop(RunState state, bool send_stop) { int ret =3D 0; + RunState oldstate =3D runstate_get(); =20 - if (runstate_is_running()) { + if (runstate_is_live(oldstate)) { + vm_was_suspended =3D (oldstate =3D=3D RUN_STATE_SUSPENDED); runstate_set(state); cpu_disable_ticks(); - pause_all_vcpus(); + if (oldstate =3D=3D RUN_STATE_RUNNING) { + pause_all_vcpus(); + } vm_state_notify(0, state); if (send_stop) { qapi_event_send_stop(); @@ -694,11 +698,13 @@ int vm_stop(RunState state) =20 /** * Prepare for (re)starting the VM. - * Returns -1 if the vCPUs are not to be restarted (e.g. if they are alrea= dy - * running or in case of an error condition), 0 otherwise. + * Returns 0 if the vCPUs should be restarted, -1 on an error condition, + * and 1 otherwise. */ int vm_prepare_start(bool step_pending) { + int ret =3D vm_was_suspended ? 1 : 0; + RunState state =3D vm_was_suspended ? RUN_STATE_SUSPENDED : RUN_STATE_= RUNNING; RunState requested; =20 qemu_vmstop_requested(&requested); @@ -729,9 +735,10 @@ int vm_prepare_start(bool step_pending) qapi_event_send_resume(); =20 cpu_enable_ticks(); - runstate_set(RUN_STATE_RUNNING); - vm_state_notify(1, RUN_STATE_RUNNING); - return 0; + runstate_set(state); + vm_state_notify(1, state); + vm_was_suspended =3D false; + return ret; } =20 void vm_start(void) @@ -745,7 +752,7 @@ void vm_start(void) current state is forgotten forever */ int vm_stop_force_state(RunState state) { - if (runstate_is_running()) { + if (runstate_is_live(runstate_get())) { return vm_stop(state); } else { int ret; diff --git a/system/runstate.c b/system/runstate.c index ea9d6c2a32..e2fa2040cb 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -108,6 +108,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_PAUSED, RUN_STATE_POSTMIGRATE }, { RUN_STATE_PAUSED, RUN_STATE_PRELAUNCH }, { RUN_STATE_PAUSED, RUN_STATE_COLO}, + { RUN_STATE_PAUSED, RUN_STATE_SUSPENDED}, =20 { RUN_STATE_POSTMIGRATE, RUN_STATE_RUNNING }, { RUN_STATE_POSTMIGRATE, RUN_STATE_FINISH_MIGRATE }, @@ -161,6 +162,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_SUSPENDED, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_SUSPENDED, RUN_STATE_PRELAUNCH }, { RUN_STATE_SUSPENDED, RUN_STATE_COLO}, + { RUN_STATE_SUSPENDED, RUN_STATE_PAUSED}, =20 { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, @@ -502,6 +504,7 @@ void qemu_system_reset(ShutdownCause reason) qapi_event_send_reset(shutdown_caused_by_guest(reason), reason); } cpu_synchronize_all_post_reset(); + vm_set_suspended(false); } =20 /* --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342870; cv=none; d=zohomail.com; s=zohoarc; b=jTeAbjxFZBU9EcQJJOeKVfoP60PO92pgTX/lQSJYcFkhy5nB/ZLOqkU/72L6KcLzmncDYNPOgayTwWa2bDTCBSxFaslMPzGtygCGPSHKOwzrC4ETmVGb5Qk4x1y0iS8gUxB1AHcyWZ5+V4BBzGgSp5sp8sEeCnt2R/fZUQONbms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342870; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ABx49MI82+qH2tz8ojbNkQ+kyIm22DuH+mdAmNEU/SQ=; b=ZLrZRL0TZlgG2IoCo+eBq3x9dEJ4RlvHDyPpI/QQSlRD+sNEAbaw749eIeNVCGp71bYrebSIaWX3IBujLMZphwXO0FQAipBL2vh/1hXk49UDs6hUtdEDsxEgiQAi4nzQyKx/pZijT8FbMDfPI4m3uSZrhKYEr9Iu4iXqrH5Y5Xc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342870787168.63730103515786; Wed, 3 Jan 2024 20:34:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPX-0000FB-L6; Wed, 03 Jan 2024 23:32:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPW-0000Er-5y for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPU-0006Yh-LX for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:49 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-0iNW2o_9PLuY6xNl_VN3pw-1; Wed, 03 Jan 2024 23:32:44 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7EFDE3C025BB; Thu, 4 Jan 2024 04:32:44 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 947C7C15968; Thu, 4 Jan 2024 04:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ABx49MI82+qH2tz8ojbNkQ+kyIm22DuH+mdAmNEU/SQ=; b=MnNSU/sXIdJfH+uF/Yaez8XDxpIh36P5lvUnFYrCg76z5YAf0bBHcRB9rJqo3M2xqRrkaN zXE2nuoWR0Qhu/GYEyoZBm1OsPJYiZ04SPfjPR+P+vN4vR/freBZiY/LrfkfCxUhRQt1Un be9oyuYVvpiCNpbmT+fZETf0lh2Wvog= X-MC-Unique: 0iNW2o_9PLuY6xNl_VN3pw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 05/26] cpus: check running not RUN_STATE_RUNNING Date: Thu, 4 Jan 2024 12:31:50 +0800 Message-ID: <20240104043213.431566-6-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342871767100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare When a vm transitions from running to suspended, runstate notifiers are not called, so the notifiers still think the vm is running. Hence, when we call vm_start to restore the suspended state, we call vm_state_notify with running=3D1. However, some notifiers check for RUN_STATE_RUNNING. They must check the running boolean instead. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-4-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- backends/tpm/tpm_emulator.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/redirect.c | 2 +- hw/xen/xen-hvm-common.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index f7f1b4ad7a..254fce7764 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -904,7 +904,7 @@ static void tpm_emulator_vm_state_change(void *opaque, = bool running, =20 trace_tpm_emulator_vm_state_change(running, state); =20 - if (!running || state !=3D RUN_STATE_RUNNING || !tpm_emu->relock_stora= ge) { + if (!running || !tpm_emu->relock_storage) { return; } =20 diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 19b4534c20..10c82ce472 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2451,7 +2451,7 @@ static void usb_ehci_vm_state_change(void *opaque, bo= ol running, RunState state) * USB-devices which have async handled packages have a packet in the * ep queue to match the completion with. */ - if (state =3D=3D RUN_STATE_RUNNING) { + if (running) { ehci_advance_async_state(ehci); } =20 diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index c9893df867..3785bb057b 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1403,7 +1403,7 @@ static void usbredir_vm_state_change(void *priv, bool= running, RunState state) { USBRedirDevice *dev =3D priv; =20 - if (state =3D=3D RUN_STATE_RUNNING && dev->parser !=3D NULL) { + if (running && dev->parser !=3D NULL) { usbredirparser_do_write(dev->parser); /* Flush any pending writes = */ } } diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 565dc39c8f..47e6cb1db3 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -623,7 +623,7 @@ void xen_hvm_change_state_handler(void *opaque, bool ru= nning, =20 xen_set_ioreq_server_state(xen_domid, state->ioservid, - (rstate =3D=3D RUN_STATE_RUNNING)); + running); } =20 void xen_exit_notifier(Notifier *n, void *data) --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342857; cv=none; d=zohomail.com; s=zohoarc; b=GgIx8gGrlwMIAPiMgMRcfI3D89r2gNPsgu1VXeCtblRYLFIGI1vqvRcT/sCcJJG30Wn6glYKEHZUXc0xSHQrYYi8/COrX7Nd6knHH30nHOrKhUb4Brk5bNNEarvCs0aBCFjMLAlVBgQcAxUXZmDXrWKGgA5zS8ss6T6CiZO2auk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342857; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6gbXyQqAy1T1gIsdSwsXwXrfFw6nqxWX12X3jJkD8LQ=; b=FhWMy9fOZJeUBbyWQ48OWYsKVSpid7CG3iyoBdsGl4ky+cvDnzQTlU/pnDk6cBYTjFcxWQBBc9THua8Oq6OMNPcMpwgUTl+wlMLBD47WQAMj4oCbcBMjIieRxqZp4wIYRWZhlzOmi5TDtKQhDq9cXaUzEklUikaT1/HnbWt5j9g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342857672210.1788038195748; Wed, 3 Jan 2024 20:34:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPf-0000Oa-AF; Wed, 03 Jan 2024 23:32:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPc-0000FY-6f for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPa-0006ZO-KW for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:55 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-308--F9vyQPuOEe1kg-NLVJpHA-1; Wed, 03 Jan 2024 23:32:50 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69B8B3C2B607; Thu, 4 Jan 2024 04:32:49 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E647C15E6A; Thu, 4 Jan 2024 04:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6gbXyQqAy1T1gIsdSwsXwXrfFw6nqxWX12X3jJkD8LQ=; b=Jrfgl8jRgaQpp98FW6YJkVAMxsoAPCThlqHEBzX+LPwOji7RIj2DadvQk0SncFZOJzjGsg oOyer7NNiWVDXvvNZg0xeBzhL6dtGAl2l02ofxZ5QqyHZYM0xthMjhQzbYkG6ttrp+hhCy h8ANq2VNsmR3D1WAQVcHpmwJn7Y5sIA= X-MC-Unique: -F9vyQPuOEe1kg-NLVJpHA-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 06/26] cpus: vm_resume Date: Thu, 4 Jan 2024 12:31:51 +0800 Message-ID: <20240104043213.431566-7-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342859811100004 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Define the vm_resume helper, for use in subsequent patches. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-5-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- include/sysemu/runstate.h | 9 +++++++++ system/cpus.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 618eb491af..0117d243c4 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -57,6 +57,15 @@ void vm_start(void); * @step_pending: whether any of the CPUs is about to be single-stepped by= gdb */ int vm_prepare_start(bool step_pending); + +/** + * vm_resume: If @state is a live state, start the vm and set the state, + * else just set the state. + * + * @state: the state to restore + */ +void vm_resume(RunState state); + int vm_stop(RunState state); int vm_stop_force_state(RunState state); int vm_shutdown(void); diff --git a/system/cpus.c b/system/cpus.c index f162435dd4..7d2c28b1d1 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -748,6 +748,15 @@ void vm_start(void) } } =20 +void vm_resume(RunState state) +{ + if (runstate_is_live(state)) { + vm_start(); + } else { + runstate_set(state); + } +} + /* does a state transition even if the VM is already stopped, current state is forgotten forever */ int vm_stop_force_state(RunState state) --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342801; cv=none; d=zohomail.com; s=zohoarc; b=D+LGUi5sdS3Da/cEJrtQyW4RI4RhmK1S735Mg0YyeZGkjUYrTkt8QM9odHtETsSj1XBQ30ZLc6ZGR0lXwGS1wDH7HZkTkrVX8rL6tqz3VzhgleQ9R6n+c2JgkWygzeTKEbhCWQ2ya/0HPFYYSTRdVTvVk/4GvAguOEWXQnsDyTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342801; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8TfpCka1YSMdMRbf5/huRwSV5G6ZPsE5XhlMly3s4AI=; b=nQqkExSxHZAautRmp/NBVMtaT+WG4Gtlaqomg6CFyW9BuVm1G/hcvjAQf+ydOrti5InYsyAhgoO/YGyXknYNI6sSotHSdaV71oVWCCPZmLeD37SbL+jijCyD2zXQQ38lA+SRdLvsy775kM+q4HPhQthk8O4El3VO457yTzi94yE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342801501900.239830714916; Wed, 3 Jan 2024 20:33:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPg-0000WE-Pd; Wed, 03 Jan 2024 23:33:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPf-0000Op-9p for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPd-0006ZZ-Bz for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:32:59 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-389-28d9F-tAOKeKefhifK3dpg-1; Wed, 03 Jan 2024 23:32:55 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 109BF3816D84; Thu, 4 Jan 2024 04:32:55 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39426C15968; Thu, 4 Jan 2024 04:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8TfpCka1YSMdMRbf5/huRwSV5G6ZPsE5XhlMly3s4AI=; b=R3qdOUW9daCLalVkEYckRWh5h71OFZjZhbfNGPVg9O7546jhBi/FS57DM2tW087p+x5TRe tVA6IoUR3ORg5MtYKAlN1z3cRXSbvvbOT9VcN/ju/pVdELogxoriOSKlBrX5zxE9WqoE+P UQmwVUBT3v8ITdlrvUCSCWHeXvWHKuU= X-MC-Unique: 28d9F-tAOKeKefhifK3dpg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 07/26] migration: propagate suspended runstate Date: Thu, 4 Jan 2024 12:31:52 +0800 Message-ID: <20240104043213.431566-8-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342803768100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, reclaim some space from the runstate member. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-6-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- migration/global_state.c | 47 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/migration/global_state.c b/migration/global_state.c index 4e2a9d8ec0..64a573c683 100644 --- a/migration/global_state.c +++ b/migration/global_state.c @@ -22,7 +22,16 @@ =20 typedef struct { uint32_t size; - uint8_t runstate[100]; + + /* + * runstate was 100 bytes, zero padded, but we trimmed it to add a + * few fields and maintain backwards compatibility. + */ + uint8_t runstate[32]; + uint8_t has_vm_was_suspended; + uint8_t vm_was_suspended; + uint8_t unused[66]; + RunState state; bool received; } GlobalState; @@ -35,6 +44,10 @@ static void global_state_do_store(RunState state) assert(strlen(state_str) < sizeof(global_state.runstate)); strpadcpy((char *)global_state.runstate, sizeof(global_state.runstate), state_str, '\0'); + global_state.has_vm_was_suspended =3D true; + global_state.vm_was_suspended =3D vm_get_suspended(); + + memset(global_state.unused, 0, sizeof(global_state.unused)); } =20 void global_state_store(void) @@ -59,24 +72,7 @@ RunState global_state_get_runstate(void) =20 static bool global_state_needed(void *opaque) { - GlobalState *s =3D opaque; - char *runstate =3D (char *)s->runstate; - - /* If it is not optional, it is mandatory */ - - if (migrate_get_current()->store_global_state) { - return true; - } - - /* If state is running or paused, it is not needed */ - - if (strcmp(runstate, "running") =3D=3D 0 || - strcmp(runstate, "paused") =3D=3D 0) { - return false; - } - - /* for any other state it is needed */ - return true; + return migrate_get_current()->store_global_state; } =20 static int global_state_post_load(void *opaque, int version_id) @@ -93,7 +89,7 @@ static int global_state_post_load(void *opaque, int versi= on_id) sizeof(s->runstate)) =3D=3D sizeof(s->runstate)) { /* * This condition should never happen during migration, because - * all runstate names are shorter than 100 bytes (the size of + * all runstate names are shorter than 32 bytes (the size of * s->runstate). However, a malicious stream could overflow * the qapi_enum_parse() call, so we force the last character * to a NUL byte. @@ -110,6 +106,14 @@ static int global_state_post_load(void *opaque, int ve= rsion_id) } s->state =3D r; =20 + /* + * global_state is saved on the outgoing side before forcing a stopped + * state, so it may have saved state=3Dsuspended and vm_was_suspended= =3D0. + * Now we are in a paused state, and when we later call vm_start, it m= ust + * restore the suspended state, so we must set vm_was_suspended=3D1 he= re. + */ + vm_set_suspended(s->vm_was_suspended || r =3D=3D RUN_STATE_SUSPENDED); + return 0; } =20 @@ -134,6 +138,9 @@ static const VMStateDescription vmstate_globalstate =3D= { .fields =3D (VMStateField[]) { VMSTATE_UINT32(size, GlobalState), VMSTATE_BUFFER(runstate, GlobalState), + VMSTATE_UINT8(has_vm_was_suspended, GlobalState), + VMSTATE_UINT8(vm_was_suspended, GlobalState), + VMSTATE_BUFFER(unused, GlobalState), VMSTATE_END_OF_LIST() }, }; --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342820; cv=none; d=zohomail.com; s=zohoarc; b=LuWOz3MG3dniCNDxI2Vm3KgtnJM7/9WBqtERxP5kpan/YvAIFdAQq060s0nZYVJ7MQl640WzdvfS1i5JwzaFZrPZCXaI0yxAbL5kGjqfR2x8MMmjgrV6GiPgeR53+ETxf1yNi7ESVFJQIZCjK0KdcFORFmYu6JTdOoFMg4e7Kfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342820; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZfZsjh2KNyTfbkgyCtCwi44q1wBfXZ33Ffimkt/Rndc=; b=OoOR4gaVL3ljisRcFWbxdVBcVSKzNlng/1IHn+w75Cw5AUcT2RssJHhB0XsDkyf+cg353vk4IpTPbs/E9gSEwDyWFvCX59HEb00uVgFseYrwJzIe17K3eE2feV1ngl/cp7mvcXnNAXYIzpOZVUCIk9t2/nBXpWX7YWu7C+B20sg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342820423440.95231699968656; Wed, 3 Jan 2024 20:33:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPr-0000aN-S8; Wed, 03 Jan 2024 23:33:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPm-0000Z4-8Q for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPk-0006bL-Lb for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:06 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-qz5dRv_FM-C-uaxJjl8oKg-1; Wed, 03 Jan 2024 23:33:00 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D66FE29AA385; Thu, 4 Jan 2024 04:32:59 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3599C15E6C; Thu, 4 Jan 2024 04:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZfZsjh2KNyTfbkgyCtCwi44q1wBfXZ33Ffimkt/Rndc=; b=WCbRYhGS3UtxErHSnZuEjoRhG0aYq+feF0fGlkD5vVhiUuKozAytCVFf4fpdvDhCL9RQmq G9n7yNXsHiQ6dpaSBXCQ7UDCVKV0UbD/wgGEciK+UHGJT0bhXqWHUTBcuVpLVW880Qcmgw HEWwN9tKEG/BqyKNW4DPX/H46a1KbvI= X-MC-Unique: qz5dRv_FM-C-uaxJjl8oKg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 08/26] migration: preserve suspended runstate Date: Thu, 4 Jan 2024 12:31:53 +0800 Message-ID: <20240104043213.431566-9-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342821581100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare A guest that is migrated in the suspended state automaticaly wakes and continues execution. This is wrong; the guest should end migration in the same state it started. The root cause is that the outgoing migration code automatically wakes the guest, then saves the RUNNING runstate in global_state_store(), hence the incoming migration code thinks the guest is running and continues the guest if autostart is true. On the outgoing side, delete the call to qemu_system_wakeup_request(). Now that vm_stop completely stops a vm in the suspended state (from the preceding patches), the existing call to vm_stop_force_state is sufficient to correctly migrate all vmstate. On the incoming side, call vm_start if the pre-migration state was running or suspended. For the latter, vm_start correctly restores the suspended state, and a future system_wakeup monitor request will cause the vm to resume running. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-7-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- migration/migration.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3ce04b2aaf..8124811045 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -604,7 +604,7 @@ static void process_incoming_migration_bh(void *opaque) */ if (!migrate_late_block_activate() || (autostart && (!global_state_received() || - global_state_get_runstate() =3D=3D RUN_STATE_RUNNING))) { + runstate_is_live(global_state_get_runstate())))) { /* Make sure all file formats throw away their mutable metadata. * If we get an error here, just don't restart the VM yet. */ bdrv_activate_all(&local_err); @@ -628,7 +628,7 @@ static void process_incoming_migration_bh(void *opaque) dirty_bitmap_mig_before_vm_start(); =20 if (!global_state_received() || - global_state_get_runstate() =3D=3D RUN_STATE_RUNNING) { + runstate_is_live(global_state_get_runstate())) { if (autostart) { vm_start(); } else { @@ -2416,7 +2416,6 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) =20 migration_downtime_start(ms); =20 - qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); global_state_store(); ret =3D migration_stop_vm(RUN_STATE_FINISH_MIGRATE); if (ret < 0) { @@ -2615,7 +2614,6 @@ static int migration_completion_precopy(MigrationStat= e *s, =20 qemu_mutex_lock_iothread(); migration_downtime_start(s); - qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); =20 s->vm_old_state =3D runstate_get(); global_state_store(); @@ -3136,7 +3134,7 @@ static void migration_iteration_finish(MigrationState= *s) case MIGRATION_STATUS_FAILED: case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_CANCELLING: - if (s->vm_old_state =3D=3D RUN_STATE_RUNNING) { + if (runstate_is_live(s->vm_old_state)) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { vm_start(); } --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704343014; cv=none; d=zohomail.com; s=zohoarc; b=b+6B9a2b/Cot8j7Dyt/PI1pqz2w1IzoIZ7fmOE4rxx1lTCkYyduXvqr3veB4+1fcqXNrxyAJGdS8vekThk/c7FvHp0ZRxNhW46fU3uB7OMMELP6hi2CCNdInu12dkbZFWG3xb+S9kG0VKpZK8k0/feiM4RQNdx/yJ23As3NdoAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704343014; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5b2CT1KStXV150qameeAoGS09H9N9IdPg5fcDO9jm+o=; b=hiI6tSprRnXOu56jyK3n5/1UC0kR7K9O4U1CPwXzg4fzcY/+WsQ3JO9y8Gz3dK0/AxSjYD7qwrtA1bHfgUXoztiNWrs6oxMjFCITwkwLv7GeM0DO50N/aLTs0dP9BWaObx50S6KRdwTPE2A+qoWW3VSKyfMjP1i6fgN+Qp9BwLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704343014048437.4842483281666; Wed, 3 Jan 2024 20:36:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPu-0000al-Ex; Wed, 03 Jan 2024 23:33:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPr-0000aO-K0 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPp-0006c1-OT for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:11 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-212-HpNDakmzMs6yUiWsiMvDkg-1; Wed, 03 Jan 2024 23:33:05 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F976836F85; Thu, 4 Jan 2024 04:33:04 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id A65E4C15968; Thu, 4 Jan 2024 04:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5b2CT1KStXV150qameeAoGS09H9N9IdPg5fcDO9jm+o=; b=PRmxXa/s/0MvBbsR37WAogMVP0Q2GUlbrxH2iYbAfhJJ9MfHIBIM4ue0wU24CVfMJRiBSh /EXThTEEzj+w7bKC+OzX8HlWKKsOW/QQzL6zPfpqlZK5nu70o/O8lHn/kZCT1bkE/3h5PN h6rdEItY5OkhbAcUPjnOYyovxv66UNs= X-MC-Unique: HpNDakmzMs6yUiWsiMvDkg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 09/26] migration: preserve suspended for snapshot Date: Thu, 4 Jan 2024 12:31:54 +0800 Message-ID: <20240104043213.431566-10-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704343014274100002 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Restoring a snapshot can break a suspended guest. Snapshots suffer from the same suspended-state issues that affect live migration, plus they must handle an additional problematic scenario, which is that a running vm must remain running if it loads a suspended snapshot. To save, the existing vm_stop call now completely stops the suspended state. Finish with vm_resume to leave the vm in the state it had prior to the save, correctly restoring the suspended state. To load, if the snapshot is not suspended, then vm_stop + vm_resume correctly handles all states, and leaves the vm in the state it had prior to the load. However, if the snapshot is suspended, restoration is trickier. First, call vm_resume to restore the state to suspended so the current state matches the saved state. Then, if the pre-load state is running, call wakeup to resume running. Prior to these changes, the vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was suspended, but now it does, so allow these transitions. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-8-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- include/migration/snapshot.h | 7 +++++++ migration/migration-hmp-cmds.c | 8 +++++--- migration/savevm.c | 23 +++++++++++++---------- system/runstate.c | 5 +++++ system/vl.c | 2 ++ 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/migration/snapshot.h b/include/migration/snapshot.h index e72083b117..9e4dcaaa75 100644 --- a/include/migration/snapshot.h +++ b/include/migration/snapshot.h @@ -16,6 +16,7 @@ #define QEMU_MIGRATION_SNAPSHOT_H =20 #include "qapi/qapi-builtin-types.h" +#include "qapi/qapi-types-run-state.h" =20 /** * save_snapshot: Save an internal snapshot. @@ -61,4 +62,10 @@ bool delete_snapshot(const char *name, bool has_devices, strList *devices, Error **errp); =20 +/** + * load_snapshot_resume: Restore runstate after loading snapshot. + * @state: state to restore + */ +void load_snapshot_resume(RunState state); + #endif diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 99710c8ffb..740a219aa4 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -399,15 +399,17 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) =20 void hmp_loadvm(Monitor *mon, const QDict *qdict) { - int saved_vm_running =3D runstate_is_running(); + RunState saved_state =3D runstate_get(); + const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; =20 vm_stop(RUN_STATE_RESTORE_VM); =20 - if (load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) { - vm_start(); + if (load_snapshot(name, NULL, false, NULL, &err)) { + load_snapshot_resume(saved_state); } + hmp_handle_error(mon, err); } =20 diff --git a/migration/savevm.c b/migration/savevm.c index 1b9ab7b8ee..74f915f3ac 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -3046,7 +3046,7 @@ bool save_snapshot(const char *name, bool overwrite, = const char *vmstate, QEMUSnapshotInfo sn1, *sn =3D &sn1; int ret =3D -1, ret2; QEMUFile *f; - int saved_vm_running; + RunState saved_state =3D runstate_get(); uint64_t vm_state_size; g_autoptr(GDateTime) now =3D g_date_time_new_now_local(); =20 @@ -3092,8 +3092,6 @@ bool save_snapshot(const char *name, bool overwrite, = const char *vmstate, return false; } =20 - saved_vm_running =3D runstate_is_running(); - global_state_store(); vm_stop(RUN_STATE_SAVE_VM); =20 @@ -3147,9 +3145,7 @@ bool save_snapshot(const char *name, bool overwrite, = const char *vmstate, the_end: bdrv_drain_all_end(); =20 - if (saved_vm_running) { - vm_start(); - } + vm_resume(saved_state); return ret =3D=3D 0; } =20 @@ -3317,6 +3313,14 @@ err_drain: return false; } =20 +void load_snapshot_resume(RunState state) +{ + vm_resume(state); + if (state =3D=3D RUN_STATE_RUNNING && runstate_get() =3D=3D RUN_STATE_= SUSPENDED) { + qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, &error_abort); + } +} + bool delete_snapshot(const char *name, bool has_devices, strList *devices, Error **errp) { @@ -3381,16 +3385,15 @@ static void snapshot_load_job_bh(void *opaque) { Job *job =3D opaque; SnapshotJob *s =3D container_of(job, SnapshotJob, common); - int orig_vm_running; + RunState orig_state =3D runstate_get(); =20 job_progress_set_remaining(&s->common, 1); =20 - orig_vm_running =3D runstate_is_running(); vm_stop(RUN_STATE_RESTORE_VM); =20 s->ret =3D load_snapshot(s->tag, s->vmstate, true, s->devices, s->errp= ); - if (s->ret && orig_vm_running) { - vm_start(); + if (s->ret) { + load_snapshot_resume(orig_state); } =20 job_progress_update(&s->common, 1); diff --git a/system/runstate.c b/system/runstate.c index e2fa2040cb..ca9eb54cde 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -77,6 +77,7 @@ typedef struct { =20 static const RunStateTransition runstate_transitions_def[] =3D { { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE }, + { RUN_STATE_PRELAUNCH, RUN_STATE_SUSPENDED }, =20 { RUN_STATE_DEBUG, RUN_STATE_RUNNING }, { RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE }, @@ -132,6 +133,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { =20 { RUN_STATE_RESTORE_VM, RUN_STATE_RUNNING }, { RUN_STATE_RESTORE_VM, RUN_STATE_PRELAUNCH }, + { RUN_STATE_RESTORE_VM, RUN_STATE_SUSPENDED }, =20 { RUN_STATE_COLO, RUN_STATE_RUNNING }, { RUN_STATE_COLO, RUN_STATE_PRELAUNCH }, @@ -150,6 +152,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_RUNNING, RUN_STATE_COLO}, =20 { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING }, + { RUN_STATE_SAVE_VM, RUN_STATE_SUSPENDED }, =20 { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED }, { RUN_STATE_SHUTDOWN, RUN_STATE_FINISH_MIGRATE }, @@ -163,6 +166,8 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_SUSPENDED, RUN_STATE_PRELAUNCH }, { RUN_STATE_SUSPENDED, RUN_STATE_COLO}, { RUN_STATE_SUSPENDED, RUN_STATE_PAUSED}, + { RUN_STATE_SUSPENDED, RUN_STATE_SAVE_VM }, + { RUN_STATE_SUSPENDED, RUN_STATE_RESTORE_VM }, =20 { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, diff --git a/system/vl.c b/system/vl.c index 6b87bfa32c..1eec5f627f 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2710,7 +2710,9 @@ void qmp_x_exit_preconfig(Error **errp) qemu_machine_creation_done(); =20 if (loadvm) { + RunState state =3D autostart ? RUN_STATE_RUNNING : runstate_get(); load_snapshot(loadvm, NULL, false, NULL, &error_fatal); + load_snapshot_resume(state); } if (replay_mode !=3D REPLAY_MODE_NONE) { replay_vmstate_init(); --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342930; cv=none; d=zohomail.com; s=zohoarc; b=JnBAxfOtUUN6/CB/foMyESMQQVBHlauAThIDj14gX0Qf51G2Fe/x70CMx9TlIjHOHF9gNc3VjLwUsRVbv+oC2tcgYkro6z/CfT4NuaYNUQThyuh0jNnz7zhRDfV6rfwDLOH/LobywU84tzIjFJt7Ql0DlzgfoanT01O2dl1C9kI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342930; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mSX1K1ZYkmrYy55DYaCkZV9xWroJ4YcrZo8x9PQDOP0=; b=JwyLDHMOlTFrRzBFU5DmUTfg65bPEOipohYzvtYPbe4LFAqEzSGcX+qfHJLryC+xDZgUjGwYM/owRqVtkBIZu/XvP1/cOclX7gEkThM/OP8zwOZvZEzzFK6MxU9WNCmmhWwyAO+8AvmZswxkt94e+79AIcjcYitHOTC2/GpzvN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342930823416.44259002004753; Wed, 3 Jan 2024 20:35:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFPz-0000k8-19; Wed, 03 Jan 2024 23:33:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPw-0000bD-GS for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFPu-0006cG-MD for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:16 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-412-27oSc5BAOOeE16mAB5ZPaw-1; Wed, 03 Jan 2024 23:33:09 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6270285A58A; Thu, 4 Jan 2024 04:33:09 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F94AC15E6A; Thu, 4 Jan 2024 04:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mSX1K1ZYkmrYy55DYaCkZV9xWroJ4YcrZo8x9PQDOP0=; b=FJigQHdS+AIr/SbVxrjftda7Gx9qBkgMNaI0mPdDghaunvdFx5ZJOsUlTO6EZISBgXW+Gp Y9Na9ocuLJcNXF3G/Eiei/43eycPHSmVxwx8U2FsWChGEzzAvhY+vbKZ2ngtGuv02iKlgt hb1ni4979OfUIppUx1WU1TSvX/JtY+I= X-MC-Unique: 27oSc5BAOOeE16mAB5ZPaw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 10/26] migration: preserve suspended for bg_migration Date: Thu, 4 Jan 2024 12:31:55 +0800 Message-ID: <20240104043213.431566-11-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342931962100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-9-git-send-email-steven.si= stare@oracle.com Signed-off-by: Peter Xu --- migration/migration.c | 7 +------ system/runstate.c | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 8124811045..2cc7e2a56c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3390,7 +3390,7 @@ static void bg_migration_vm_start_bh(void *opaque) qemu_bh_delete(s->vm_start_bh); s->vm_start_bh =3D NULL; =20 - vm_start(); + vm_resume(s->vm_old_state); migration_downtime_end(s); } =20 @@ -3462,11 +3462,6 @@ static void *bg_migration_thread(void *opaque) =20 qemu_mutex_lock_iothread(); =20 - /* - * If VM is currently in suspended state, then, to make a valid runsta= te - * transition in vm_stop_force_state() we need to wakeup it up. - */ - qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); s->vm_old_state =3D runstate_get(); =20 global_state_store(); diff --git a/system/runstate.c b/system/runstate.c index ca9eb54cde..621a023120 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -168,6 +168,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_SUSPENDED, RUN_STATE_PAUSED}, { RUN_STATE_SUSPENDED, RUN_STATE_SAVE_VM }, { RUN_STATE_SUSPENDED, RUN_STATE_RESTORE_VM }, + { RUN_STATE_SUSPENDED, RUN_STATE_SHUTDOWN }, =20 { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342998; cv=none; d=zohomail.com; s=zohoarc; b=Bnuux1DoxfT+T4IAQpYJSql/3Z3bSE39ooG9UK5bTtdW9LBNx7xd8qbQtkgLWfdK7gIZQAQhYNPLB4YnS4Efoo+uObgQos/MhRWg/ZqKIqp7/TeuRpVnY9mi3/5fXvBA8uXnXhfyA7wzeOncUDn6dy+mDhXXApZWovfoPY6l3qg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342998; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gNoIPqx89KwEEiI+qbI/WDuicixEzT9Crv1KraL+/p4=; b=ai0+ErMNbS/RwIue7xsX5EAo6mkVObE0jtwYi8NyWY7cgHfbGSnuOR/dpAYSc64LtQHDClkiocp7G7Us5DYcNJBdMb3A2zynkNfLjk/GAH9HMtYZ+QV21frGTRE3jhh7AjM0xbVPs8ziFYOJ/8y2R14lMibUqMLOqfr1tWn3ie4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342998165252.89433561646524; Wed, 3 Jan 2024 20:36:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQ4-0000zG-JM; Wed, 03 Jan 2024 23:33:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQ2-0000ob-S2 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQ0-0006cz-SD for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:22 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-XJDPvUa5Mn-0gPH-UJ5qNw-1; Wed, 03 Jan 2024 23:33:15 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 986B5185A780; Thu, 4 Jan 2024 04:33:14 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BA70C15968; Thu, 4 Jan 2024 04:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gNoIPqx89KwEEiI+qbI/WDuicixEzT9Crv1KraL+/p4=; b=fIwo62H/EWuPBtCEaaWlaYhty+OxNUtrXjeL3MvBOZUNB9KUCw/86CJHaenakDTI1v1iat eeyDCw/YI3DJSJ5CKKywhD25skT+d1nX7xavFLdiy4jEDwSuwpK6uPaO8/ngDkOarMZQpg HonaYoKIpxAOiMeAI/mlcXv/sMkCtQA= X-MC-Unique: XJDPvUa5Mn-0gPH-UJ5qNw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 11/26] tests/qtest: migration events Date: Thu, 4 Jan 2024 12:31:56 +0800 Message-ID: <20240104043213.431566-12-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704343000241100010 From: Steve Sistare Define a state object to capture events seen by migration tests, to allow more events to be captured in a subsequent patch, and simplify event checking in wait_for_migration_pass. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: "Daniel P. Berrang=C3=A9" Link: https://lore.kernel.org/r/1704312341-66640-10-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- tests/qtest/migration-helpers.h | 9 ++-- tests/qtest/migration-helpers.c | 22 +++----- tests/qtest/migration-test.c | 91 ++++++++++++++++----------------- 3 files changed, 55 insertions(+), 67 deletions(-) diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index e31dc85cc7..3d32699c45 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -15,9 +15,12 @@ =20 #include "libqtest.h" =20 -bool migrate_watch_for_stop(QTestState *who, const char *name, - QDict *event, void *opaque); -bool migrate_watch_for_resume(QTestState *who, const char *name, +typedef struct QTestMigrationState { + bool stop_seen; + bool resume_seen; +} QTestMigrationState; + +bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque); =20 G_GNUC_PRINTF(3, 4) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index 24fb7b3525..fd3b94efa2 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -24,26 +24,16 @@ */ #define MIGRATION_STATUS_WAIT_TIMEOUT 120 =20 -bool migrate_watch_for_stop(QTestState *who, const char *name, - QDict *event, void *opaque) +bool migrate_watch_for_events(QTestState *who, const char *name, + QDict *event, void *opaque) { - bool *seen =3D opaque; + QTestMigrationState *state =3D opaque; =20 if (g_str_equal(name, "STOP")) { - *seen =3D true; + state->stop_seen =3D true; return true; - } - - return false; -} - -bool migrate_watch_for_resume(QTestState *who, const char *name, - QDict *event, void *opaque) -{ - bool *seen =3D opaque; - - if (g_str_equal(name, "RESUME")) { - *seen =3D true; + } else if (g_str_equal(name, "RESUME")) { + state->resume_seen =3D true; return true; } =20 diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index d520c587f7..41fc837f36 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -43,8 +43,8 @@ unsigned start_address; unsigned end_address; static bool uffd_feature_thread_id; -static bool got_src_stop; -static bool got_dst_resume; +static QTestMigrationState src_state; +static QTestMigrationState dst_state; =20 /* * An initial 3 MB offset is used as that corresponds @@ -230,6 +230,20 @@ static void wait_for_serial(const char *side) } while (true); } =20 +static void wait_for_stop(QTestState *who, QTestMigrationState *state) +{ + if (!state->stop_seen) { + qtest_qmp_eventwait(who, "STOP"); + } +} + +static void wait_for_resume(QTestState *who, QTestMigrationState *state) +{ + if (!state->resume_seen) { + qtest_qmp_eventwait(who, "RESUME"); + } +} + /* * It's tricky to use qemu's migration event capability with qtest, * events suddenly appearing confuse the qmp()/hmp() responses. @@ -277,21 +291,19 @@ static void read_blocktime(QTestState *who) qobject_unref(rsp_return); } =20 +/* + * Wait for two changes in the migration pass count, but bail if we stop. + */ static void wait_for_migration_pass(QTestState *who) { - uint64_t initial_pass =3D get_migration_pass(who); - uint64_t pass; - - /* Wait for the 1st sync */ - while (!got_src_stop && !initial_pass) { - usleep(1000); - initial_pass =3D get_migration_pass(who); - } + uint64_t pass, prev_pass =3D 0, changes =3D 0; =20 - do { + while (changes < 2 && !src_state.stop_seen) { usleep(1000); pass =3D get_migration_pass(who); - } while (pass =3D=3D initial_pass && !got_src_stop); + changes +=3D (pass !=3D prev_pass); + prev_pass =3D pass; + } } =20 static void check_guests_ram(QTestState *who) @@ -617,10 +629,7 @@ static void migrate_postcopy_start(QTestState *from, Q= TestState *to) { qtest_qmp_assert_success(from, "{ 'execute': 'migrate-start-postcopy' = }"); =20 - if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); - } - + wait_for_stop(from, &src_state); qtest_qmp_eventwait(to, "RESUME"); } =20 @@ -756,8 +765,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, } } =20 - got_src_stop =3D false; - got_dst_resume =3D false; + dst_state =3D (QTestMigrationState) { }; + src_state =3D (QTestMigrationState) { }; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { memory_size =3D "150M"; =20 @@ -848,8 +857,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, if (!args->only_target) { *from =3D qtest_init_with_env(QEMU_ENV_SRC, cmd_source); qtest_qmp_set_event_callback(*from, - migrate_watch_for_stop, - &got_src_stop); + migrate_watch_for_events, + &src_state); } =20 cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " @@ -869,8 +878,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, ignore_stderr); *to =3D qtest_init_with_env(QEMU_ENV_DST, cmd_target); qtest_qmp_set_event_callback(*to, - migrate_watch_for_resume, - &got_dst_resume); + migrate_watch_for_events, + &dst_state); =20 /* * Remove shmem file immediately to avoid memory leak in test failed c= ase. @@ -1717,9 +1726,7 @@ static void test_precopy_common(MigrateCommon *args) */ if (args->result =3D=3D MIG_TEST_SUCCEED) { qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); - if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); - } + wait_for_stop(from, &src_state); migrate_ensure_converge(from); } } @@ -1765,9 +1772,8 @@ static void test_precopy_common(MigrateCommon *args) */ wait_for_migration_complete(from); =20 - if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); - } + wait_for_stop(from, &src_state); + } else { wait_for_migration_complete(from); /* @@ -1780,9 +1786,7 @@ static void test_precopy_common(MigrateCommon *args) qtest_qmp_assert_success(to, "{ 'execute' : 'cont'}"); } =20 - if (!got_dst_resume) { - qtest_qmp_eventwait(to, "RESUME"); - } + wait_for_resume(to, &dst_state); =20 wait_for_serial("dest_serial"); } @@ -1821,9 +1825,7 @@ static void test_file_common(MigrateCommon *args, boo= l stop_src) =20 if (stop_src) { qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); - if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); - } + wait_for_stop(from, &src_state); } =20 if (args->result =3D=3D MIG_TEST_QMP_ERROR) { @@ -1844,10 +1846,7 @@ static void test_file_common(MigrateCommon *args, bo= ol stop_src) if (stop_src) { qtest_qmp_assert_success(to, "{ 'execute' : 'cont'}"); } - - if (!got_dst_resume) { - qtest_qmp_eventwait(to, "RESUME"); - } + wait_for_resume(to, &dst_state); =20 wait_for_serial("dest_serial"); =20 @@ -1966,9 +1965,7 @@ static void test_ignore_shared(void) =20 migrate_wait_for_dirty_mem(from, to); =20 - if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); - } + wait_for_stop(from, &src_state); =20 qtest_qmp_eventwait(to, "RESUME"); =20 @@ -2503,7 +2500,7 @@ static void test_migrate_auto_converge(void) break; } usleep(20); - g_assert_false(got_src_stop); + g_assert_false(src_state.stop_seen); } while (true); /* The first percentage of throttling should be at least init_pct */ g_assert_cmpint(percentage, >=3D, init_pct); @@ -2842,9 +2839,7 @@ static void test_multifd_tcp_cancel(void) =20 migrate_ensure_converge(from); =20 - if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); - } + wait_for_stop(from, &src_state); qtest_qmp_eventwait(to2, "RESUME"); =20 wait_for_serial("dest_serial"); @@ -3177,7 +3172,7 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full =3D read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); usleep(100); - g_assert_false(got_src_stop); + g_assert_false(src_state.stop_seen); } =20 /* Now cancel migrate and wait for dirty limit throttle switch off */ @@ -3189,7 +3184,7 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full =3D read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); usleep(100); - g_assert_false(got_src_stop); + g_assert_false(src_state.stop_seen); } while (throttle_us_per_full !=3D 0 && --max_try_count); =20 /* Assert dirty limit is not in service */ @@ -3218,7 +3213,7 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full =3D read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); usleep(100); - g_assert_false(got_src_stop); + g_assert_false(src_state.stop_seen); } =20 /* --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704343016; cv=none; d=zohomail.com; s=zohoarc; b=ANvKahcdYbPyhRJw04pgToh6g7bjJeHaIxEGb2kdwcf/3dfbBL+CRAMNUDGwsiIS2A3S1NIDfWj+k05sLObjXwP4Q9OU/K01gZE4jfY9UorkHuW4cF1THarWmWe7IV4rdNZOhHASLdkHyXYlegpVSllU2ftgt3UxivHbSu8nwC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704343016; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gjBpUgwZoxalhlFoV5B9Sv8iXcXP+zznwx/LPMyYugs=; b=RxZKV5Kp9QR1svJEewpZlqeI36XgvGnR55lrlT/bnlFgMnRq16unG1+1LYiHKDRsaXVPq1HdHQr8aEgi85valAwJ2nXYYCTpGrlgwV0EZfISjlg0RDvfHba5T6SmJbDCcgneVZ/AATIN3ypGktVMpNaJu0J99RnFXWR4s6xmrEE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704343015994718.6491219707673; Wed, 3 Jan 2024 20:36:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQ8-0001Qu-J9; Wed, 03 Jan 2024 23:33:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQ6-0001B1-0F for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQ3-0006dO-QF for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:25 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-rillOv6rPKenQuCdMGtCCg-1; Wed, 03 Jan 2024 23:33:19 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6AFCB848C02; Thu, 4 Jan 2024 04:33:19 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4618FC15968; Thu, 4 Jan 2024 04:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gjBpUgwZoxalhlFoV5B9Sv8iXcXP+zznwx/LPMyYugs=; b=X8uRKvASBJKtK/9WD5DR4no+yy8ZgqPs426FEzbpUiw4Rs215WeBWAqSvaa7YIpH5dpo0J TGob5F+vI3EBPkkQVakNO72sp2jrgOlsEQP0WNr+UROIZwFzsyXsKLJwDBzyxIiV19FEc1 LEqGW9wfwSoHxPRotJIXyBuSScrryYI= X-MC-Unique: rillOv6rPKenQuCdMGtCCg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 12/26] tests/qtest: option to suspend during migration Date: Thu, 4 Jan 2024 12:31:57 +0800 Message-ID: <20240104043213.431566-13-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704343016288100009 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Add an option to suspend the src in a-b-bootblock.S, which puts the guest in S3 state after one round of writing to memory. The option is enabled by poking a 1 into the suspend_me word in the boot block prior to starting the src vm. Generate symbol offsets in a-b-bootblock.h so that the suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/1704312341-66640-11-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- tests/migration/i386/a-b-bootblock.h | 26 ++++++++++----- tests/qtest/migration-test.c | 12 +++++-- tests/migration/i386/Makefile | 5 +-- tests/migration/i386/a-b-bootblock.S | 50 ++++++++++++++++++++++++++-- 4 files changed, 77 insertions(+), 16 deletions(-) diff --git a/tests/migration/i386/a-b-bootblock.h b/tests/migration/i386/a-= b-bootblock.h index 5b523917ce..c83f8711db 100644 --- a/tests/migration/i386/a-b-bootblock.h +++ b/tests/migration/i386/a-b-bootblock.h @@ -4,7 +4,7 @@ * the header and the assembler differences in your patch submission. */ unsigned char x86_bootsect[] =3D { - 0xfa, 0x0f, 0x01, 0x16, 0x8c, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00, + 0xfa, 0x0f, 0x01, 0x16, 0xb8, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x20, 0x7c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x92, 0x0c, 0x02, 0xe6, 0x92, 0xb8, 0x10, 0x00, 0x00, 0x00, 0x8e, 0xd8, 0x66, 0xb8, 0x41, @@ -13,13 +13,13 @@ unsigned char x86_bootsect[] =3D { 0x40, 0x06, 0x7c, 0xf1, 0xb8, 0x00, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x40, 0x06, 0x7c, 0xf2, 0xfe, 0xc3, 0x80, 0xe3, 0x3f, 0x75, 0xe6, 0x66, 0xb8, 0x42, 0x00, 0x66, 0xba, - 0xf8, 0x03, 0xee, 0xeb, 0xdb, 0x8d, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0x27, 0x00, 0x74, 0x7c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf8, 0x03, 0xee, 0xa1, 0xbe, 0x7c, 0x00, 0x00, 0x83, 0xf8, 0x00, 0x74, + 0xd3, 0xb8, 0x04, 0x00, 0x10, 0x00, 0x8b, 0x00, 0x83, 0xf8, 0x01, 0x74, + 0xc7, 0xb0, 0xf1, 0xe6, 0xb2, 0xb8, 0x04, 0x00, 0x10, 0x00, 0xc7, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x66, 0xb8, 0x01, 0x24, 0x66, 0xba, 0x04, 0x06, + 0x66, 0xef, 0x66, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, + 0x00, 0x92, 0xcf, 0x00, 0x27, 0x00, 0xa0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -49,3 +49,13 @@ unsigned char x86_bootsect[] =3D { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa }; =20 +#define SYM_do_zero 0x00007c3d +#define SYM_gdt 0x00007ca0 +#define SYM_gdtdesc 0x00007cb8 +#define SYM_innerloop 0x00007c51 +#define SYM_mainloop 0x00007c4c +#define SYM_pre_zero 0x00007c38 +#define SYM_start 0x00007c00 +#define SYM_suspend_me 0x00007cbe +#define SYM_TEST_MEM_END 0x06400000 +#define SYM_TEST_MEM_START 0x00100000 diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 41fc837f36..2e2ab6af3c 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -133,7 +133,7 @@ static char *bootpath; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void bootfile_create(char *dir) +static void bootfile_create(char *dir, bool suspend_me) { const char *arch =3D qtest_get_arch(); unsigned char *content; @@ -143,6 +143,7 @@ static void bootfile_create(char *dir) if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { /* the assembled x86 boot sector should be exactly one sector larg= e */ g_assert(sizeof(x86_bootsect) =3D=3D 512); + x86_bootsect[SYM_suspend_me - SYM_start] =3D suspend_me; content =3D x86_bootsect; len =3D sizeof(x86_bootsect); } else if (g_str_equal(arch, "s390x")) { @@ -646,6 +647,8 @@ typedef struct { bool use_dirty_ring; const char *opts_source; const char *opts_target; + /* suspend the src before migrating to dest. */ + bool suspend_me; } MigrateStart; =20 /* @@ -767,6 +770,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, =20 dst_state =3D (QTestMigrationState) { }; src_state =3D (QTestMigrationState) { }; + bootfile_create(tmpfs, args->suspend_me); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { memory_size =3D "150M"; =20 @@ -2980,7 +2985,9 @@ static int64_t get_limit_rate(QTestState *who) static QTestState *dirtylimit_start_vm(void) { QTestState *vm =3D NULL; - g_autofree gchar * + g_autofree gchar *cmd =3D NULL; + + bootfile_create(tmpfs, false); cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " @@ -3329,7 +3336,6 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); - bootfile_create(tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 diff --git a/tests/migration/i386/Makefile b/tests/migration/i386/Makefile index 5c0324134a..37a72ae353 100644 --- a/tests/migration/i386/Makefile +++ b/tests/migration/i386/Makefile @@ -4,9 +4,10 @@ .PHONY: all clean all: a-b-bootblock.h =20 -a-b-bootblock.h: x86.bootsect +a-b-bootblock.h: x86.bootsect x86.o echo "$$__note" > header.tmp xxd -i $< | sed -e 's/.*int.*//' >> header.tmp + nm x86.o | awk '{print "#define SYM_"$$3" 0x"$$1}' >> header.tmp mv header.tmp $@ =20 x86.bootsect: x86.boot @@ -16,7 +17,7 @@ x86.boot: x86.o $(CROSS_PREFIX)objcopy -O binary $< $@ =20 x86.o: a-b-bootblock.S - $(CROSS_PREFIX)gcc -m32 -march=3Di486 -c $< -o $@ + $(CROSS_PREFIX)gcc -I.. -m32 -march=3Di486 -c $< -o $@ =20 clean: @rm -rf *.boot *.o *.bootsect diff --git a/tests/migration/i386/a-b-bootblock.S b/tests/migration/i386/a-= b-bootblock.S index 6bb9999d60..6f39eb6051 100644 --- a/tests/migration/i386/a-b-bootblock.S +++ b/tests/migration/i386/a-b-bootblock.S @@ -9,6 +9,23 @@ # # Author: dgilbert@redhat.com =20 +#include "migration-test.h" + +#define ACPI_ENABLE 0xf1 +#define ACPI_PORT_SMI_CMD 0xb2 +#define ACPI_PM_BASE 0x600 +#define PM1A_CNT_OFFSET 4 + +#define ACPI_SCI_ENABLE 0x0001 +#define ACPI_SLEEP_TYPE 0x0400 +#define ACPI_SLEEP_ENABLE 0x2000 +#define SLEEP (ACPI_SCI_ENABLE + ACPI_SLEEP_TYPE + ACPI_SLEEP_ENABLE) + +#define LOW_ADDR X86_TEST_MEM_START +#define HIGH_ADDR X86_TEST_MEM_END + +/* Save the suspended status at an address that is not written in the loop= . */ +#define suspended (X86_TEST_MEM_START + 4) =20 .code16 .org 0x7c00 @@ -35,8 +52,8 @@ start: # at 0x7c00 ? mov %eax,%ds =20 # Start from 1MB -.set TEST_MEM_START, (1024*1024) -.set TEST_MEM_END, (100*1024*1024) +.set TEST_MEM_START, X86_TEST_MEM_START +.set TEST_MEM_END, X86_TEST_MEM_END =20 mov $65,%ax mov $0x3f8,%dx @@ -69,7 +86,30 @@ innerloop: mov $0x3f8,%dx outb %al,%dx =20 - jmp mainloop + # should this test suspend? + mov (suspend_me),%eax + cmp $0,%eax + je mainloop + + # are we waking after suspend? do not suspend again. + mov $suspended,%eax + mov (%eax),%eax + cmp $1,%eax + je mainloop + + # enable acpi + mov $ACPI_ENABLE,%al + outb %al,$ACPI_PORT_SMI_CMD + + # suspend to ram + mov $suspended,%eax + movl $1,(%eax) + mov $SLEEP,%ax + mov $(ACPI_PM_BASE + PM1A_CNT_OFFSET),%dx + outw %ax,%dx + # not reached. The wakeup causes reset and restart at 0x7c00, and= we + # do not save and restore registers as a real kernel would do. + =20 # GDT magic from old (GPLv2) Grub startup.S .p2align 2 /* force 4-byte alignment */ @@ -95,6 +135,10 @@ gdtdesc: .word 0x27 /* limit */ .long gdt /* addr */ =20 + /* test launcher can poke a 1 here to exercise suspend */ +suspend_me: + .int 0 + /* I'm a bootable disk */ .org 0x7dfe .byte 0x55 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342987; cv=none; d=zohomail.com; s=zohoarc; b=ctoOR/GpUIVE4G5yYuJrrVZXFzw+Docxh8JC9olooZLyhzOXUTorf53FJCU5sGj+Ua86uIy2mJDh0kDEVO62hPzyFsJM0F8bAfQzOqncIg0HvhHm4p6GEsuqc6aA6R56ZbJlf8YBevrEhPLAbuFU7uL+nZzeKHPyseoaW0L7mVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342987; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9wo1amShqbR7nHhQ6whCPhB59mDEhZ8kFcQVY5uBXCI=; b=mE2UGvFk23Qd2tWlnFy6PFuH+S/gyk/ML6jPQfqXlZGTD5mEp1ijwjMzCB8+41D5JYdrFSnIxIKL8aKs8D8B3sFHX8mCtcY3M/5JXUn+6xQLIATl3jv6aIrxTJHrPPvocAhU7xBnVqL0tqUK0vypAELkCUUiXwAX74vNvp3Xtdc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342987409648.0742201554738; Wed, 3 Jan 2024 20:36:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQA-0001h3-Nj; Wed, 03 Jan 2024 23:33:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQ8-0001OA-0y for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQ6-0006da-2T for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:27 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-6JMG9sumPt2Wm-UzdSVX3w-1; Wed, 03 Jan 2024 23:33:24 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E647A280A9BB; Thu, 4 Jan 2024 04:33:23 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1853EC15968; Thu, 4 Jan 2024 04:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wo1amShqbR7nHhQ6whCPhB59mDEhZ8kFcQVY5uBXCI=; b=gjh5CTrbP2O/Ui1dl/C5sOhaVTq2Av/2x6xTveYUK+xqyGZOd8GYbjZ3tRdVLqccKhDmlu /438hjj30oGxLksRPRysIZWi7RpAM7+QURnAY1N0SnABiCtpE0sOeU9L7b06NOBqm+AWQn Pjj3bkbWcxby+xfllRHVQDH/A1cKmXs= X-MC-Unique: 6JMG9sumPt2Wm-UzdSVX3w-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 13/26] tests/qtest: precopy migration with suspend Date: Thu, 4 Jan 2024 12:31:58 +0800 Message-ID: <20240104043213.431566-14-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342988237100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-12-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- tests/qtest/migration-helpers.h | 2 ++ tests/qtest/migration-helpers.c | 3 ++ tests/qtest/migration-test.c | 62 +++++++++++++++++++++++++++++++-- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index 3d32699c45..b478549096 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -18,6 +18,8 @@ typedef struct QTestMigrationState { bool stop_seen; bool resume_seen; + bool suspend_seen; + bool suspend_me; } QTestMigrationState; =20 bool migrate_watch_for_events(QTestState *who, const char *name, diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index fd3b94efa2..37e8e812c5 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -32,6 +32,9 @@ bool migrate_watch_for_events(QTestState *who, const char= *name, if (g_str_equal(name, "STOP")) { state->stop_seen =3D true; return true; + } else if (g_str_equal(name, "SUSPEND")) { + state->suspend_seen =3D true; + return true; } else if (g_str_equal(name, "RESUME")) { state->resume_seen =3D true; return true; diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 2e2ab6af3c..a3bfbf2654 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -178,7 +178,7 @@ static void bootfile_delete(void) /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's - * but on the destination we won't have the A. + * but on the destination we won't have the A (unless we enabled suspend/r= esume) */ static void wait_for_serial(const char *side) { @@ -245,6 +245,13 @@ static void wait_for_resume(QTestState *who, QTestMigr= ationState *state) } } =20 +static void wait_for_suspend(QTestState *who, QTestMigrationState *state) +{ + if (state->suspend_me && !state->suspend_seen) { + qtest_qmp_eventwait(who, "SUSPEND"); + } +} + /* * It's tricky to use qemu's migration event capability with qtest, * events suddenly appearing confuse the qmp()/hmp() responses. @@ -299,7 +306,7 @@ static void wait_for_migration_pass(QTestState *who) { uint64_t pass, prev_pass =3D 0, changes =3D 0; =20 - while (changes < 2 && !src_state.stop_seen) { + while (changes < 2 && !src_state.stop_seen && !src_state.suspend_seen)= { usleep(1000); pass =3D get_migration_pass(who); changes +=3D (pass !=3D prev_pass); @@ -584,6 +591,12 @@ static void migrate_wait_for_dirty_mem(QTestState *fro= m, usleep(1000 * 10); } while (qtest_readq(to, marker_address) !=3D MAGIC_MARKER); =20 + + /* If suspended, src only iterates once, and watch_byte may never chan= ge */ + if (src_state.suspend_me) { + return; + } + /* * Now ensure that already transferred bytes are * dirty again from the guest workload. Note the @@ -771,6 +784,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, dst_state =3D (QTestMigrationState) { }; src_state =3D (QTestMigrationState) { }; bootfile_create(tmpfs, args->suspend_me); + src_state.suspend_me =3D args->suspend_me; =20 if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { memory_size =3D "150M"; @@ -1717,6 +1731,7 @@ static void test_precopy_common(MigrateCommon *args) /* Wait for the first serial output from the source */ if (args->result =3D=3D MIG_TEST_SUCCEED) { wait_for_serial("src_serial"); + wait_for_suspend(from, &src_state); } =20 if (args->live) { @@ -1793,6 +1808,11 @@ static void test_precopy_common(MigrateCommon *args) =20 wait_for_resume(to, &dst_state); =20 + if (args->start.suspend_me) { + /* wakeup succeeds only if guest is suspended */ + qtest_qmp_assert_success(to, "{'execute': 'system_wakeup'}"); + } + wait_for_serial("dest_serial"); } =20 @@ -1879,6 +1899,34 @@ static void test_precopy_unix_plain(void) test_precopy_common(&args); } =20 +static void test_precopy_unix_suspend_live(void) +{ + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateCommon args =3D { + .listen_uri =3D uri, + .connect_uri =3D uri, + /* + * despite being live, the test is fast because the src + * suspends immediately. + */ + .live =3D true, + .start.suspend_me =3D true, + }; + + test_precopy_common(&args); +} + +static void test_precopy_unix_suspend_notlive(void) +{ + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateCommon args =3D { + .listen_uri =3D uri, + .connect_uri =3D uri, + .start.suspend_me =3D true, + }; + + test_precopy_common(&args); +} =20 static void test_precopy_unix_dirty_ring(void) { @@ -3279,7 +3327,7 @@ static bool kvm_dirty_ring_supported(void) int main(int argc, char **argv) { bool has_kvm, has_tcg; - bool has_uffd; + bool has_uffd, is_x86; const char *arch; g_autoptr(GError) err =3D NULL; const char *qemu_src =3D getenv(QEMU_ENV_SRC); @@ -3309,6 +3357,7 @@ int main(int argc, char **argv) =20 has_uffd =3D ufd_version_check(); arch =3D qtest_get_arch(); + is_x86 =3D !strcmp(arch, "i386") || !strcmp(arch, "x86_64"); =20 /* * On ppc64, the test only works with kvm-hv, but not with kvm-pr and = TCG @@ -3339,6 +3388,13 @@ int main(int argc, char **argv) =20 module_call_init(MODULE_INIT_QOM); =20 + if (is_x86) { + qtest_add_func("/migration/precopy/unix/suspend/live", + test_precopy_unix_suspend_live); + qtest_add_func("/migration/precopy/unix/suspend/notlive", + test_precopy_unix_suspend_notlive); + } + if (has_uffd) { qtest_add_func("/migration/postcopy/plain", test_postcopy); qtest_add_func("/migration/postcopy/recovery/plain", --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342923; cv=none; d=zohomail.com; s=zohoarc; b=iw2g52zIiL75LQGyVw8+AeRLlT7BfJnBhsiJbWpG8OygGdAGMf38Maz5GK/zSMwzSB44e7Gc2c+Fz50CtmtitAqlKOWYfK0SpHg3Wz8RAa4dm8Il59hl/5ECFCdeWztnaNeiH3twISX9wjT+R9bGsqF+2meTwD2ffQS03BufsE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342923; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/fQPTKUjWUNYYWDBbQarw+AlYF3QAbLTeuopgvvg1pw=; b=UKvJ8GRKF2h0jnTN+D0WPc4zE8rNlR+QMu5iszW9aElu+gpcsW6tCCdBx2EBQI75+nIYWSrvoHiUBrTZDJ3i0meRyqL6/GFxVJ2hxlzkhjrONyopZZFcfBDDwOUcxecNt2tFnRficvFbGawnB3uHMAlKJEHTT3Apu/VLpGrFKo8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17043429232031007.3831692490409; Wed, 3 Jan 2024 20:35:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQE-00023K-BP; Wed, 03 Jan 2024 23:33:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQC-0001xt-Lk for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQB-0006eM-1G for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:32 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-648-suXgaplkMp6Gg4aJnvcOFg-1; Wed, 03 Jan 2024 23:33:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F3C4836F87; Thu, 4 Jan 2024 04:33:28 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFA47C15968; Thu, 4 Jan 2024 04:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/fQPTKUjWUNYYWDBbQarw+AlYF3QAbLTeuopgvvg1pw=; b=WDMHw6UlF6IMRHGhark0I/NmZ24bxkcZ39bOVdqrLwMkN2zJw8udbul8zrVZx4qY94oQpF GiaSJtcZZ3UlMhkS1ZD7H6mKaSzUmWAUcbYZekig+wVIaora+Egpl8Y6D2axm24PZ4rfKv Ypkh5siAWPYkfxIh1S9WdJnoEe7kl/g= X-MC-Unique: suXgaplkMp6Gg4aJnvcOFg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 14/26] tests/qtest: postcopy migration with suspend Date: Thu, 4 Jan 2024 12:31:59 +0800 Message-ID: <20240104043213.431566-15-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342923926100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Add a test case to verify that the suspended state is handled correctly by live migration postcopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/1704312341-66640-13-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- tests/qtest/migration-test.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index a3bfbf2654..136e5df06c 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1347,6 +1347,7 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); + wait_for_suspend(from, &src_state); =20 g_autofree char *uri =3D migrate_get_socket_address(to, "socket-addres= s"); migrate_qmp(from, uri, "{}"); @@ -1364,6 +1365,11 @@ static void migrate_postcopy_complete(QTestState *fr= om, QTestState *to, { wait_for_migration_complete(from); =20 + if (args->start.suspend_me) { + /* wakeup succeeds only if guest is suspended */ + qtest_qmp_assert_success(to, "{'execute': 'system_wakeup'}"); + } + /* Make sure we get at least one "B" on destination */ wait_for_serial("dest_serial"); =20 @@ -1397,6 +1403,15 @@ static void test_postcopy(void) test_postcopy_common(&args); } =20 +static void test_postcopy_suspend(void) +{ + MigrateCommon args =3D { + .start.suspend_me =3D true, + }; + + test_postcopy_common(&args); +} + static void test_postcopy_compress(void) { MigrateCommon args =3D { @@ -3412,7 +3427,10 @@ int main(int argc, char **argv) qtest_add_func("/migration/postcopy/recovery/double-failures", test_postcopy_recovery_double_fail); #endif /* _WIN32 */ - + if (is_x86) { + qtest_add_func("/migration/postcopy/suspend", + test_postcopy_suspend); + } } =20 qtest_add_func("/migration/bad_dest", test_baddest); --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342982; cv=none; d=zohomail.com; s=zohoarc; b=fHxrNDNaDs/uFTho1sNkYXISM68c+FsA04ylsGyBqaTgU7NAGkdpjiNJ+TT3Vqm2mWGk/DnpKCbhnMy4UURaaEvrDU6Ej7kryP+UjyvoZHm/VSZTlzbtZWWWyGz8NF/uzg573jXyVgDho2WGTOGnM0gbEbmrCl5xXjCUOUq6RD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342982; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f6dD/TMed/X7jmYABUeRfkONtrvV/Qb+PQJm110QTWc=; b=TFb8AyuusJ6k9IN37tw+VViZ2pKAd2I/UHiT/DDjaL1rzRIP76H6KnftYK/hDV2JkgW+tl3RsiLIG9sHJoWHEqkW8WURmtS2QfcBuAONKfFibaOe4i14Wsgv9HstipgQXWRrgiNt7NXtIi2aY1Wwx9H6yPmHdn6F/X3orYwnrvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342982687142.72610363646572; Wed, 3 Jan 2024 20:36:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQK-0002ap-Nn; Wed, 03 Jan 2024 23:33:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQJ-0002LE-3W for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQH-0006es-J2 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:38 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-xD047C_9MdKMaSw9jMZA5w-1; Wed, 03 Jan 2024 23:33:34 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3842848C0D; Thu, 4 Jan 2024 04:33:33 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E35FC159B0; Thu, 4 Jan 2024 04:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f6dD/TMed/X7jmYABUeRfkONtrvV/Qb+PQJm110QTWc=; b=Npn8mhSPCGAnVs4YpjM6VLY6eGXSZ95aRL9iOkjOr2fnD/GCZYaMeuu/sm7G6r29JhCb+W 8X+SiDHAyl0cd2oxcI+dDX38NZCaq0bnfWoka30JUcBpJDPh0ETIRGsPrAZdwjMR7JJO/P nt2YEbK6LGl6BGiUnD+UL62AYx3dUts= X-MC-Unique: xD047C_9MdKMaSw9jMZA5w-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 15/26] migration: Remove migrate_max_downtime() declaration Date: Thu, 4 Jan 2024 12:32:00 +0800 Message-ID: <20240104043213.431566-16-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342984167100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon migrate_max_downtime() has been removed long ago, but its declaration was mistakenly left. Remove it. Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-2-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/migration.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index cf2c9c88e0..b3c9288c38 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -480,8 +480,6 @@ void migration_incoming_process(void); =20 bool migration_has_all_channels(void); =20 -uint64_t migrate_max_downtime(void); - void migrate_set_error(MigrationState *s, const Error *error); bool migrate_has_error(MigrationState *s); =20 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342967; cv=none; d=zohomail.com; s=zohoarc; b=OSqSJ2UcR4rL9IYSzK7LCo4dP+bV2UXbyTilbjCUQzaMAgVQa8pI7MjHdyDW2Y0V6GWQ3zwArMp6UeF5tzV2z4mA3I3069bH8VJwdhhA7tZU0iDJkR2rZgqInhh14HN+LCMBRr6tQMxA620VPa01QVcdyvQTZ/y+Ou+FnV8edeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342967; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0IXyR77MmXg5DRcWNr3EtDy3UkylAedjUQHA89X8zeg=; b=Bb3Cf4TjiMV9h+yWrv4gGWB5yYof77e7OZVjYvG2dNZ1AZVpYB4qbu7qzkFwPyZPoYF2EnZbeOExKsl5eb5tiIEiVxBX1Zqkn2eM9/roV0DzJQXFbtT35iGCIzlUBF/HqBwSSFXKTSV3Vm/xbmX0NJWQlQwrpRmuoQ7GZBKL4oQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342967113441.0381794668141; Wed, 3 Jan 2024 20:36:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQb-0003uh-Fk; Wed, 03 Jan 2024 23:33:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQa-0003pV-4Y for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQN-0006fW-5Y for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:55 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-G-b7FH9QOiiEhTh3HcFUHQ-1; Wed, 03 Jan 2024 23:33:39 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E5F585A589; Thu, 4 Jan 2024 04:33:38 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7372FC15A0C; Thu, 4 Jan 2024 04:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0IXyR77MmXg5DRcWNr3EtDy3UkylAedjUQHA89X8zeg=; b=dV5lUerREPbPHdTy3QchqMScocboyAgLpRyRAD2wIKZy4IUUwDqozF4lLqZHhXdx2OpOeE caXX1wzGkX24Ro/hk7Y9WswQMUnLWZI1l0rEZ+M4HSu1FS3baME7eAMymWYOJRWWCr2ITd v5AKnJeFVYaGFdPc+8tCbQAbwEMWixY= X-MC-Unique: G-b7FH9QOiiEhTh3HcFUHQ-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 16/26] migration: Remove nulling of hostname in migrate_init() Date: Thu, 4 Jan 2024 12:32:01 +0800 Message-ID: <20240104043213.431566-17-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342968081100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon MigrationState->hostname is set to NULL in migrate_init(). This is redundant because it is already freed and set to NULL in migrade_fd_cleanup(). Remove it. Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-3-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/migration.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 2cc7e2a56c..15dc8aa21c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1588,7 +1588,6 @@ int migrate_init(MigrationState *s, Error **errp) s->migration_thread_running =3D false; error_free(s->error); s->error =3D NULL; - s->hostname =3D NULL; s->vmdesc =3D NULL; =20 migrate_set_state(&s->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_S= ETUP); --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342906; cv=none; d=zohomail.com; s=zohoarc; b=gtal8bAS/WAiy/ceVN2KqWmdtXC4OECgprvwXZnPcs2JlWwj1o/7XrKtxhHSeOo60V12wvkPHnfPorbwDO+fztL+xOcHi2YhXAF+IN/xRH1wF0o6elkfzRpZ5rgnhwoVzEM0mdCgl77d5akmp62jH/qM/Vb86TNe5yTOHSwMxBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342906; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Rnk2maPq+bSGItFG+Z0n+FGuFwgdzYVZMOX86HeQM6Q=; b=Plie+elVJM641PIrMpoe2k0h/V5+NHV3rp8I4YNz8hRpl5vOavk1oshNvaD5kI0Q8qWHs8ej4qL1EzlRdNbvdR4DhvnsGpKCWBucHooReqbVVVybjJYnP6l9W834tfDF2ZHul3xGTeYVlSjf5gReprGRHG6YYFWwHi1am+z+27g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342906819120.7342184268814; Wed, 3 Jan 2024 20:35:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQT-0003Iu-63; Wed, 03 Jan 2024 23:33:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQR-00037S-I4 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQP-0006fi-W9 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:47 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-346-s3SGKsMxPCeEfg4skg70xA-1; Wed, 03 Jan 2024 23:33:44 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AC1A23816D84; Thu, 4 Jan 2024 04:33:43 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E919C15968; Thu, 4 Jan 2024 04:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rnk2maPq+bSGItFG+Z0n+FGuFwgdzYVZMOX86HeQM6Q=; b=WTsygflArtvtYmeS5MRXrD+VL2aRyyuentOun4g4cZ62PMuUZj+a3bnFUd6zYEvtn4MLdC HFWuoT5RY42G7o0agUpc3SOuayRBWdEN/G5XCbfD5F7ChOHSJhBydw80+vatQKeYqC9xAy nBW5FIZGwCIjNqv9yWLV7y5rw44msyk= X-MC-Unique: s3SGKsMxPCeEfg4skg70xA-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 17/26] migration: Refactor migration_incoming_setup() Date: Thu, 4 Jan 2024 12:32:02 +0800 Message-ID: <20240104043213.431566-18-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342907881100001 From: Avihai Horon Commit 6720c2b32725 ("migration: check magic value for deciding the mapping of channels") extracted the only code that could fail in migration_incoming_setup(). Now migration_incoming_setup() can't fail, so refactor it to return void and remove errp parameter. Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20231231093016.14204-4-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/migration.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 15dc8aa21c..e7d342ab59 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -724,11 +724,8 @@ fail: /** * migration_incoming_setup: Setup incoming migration * @f: file for main migration channel - * @errp: where to put errors - * - * Returns: %true on success, %false on error. */ -static bool migration_incoming_setup(QEMUFile *f, Error **errp) +static void migration_incoming_setup(QEMUFile *f) { MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 @@ -736,7 +733,6 @@ static bool migration_incoming_setup(QEMUFile *f, Error= **errp) mis->from_src_file =3D f; } qemu_file_set_blocking(f, false); - return true; } =20 void migration_incoming_process(void) @@ -780,9 +776,7 @@ static bool postcopy_try_recover(void) =20 void migration_fd_process_incoming(QEMUFile *f, Error **errp) { - if (!migration_incoming_setup(f, errp)) { - return; - } + migration_incoming_setup(f); if (postcopy_try_recover()) { return; } @@ -855,10 +849,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, E= rror **errp) =20 if (default_channel) { f =3D qemu_file_new_input(ioc); - - if (!migration_incoming_setup(f, errp)) { - return; - } + migration_incoming_setup(f); } else { /* Multiple connections */ assert(migration_needs_multiple_sockets()); --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342992; cv=none; d=zohomail.com; s=zohoarc; b=llkiVK/C6kfgDaZxKxO3MxARiofZHnZZ3q8MCNe897sJOy2/BVTT3IrpU+Iud2oTo6zyOYri8GLYNOz6h+uva9xiZ+whVZ4en3hPIScT4JEzxHhmPX+2JPAnxGQQhn1nOIuIX/Q1YoEW0mZ4AjPha0BItzcUepu1pxyaFRES9N0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342992; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LdgknPaPIQRAT3aoK1JFpcg7tOfhi2KNrc0fRj1JKyE=; b=Bnqfo0fHiVWvRJs6VPCfchJk8Vi1mReK6BOjRbQXK6lVJfMpqwAvXhFO5f2QXoLG7+eXJwiOQrszSR48xUFIr2DpRPjbWokGjS0ZN3uxYdQoVzVfZM1gquVWuk/GmarXIc2z7dq+JzsYqLvi3qIOkHLNVmv7p38NymIQg/DJGtY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342992277142.6447541562236; Wed, 3 Jan 2024 20:36:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQf-00049j-4v; Wed, 03 Jan 2024 23:34:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQd-000451-BX for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQX-0006g8-0l for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:59 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-gtMyQl9kNZ-MY0aobIYGLg-1; Wed, 03 Jan 2024 23:33:49 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9673F848C02; Thu, 4 Jan 2024 04:33:48 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B93BC15968; Thu, 4 Jan 2024 04:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LdgknPaPIQRAT3aoK1JFpcg7tOfhi2KNrc0fRj1JKyE=; b=KAOlu5v4lULiZuLRMewNirEnv3wsUJcoB20nOtyQLC/Pr3R9XgLhNGIzppL483eUw0NTGJ b87RDOfBIet01VI79+lN4KYCWkNg3xR8lCrSznAd59qpDKWXwSnezwbK3qluM1EyRCgyo/ BZ4S2zr+RYW897tMxVhsQiDj611RtfQ= X-MC-Unique: gtMyQl9kNZ-MY0aobIYGLg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 18/26] migration: Remove errp parameter in migration_fd_process_incoming() Date: Thu, 4 Jan 2024 12:32:03 +0800 Message-ID: <20240104043213.431566-19-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342994172100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon Errp parameter in migration_fd_process_incoming() is unused. Remove it. Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-5-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/migration.h | 2 +- migration/migration.c | 2 +- migration/rdma.c | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index b3c9288c38..17972dac34 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -474,7 +474,7 @@ struct MigrationState { =20 void migrate_set_state(int *state, int old_state, int new_state); =20 -void migration_fd_process_incoming(QEMUFile *f, Error **errp); +void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); =20 diff --git a/migration/migration.c b/migration/migration.c index e7d342ab59..8bb1a8134e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -774,7 +774,7 @@ static bool postcopy_try_recover(void) return false; } =20 -void migration_fd_process_incoming(QEMUFile *f, Error **errp) +void migration_fd_process_incoming(QEMUFile *f) { migration_incoming_setup(f); if (postcopy_try_recover()) { diff --git a/migration/rdma.c b/migration/rdma.c index 04debab5d9..94c0f871f0 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4035,7 +4035,6 @@ static void rdma_accept_incoming_migration(void *opaq= ue) { RDMAContext *rdma =3D opaque; QEMUFile *f; - Error *local_err =3D NULL; =20 trace_qemu_rdma_accept_incoming_migration(); if (qemu_rdma_accept(rdma) < 0) { @@ -4057,10 +4056,7 @@ static void rdma_accept_incoming_migration(void *opa= que) } =20 rdma->migration_started_on_destination =3D 1; - migration_fd_process_incoming(f, &local_err); - if (local_err) { - error_reportf_err(local_err, "RDMA ERROR:"); - } + migration_fd_process_incoming(f); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342885; cv=none; d=zohomail.com; s=zohoarc; b=T462qerge8BOyz1pVH78kbWD3LiguhmtNgxuVcepx/yF5gF/0vb7eu8mPb8/U37fuqwY6I46P8j/tK2b/EvxOhj419ZqwNkBYwdL6TN3g2TXiObPCJHpbsCbZ3H51A8f+/sL5bm1Dzs8ubyaOtBNDwCdKTC5Gu5Y1F9uop4Z7vk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342885; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=us41yrcMcSdyWcpoeSxKL5eD1gEkbSmgYfU1tFzhJXs=; b=Gjoo6Rj+bWjuEZqoX627Uz20z/1nIVmBZwQO50AGH0nTcwXuVJ9bqoxcc+sCd7cB/sF9k2lp0ET3ctb4R6Qqq267Dje/EfWi4u6UeISFlZT8beEFKwiE6LOVkieIt/pw3+8q/kizUSAfPALAoCVBnbwWK42dXy5+flGTUagdvq4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342885566140.7271504260758; Wed, 3 Jan 2024 20:34:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQe-00049G-PY; Wed, 03 Jan 2024 23:34:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQd-00044r-9d for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQb-0006gf-Iv for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:33:58 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-mt6ALst1MPijeHRwD20fhQ-1; Wed, 03 Jan 2024 23:33:53 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3783B101A52A; Thu, 4 Jan 2024 04:33:53 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F70BC15968; Thu, 4 Jan 2024 04:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=us41yrcMcSdyWcpoeSxKL5eD1gEkbSmgYfU1tFzhJXs=; b=innJrWSCuY7BjxTLc3PxDLYXIyN9MFS8PP5boE9a2TWIpp3JvXT74rRqJZ5DghAJ8A+hW/ Vob9BEHwIWVbIkFdT/RAE1vxznHx3TNFR1f2rkd+HhmllrBWi2Fu8+li2dIRjzGJ61hDTT trIeRuZdEEdo70sB33fH6nq5e1BHwOQ= X-MC-Unique: mt6ALst1MPijeHRwD20fhQ-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 19/26] migration/multifd: Fix error message in multifd_recv_initial_packet() Date: Thu, 4 Jan 2024 12:32:04 +0800 Message-ID: <20240104043213.431566-20-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342887832100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon In multifd_recv_initial_packet(), if MultiFDInit_t->id is greater than the configured number of multifd channels, an irrelevant error message about multifd version is printed. Change the error message to a relevant one about the channel id. Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-6-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/multifd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 409460684f..a6204fc72f 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -228,8 +228,8 @@ static int multifd_recv_initial_packet(QIOChannel *c, E= rror **errp) } =20 if (msg.id > migrate_multifd_channels()) { - error_setg(errp, "multifd: received channel version %u " - "expected %u", msg.version, MULTIFD_VERSION); + error_setg(errp, "multifd: received channel id %u is greater than " + "number of channels %u", msg.id, migrate_multifd_channe= ls()); return -1; } =20 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342859; cv=none; d=zohomail.com; s=zohoarc; b=KQzTs+h6+SV9l2JVHAmxFaaSzX2WSklR65C0m0CsC9tABJiEParrt1m9zBvoy9s9vI890uJQ24LV3U7wshIgOxcPNfynpuBL5/bNxrFyPf+vU82qAubot92m3t/dJ4NXKT6eAW8MH7OiJbB4SfYZKYazeDGDOOGU/2wib1R7r2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342859; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mUcE0/zFGxgmCe2vjJ2VSUOvSJD3gtwfWIbs5TqOBCQ=; b=SgQBrbX+5FPOB7l2xSv295vl0bwN/IUbSQpnhTi0lc49ujuqPzqX/P5qGeo+k6MyOW0xL6f8I9HSjrRl70PWpwoHhV4b8S3eqoSIbl/vIQ07xTMY/VXzSVODrqRW9njV3nljE0EDpZf0HiYkVUBXpDy8St7qYKeTV+h/OC5M2Vk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342859263630.3482813375406; Wed, 3 Jan 2024 20:34:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQo-0004HM-Qg; Wed, 03 Jan 2024 23:34:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQk-0004GC-G3 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQi-0006ir-QL for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:06 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-AkmH26GpP-ylxP9bn9CDwQ-1; Wed, 03 Jan 2024 23:33:58 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 575803C025BB; Thu, 4 Jan 2024 04:33:58 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 076E0C15968; Thu, 4 Jan 2024 04:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mUcE0/zFGxgmCe2vjJ2VSUOvSJD3gtwfWIbs5TqOBCQ=; b=apUsX3yMcYDiFI2cxgyFB37phuy7SFPHMYnoxESGXUNOhsoeT2LrKURjeryCWDmgxIGVwH WewnEl8EEXtho56yeSEbGnbFxoWWQCYiDVbIzOsS6vYy+WRlVCqbWXxtxb5SVDZ853QJUJ b721k8ks9RBqrYs4+UsBI/o8UIbCy3E= X-MC-Unique: AkmH26GpP-ylxP9bn9CDwQ-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 20/26] migration/multifd: Simplify multifd_channel_connect() if else statement Date: Thu, 4 Jan 2024 12:32:05 +0800 Message-ID: <20240104043213.431566-21-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342859810100003 From: Avihai Horon The else branch in multifd_channel_connect() is redundant because when the if branch is taken the function returns. Simplify the code by removing the else branch. Signed-off-by: Avihai Horon Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20231231093016.14204-7-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/multifd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index a6204fc72f..55d5fd55f8 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -847,14 +847,13 @@ static bool multifd_channel_connect(MultiFDSendParams= *p, * so we mustn't call multifd_send_thread until then */ return multifd_tls_channel_connect(p, ioc, errp); - - } else { - migration_ioc_register_yank(ioc); - p->registered_yank =3D true; - p->c =3D ioc; - qemu_thread_create(&p->thread, p->name, multifd_send_thread, p, - QEMU_THREAD_JOINABLE); } + + migration_ioc_register_yank(ioc); + p->registered_yank =3D true; + p->c =3D ioc; + qemu_thread_create(&p->thread, p->name, multifd_send_thread, p, + QEMU_THREAD_JOINABLE); return true; } =20 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342996; cv=none; d=zohomail.com; s=zohoarc; b=a+Tlc8/A8rzsEH/Hr/eZRImqYNiF8JpMKuyUhggOLaay/yQKdLMd2yY+HhYlQgyF2OdQQuLpigdP8OqEehQNQ3vneDAZmP+9G9/uLe/OqOxchihNaY9E7NQWVVMhtkk8f+bkHrzbnRuiplg2YL822iFeUDnKooT/9JFgozu/u/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342996; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5aZuxJnrToxZ5DpnWuVDhfmW883sU+rGu7ymv+9ot6E=; b=bgvbzkQSOJJSsjGQk7I4l2SWQVTfUFu6HLrNBm5pg7uSFpOAfYsvBouoVq4U9Uxjdfk9Z2z5uKOQ6ETVEtDMrsZ+06FTU+0cGj1OB5BEdPntgTlvuRTgZfBPBlgFET8HnESIUaMJSv8VvO5TcpAQpE6su0GErRtZB2ZUZbZ4V38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342996464202.62447181976904; Wed, 3 Jan 2024 20:36:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQp-0004IA-Rz; Wed, 03 Jan 2024 23:34:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQm-0004Gh-Rv for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQl-0006jG-AL for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:08 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-UIa82VnpMSeDndPZ5jshaw-1; Wed, 03 Jan 2024 23:34:03 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EAA0848C03; Thu, 4 Jan 2024 04:34:03 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24B79C15968; Thu, 4 Jan 2024 04:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5aZuxJnrToxZ5DpnWuVDhfmW883sU+rGu7ymv+9ot6E=; b=eUG590kqFlILiStxN0yEK0a7TMqfhM3ACS7JzU8oIM7ZplROWyTAJrlj5HmhX89mHEXc3O jz/6StCcR4qX4ZHXXD+XDLlthMJN4O3CJjovTYAiDM/WnEgANpPNZlgXH3g7lGwvcROh/k BHwB1Q1wvVQ02w/EqfL9Rt232dorZjc= X-MC-Unique: UIa82VnpMSeDndPZ5jshaw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 21/26] migration/multifd: Fix leaking of Error in TLS error flow Date: Thu, 4 Jan 2024 12:32:06 +0800 Message-ID: <20240104043213.431566-22-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342998189100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon If there is an error in multifd TLS handshake task, multifd_tls_outgoing_handshake() retrieves the error with qio_task_propagate_error() but never frees it. Fix it by freeing the obtained Error. In addition, the error is not reported at all, so report it with migrate_set_error(). Fixes: 29647140157a ("migration/tls: add support for multifd tls-handshake") Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-8-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/multifd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index 55d5fd55f8..9ac24866ad 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -787,6 +787,7 @@ static void multifd_tls_outgoing_handshake(QIOTask *tas= k, =20 trace_multifd_tls_outgoing_handshake_error(ioc, error_get_pretty(err)); =20 + migrate_set_error(migrate_get_current(), err); /* * Error happen, mark multifd_send_thread status as 'quit' although it * is not created, and then tell who pay attention to me. @@ -794,6 +795,7 @@ static void multifd_tls_outgoing_handshake(QIOTask *tas= k, p->quit =3D true; qemu_sem_post(&multifd_send_state->channels_ready); qemu_sem_post(&p->sem_sync); + error_free(err); } =20 static void *multifd_tls_handshake_thread(void *opaque) --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342939; cv=none; d=zohomail.com; s=zohoarc; b=kKHc2175cHVGvw0Rgn3NYyTe4xlUngPP43xOvAC0Ig65oIspHnS/ncqNbCrXCpuUXYQBnhTp62c0vUWvqg2m2Gjz4d+rAfJ7RXUlnlTDM4Vss5wyL1pXC+M/eUi7YSuX+WSEBkWkZ1LxwQ4546APWuFpIzM+F4qDzmhqua37nCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342939; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pgPfvYyH9GUtQmjreG2FRloy8mQoBl7JfiFhYkJLhrg=; b=dGODqzY5aTFlyNdAX7zWkmnn7kx3fNyt7XlYQMmEsLY4wXxzY9BhBKevYYVw3ruJ32QXGucZU6PmwoPEqcM/7+FtkXXyWlOh/ATxqzwvYUrdPirrnQ9fWKRMFCboJCm0keZruOea1Nr0QILMZqBGE8fHzk3wjDsqm8wEr3RkWhM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342939183214.3055213368683; Wed, 3 Jan 2024 20:35:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFQq-0004J3-RJ; Wed, 03 Jan 2024 23:34:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQp-0004I6-MK for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQo-0006jX-29 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:11 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-osB_PlAtMkaMLOgUJ2SRDw-1; Wed, 03 Jan 2024 23:34:08 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2F9385A589; Thu, 4 Jan 2024 04:34:07 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id B904BC15A0C; Thu, 4 Jan 2024 04:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pgPfvYyH9GUtQmjreG2FRloy8mQoBl7JfiFhYkJLhrg=; b=dPHXwyl8JFC1xaBgSoQ3iG0gmccu0PzBrW4BhSL3IlVtuWMnFn/gPgUqFF3YNg7lsv2AfD dqeH2IsliH5lW6ccddt2syGZlMpd6HT6zi4FNSEi+UAMuZfJ6Pe/U0Qh0Hwr6wc+6+EZJ7 GnmxAMJFU1NVWhp/gFQc0tA4IFg63G8= X-MC-Unique: osB_PlAtMkaMLOgUJ2SRDw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 22/26] migration/multifd: Remove error_setg() in migration_ioc_process_incoming() Date: Thu, 4 Jan 2024 12:32:07 +0800 Message-ID: <20240104043213.431566-23-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342939986100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon If multifd_load_setup() fails in migration_ioc_process_incoming(), error_setg() is called with errp. This will lead to an assert because in that case errp already contains an error. Fix it by removing the redundant error_setg(). Fixes: 6720c2b32725 ("migration: check magic value for deciding the mapping= of channels") Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-9-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/migration.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 8bb1a8134e..9524c22a50 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -843,7 +843,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Er= ror **errp) } =20 if (multifd_load_setup(errp) !=3D 0) { - error_setg(errp, "Failed to setup multifd channels"); return; } =20 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342898; cv=none; d=zohomail.com; s=zohoarc; b=AFqHqsfjqrrgDvHRL/2wn8fJqHU5LauZcF/wVAg0/k8q0NpghCKD1R/O5YEPw6i3XDWxgJiAz/+Me1Ga1iDLCfbb5NlBfaDSSmmN+GLDgoY9PqrWSSup6FjDQLwV4WwuuLbgUQFKcHvwuRYcQ2qySPPy83E7Y+MFLWNwWFjvyoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342898; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=npgsv/Aqt/+Dln7YULjrFDqK7akW53zfrukoD4RwOAU=; b=gK+XJLLQdTDAKfzTRhfrabGmcexWJ/nsblddVe068khSY2w5GJ+L/GcBs7QwamLmidJudAr6wBfLKbBt1EHawpLQPXZ6/LiyHfYMIoa5tc5wKnWGL8nVneBdF60AuounWm2H1ldKXNcvJxqYoEmY7hOcg8kPTjtU4jzsTbKgHF8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342898824719.621190549939; Wed, 3 Jan 2024 20:34:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFRH-0004ry-T4; Wed, 03 Jan 2024 23:34:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQw-0004ew-SW for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQv-0006kK-81 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:18 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-327-7DFXF-ZYN-OuZTHSL7RvZw-1; Wed, 03 Jan 2024 23:34:13 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D947685A589; Thu, 4 Jan 2024 04:34:12 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 727C7C159B0; Thu, 4 Jan 2024 04:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=npgsv/Aqt/+Dln7YULjrFDqK7akW53zfrukoD4RwOAU=; b=dySepsfzUpqFYwKP/EVVxKiWsAksVUmF/iH1T93Uc0PIHbB8VVoz6XGAq9eAct74cGQZzO hGc2yawChqIrf++75X73gpnMaj77wYw5I8niwCdCsOXG6Pz9wclCrB/KPFYDPX0EeZV/tA hjavzDSLi5rykkCblWC5pwhbfUGKf54= X-MC-Unique: 7DFXF-ZYN-OuZTHSL7RvZw-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 23/26] migration: Fix migration_channel_read_peek() error path Date: Thu, 4 Jan 2024 12:32:08 +0800 Message-ID: <20240104043213.431566-24-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342899846100001 From: Avihai Horon migration_channel_read_peek() calls qio_channel_readv_full() and handles both cases of return value =3D=3D 0 and return value < 0 the same way, by calling error_setg() with errp. However, if return value < 0, errp is already set, so calling error_setg() with errp will lead to an assert. Fix it by handling these cases separately, calling error_setg() with errp only in return value =3D=3D 0 case. Fixes: 6720c2b32725 ("migration: check magic value for deciding the mapping= of channels") Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20231231093016.14204-10-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/channel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index ca3319a309..f9de064f3b 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -117,9 +117,12 @@ int migration_channel_read_peek(QIOChannel *ioc, len =3D qio_channel_readv_full(ioc, &iov, 1, NULL, NULL, QIO_CHANNEL_READ_FLAG_MSG_PEEK, errp); =20 - if (len <=3D 0 && len !=3D QIO_CHANNEL_ERR_BLOCK) { - error_setg(errp, - "Failed to peek at channel"); + if (len < 0 && len !=3D QIO_CHANNEL_ERR_BLOCK) { + return -1; + } + + if (len =3D=3D 0) { + error_setg(errp, "Failed to peek at channel"); return -1; } =20 --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342903; cv=none; d=zohomail.com; s=zohoarc; b=dFnhFxH49bN4zne9VjEsR8I9aFPpYbW+TW1VY5Hc2Lr9mcMpMgXAjFmteTL7aLRwJkPGnpU8OEVT5E/l4EFDuL7EzgThesnFOg5LpT4Fm3JfhiMfR8xGuRdPMiu3KJvukAfmE3ZmEwKHn7RTnjrSA83H5S9R7QQ8Dp3HlZbQlu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342903; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AIIkk4Ue2v4Wf9MQGpGUsHUucPOijO16PEsvA6ywQwk=; b=F5IKJdtOfSFi0PndaVakFxqF8jBPD53Svgc+2O8JOMpekwV971ViNxGnseVZes7BHb9bU1lHrJ7w97aqxbdRI4ykBTJpFq9VLUR0XvSjZ4/ogjh81CjIXIiN0+y31vks0+lf2bZhdnzzKnJLigliCXLzt9iu/JA9+kFCVS+je/c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17043429032318.196477146967368; Wed, 3 Jan 2024 20:35:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFRJ-000509-EJ; Wed, 03 Jan 2024 23:34:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFR2-0004jz-SL for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFQz-0006kg-LL for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:23 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-DG605HFVM3K-FkS8jw1uWg-1; Wed, 03 Jan 2024 23:34:17 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 80D0F29AA390; Thu, 4 Jan 2024 04:34:17 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8ECEC15A0C; Thu, 4 Jan 2024 04:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AIIkk4Ue2v4Wf9MQGpGUsHUucPOijO16PEsvA6ywQwk=; b=aLDpGRaQaTqJ3/AGyBQWBW0RZJS6s6VsOv0W0MOHLn9GIkVxBHvj6YMiOgA8GtCltUxZve K4kXOo6HL1sF9anaNvVs1meG5RZqtdMquTl+kWtqf/b7GfeNDBbZVz9HArp5QQYYf9iK3G 9tvT1EdLj7Ag4HEzTbsICenGgzvCq7Y= X-MC-Unique: DG605HFVM3K-FkS8jw1uWg-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon Subject: [PULL 24/26] migration: Remove unnecessary usage of local Error Date: Thu, 4 Jan 2024 12:32:09 +0800 Message-ID: <20240104043213.431566-25-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342903882100001 Content-Type: text/plain; charset="utf-8" From: Avihai Horon According to Error API, usage of ERRP_GUARD() or a local Error instead of errp is needed if errp is passed to void functions, where it is later dereferenced to see if an error occurred. There are several places in migration.c that use local Error although it is not needed. Change these places to use errp directly. Signed-off-by: Avihai Horon Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20231231093016.14204-11-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/migration.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9524c22a50..454cd4ec1f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -830,10 +830,9 @@ void migration_ioc_process_incoming(QIOChannel *ioc, E= rror **errp) * issue is not possible. */ ret =3D migration_channel_read_peek(ioc, (void *)&channel_magic, - sizeof(channel_magic), &local_er= r); + sizeof(channel_magic), errp); =20 if (ret !=3D 0) { - error_propagate(errp, local_err); return; } =20 @@ -1825,8 +1824,6 @@ bool migration_is_blocked(Error **errp) static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, bool resume, Error **errp) { - Error *local_err =3D NULL; - if (blk_inc) { warn_report("parameter 'inc' is deprecated;" " use blockdev-mirror with NBD instead"); @@ -1896,8 +1893,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, "current migration capabilities"); return false; } - if (!migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, true, &local_err)= ) { - error_propagate(errp, local_err); + if (!migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, true, errp)) { return false; } s->must_remove_block_options =3D true; --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704342955; cv=none; d=zohomail.com; s=zohoarc; b=jYQ3NcvnIIc68MskLLtUAjIaBLyuTRDXFT4v43pUz6LUV/iJ25igduS3DCbBzfj+WzP1bALO9A3WzOrdRXComEaJj9zby0Y+yTZFA9s2BEKuGkjXscYHgtWcSWkMs0og0gNt0yeFGKKONMzM1Br8UZlnRxR1XaGBNi3PZemDBb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704342955; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zQqNPtY1Kadk2AaZ4HNHSmHk4bJZRjD+6n3RMnyFLo4=; b=RsFX9sihQsqfvgeZehm+dJhmzDuQL0NZSI2Lzfth7XmubGsGFqi4szEg48wxRI323cpGz5TJQ8TvIdl0ooFnYke3Pq49W7dXBXaSIBdFmhDhI28PCOG3TfrZBk90sI0wGh8qCGc4zYVgh2kA2tL4nI7cKX53NnLIR7CR8eMjpRo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704342955702916.6043183767059; Wed, 3 Jan 2024 20:35:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFRJ-00050m-Lc; Wed, 03 Jan 2024 23:34:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFRA-0004nr-7z for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFR8-0006l3-If for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:31 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-152-7BCZJPXuMZeI1I8n5UOzOA-1; Wed, 03 Jan 2024 23:34:24 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E88A8101A555; Thu, 4 Jan 2024 04:34:22 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48DE6C159B0; Thu, 4 Jan 2024 04:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQqNPtY1Kadk2AaZ4HNHSmHk4bJZRjD+6n3RMnyFLo4=; b=IieF+bCqS7aOFGc1Lsz+Vvhes/79JOlkNCu/NoK9nc1N5kr3u9smloF3axsHbcof97czxM r5DFl+10OhtY3ezdMyT2S07/C7nP7cVMdapVhfQ9kdX98We1MqBVp2X4bkjqEX/jRTCH5v hftEOcWB3ytd/k8+4ZoUF8207RIvKpY= X-MC-Unique: 7BCZJPXuMZeI1I8n5UOzOA-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 25/26] migration/multifd: Remove unnecessary usage of local Error Date: Thu, 4 Jan 2024 12:32:10 +0800 Message-ID: <20240104043213.431566-26-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704342956071100001 From: Avihai Horon According to Error API, usage of ERRP_GUARD() or a local Error instead of errp is needed if errp is passed to void functions, where it is later dereferenced to see if an error occurred. There are several places in multifd.c that use local Error although it is not needed. Change these places to use errp directly. Signed-off-by: Avihai Horon Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20231231093016.14204-12-avihaih@nvidia.com Signed-off-by: Peter Xu --- migration/multifd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 9ac24866ad..9f353aecfa 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -951,12 +951,10 @@ int multifd_save_setup(Error **errp) =20 for (i =3D 0; i < thread_count; i++) { MultiFDSendParams *p =3D &multifd_send_state->params[i]; - Error *local_err =3D NULL; int ret; =20 - ret =3D multifd_send_state->ops->send_setup(p, &local_err); + ret =3D multifd_send_state->ops->send_setup(p, errp); if (ret) { - error_propagate(errp, local_err); return ret; } } @@ -1195,12 +1193,10 @@ int multifd_load_setup(Error **errp) =20 for (i =3D 0; i < thread_count; i++) { MultiFDRecvParams *p =3D &multifd_recv_state->params[i]; - Error *local_err =3D NULL; int ret; =20 - ret =3D multifd_recv_state->ops->recv_setup(p, &local_err); + ret =3D multifd_recv_state->ops->recv_setup(p, errp); if (ret) { - error_propagate(errp, local_err); return ret; } } --=20 2.41.0 From nobody Tue Nov 26 20:21:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1704343013; cv=none; d=zohomail.com; s=zohoarc; b=Ec2kaVGpK6hoR3dhzrx5s4DuHmGGJkRmzRjRTf+lVRVNFCUZ6/bWWx8n2ZT9XMvoIIYXlisv5g8xV6mA1Rlfo/lE7iGvKx4zKeaYVVLvAoBAIjtSUBaMqbHJZE9jKH7t/9tFcDTw+X82AUIv+bJsbp7Mio0lC3HUFwGB9bx3SJw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704343013; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PG5OczbzhFEeu/f0fXXcZOAN8vl5nmE+f4X8lWso424=; b=Fq8+mfFG66K9Vwhsc4nlrNaaBBqrObJ02dv5XJy+x8F3O9Cbb6RvnvR8aWDKGcJ3Yjiq1+uueA07DFJF9e1RnkiIHvpqNEnC+T+iw3Ysrr9Ylx70fnsOWp7En5QL4H+6xosIuFNuHKYSU6LLSHYLk78+fBsUYxcLWy2QL+4RaHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704343013156587.5495274203082; Wed, 3 Jan 2024 20:36:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLFRL-0005Cz-BE; Wed, 03 Jan 2024 23:34:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFRC-0004oE-9X for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLFRA-0006lY-K8 for qemu-devel@nongnu.org; Wed, 03 Jan 2024 23:34:34 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-xJuENRcjN3mjI5zDkp-PbA-1; Wed, 03 Jan 2024 23:34:28 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DD5F380673B; Thu, 4 Jan 2024 04:34:28 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1451C1596E; Thu, 4 Jan 2024 04:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704342871; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PG5OczbzhFEeu/f0fXXcZOAN8vl5nmE+f4X8lWso424=; b=h+IayVAk/J+ox+J+r91oJ4OjJMnhJREvkdcEKzaN9wenwLTPRqhX8JCv0KLjlU9GAgVAYQ UiQ/y7+Hfz4cIW90S7WoIXlVaZdD7nNsB5pQ2bN9NzLEWU01UAuZMtFjaP4i4UZrEVlUAh mDJ27Ov0c8AW4twu3Rt4EUxS72Ya9s0= X-MC-Unique: xJuENRcjN3mjI5zDkp-PbA-1 From: peterx@redhat.com To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Fabiano Rosas , Steve Sistare , Juan Quintela , peterx@redhat.com, Leonardo Bras Soares Passos , Avihai Horon , Peter Maydell Subject: [PULL 26/26] migration: fix coverity migrate_mode finding Date: Thu, 4 Jan 2024 12:32:11 +0800 Message-ID: <20240104043213.431566-27-peterx@redhat.com> In-Reply-To: <20240104043213.431566-1-peterx@redhat.com> References: <20240104043213.431566-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.601, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1704343014237100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Coverity diagnoses a possible out-of-range array index here ... static GSList *migration_blockers[MIG_MODE__MAX]; fill_source_migration_info() { GSList *cur_blocker =3D migration_blockers[migrate_mode()]; ... because it does not know that MIG_MODE__MAX will never be returned as a migration mode. To fix, assert so in migrate_mode(). Fixes: fa3673e497a1 ("migration: per-mode blockers") Reported-by: Peter Maydell Suggested-by: Peter Maydell Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/1699907025-215450-1-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- migration/options.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/options.c b/migration/options.c index 8d8ec73ad9..3e3e0b93b4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -833,8 +833,10 @@ uint64_t migrate_max_postcopy_bandwidth(void) MigMode migrate_mode(void) { MigrationState *s =3D migrate_get_current(); + MigMode mode =3D s->parameters.mode; =20 - return s->parameters.mode; + assert(mode >=3D 0 && mode < MIG_MODE__MAX); + return mode; } =20 int migrate_multifd_channels(void) --=20 2.41.0