From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567027; cv=none; d=zohomail.com; s=zohoarc; b=eXVJnDFGWxhYAj0eovzKPXvy/1nfXgCGOAPHbRomlRrfx1IUhpfR1XjosnXFKxCUtbe7Q6RZmG/B//ASEZCBqx8cs+OHgA05cQQUjzkR8XbsbvpmLvQgybkg95qclCETrnpePxOcI09f2zoQxYWuWEdOEkiUyxPIUTszURv27Nc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567027; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u4aEQFK/b1puWPkbGs5vLgQwxC6ukOLZfeqcPazgIpo=; b=JXWdn1LbowMP9SJufYnt0xplQdxwAWtHin2uWS+fmti/HqIWJs+zoxvDyHqzxlwfqoK8Ss7EGX9FC82QhW4JhdtyfmD+QJ+DD2zyruXsPV8CWe147WN0VTeUE/KomlbvfnxVzbJYTtC5OkA1Rilj+y8UylX0vfG/HBmGNd3uimw= 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+importer2=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 1650567027758285.1668705279569; Thu, 21 Apr 2022 11:50:27 -0700 (PDT) Received: from localhost ([::1]:54684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbso-0008PN-Oc for importer2@patchew.org; Thu, 21 Apr 2022 14:50:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjn-0001aR-QN for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbji-0005yB-Pq for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:05 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-541-0XQHbwXNNHijwklaJq7Mag-1; Thu, 21 Apr 2022 14:41:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 655C9800B28 for ; Thu, 21 Apr 2022 18:41:00 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CF454047D3E; Thu, 21 Apr 2022 18:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566462; 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=u4aEQFK/b1puWPkbGs5vLgQwxC6ukOLZfeqcPazgIpo=; b=ZXWvpM6AjE3wR4HtJv+gR2Mk2mn7VlQbI0q7RBrU5a23z7oNKoowH/EpGcJnJ2PoYi2bQ7 8Vqsmkj0D4AKGSU96fYUYVrT8oNa+LhjItuSB1By5vZC+41A7iCRF2UpJna9DZYiVW8qEg tAKgEVNPAyuzNrbmi57DpRkyvykZEs0= X-MC-Unique: 0XQHbwXNNHijwklaJq7Mag-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 01/18] tests: improve error message when saving TLS PSK file fails Date: Thu, 21 Apr 2022 19:40:35 +0100 Message-Id: <20220421184052.306581-2-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567028121100001 From: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Xu Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-3-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tests/unit/crypto-tls-psk-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/crypto-tls-psk-helpers.c b/tests/unit/crypto-tls-ps= k-helpers.c index 7f8a488961..4bea7c6fa2 100644 --- a/tests/unit/crypto-tls-psk-helpers.c +++ b/tests/unit/crypto-tls-psk-helpers.c @@ -30,7 +30,7 @@ void test_tls_psk_init(const char *pskfile) =20 fp =3D fopen(pskfile, "w"); if (fp =3D=3D NULL) { - g_critical("Failed to create pskfile %s", pskfile); + g_critical("Failed to create pskfile %s: %s", pskfile, strerror(er= rno)); abort(); } /* Don't do this in real applications! Use psktool. */ --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567332; cv=none; d=zohomail.com; s=zohoarc; b=n8qK6h8nWmGaOeCkrXMCrbRL2lG8EkxoiKchCbzOfrgyqmmeeRjsH9Smod/zHN4pb2Kqoa76+m7AYOqK/qsj3/3pHVxl9gou+ne8gUn4E/2gOAOv5iFROHaQrHKRKUAfnSf0Dk7pxKJRgC+EDT/gWZ+QxLCcorVGpN4iOoLZbHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567332; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0UNzeV9a1XgcZqW1koTGyy1goyW50r9ndD2isfYshXc=; b=oBFVrgn7nO7zhLVN+NboqW18cKomHfixpbkqmOSBRMuJ8u+ag4Asy7FpfnnFHh7/k3XxV7Uj10uQ8Bn9MIofrQpQlACV93hoqAmlkzGCxEGIU7dhh3FvGF2VjRmX1vFzpG+C2xx9GCfPn/xRPyBwll6lxq9bsFIQrCicv/m0las= 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+importer2=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 1650567332220597.6278459118407; Thu, 21 Apr 2022 11:55:32 -0700 (PDT) Received: from localhost ([::1]:41952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbxi-0002AY-RQ for importer2@patchew.org; Thu, 21 Apr 2022 14:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjp-0001cM-4h for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjj-0005yF-Dl for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-VNrvggZdNK-qqAfzDJcGYQ-1; Thu, 21 Apr 2022 14:41:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6388D85A5A8 for ; Thu, 21 Apr 2022 18:41:01 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FF2E40E80F5; Thu, 21 Apr 2022 18:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566462; 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=0UNzeV9a1XgcZqW1koTGyy1goyW50r9ndD2isfYshXc=; b=Q1GJN15Y0BTSQkEKmkptjPo8rMnV+ZrxBXfC/40eTP1ikfynW0zRclwBEgSp2GmFeniZ67 45goO9cD38C4510sADNJlct961ZZIkLx2FImBLpU4j/FTE9l1sT4wd5w984WYVmkqmSohz zNu8dyjoZ4k1BjIowVfbgkDEq1GUoQw= X-MC-Unique: VNrvggZdNK-qqAfzDJcGYQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 02/18] tests: support QTEST_TRACE env variable Date: Thu, 21 Apr 2022 19:40:36 +0100 Message-Id: <20220421184052.306581-3-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567333925100001 From: Daniel P. Berrang=C3=A9 When debugging failing qtests it is useful to be able to turn on trace output to stderr. The QTEST_TRACE env variable contents get injected as a '-trace ' command line arg Reviewed-by: Peter Xu Reviewed-by: Thomas Huth Reviewed-by: Juan Quintela Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-4-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/libqtest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 2b9bdb947d..7db7ef3a68 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -259,6 +259,9 @@ QTestState *qtest_init_without_qmp_handshake(const char= *extra_args) gchar *qmp_socket_path; gchar *command; const char *qemu_binary =3D qtest_qemu_binary(); + const char *trace =3D g_getenv("QTEST_TRACE"); + g_autofree char *tracearg =3D trace ? + g_strdup_printf("-trace %s ", trace) : g_strdup(""); =20 s =3D g_new(QTestState, 1); =20 @@ -281,14 +284,15 @@ QTestState *qtest_init_without_qmp_handshake(const ch= ar *extra_args) =20 qtest_add_abrt_handler(kill_qemu_hook_func, s); =20 - command =3D g_strdup_printf("exec %s " + command =3D g_strdup_printf("exec %s %s" "-qtest unix:%s " "-qtest-log %s " "-chardev socket,path=3D%s,id=3Dchar0 " "-mon chardev=3Dchar0,mode=3Dcontrol " "-display none " "%s" - " -accel qtest", qemu_binary, socket_path, + " -accel qtest", + qemu_binary, tracearg, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/nu= ll", qmp_socket_path, extra_args ?: ""); --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567145; cv=none; d=zohomail.com; s=zohoarc; b=c2d7zY3y80XJfoA8AfAeqGwo8pKn9JeQfhXOG1siprdAVWNRD8ZtUZ9SDszddsZhwDSONUDYtB2c1Ev+s8XnpbQEX0e/whKb7PmthMEjQ9vLLmIF7BxbKmXgNG8lTNtvAz0d05avVyQY/6Ivxr1MT/2iXWpYSLlNuJy/6mJYCyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567145; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RtzUAALxdpwBSP5lKSE4yAM/5cSvovGa0uBaAM/KCPg=; b=LjdVHAHsZTEojJck90jOfALMVwF92Iy3ajJOammw1h4lmINaY3VxgC5o6eys373n1B72HBLHDIWq5VvBFE4+uAnQ7bJ+URbc1dnIaVLFKKiC8Os/qAGPuH20qu+o/Ru+8rgF698bjazWdV4J+htyHacTejzGj2ArbN5pkHjLjVg= 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+importer2=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 1650567145280879.1074205285663; Thu, 21 Apr 2022 11:52:25 -0700 (PDT) Received: from localhost ([::1]:60804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbuh-0004KZ-T9 for importer2@patchew.org; Thu, 21 Apr 2022 14:52:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjo-0001ab-85 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjk-0005yM-Sd for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:06 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-f4op8XkZNFm-CzqKVZyPRA-1; Thu, 21 Apr 2022 14:41:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 626DF185A7A4 for ; Thu, 21 Apr 2022 18:41:02 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D8C440E80F5; Thu, 21 Apr 2022 18:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566464; 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=RtzUAALxdpwBSP5lKSE4yAM/5cSvovGa0uBaAM/KCPg=; b=eXj4kBAHy5VRye4FN0SbsoBiS3FK8aVKkB1dcHTn1+pir2msvnPRkms5wVajOX2fdSlU2E qKAyJahCo8yz9eHXVenNBvAib5jdLiq69ZkK4+tVUpmc0wGy735N93JrAbSgvGw1nJ5GCz yrgwojitBwW0Gh+Pg5S5kzYnR7U5rFg= X-MC-Unique: f4op8XkZNFm-CzqKVZyPRA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 03/18] tests: print newline after QMP response in qtest logs Date: Thu, 21 Apr 2022 19:40:37 +0100 Message-Id: <20220421184052.306581-4-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567146855100001 From: Daniel P. Berrang=C3=A9 The QMP commands have a trailing newline, but the response does not. This makes the qtest logs hard to follow as the next QMP command appears in the same line as the previous QMP response. Reviewed-by: Thomas Huth Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-5-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/libqtest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7db7ef3a68..5098d71485 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -612,10 +612,13 @@ QDict *qmp_fd_receive(int fd) } =20 if (log) { - len =3D write(2, &c, 1); + g_assert(write(2, &c, 1) =3D=3D 1); } json_message_parser_feed(&qmp.parser, &c, 1); } + if (log) { + g_assert(write(2, "\n", 1) =3D=3D 1); + } json_message_parser_destroy(&qmp.parser); =20 return qmp.response; --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567225; cv=none; d=zohomail.com; s=zohoarc; b=N1t3/iGFX8oPN39J42P2zix2vRdC3mvyE+Pje6ZlcVIFxt6WRxHyly6+ZpGbrSuSElfEJk9wXSifTwc6oPQTqYw1n5AXOvsT/4vPF5M0WfF3Sr4Syb7GB1njlsgpH10kjux0yEIOA6DA3me27lFen4qAlNB6/vbvb69drFGJ4nU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567225; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2AoNqAMq3lpq78IVxBhWTjPkTqZTFHUuUETthXV0Dus=; b=gNB1DOHdOH2ze5aEhPWXrtuT/puXhpdjDmDcaXTtK6lg7CHyAcQ5n8jOPm8+hTbdE9qXHO7fbqgaz9qS0hYyM3JrZFhf6B3GPSGi7fLtRhHBsWTfGvmvVKfmWBmQRzG5ZXlq/d46h9cliewZBI1Zsc/h3bHNutZan2orK36rfqk= 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+importer2=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 1650567225735203.0310404255938; Thu, 21 Apr 2022 11:53:45 -0700 (PDT) Received: from localhost ([::1]:35104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbw0-000616-Cj for importer2@patchew.org; Thu, 21 Apr 2022 14:53:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjp-0001cP-Uz for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjo-0005yj-DT for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:09 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-h8udsAtZPMq857uvUfFKkg-1; Thu, 21 Apr 2022 14:41:03 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61DF62808563 for ; Thu, 21 Apr 2022 18:41:03 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C29B40C1438; Thu, 21 Apr 2022 18:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566466; 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=2AoNqAMq3lpq78IVxBhWTjPkTqZTFHUuUETthXV0Dus=; b=EXUZPGwlXbI6fo9D1T6OpsQRzvfYGxvH0S8aabQlbhEfUVsHDfmKEfyF2ZFQL/MxDCZdV+ 3Gp5E8X7z3icMy6qh/1ZTcHkQBWyXAlDKhyAnJ52UnGSVzQeoTgBrzLp8Pa9V+3wXhDmiv 8R+0kJDLI02WPvtBq0p25WkkrJKK6lE= X-MC-Unique: h8udsAtZPMq857uvUfFKkg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 04/18] migration: fix use of TLS PSK credentials with a UNIX socket Date: Thu, 21 Apr 2022 19:40:38 +0100 Message-Id: <20220421184052.306581-5-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567227210100001 From: Daniel P. Berrang=C3=A9 The migration TLS code has a check mandating that a hostname be available when starting a TLS session. This is expected when using x509 credentials, but is bogus for PSK and anonymous credentials as neither involve hostname validation. The TLS crdentials object gained suitable error reporting in the case of TLS with x509 credentials, so there is no longer any need for the migration code to do its own (incorrect) validation. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-7-berrange@redhat.com> Reviewed-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- migration/tls.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/migration/tls.c b/migration/tls.c index ca1ea3bbdd..32c384a8b6 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -137,10 +137,6 @@ QIOChannelTLS *migration_tls_client_create(MigrationSt= ate *s, if (s->parameters.tls_hostname && *s->parameters.tls_hostname) { hostname =3D s->parameters.tls_hostname; } - if (!hostname) { - error_setg(errp, "No hostname available for TLS"); - return NULL; - } =20 tioc =3D qio_channel_tls_new_client( ioc, creds, hostname, errp); --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650566855; cv=none; d=zohomail.com; s=zohoarc; b=cHRHG5TOkn/IcoPhjw1cVNtstcts/Y4dMDmId+GdAWlMi4dlYE2J224wgr1KcaOi+quKjVtWXc7BRqnTuzeyN3UN6EPd+O5LDlepLXR0OScUc74r6JacrsF6IXV/S58t7yB0Q9NG0z2fruCj/SHR4QOZ0vlctuUgiwtlm2ZmSDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650566855; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oYjefRdsFi98UxVnXiGM7Xgzv42kxDHTqh2VH2uPv6I=; b=TjJrMKa7Vw+vae0xgsA+mKlfepCruJEiPZSjCTZRMMbxTghifCsKFry/sTQmGmTzVC9zXilgXaUJRfIlHSg7siRb6fiV35nrTDtC7H+xN+o0DsVpqmtDfOjNdXwkouFOfJtirOvXl5A6i6ksmXLhtFI2KgArBdGyF0XgpMZqCvg= 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+importer2=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 1650566855616300.61963930783236; Thu, 21 Apr 2022 11:47:35 -0700 (PDT) Received: from localhost ([::1]:45984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbq2-0002DL-I8 for importer2@patchew.org; Thu, 21 Apr 2022 14:47:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjo-0001cL-Cl for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjm-0005yT-Dy for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-390-bIXv1qvHNdCZdiFJ6K9U4w-1; Thu, 21 Apr 2022 14:41:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6607D811E81 for ; Thu, 21 Apr 2022 18:41:04 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EEB940D1B9A; Thu, 21 Apr 2022 18:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566465; 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=oYjefRdsFi98UxVnXiGM7Xgzv42kxDHTqh2VH2uPv6I=; b=UhADh/5IChDA+V2Kywy770OFP9kXl92rooUAGteRVAM1TZiFKC4HT5nUpRttWp+vvS5XfY fijNPgdN05YigtBSRHmfY4DQLvAf79WddgNOEMUtky0KrQelNEylXWGe7GmFtPYw9rtMGR GPILDxwJyZXpLhH4Wwbv5V4TEeWLXxI= X-MC-Unique: bIXv1qvHNdCZdiFJ6K9U4w-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 05/18] tests: switch MigrateStart struct to be stack allocated Date: Thu, 21 Apr 2022 19:40:39 +0100 Message-Id: <20220421184052.306581-6-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650566857274100003 From: Daniel P. Berrang=C3=A9 There's no compelling reason why the MigrateStart struct needs to be heap allocated. Using stack allocation and static initializers is simpler. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-8-berrange@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 134 +++++++++++++++-------------------- 1 file changed, 56 insertions(+), 78 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0870656d82..36e5408702 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -474,28 +474,12 @@ typedef struct { bool only_target; /* Use dirty ring if true; dirty logging otherwise */ bool use_dirty_ring; - char *opts_source; - char *opts_target; + const char *opts_source; + const char *opts_target; } MigrateStart; =20 -static MigrateStart *migrate_start_new(void) -{ - MigrateStart *args =3D g_new0(MigrateStart, 1); - - args->opts_source =3D g_strdup(""); - args->opts_target =3D g_strdup(""); - return args; -} - -static void migrate_start_destroy(MigrateStart *args) -{ - g_free(args->opts_source); - g_free(args->opts_target); - g_free(args); -} - static int test_migrate_start(QTestState **from, QTestState **to, - const char *uri, MigrateStart **pargs) + const char *uri, MigrateStart *args) { g_autofree gchar *arch_source =3D NULL; g_autofree gchar *arch_target =3D NULL; @@ -507,15 +491,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, g_autofree char *shmem_path =3D NULL; const char *arch =3D qtest_get_arch(); const char *machine_opts =3D NULL; - MigrateStart *args =3D *pargs; const char *memory_size; - int ret =3D 0; =20 if (args->use_shmem) { if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { g_test_skip("/dev/shm is not supported"); - ret =3D -1; - goto out; + return -1; } } =20 @@ -591,7 +572,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, - arch_source, shmem_opts, args->opts_sourc= e, + arch_source, shmem_opts, + args->opts_source ? args->opts_source : "= ", ignore_stderr); if (!args->only_target) { *from =3D qtest_init(cmd_source); @@ -609,7 +591,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_target, shmem_opts, - args->opts_target, ignore_stderr); + args->opts_target ? args->opts_target : "= ", + ignore_stderr); *to =3D qtest_init(cmd_target); =20 /* @@ -620,11 +603,7 @@ static int test_migrate_start(QTestState **from, QTest= State **to, unlink(shmem_path); } =20 -out: - migrate_start_destroy(args); - /* This tells the caller that this structure is gone */ - *pargs =3D NULL; - return ret; + return 0; } =20 static void test_migrate_end(QTestState *from, QTestState *to, bool test_d= est) @@ -668,7 +647,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, &args)) { + if (test_migrate_start(&from, &to, uri, args)) { return -1; } =20 @@ -712,10 +691,10 @@ static void migrate_postcopy_complete(QTestState *fro= m, QTestState *to) =20 static void test_postcopy(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D {}; QTestState *from, *to; =20 - if (migrate_postcopy_prepare(&from, &to, args)) { + if (migrate_postcopy_prepare(&from, &to, &args)) { return; } migrate_postcopy_start(from, to); @@ -724,13 +703,13 @@ static void test_postcopy(void) =20 static void test_postcopy_recovery(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .hide_stderr =3D true, + }; QTestState *from, *to; g_autofree char *uri =3D NULL; =20 - args->hide_stderr =3D true; - - if (migrate_postcopy_prepare(&from, &to, args)) { + if (migrate_postcopy_prepare(&from, &to, &args)) { return; } =20 @@ -786,11 +765,11 @@ static void test_postcopy_recovery(void) =20 static void test_baddest(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .hide_stderr =3D true + }; QTestState *from, *to; =20 - args->hide_stderr =3D true; - if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { return; } @@ -802,11 +781,11 @@ static void test_baddest(void) static void test_precopy_unix_common(bool dirty_ring) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .use_dirty_ring =3D dirty_ring, + }; QTestState *from, *to; =20 - args->use_dirty_ring =3D dirty_ring; - if (test_migrate_start(&from, &to, uri, &args)) { return; } @@ -892,7 +871,7 @@ static void test_ignore_shared(void) =20 static void test_xbzrle(const char *uri) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D {}; QTestState *from, *to; =20 if (test_migrate_start(&from, &to, uri, &args)) { @@ -945,7 +924,7 @@ static void test_xbzrle_unix(void) =20 static void test_precopy_tcp(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D {}; g_autofree char *uri =3D NULL; QTestState *from, *to; =20 @@ -987,7 +966,7 @@ static void test_precopy_tcp(void) =20 static void test_migrate_fd_proto(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D {}; QTestState *from, *to; int ret; int pair[2]; @@ -1074,7 +1053,7 @@ static void do_test_validate_uuid(MigrateStart *args,= bool should_fail) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, &args)) { + if (test_migrate_start(&from, &to, uri, args)) { return; } =20 @@ -1103,51 +1082,49 @@ static void do_test_validate_uuid(MigrateStart *arg= s, bool should_fail) =20 static void test_validate_uuid(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", + .opts_target =3D "-uuid 11111111-1111-1111-1111-111111111111", + }; =20 - g_free(args->opts_source); - g_free(args->opts_target); - args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); - args->opts_target =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); - do_test_validate_uuid(args, false); + do_test_validate_uuid(&args, false); } =20 static void test_validate_uuid_error(void) { - MigrateStart *args =3D migrate_start_new(); - - g_free(args->opts_source); - g_free(args->opts_target); - args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); - args->opts_target =3D g_strdup("-uuid 22222222-2222-2222-2222-22222222= 2222"); - args->hide_stderr =3D true; - do_test_validate_uuid(args, true); + MigrateStart args =3D { + .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", + .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", + .hide_stderr =3D true, + }; + + do_test_validate_uuid(&args, true); } =20 static void test_validate_uuid_src_not_set(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", + .hide_stderr =3D true, + }; =20 - g_free(args->opts_target); - args->opts_target =3D g_strdup("-uuid 22222222-2222-2222-2222-22222222= 2222"); - args->hide_stderr =3D true; - do_test_validate_uuid(args, false); + do_test_validate_uuid(&args, false); } =20 static void test_validate_uuid_dst_not_set(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", + .hide_stderr =3D true, + }; =20 - g_free(args->opts_source); - args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); - args->hide_stderr =3D true; - do_test_validate_uuid(args, false); + do_test_validate_uuid(&args, false); } =20 static void test_migrate_auto_converge(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D {}; QTestState *from, *to; int64_t remaining, percentage; =20 @@ -1230,7 +1207,7 @@ static void test_migrate_auto_converge(void) =20 static void test_multifd_tcp(const char *method) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D {}; QTestState *from, *to; QDict *rsp; g_autofree char *uri =3D NULL; @@ -1314,13 +1291,13 @@ static void test_multifd_tcp_zstd(void) */ static void test_multifd_tcp_cancel(void) { - MigrateStart *args =3D migrate_start_new(); + MigrateStart args =3D { + .hide_stderr =3D true, + }; QTestState *from, *to, *to2; QDict *rsp; g_autofree char *uri =3D NULL; =20 - args->hide_stderr =3D true; - if (test_migrate_start(&from, &to, "defer", &args)) { return; } @@ -1357,8 +1334,9 @@ static void test_multifd_tcp_cancel(void) =20 migrate_cancel(from); =20 - args =3D migrate_start_new(); - args->only_target =3D true; + args =3D (MigrateStart){ + .only_target =3D true, + }; =20 if (test_migrate_start(&from, &to2, "defer", &args)) { return; --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567057; cv=none; d=zohomail.com; s=zohoarc; b=Rx+8PoJ0267YBwKlyGwYLPQL1u4n5B7H+r0QvUNglEN5C1M+BbG3QbDUrK9uDFoTDUnSfIEp8xbkfSriGCYLGbzknweOtoHQCjTDLVZqwSw9QGiwpmF5q31tZx2xpn+iIkGkEBY2R+l5VbUL8QEeOykr7RqgVU9zkb8EOJSdMaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567057; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wlSZaUzoh9JQ9tUc4GoYHabSOHix6gUQiealBLtK/NE=; b=PWra6jpMDVKAitJu9DI8/IiAgXrbuK5oSYhyQ3+RdDh/WV1JGslA7mROfvbygKkzXVcmFk9A5oLcKgnkWTVEwRGMaXLVtLNnCxRm5SoDF8g10VAYGiS24tS1/e14nf71SaLPRSng1Wozu9sXmWwhrHGowBle/CeEry5amcnIiBE= 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+importer2=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 1650567057003874.25439850512; Thu, 21 Apr 2022 11:50:57 -0700 (PDT) Received: from localhost ([::1]:55790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbtH-0000il-7l for importer2@patchew.org; Thu, 21 Apr 2022 14:50:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjp-0001cN-6d for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58385) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjn-0005yp-EV for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-92-bHi-kh4jOoeO0mWPG8NLCg-1; Thu, 21 Apr 2022 14:41:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68FF0803C9F for ; Thu, 21 Apr 2022 18:41:05 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1F2F404D2F0; Thu, 21 Apr 2022 18:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566466; 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=wlSZaUzoh9JQ9tUc4GoYHabSOHix6gUQiealBLtK/NE=; b=DHW/3tXBNUmVQaS5zv/nWog212WVY5fgP7KCeG8U1wBGMb+N92lUcl2ssvKu8aUcmUHL8x JFumluj5i50J+CBqcxbhuE0KwCGDVJEP2XF65K/nXQpkQZpxQ7sKhtR8PzYZnAP9GDd4YY 5x7LrNKh0hfOraRXoKUg6pPMPoPiCHI= X-MC-Unique: bHi-kh4jOoeO0mWPG8NLCg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 06/18] tests: merge code for UNIX and TCP migration pre-copy tests Date: Thu, 21 Apr 2022 19:40:40 +0100 Message-Id: <20220421184052.306581-7-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567058340100001 From: Daniel P. Berrang=C3=A9 The test cases differ only in the URI they provide to the migration commands, and the ability to set the dirty_ring mode. This code is trivially merged into a common helper. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-9-berrange@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 98 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 36e5408702..b62869b3af 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -778,19 +778,32 @@ static void test_baddest(void) test_migrate_end(from, to, false); } =20 -static void test_precopy_unix_common(bool dirty_ring) +typedef struct { + /* Optional: fine tune start parameters */ + MigrateStart start; + + /* Required: the URI for the dst QEMU to listen on */ + const char *listen_uri; + + /* + * Optional: the URI for the src QEMU to connect to + * If NULL, then it will query the dst QEMU for its actual + * listening address and use that as the connect address. + * This allows for dynamically picking a free TCP port. + */ + const char *connect_uri; +} MigrateCommon; + +static void test_precopy_common(MigrateCommon *args) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateStart args =3D { - .use_dirty_ring =3D dirty_ring, - }; QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, &args)) { + if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } =20 - /* We want to pick a speed slow enough that the test completes + /* + * We want to pick a speed slow enough that the test completes * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. */ @@ -802,7 +815,14 @@ static void test_precopy_unix_common(bool dirty_ring) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + if (!args->connect_uri) { + g_autofree char *local_connect_uri =3D + migrate_get_socket_address(to, "socket-address"); + migrate_qmp(from, local_connect_uri, "{}"); + } else { + migrate_qmp(from, args->connect_uri, "{}"); + } + =20 wait_for_migration_pass(from); =20 @@ -822,14 +842,27 @@ static void test_precopy_unix_common(bool dirty_ring) =20 static void test_precopy_unix(void) { - /* Using default dirty logging */ - test_precopy_unix_common(false); + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateCommon args =3D { + .listen_uri =3D uri, + .connect_uri =3D uri, + }; + + test_precopy_common(&args); } =20 static void test_precopy_unix_dirty_ring(void) { - /* Using dirty ring tracking */ - test_precopy_unix_common(true); + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateCommon args =3D { + .start =3D { + .use_dirty_ring =3D true, + }, + .listen_uri =3D uri, + .connect_uri =3D uri, + }; + + test_precopy_common(&args); } =20 #if 0 @@ -924,44 +957,11 @@ static void test_xbzrle_unix(void) =20 static void test_precopy_tcp(void) { - MigrateStart args =3D {}; - g_autofree char *uri =3D NULL; - QTestState *from, *to; - - if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { - return; - } - - /* - * We want to pick a speed slow enough that the test completes - * quickly, but that it doesn't complete precopy even on a slow - * machine, so also set the downtime. - */ - /* 1 ms should make it not converge*/ - migrate_set_parameter_int(from, "downtime-limit", 1); - /* 1GB/s */ - migrate_set_parameter_int(from, "max-bandwidth", 1000000000); - - /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); - - uri =3D migrate_get_socket_address(to, "socket-address"); - - migrate_qmp(from, uri, "{}"); - - wait_for_migration_pass(from); - - migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); - - if (!got_stop) { - qtest_qmp_eventwait(from, "STOP"); - } - qtest_qmp_eventwait(to, "RESUME"); - - wait_for_serial("dest_serial"); - wait_for_migration_complete(from); + MigrateCommon args =3D { + .listen_uri =3D "tcp:127.0.0.1:0", + }; =20 - test_migrate_end(from, to, true); + test_precopy_common(&args); } =20 static void test_migrate_fd_proto(void) --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650566827; cv=none; d=zohomail.com; s=zohoarc; b=Pxck2fP6aRE3c0Dv2easT4nSXGUhNhOXS0f4VtCYJM7LyitKHB5wXycfBMPaiswtgYWiWM4b6wbgTkJLdQ60zEKDGVAv4eT99oAv3E2z+cID99qMxArO5WxGes4DzR9MlJ6UmpyNza5kWF9YEfzvtV9nygEenA3pGoi08yfFgM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650566827; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ShCUuI63/mt3wpxMNlFt0Jc5lH6COcup9Ii6XnVBldc=; b=WS2CVuC8L7FR2UCchafo46WTEwv2RUOCakAWikwae7vZsi1XxAGE7/Wn4Bxh6U8vuMFbtfoUybVXt09Z6hv9PWgialf5hnKGPExLycsPoUBaVtajkNHZ9Bfs2c4w+4PHSeMJWq+I6hkcSs8AW0VJ/c7+8Eb4aCVQEAV1j6W9lbE= 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+importer2=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 165056682717198.5694727025965; Thu, 21 Apr 2022 11:47:07 -0700 (PDT) Received: from localhost ([::1]:43636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbpa-0000bR-5l for importer2@patchew.org; Thu, 21 Apr 2022 14:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjp-0001cO-Pi for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjo-0005yy-8R for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-FK824TwCPx6MqJxMj7CuCA-1; Thu, 21 Apr 2022 14:41:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CB56811E78 for ; Thu, 21 Apr 2022 18:41:06 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B5540C1438; Thu, 21 Apr 2022 18:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566467; 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=ShCUuI63/mt3wpxMNlFt0Jc5lH6COcup9Ii6XnVBldc=; b=FK2t5V0w6DKGibZqH0fPBaxReJcAgeFWbKOL9n1VxUFCylSZCOTogFBIwZygBRcG1UG16Z 9h1rTHco+hmywz8gcw3IX0V8iu8oY+sn1GUvuN/xv3V3BPPzSQutJHjXF9msAEPFJYansh V69e5pMFClrnzZWFV3fqJ+5zyZdOHWI= X-MC-Unique: FK824TwCPx6MqJxMj7CuCA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 07/18] tests: introduce ability to provide hooks for migration precopy test Date: Thu, 21 Apr 2022 19:40:41 +0100 Message-Id: <20220421184052.306581-8-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650566829142100001 From: Daniel P. Berrang=C3=A9 There are alot of different scenarios to test with migration due to the wide number of parameters and capabilities available. To enable sharing of the basic precopy test scenario, we need to be able to set arbitrary parameters and capabilities before the migration is initiated, but don't want to have all this logic in the common helper function. Solve this by defining two hooks that can be provided by the test case, one before migration starts and one after migration finishes. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-10-berrange@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b62869b3af..ae40429798 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -778,6 +778,30 @@ static void test_baddest(void) test_migrate_end(from, to, false); } =20 +/* + * A hook that runs after the src and dst QEMUs have been + * created, but before the migration is started. This can + * be used to set migration parameters and capabilities. + * + * Returns: NULL, or a pointer to opaque state to be + * later passed to the TestMigrateFinishHook + */ +typedef void * (*TestMigrateStartHook)(QTestState *from, + QTestState *to); + +/* + * A hook that runs after the migration has finished, + * regardless of whether it succeeded or failed, but + * before QEMU has terminated (unless it self-terminated + * due to migration error) + * + * @opaque is a pointer to state previously returned + * by the TestMigrateStartHook if any, or NULL. + */ +typedef void (*TestMigrateFinishHook)(QTestState *from, + QTestState *to, + void *opaque); + typedef struct { /* Optional: fine tune start parameters */ MigrateStart start; @@ -792,11 +816,17 @@ typedef struct { * This allows for dynamically picking a free TCP port. */ const char *connect_uri; + + /* Optional: callback to run at start to set migration parameters */ + TestMigrateStartHook start_hook; + /* Optional: callback to run at finish to cleanup */ + TestMigrateFinishHook finish_hook; } MigrateCommon; =20 static void test_precopy_common(MigrateCommon *args) { QTestState *from, *to; + void *data_hook =3D NULL; =20 if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { return; @@ -812,6 +842,10 @@ static void test_precopy_common(MigrateCommon *args) /* 1GB/s */ migrate_set_parameter_int(from, "max-bandwidth", 1000000000); =20 + if (args->start_hook) { + data_hook =3D args->start_hook(from, to); + } + /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 @@ -837,6 +871,10 @@ static void test_precopy_common(MigrateCommon *args) wait_for_serial("dest_serial"); wait_for_migration_complete(from); =20 + if (args->finish_hook) { + args->finish_hook(from, to, data_hook); + } + test_migrate_end(from, to, true); } =20 --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650566965; cv=none; d=zohomail.com; s=zohoarc; b=lIxvYG5rwe8Wpl+6dvKNrC+A02IMEW4D25ofiy+WIUsKjPtYDw5sHyamwAx4TNHlIKyyCdmWjR1VFsg7w38OOAMlkB595GcYiG1zQJo9hO/xPRypjrDSIhdRtoDBLXElgvOJsjfbDYH0StX5qURGKCUK2uEMnruhZXXtvBhv5Hk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650566965; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FXXeq/F97wMpl3QZrWtox0qlKB/Ki3jgj0ftB3LfKfo=; b=aK1IqD8HX8ZsCeUsNIx54e4EE8OjEMGnc5PwvyjdOmcFOS3k/tqNfp3W3e0UGH84Dc2dv0eXy6f6XB6skaywjvOzDKLhERscvvU2Oq4r+VyRHwftYUw5vTjFcF3Ujb7vskJ60Ha1AlUrm1gci5ETdyomEaDfmpscXNWk5Jq9Os4= 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+importer2=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 1650566965701985.8351746141609; Thu, 21 Apr 2022 11:49:25 -0700 (PDT) Received: from localhost ([::1]:52182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbro-0006fM-K2 for importer2@patchew.org; Thu, 21 Apr 2022 14:49:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjr-0001cS-4g for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjp-0005zF-GF for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-vroabMdQONWSRIVtqZwhDg-1; Thu, 21 Apr 2022 14:41:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B2C829ABA2F for ; Thu, 21 Apr 2022 18:41:07 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A667540C1438; Thu, 21 Apr 2022 18:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566469; 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=FXXeq/F97wMpl3QZrWtox0qlKB/Ki3jgj0ftB3LfKfo=; b=jH47K7ROpGhLfwKk1zf6UNuZqeHCOYQ4F3ruq4ek0HvLAAQG97zMgU8rhgBbkMtqPyXGQ6 5NJtTUu67fwbqEnnObTDiof7vO6c8ES1hek99pxA6GyXCFzwZrIVA8s8ga6k5eyHOIwqE9 /OQKQUp5U+fpopgybpCPVNcWHJAK45Q= X-MC-Unique: vroabMdQONWSRIVtqZwhDg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 08/18] tests: switch migration FD passing test to use common precopy helper Date: Thu, 21 Apr 2022 19:40:42 +0100 Message-Id: <20220421184052.306581-9-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650566967845100001 From: Daniel P. Berrang=C3=A9 The combination of the start and finish hooks allow the FD passing code to use the precopy helper Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-11-berrange@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 57 +++++++++++++----------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index ae40429798..04f749aaa1 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1002,31 +1002,12 @@ static void test_precopy_tcp(void) test_precopy_common(&args); } =20 -static void test_migrate_fd_proto(void) +static void *test_migrate_fd_start_hook(QTestState *from, + QTestState *to) { - MigrateStart args =3D {}; - QTestState *from, *to; + QDict *rsp; int ret; int pair[2]; - QDict *rsp; - const char *error_desc; - - if (test_migrate_start(&from, &to, "defer", &args)) { - return; - } - - /* - * We want to pick a speed slow enough that the test completes - * quickly, but that it doesn't complete precopy even on a slow - * machine, so also set the downtime. - */ - /* 1 ms should make it not converge */ - migrate_set_parameter_int(from, "downtime-limit", 1); - /* 1GB/s */ - migrate_set_parameter_int(from, "max-bandwidth", 1000000000); - - /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); =20 /* Create two connected sockets for migration */ ret =3D socketpair(PF_LOCAL, SOCK_STREAM, 0, pair); @@ -1051,17 +1032,15 @@ static void test_migrate_fd_proto(void) qobject_unref(rsp); close(pair[1]); =20 - /* Start migration to the 2nd socket*/ - migrate_qmp(from, "fd:fd-mig", "{}"); - - wait_for_migration_pass(from); - - migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); + return NULL; +} =20 - if (!got_stop) { - qtest_qmp_eventwait(from, "STOP"); - } - qtest_qmp_eventwait(to, "RESUME"); +static void test_migrate_fd_finish_hook(QTestState *from, + QTestState *to, + void *opaque) +{ + QDict *rsp; + const char *error_desc; =20 /* Test closing fds */ /* We assume, that QEMU removes named fd from its list, @@ -1079,11 +1058,17 @@ static void test_migrate_fd_proto(void) error_desc =3D qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); g_assert_cmpstr(error_desc, =3D=3D, "File descriptor named 'fd-mig' no= t found"); qobject_unref(rsp); +} =20 - /* Complete migration */ - wait_for_serial("dest_serial"); - wait_for_migration_complete(from); - test_migrate_end(from, to, true); +static void test_migrate_fd_proto(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "defer", + .connect_uri =3D "fd:fd-mig", + .start_hook =3D test_migrate_fd_start_hook, + .finish_hook =3D test_migrate_fd_finish_hook + }; + test_precopy_common(&args); } =20 static void do_test_validate_uuid(MigrateStart *args, bool should_fail) --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567238; cv=none; d=zohomail.com; s=zohoarc; b=YVhNzZk9IVTKyDgEl/YRXP+0VdPU6x0kCQfC7aImz9FhX9tMZyTLhASqfkIq3rDWhKUqBYsArq0UkyzBSDX/lPTGGspKtxcw3qxOStsGrzPnIHPti+gI0PerG7XpqIypjnyAXws8mL+OvWh3KXEcAraV1ck3Spp2oePBRuVxcyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567238; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vtDZHV/9as3nKwr1dLZppHup5qfkwMfGr6pqHzzkvqI=; b=UfiePQp01cQsP/7LCGFSgqQlqpmSGdTYAZgwLvhtoGDR9muP8OM/TdThdFQFk1wt2IYFDy2zNfOLCNUaGHt1tdJMs1d7nI39ElmVR8ljIy6b4+ByA1jaC19amlk0RrEUVbaav+ats5i0VRjJ0EN1fmuVgCDPFC5J1i35WxEGK84= 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+importer2=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 1650567238838945.4722076298373; Thu, 21 Apr 2022 11:53:58 -0700 (PDT) Received: from localhost ([::1]:36190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbwD-0006kD-RF for importer2@patchew.org; Thu, 21 Apr 2022 14:53:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjt-0001eV-3H for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjq-0005zW-RO for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:12 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-112-gOy89NIbPCyPQcY1WKD3iQ-1; Thu, 21 Apr 2022 14:41:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D186101AA42 for ; Thu, 21 Apr 2022 18:41:08 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A61F540E80F5; Thu, 21 Apr 2022 18:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566470; 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=vtDZHV/9as3nKwr1dLZppHup5qfkwMfGr6pqHzzkvqI=; b=imKNaDXiho6DZ+xZL1qtiFClsC2NFsIiHkmPCex3KWYIJH3hztYbPtngIy5Ot0+l8eJqln RTcI/w9V2D/6fQbwjTAxVUNP2uoG/hbMeNO7VPVgatDSvEH0VVQrTe6dDI747GOsFDpLOm mrivMnu3vK7qPacSPWoxfsC4UM0JmXk= X-MC-Unique: gOy89NIbPCyPQcY1WKD3iQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 09/18] tests: expand the migration precopy helper to support failures Date: Thu, 21 Apr 2022 19:40:43 +0100 Message-Id: <20220421184052.306581-10-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567239470100001 From: Daniel P. Berrang=C3=A9 The migration precopy testing helper function always expects the migration to run to a completion state. There will be test scenarios for TLS where expect either the client or server to fail the migration. This expands the helper to cope with these scenarios. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220310171821.3724080-12-berrange@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 51 +++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 04f749aaa1..2af36c16a3 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -821,6 +821,30 @@ typedef struct { TestMigrateStartHook start_hook; /* Optional: callback to run at finish to cleanup */ TestMigrateFinishHook finish_hook; + + /* + * Optional: normally we expect the migration process to complete. + * + * There can be a variety of reasons and stages in which failure + * can happen during tests. + * + * If a failure is expected to happen at time of establishing + * the connection, then MIG_TEST_FAIL will indicate that the dst + * QEMU is expected to stay running and accept future migration + * connections. + * + * If a failure is expected to happen while processing the + * migration stream, then MIG_TEST_FAIL_DEST_QUIT_ERR will indicate + * that the dst QEMU is expected to quit with non-zero exit status + */ + enum { + /* This test should succeed, the default */ + MIG_TEST_SUCCEED =3D 0, + /* This test should fail, dest qemu should keep alive */ + MIG_TEST_FAIL, + /* This test should fail, dest qemu should fail with abnormal stat= us */ + MIG_TEST_FAIL_DEST_QUIT_ERR, + } result; } MigrateCommon; =20 static void test_precopy_common(MigrateCommon *args) @@ -858,24 +882,33 @@ static void test_precopy_common(MigrateCommon *args) } =20 =20 - wait_for_migration_pass(from); + if (args->result !=3D MIG_TEST_SUCCEED) { + bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; + wait_for_migration_fail(from, allow_active); =20 - migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); + if (args->result =3D=3D MIG_TEST_FAIL_DEST_QUIT_ERR) { + qtest_set_expected_status(to, 1); + } + } else { + wait_for_migration_pass(from); =20 - if (!got_stop) { - qtest_qmp_eventwait(from, "STOP"); - } + migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIM= E); =20 - qtest_qmp_eventwait(to, "RESUME"); + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } =20 - wait_for_serial("dest_serial"); - wait_for_migration_complete(from); + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + } =20 if (args->finish_hook) { args->finish_hook(from, to, data_hook); } =20 - test_migrate_end(from, to, true); + test_migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); } =20 static void test_precopy_unix(void) --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567300; cv=none; d=zohomail.com; s=zohoarc; b=fafCvrKQlkkIvJcGylj1e13rS5Xy2qUCX16oydVBmmpUtal0eVYGwsK4E/gjJOhI2ho6TKX8WI/SLiwtHW3dnCFOtN5vgNBPa21LyWu2YgPOnIg9S477RH89Ob0YmgK24mOKWSB1pgxmYcNGPqd8d3mb9vtjpcLzPGyhzE6Y26g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567300; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0gk5LRcuKuYvwai5NLh7dTzm4ismprPtiA8ZHZ3dYEc=; b=ZLXlT1yiyZtbFzNTr5kV9asXYYkZ4iYH4MyndUgA2GR+t4qAsNLOIqedQYJzPhaaqD28fmK2Blur0lCdUD8wuW9xTNv9BhLCIyDTBUehzqbFHgyQkLg7fvDU77eeEhyyahpB4fyqluU7MLtGdBqTvOYSgc7McvcwSDii/nAZ+40= 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+importer2=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 1650567300791363.5769470393476; Thu, 21 Apr 2022 11:55:00 -0700 (PDT) Received: from localhost ([::1]:40008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbxD-0000r2-DB for importer2@patchew.org; Thu, 21 Apr 2022 14:54:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjt-0001eW-EW for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjr-0005zg-Rr for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-KFvM36mpMqC75fo_BFApsA-1; Thu, 21 Apr 2022 14:41:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B1DB185A79C for ; Thu, 21 Apr 2022 18:41:09 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A702C40E8113; Thu, 21 Apr 2022 18:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566471; 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=0gk5LRcuKuYvwai5NLh7dTzm4ismprPtiA8ZHZ3dYEc=; b=d30L/C7GxgX69uCt8h106Dv4DBYvBzN6O3Qvp6/ibeLrMCxjYglPhnms1+3xhXGu0RxogM SBcgAL7SzBpb0ej9/ES49h8hvel1os7CkZbgKJBqjCdXqsQjAleEvZjHYUDDeCofBumw+V RiSw5+HH7Jeh9DnGBqWZkbCVeCWZytQ= X-MC-Unique: KFvM36mpMqC75fo_BFApsA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 10/18] migration: Postpone releasing MigrationState.hostname Date: Thu, 21 Apr 2022 19:40:44 +0100 Message-Id: <20220421184052.306581-11-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567301698100001 From: Peter Xu We used to release it right after migrate_fd_connect(). That's not good enough when there're more than one socket pair required, because it'll be needed to establish TLS connection for the rest channels. One example is multifd, where we copied over the hostname for each channel but that's actually not needed. Keeping the hostname until the cleanup phase of migration. Cc: Daniel P. Berrange Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-2-peterx@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert dgilbert: Fixup checkpatch error; don't need to check for NULL around g_free --- migration/channel.c | 1 - migration/migration.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/channel.c b/migration/channel.c index c4fc000a1a..c6a8dcf1d7 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -96,6 +96,5 @@ void migration_channel_connect(MigrationState *s, } } migrate_fd_connect(s, error); - g_free(s->hostname); error_free(error); } diff --git a/migration/migration.c b/migration/migration.c index 4dcb511bb6..3f61a08752 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1809,6 +1809,9 @@ static void migrate_fd_cleanup(MigrationState *s) qemu_bh_delete(s->cleanup_bh); s->cleanup_bh =3D NULL; =20 + g_free(s->hostname); + s->hostname =3D NULL; + qemu_savevm_state_cleanup(); =20 if (s->to_dst_file) { --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650566625; cv=none; d=zohomail.com; s=zohoarc; b=AIO5f1Dgtnlv6+PMNJm0eINb4haizksSdzKc+ABCjenCE7m49/bn3opsDA91TmpmbJu6IrfiZ5mp+RAELk2nBcezI0RrPPSrTCjTNPokLA2sn4g4R/0n+YMo/CZQ8C8YTc8BfMF6DQnNZc0ar/hdXbAYtMkr8Onl5QfqDdCShkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650566625; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UsAgmkYn4qnFiwWvE7fgO6WgOldiJGWTCZEXrnCrgMQ=; b=XDj3A6X/k+OsijbVrCtG6EbLBwvQiAdCjRhztxnv+neDSmBYxsffba2Hp6GWlIcS8YxxKKdRoIdNxmTjJAEyrFiq92M0xpCuoQTpVL9fTw0xtdpBe3TDU3czY/ABpyU2g8JYT9fGs7Lvu3NincRFqJEqxvebaSD8kcYTgQYlWjo= 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+importer2=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 1650566625016323.8207418668027; Thu, 21 Apr 2022 11:43:45 -0700 (PDT) Received: from localhost ([::1]:37400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbmK-0004Zh-22 for importer2@patchew.org; Thu, 21 Apr 2022 14:43:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbju-0001fW-HJ for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjs-0005zr-RY for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:14 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-uoqqCc5ANS-i58QS9lGtrQ-1; Thu, 21 Apr 2022 14:41:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B4FA3C1618B for ; Thu, 21 Apr 2022 18:41:10 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A71BB4047D3E; Thu, 21 Apr 2022 18:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566471; 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=UsAgmkYn4qnFiwWvE7fgO6WgOldiJGWTCZEXrnCrgMQ=; b=BDOZjMKDe5fLGPrBcm7XZtz1vtzRfDbVk1e05lw9RrGkgALoerKcPKB6sU0cbkgV0qaJtS ulXuzmzLdQInjvy6PfXt/i+TB6gqoTKdlwyILgX87i+71mxVE8poBvX9NZfjcPeUMC8ZAX hAQ0RLQCKsk0/jE/dxFXiDKMARlivgw= X-MC-Unique: uoqqCc5ANS-i58QS9lGtrQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 11/18] migration: Drop multifd tls_hostname cache Date: Thu, 21 Apr 2022 19:40:45 +0100 Message-Id: <20220421184052.306581-12-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650566626308100002 From: Peter Xu The hostname is cached N times, N equals to the multifd channels. Drop that cache because after previous patch we've got s->hostname being alive for the whole lifecycle of migration procedure. Cc: Juan Quintela Cc: Daniel P. Berrange Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-3-peterx@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/multifd.c | 10 +++------- migration/multifd.h | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 76b57a7177..1be4ab5d17 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -542,8 +542,6 @@ void multifd_save_cleanup(void) qemu_sem_destroy(&p->sem_sync); g_free(p->name); p->name =3D NULL; - g_free(p->tls_hostname); - p->tls_hostname =3D NULL; multifd_pages_clear(p->pages); p->pages =3D NULL; p->packet_len =3D 0; @@ -763,7 +761,7 @@ static void multifd_tls_channel_connect(MultiFDSendPara= ms *p, Error **errp) { MigrationState *s =3D migrate_get_current(); - const char *hostname =3D p->tls_hostname; + const char *hostname =3D s->hostname; QIOChannelTLS *tioc; =20 tioc =3D migration_tls_client_create(s, ioc, hostname, errp); @@ -787,7 +785,8 @@ static bool multifd_channel_connect(MultiFDSendParams *= p, MigrationState *s =3D migrate_get_current(); =20 trace_multifd_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), p->tls_hostname, error); + ioc, object_get_typename(OBJECT(ioc)), + migrate_get_current()->hostname, error); =20 if (!error) { if (s->parameters.tls_creds && @@ -874,7 +873,6 @@ int multifd_save_setup(Error **errp) int thread_count; uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); uint8_t i; - MigrationState *s; =20 if (!migrate_use_multifd()) { return 0; @@ -884,7 +882,6 @@ int multifd_save_setup(Error **errp) return -1; } =20 - s =3D migrate_get_current(); thread_count =3D migrate_multifd_channels(); multifd_send_state =3D g_malloc0(sizeof(*multifd_send_state)); multifd_send_state->params =3D g_new0(MultiFDSendParams, thread_count); @@ -909,7 +906,6 @@ int multifd_save_setup(Error **errp) p->packet->magic =3D cpu_to_be32(MULTIFD_MAGIC); p->packet->version =3D cpu_to_be32(MULTIFD_VERSION); p->name =3D g_strdup_printf("multifdsend_%d", i); - p->tls_hostname =3D g_strdup(s->hostname); /* We need one extra place for the packet header */ p->iov =3D g_new0(struct iovec, page_count + 1); p->normal =3D g_new0(ram_addr_t, page_count); diff --git a/migration/multifd.h b/migration/multifd.h index 4dda900a0b..3d577b98b7 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -72,8 +72,6 @@ typedef struct { uint8_t id; /* channel thread name */ char *name; - /* tls hostname */ - char *tls_hostname; /* channel thread id */ QemuThread thread; /* communication channel */ --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567441; cv=none; d=zohomail.com; s=zohoarc; b=OQZeysINbItcYLEmEb6gbhEebq0wRF1+SPxEtQXpiu7OYBuay+OeQbaRYv1obZod/BvJstKDcsYX+oMgY+4f8ZQVWUPgggWJCjcBsrX/LZ9CK/R/W8bHNjRFoC8hbHTohsnqCn9IY55Oeccql+rvCMu8SSB8BfUyAvGbSJHaPBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567441; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BKYop8sAAFoWP1QwSZtJ1gPDb1K+velWWJw8pd37awQ=; b=PkopjHoEQocfs35OIk+jvsNqPxES4GnpbRu5tebQX0D0ptfRUX33Chv/aOOlHBBJcd/g9IUIbkgJFnETSwtyQfU3Fo89mWMeYbRw+BIuGRDsWkSM3DyKvSlOoYAgfp/sNp504iL/nOvkdWmSitLf7A0jzfnA5Zc9OjXx6NDb1lQ= 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+importer2=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 1650567441252734.9974956127484; Thu, 21 Apr 2022 11:57:21 -0700 (PDT) Received: from localhost ([::1]:46662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbzU-0005PR-3o for importer2@patchew.org; Thu, 21 Apr 2022 14:57:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbju-0001gU-Sb for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59638) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjt-000601-Df for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:14 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-310-fyHaT4_wPsyKI3URYFXTpA-1; Thu, 21 Apr 2022 14:41:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 682A92A2AD4C for ; Thu, 21 Apr 2022 18:41:11 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A53C640E80F5; Thu, 21 Apr 2022 18:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566472; 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=BKYop8sAAFoWP1QwSZtJ1gPDb1K+velWWJw8pd37awQ=; b=ZEO1SB8MpL+kAxoNxhoE+kcBFXvWRnCc1AHh9qrjPSf4yjTeLmpNAC8H4Y3NGC+QxxOpvZ 0MdappkiiLJvHMNOCh816fD0tRGQsjI1VJh73UkNUHgYb4OP/YhA+GAVQKkbjocl8ghOiR pAAMwmg9V0I2+r8yOXSSxKfRQ6/PIvE= X-MC-Unique: fyHaT4_wPsyKI3URYFXTpA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 12/18] migration: Add pss.postcopy_requested status Date: Thu, 21 Apr 2022 19:40:46 +0100 Message-Id: <20220421184052.306581-13-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567442796100001 From: Peter Xu This boolean flag shows whether the current page during migration is trigge= red by postcopy or not. Then in ram_save_host_page() and deeper stack we'll be able to have a reference on the priority of this page. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-4-peterx@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 3532f64ecb..bfcd45a36e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -414,6 +414,8 @@ struct PageSearchStatus { unsigned long page; /* Set once we wrap around */ bool complete_round; + /* Whether current page is explicitly requested by postcopy */ + bool postcopy_requested; }; typedef struct PageSearchStatus PageSearchStatus; =20 @@ -1487,6 +1489,9 @@ retry: */ static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *ag= ain) { + /* This is not a postcopy requested page */ + pss->postcopy_requested =3D false; + pss->page =3D migration_bitmap_find_dirty(rs, pss->block, pss->page); if (pss->complete_round && pss->block =3D=3D rs->last_seen_block && pss->page >=3D rs->last_page) { @@ -1981,6 +1986,7 @@ static bool get_queued_page(RAMState *rs, PageSearchS= tatus *pss) * really rare. */ pss->complete_round =3D false; + pss->postcopy_requested =3D true; } =20 return !!block; --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567347; cv=none; d=zohomail.com; s=zohoarc; b=Fo0KEeqIakuxXdHid0AjsuRc9VMqTY75fhaps2EHIgcBDYA7bblnXnMgVmy3eXavGHF5K9JAvaaw135HnZ9Z8tXSbEVCHJF5rngicpWajPgNBNyH6lJAQWhKGaQYKrsKd63mkTL90YpwiZk6t9i5XTgQlJRM3DKEagw6mg6crFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567347; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VSJ+uVtjLpx0WolP/HLc4wS3V4GU312JhRq1aIQh6d8=; b=CAZkEeR50jU1haDzUNKP4vk730AUSKjBOQzlevXvvtH9XsIGREOqCHjkQlnEXZQFPlnOxqLlcZ5ygH40n1g6Om6lvTYbPam82i5kWzr84B8S12sAof5/2HnQcMSVLqeeM+9lOs0sSRq7SNzHdDExiu9gYjWtLsBDgTAcEtWR78A= 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+importer2=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 1650567347494832.0500565488937; Thu, 21 Apr 2022 11:55:47 -0700 (PDT) Received: from localhost ([::1]:42680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbxy-0002fT-0S for importer2@patchew.org; Thu, 21 Apr 2022 14:55:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjw-0001ir-LB for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbju-00061P-Rp for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-6hS_u-adNie5bx3vvCmtKg-1; Thu, 21 Apr 2022 14:41:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D577803B22 for ; Thu, 21 Apr 2022 18:41:12 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3968404D2EE; Thu, 21 Apr 2022 18:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566474; 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=VSJ+uVtjLpx0WolP/HLc4wS3V4GU312JhRq1aIQh6d8=; b=M0yPyKJDJpg2U2X01kBoa5bO0QvsBhLIHuMgkysprfMHtIBFtooFXrENZFnazz99p9vstM mRWj8VOTYIyG7V5aR3G1sqCJTUWCHD/1YVJFWLm4jmfGkEKd4VwwpZKIpzxbkmTGR9UKuY gmW4El905VhI0ZXruXLYFdRcaexKAwM= X-MC-Unique: 6hS_u-adNie5bx3vvCmtKg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 13/18] migration: Move migrate_allow_multifd and helpers into migration.c Date: Thu, 21 Apr 2022 19:40:47 +0100 Message-Id: <20220421184052.306581-14-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567347995100001 From: Peter Xu This variable, along with its helpers, is used to detect whether multiple channel will be supported for migration. In follow up patches, there'll be other capability that requires multi-channels. Hence move it outside multi= fd specific code and make it public. Meanwhile rename it from "multifd" to "multi_channels" to show its real meaning. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-5-peterx@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 22 +++++++++++++++++----- migration/migration.h | 3 +++ migration/multifd.c | 19 ++++--------------- migration/multifd.h | 2 -- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3f61a08752..d86fb0c332 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -180,6 +180,18 @@ static int migration_maybe_pause(MigrationState *s, int new_state); static void migrate_fd_cancel(MigrationState *s); =20 +static bool migrate_allow_multi_channels =3D true; + +void migrate_protocol_allow_multi_channels(bool allow) +{ + migrate_allow_multi_channels =3D allow; +} + +bool migrate_multi_channels_is_allowed(void) +{ + return migrate_allow_multi_channels; +} + static gint page_request_addr_cmp(gconstpointer ap, gconstpointer bp) { uintptr_t a =3D (uintptr_t) ap, b =3D (uintptr_t) bp; @@ -469,12 +481,12 @@ static void qemu_start_incoming_migration(const char = *uri, Error **errp) { const char *p =3D NULL; =20 - migrate_protocol_allow_multifd(false); /* reset it anyway */ + migrate_protocol_allow_multi_channels(false); /* reset it anyway */ qapi_event_send_migration(MIGRATION_STATUS_SETUP); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || strstart(uri, "vsock:", NULL)) { - migrate_protocol_allow_multifd(true); + migrate_protocol_allow_multi_channels(true); socket_start_incoming_migration(p ? p : uri, errp); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { @@ -1261,7 +1273,7 @@ static bool migrate_caps_check(bool *cap_list, =20 /* incoming side only */ if (runstate_check(RUN_STATE_INMIGRATE) && - !migrate_multifd_is_allowed() && + !migrate_multi_channels_is_allowed() && cap_list[MIGRATION_CAPABILITY_MULTIFD]) { error_setg(errp, "multifd is not supported by current protocol"); return false; @@ -2322,11 +2334,11 @@ void qmp_migrate(const char *uri, bool has_blk, boo= l blk, } } =20 - migrate_protocol_allow_multifd(false); + migrate_protocol_allow_multi_channels(false); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || strstart(uri, "vsock:", NULL)) { - migrate_protocol_allow_multifd(true); + migrate_protocol_allow_multi_channels(true); socket_start_outgoing_migration(s, p ? p : uri, &local_err); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { diff --git a/migration/migration.h b/migration/migration.h index 2de861df01..f17ccc657c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -430,4 +430,7 @@ void migration_cancel(const Error *error); void populate_vfio_info(MigrationInfo *info); void postcopy_temp_page_reset(PostcopyTmpPage *tmp_page); =20 +bool migrate_multi_channels_is_allowed(void); +void migrate_protocol_allow_multi_channels(bool allow); + #endif diff --git a/migration/multifd.c b/migration/multifd.c index 1be4ab5d17..9ea4f581e2 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -517,7 +517,7 @@ void multifd_save_cleanup(void) { int i; =20 - if (!migrate_use_multifd() || !migrate_multifd_is_allowed()) { + if (!migrate_use_multifd() || !migrate_multi_channels_is_allowed()) { return; } multifd_send_terminate_threads(NULL); @@ -857,17 +857,6 @@ cleanup: multifd_new_send_channel_cleanup(p, sioc, local_err); } =20 -static bool migrate_allow_multifd =3D true; -void migrate_protocol_allow_multifd(bool allow) -{ - migrate_allow_multifd =3D allow; -} - -bool migrate_multifd_is_allowed(void) -{ - return migrate_allow_multifd; -} - int multifd_save_setup(Error **errp) { int thread_count; @@ -877,7 +866,7 @@ int multifd_save_setup(Error **errp) if (!migrate_use_multifd()) { return 0; } - if (!migrate_multifd_is_allowed()) { + if (!migrate_multi_channels_is_allowed()) { error_setg(errp, "multifd is not supported by current protocol"); return -1; } @@ -976,7 +965,7 @@ int multifd_load_cleanup(Error **errp) { int i; =20 - if (!migrate_use_multifd() || !migrate_multifd_is_allowed()) { + if (!migrate_use_multifd() || !migrate_multi_channels_is_allowed()) { return 0; } multifd_recv_terminate_threads(NULL); @@ -1125,7 +1114,7 @@ int multifd_load_setup(Error **errp) if (!migrate_use_multifd()) { return 0; } - if (!migrate_multifd_is_allowed()) { + if (!migrate_multi_channels_is_allowed()) { error_setg(errp, "multifd is not supported by current protocol"); return -1; } diff --git a/migration/multifd.h b/migration/multifd.h index 3d577b98b7..7d0effcb03 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -13,8 +13,6 @@ #ifndef QEMU_MIGRATION_MULTIFD_H #define QEMU_MIGRATION_MULTIFD_H =20 -bool migrate_multifd_is_allowed(void); -void migrate_protocol_allow_multifd(bool allow); int multifd_save_setup(Error **errp); void multifd_save_cleanup(void); int multifd_load_setup(Error **errp); --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650566854; cv=none; d=zohomail.com; s=zohoarc; b=e3vlUws96fPXe693S6JTcVUNF5ysF2n9L3sDzynSP8e4kBDEIxAkwtTCVrhFCYIU6SG5DKKA+sqgMbpnIUKNyGBgeIVqGuEXq0fhZ0KKXSL64vG0rV0EuGFZA0tem3PQPs5msLjNl5Lo4k7fzeLGhXHl6lBuu8sEc9P7kK+msMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650566854; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FEcnVTzWMhm0+Xw0yIxa7ZhMR0gWt6kEvFB9S3UTdSo=; b=Rwz+MrnjrupbQwkSK5IKxKzuGeim//QaF51Vi+/DTU+NJzEOsKijPqejdHGAuEqqrJHmUQR3MUiXwN2m4B7aCg6M/xs92Y0rNwfj1hmR+036jOemfBcCorK7aZ15z7XDcKJYdSKrVYk9mQB1RKXgIwsfWTY3LyJu5rrWBopCeus= 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+importer2=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 1650566854603292.78865422046374; Thu, 21 Apr 2022 11:47:34 -0700 (PDT) Received: from localhost ([::1]:45956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbq1-0002CL-LF for importer2@patchew.org; Thu, 21 Apr 2022 14:47:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjw-0001is-TP for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:48507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjv-00061g-EM for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-253-CleElC4TPa-rxbbxD5JvzA-1; Thu, 21 Apr 2022 14:41:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70807801E67 for ; Thu, 21 Apr 2022 18:41:13 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8620404D2EE; Thu, 21 Apr 2022 18:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566474; 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=FEcnVTzWMhm0+Xw0yIxa7ZhMR0gWt6kEvFB9S3UTdSo=; b=YdSPr2o0rFqPjRpy3gTDQsnIW+03iBe2lK9NdIPk3kr/SmQLZVYZiZzpnhv2ruZMnHawkZ DK8m2CEyATh22u98SCX+tgZlroYlAQTuNukIB+SYq0GeYpRokH9Fr1PS9r9NY0Sjguljvb OUA4rgi00SZT9mUweNAGf+05+pgqDDs= X-MC-Unique: CleElC4TPa-rxbbxD5JvzA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 14/18] migration: Export ram_load_postcopy() Date: Thu, 21 Apr 2022 19:40:48 +0100 Message-Id: <20220421184052.306581-15-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650566855301100001 From: Peter Xu Will be reused in postcopy fast load thread. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-6-peterx@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 2 +- migration/ram.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index bfcd45a36e..253fe4b756 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3645,7 +3645,7 @@ int ram_postcopy_incoming_init(MigrationIncomingState= *mis) * * @f: QEMUFile where to send the data */ -static int ram_load_postcopy(QEMUFile *f) +int ram_load_postcopy(QEMUFile *f) { int flags =3D 0, ret =3D 0; bool place_needed =3D false; diff --git a/migration/ram.h b/migration/ram.h index 2c6dc3675d..ded0a3a086 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -61,6 +61,7 @@ void ram_postcopy_send_discard_bitmap(MigrationState *ms); /* For incoming postcopy discard */ int ram_discard_range(const char *block_name, uint64_t start, size_t lengt= h); int ram_postcopy_incoming_init(MigrationIncomingState *mis); +int ram_load_postcopy(QEMUFile *f); =20 void ram_handle_compressed(void *host, uint8_t ch, uint64_t size); =20 --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567587; cv=none; d=zohomail.com; s=zohoarc; b=G/0CSb340LLyNj9h/IcijPSfyZjlic9LcXwuPLEhP8pXP6EmxjtJCtQSaBVdy+jsd4F2K9deRwKwp29Vh5oFfc8CMlsE+5JlbUOaRiIP1SSqf5viebDLSyHLrhHXL8YnW/rEqCpTfx2NCtJx+FJ93/sYAHzfNFoQ6ShgWdpEIVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567587; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q2MnMv4++ybw7wlp6m3cJtrIBaSPkE3FfCE8orcS37s=; b=oGfCNBGSYA65NKTIn9R5duiLx0BswrjPTEzJwA7xfeO2tiwxXVAOS9SoUa9xMSX5iRLa//FnjxWQcit+nLa7LEnLPLstkIenPTBJA43sHZvyEdveO/s9UPBlt0jbJtQK0axSaIOFDU8ksCk8wui3coVv4HS1p3psiwV+qdht97I= 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+importer2=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 165056758780740.407540756935646; Thu, 21 Apr 2022 11:59:47 -0700 (PDT) Received: from localhost ([::1]:53674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhc1q-0001s2-RQ for importer2@patchew.org; Thu, 21 Apr 2022 14:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjy-0001ks-8M for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjw-00061s-ID for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:17 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-AYoGvcv3ND642lzsptclMg-1; Thu, 21 Apr 2022 14:41:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 707901C07382 for ; Thu, 21 Apr 2022 18:41:14 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA0FF40C1438; Thu, 21 Apr 2022 18:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566475; 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=q2MnMv4++ybw7wlp6m3cJtrIBaSPkE3FfCE8orcS37s=; b=P7+ICh7NbuNcHKMgpNznbGZkH/Qk1FWJDI0Tc/fG80ofACgotbKErV5I0tOXSXlARbD+BN Yvdzuq4hnPyDg89zjIvf4DbXRNYGp9cfyw+uCNmJtAP2dnI6oBFi+ovrJRu5f2RapW5Aos IzwZa9wXC+a7XzomnKzIgAWWySWm16U= X-MC-Unique: AYoGvcv3ND642lzsptclMg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 15/18] migration: Move channel setup out of postcopy_try_recover() Date: Thu, 21 Apr 2022 19:40:49 +0100 Message-Id: <20220421184052.306581-16-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567589636100001 From: Peter Xu We used to use postcopy_try_recover() to replace migration_incoming_setup()= to setup incoming channels. That's fine for the old world, but in the new wor= ld there can be more than one channels that need setup. Better move the chann= el setup out of it so that postcopy_try_recover() only handles the last phase = of switching to the recovery phase. To do that in migration_fd_process_incoming(), move the postcopy_try_recove= r() call to be after migration_incoming_setup(), which will setup the channels. While in migration_ioc_process_incoming(), postpone the recover() routine r= ight before we'll jump into migration_incoming_process(). A side benefit is we don't need to pass in QEMUFile* to postcopy_try_recove= r() anymore. Remove it. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-7-peterx@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d86fb0c332..b1659b7092 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -671,19 +671,20 @@ void migration_incoming_process(void) } =20 /* Returns true if recovered from a paused migration, otherwise false */ -static bool postcopy_try_recover(QEMUFile *f) +static bool postcopy_try_recover(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 if (mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED) { /* Resumed from a paused postcopy migration */ =20 - mis->from_src_file =3D f; + /* This should be set already in migration_incoming_setup() */ + assert(mis->from_src_file); /* Postcopy has standalone thread to do vm load */ - qemu_file_set_blocking(f, true); + qemu_file_set_blocking(mis->from_src_file, true); =20 /* Re-configure the return path */ - mis->to_src_file =3D qemu_file_get_return_path(f); + mis->to_src_file =3D qemu_file_get_return_path(mis->from_src_file); =20 migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_PAUSED, MIGRATION_STATUS_POSTCOPY_RECOVER); @@ -704,11 +705,10 @@ static bool postcopy_try_recover(QEMUFile *f) =20 void migration_fd_process_incoming(QEMUFile *f, Error **errp) { - if (postcopy_try_recover(f)) { + if (!migration_incoming_setup(f, errp)) { return; } - - if (!migration_incoming_setup(f, errp)) { + if (postcopy_try_recover()) { return; } migration_incoming_process(); @@ -724,11 +724,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, E= rror **errp) /* The first connection (multifd may have multiple) */ QEMUFile *f =3D qemu_fopen_channel_input(ioc); =20 - /* If it's a recovery, we're done */ - if (postcopy_try_recover(f)) { - return; - } - if (!migration_incoming_setup(f, errp)) { return; } @@ -749,6 +744,10 @@ void migration_ioc_process_incoming(QIOChannel *ioc, E= rror **errp) } =20 if (start_migration) { + /* If it's a recovery, we're done */ + if (postcopy_try_recover()) { + return; + } migration_incoming_process(); } } --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567563; cv=none; d=zohomail.com; s=zohoarc; b=ZPDI0P5HR6TzcLC47brS67A4qNPUK2f0hE1RdckThGfYNJAIpK2y9P9JdcTN4VD4EEogKkpoUvbmBF2gozJGPZrbueehxhGwBtMYyYDu+HoVvNjENQbpbY0MpXCtR4oLnjSAL9rTrKA4iKmB01o6Vhrgn00VsO0CkdpXrEyi9xM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567563; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5d7IQvMN01To+Cis3r5roNwiQ+8elWi3grVMM/yY6IY=; b=LnzGgvPvsJSJ7NBIZqoc/3MMskbS6kxO7qZeZT6dCetNAl8wT4GI40eg5XEPmraWpYsKqtE4wN26j5/AjJMDGYPDQi9SrCWRzPdM8W1qTk+2npPorPynXcIuwhTkuGoxMkjCjXr5A7I0kXIjenXlS2QWc4IYmzDEUn0S35rA1gE= 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+importer2=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 165056756327585.0481097265274; Thu, 21 Apr 2022 11:59:23 -0700 (PDT) Received: from localhost ([::1]:51772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhc1S-0000bh-9t for importer2@patchew.org; Thu, 21 Apr 2022 14:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjz-0001oO-BA for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjx-000628-Nk for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:19 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-445-cjaAWJExNDCZlaqCllETIQ-1; Thu, 21 Apr 2022 14:41:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 749E2801E67 for ; Thu, 21 Apr 2022 18:41:15 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC15040E80F5; Thu, 21 Apr 2022 18:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566477; 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=5d7IQvMN01To+Cis3r5roNwiQ+8elWi3grVMM/yY6IY=; b=fS+3bznD5AtNCeSZrxTxcvrXTZ0jt7m3Tfmd/Aii+J8xGs+XmJtYbl1ZLq8v6DWWmzPCI+ NU5OkXYNzw4lORCuj/cwYcXWqYyHR+ESXzB1gR3Boi5OoA4S8/LDNfBlkS7DgTGxQt5c86 Ynho+ahXyOpFyGWDWGyKEhj3DEfjjb8= X-MC-Unique: cjaAWJExNDCZlaqCllETIQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 16/18] migration: Allow migrate-recover to run multiple times Date: Thu, 21 Apr 2022 19:40:50 +0100 Message-Id: <20220421184052.306581-17-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567565378100001 From: Peter Xu Previously migration didn't have an easy way to cleanup the listening transport, migrate recovery only allows to execute once. That's done with a trick flag in postcopy_recover_triggered. Now the facility is already there. Drop postcopy_recover_triggered and instead allows a new migrate-recover to release the previous listener transport. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-8-peterx@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 13 ++----------- migration/migration.h | 1 - migration/savevm.c | 3 --- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b1659b7092..cc00b344a9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2162,11 +2162,8 @@ void qmp_migrate_recover(const char *uri, Error **er= rp) return; } =20 - if (qatomic_cmpxchg(&mis->postcopy_recover_triggered, - false, true) =3D=3D true) { - error_setg(errp, "Migrate recovery is triggered already"); - return; - } + /* If there's an existing transport, release it */ + migration_incoming_transport_cleanup(mis); =20 /* * Note that this call will never start a real migration; it will @@ -2174,12 +2171,6 @@ void qmp_migrate_recover(const char *uri, Error **er= rp) * to continue using that newly established channel. */ qemu_start_incoming_migration(uri, errp); - - /* Safe to dereference with the assert above */ - if (*errp) { - /* Reset the flag so user could still retry */ - qatomic_set(&mis->postcopy_recover_triggered, false); - } } =20 void qmp_migrate_pause(Error **errp) diff --git a/migration/migration.h b/migration/migration.h index f17ccc657c..a863032b71 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -139,7 +139,6 @@ struct MigrationIncomingState { struct PostcopyBlocktimeContext *blocktime_ctx; =20 /* notify PAUSED postcopy incoming migrations to try to continue */ - bool postcopy_recover_triggered; QemuSemaphore postcopy_pause_sem_dst; QemuSemaphore postcopy_pause_sem_fault; =20 diff --git a/migration/savevm.c b/migration/savevm.c index 02ed94c180..d9076897b8 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2589,9 +2589,6 @@ static bool postcopy_pause_incoming(MigrationIncoming= State *mis) =20 assert(migrate_postcopy_ram()); =20 - /* Clear the triggered bit to allow one recovery */ - mis->postcopy_recover_triggered =3D false; - /* * Unregister yank with either from/to src would work, since ioc behin= d it * is the same --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567469; cv=none; d=zohomail.com; s=zohoarc; b=LbZl+kzr7pIVTKJPDiI58XmO4nU0t70nAhUvZB+fN/qjaL05ZMHWyREBYGcRGOLQJppj5SihRjljAiSQ91Yo6Nl/u5Eb1lcVLeckylnuPTsDyrnDeFyoka+c0daUIn+K/LDwFHmofTWWi4HWEqZIc424JRoKcjqq8d9Q+CE38S4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567469; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nAZ0hMye+wTjnjKUhNTlNO9H6DiFfeVSktumbW0T7L8=; b=ikPEf1RSvzr2RhK1HmE0bG87qjjQZOyrDFPOdB6niNqEIOYjbLjHr928ID7HkaCU6IHfbqisS6X3hSRJomh6FdKtdG+vlScGbfTVH4W2J7iDVXFSqRb/7tkRgeQ2D+o6eqvSGIHcRylIid/SH4d7lNzscxSSdlokGLHxkKErGyQ= 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+importer2=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 1650567469855547.8590195882582; Thu, 21 Apr 2022 11:57:49 -0700 (PDT) Received: from localhost ([::1]:48506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhbzw-0006eg-EJ for importer2@patchew.org; Thu, 21 Apr 2022 14:57:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbk0-0001qF-1h for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjy-00062F-EU for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:19 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-K4gCwJ2VMoi-wJ2hpb0sBg-1; Thu, 21 Apr 2022 14:41:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76FED803D42 for ; Thu, 21 Apr 2022 18:41:16 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF15840C1438; Thu, 21 Apr 2022 18:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566477; 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=nAZ0hMye+wTjnjKUhNTlNO9H6DiFfeVSktumbW0T7L8=; b=L3hWTln3yeCRPHhHkrOAi6IL/rnFD246JXOwDZmDwfP8b69Q0OZ60GH7NhJZ31M7jxc2zB bQl8MAQFMYvzPWQCs49OWu3S0xU8VGLnCM+ZPhzSW77iyY42yQ0RgvufnHG6HFmCS7fMwR RZfv0EBpCiRa7qwwm2QIiNSREWEbEJk= X-MC-Unique: K4gCwJ2VMoi-wJ2hpb0sBg-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 17/18] migration: Fix operator type Date: Thu, 21 Apr 2022 19:40:51 +0100 Message-Id: <20220421184052.306581-18-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567471130100001 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Clang spotted an & that should have been an &&; fix it. Reported by: David Binderman / https://gitlab.com/dcb Fixes: 65dacaa04fa ("migration: introduce save_normal_page()") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/963 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20220406102515.96320-1-dgilbert@redhat.com> Reviewed-by: Peter Maydell Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 253fe4b756..a2489a2699 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1291,7 +1291,7 @@ static int save_normal_page(RAMState *rs, RAMBlock *b= lock, ram_addr_t offset, offset | RAM_SAVE_FLAG_PAGE)); if (async) { qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE, - migrate_release_ram() & + migrate_release_ram() && migration_in_postcopy()); } else { qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE); --=20 2.35.1 From nobody Mon May 6 19:31:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650567792; cv=none; d=zohomail.com; s=zohoarc; b=Mtuh+Rkwqy2RAKAVecewAi7hCvBlYeXeT63gDt7v+sKJ3Z0kCuAfd+CAMujOfUa4gZSlKxcPPWzro6hHCzrNiiB8PPWAeAzL+m9UJmVskgiIjpvhlYqFbpZcUgjuzXjmnR+1MiQUmEImjiKTpKj7qOlqHo+KEmGyy62ZqWLo0zA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650567792; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p4K+rUeguwktn+a89vVJdCmz7fvriyqJiq82REhTvy8=; b=fdyAPemiDrp1ZTOM4Z1lOobOMPoQ4iFQt7dDRTWIdFyzTyLWXYOgucyg1AXP4PYZooyWikH9gF5Fxy82BMuOK13BFXVHB40oy8hx0A+2OjfQ7Z+LnfsorMNla9ZYTL0DQACYja1cuKnFiy7hhktsJpEQkcugBw9EdjfUYihv+1c= 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+importer2=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 1650567792182276.8624080542428; Thu, 21 Apr 2022 12:03:12 -0700 (PDT) Received: from localhost ([::1]:32922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhc59-0007vv-82 for importer2@patchew.org; Thu, 21 Apr 2022 15:03:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbk2-0001vb-Ab for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhbjz-00062S-JI for qemu-devel@nongnu.org; Thu, 21 Apr 2022 14:41:22 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-77-qtMW-qs_Nf2NQPUqfQTG6g-1; Thu, 21 Apr 2022 14:41:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77945196F5BA for ; Thu, 21 Apr 2022 18:41:17 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0E3740EC012; Thu, 21 Apr 2022 18:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650566479; 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=p4K+rUeguwktn+a89vVJdCmz7fvriyqJiq82REhTvy8=; b=N7FjXzn3WyhV+Jbfpn58z1E25ORpKyUhc7iDJiE7nu6Tf3YRZIEz8HJqqzWflvWkrRAyI+ c35dEVPb+USSWyQ+z86HgKAw1MU5PTwUFT4ZHhhUxDY+/keihWGN7M9KDhn2gI5Z2DEbVO bCMh3x3dBsYVWiO0ULyhoP/1QqqIJL0= X-MC-Unique: qtMW-qs_Nf2NQPUqfQTG6g-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, berrange@redhat.com Subject: [PULL 18/18] migration: Read state once Date: Thu, 21 Apr 2022 19:40:52 +0100 Message-Id: <20220421184052.306581-19-dgilbert@redhat.com> In-Reply-To: <20220421184052.306581-1-dgilbert@redhat.com> References: <20220421184052.306581-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: quintela@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650567792715100001 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" The 'status' field for the migration is updated normally using an atomic operation from the migration thread. Most readers of it aren't that careful, and in most cases it doesn't matter. In query_migrate->fill_source_migration_info the 'state' is read twice; the first time to decide which state fields to fill in, and then secondly to copy the state to the status field; that can end up with a status that's inconsistent; e.g. setting up the fields for 'setup' and then having an 'active' status. In that case libvirt gets upset by the lack of ram info. The symptom is: libvirt.libvirtError: internal error: migration was active, but no RAM i= nfo was set Read the state exactly once in fill_source_migration_info. This is a possible fix for: https://bugzilla.redhat.com/show_bug.cgi?id=3D2074205 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20220413113329.103696-1-dgilbert@redhat.com> Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index cc00b344a9..5a31b23bd6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1084,6 +1084,7 @@ static void populate_disk_info(MigrationInfo *info) static void fill_source_migration_info(MigrationInfo *info) { MigrationState *s =3D migrate_get_current(); + int state =3D qatomic_read(&s->state); GSList *cur_blocker =3D migration_blockers; =20 info->blocked_reasons =3D NULL; @@ -1103,7 +1104,7 @@ static void fill_source_migration_info(MigrationInfo = *info) } info->has_blocked_reasons =3D info->blocked_reasons !=3D NULL; =20 - switch (s->state) { + switch (state) { case MIGRATION_STATUS_NONE: /* no migration has happened ever */ /* do not overwrite destination migration status */ @@ -1148,7 +1149,7 @@ static void fill_source_migration_info(MigrationInfo = *info) info->has_status =3D true; break; } - info->status =3D s->state; + info->status =3D state; } =20 typedef enum WriteTrackingSupport { --=20 2.35.1