From nobody Sat May 18 07:09:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686046788; cv=none; d=zohomail.com; s=zohoarc; b=G8FwqY3CB2o24wIGwkCDAHBJ6Ld9aAsqRcT1rOwWWyNzSGCHMQOiYSlSzprkrJ/feGxWp3dN6I9XkJPLhBavCHg0qiDBK9ve/NFcajzF9xeIluHZ9SdFdbQ5Y8anCIqKmTncVXCtJJZiajFLk5VxeJiQWSkUHSpWB6+Xa10/q70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686046788; h=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=htqefU01CUW29vhaLHdvRfz6VgtGymSs2/U9/KZpSF8=; b=enDwzARWtHEixwvp1f/A7FMCqA+5teC7b9iR4CLzE4y01xXXM2XtLSdZG9hB4p2qXyRYXEXWy7axMufMHyVUkJ30ePNm0YpBa7Gr0PYwVj+WNXXM+NCqJYBl/crvZReXznXsOiinGOIG4Jf+rh5j9F+c9SQU+2S/gKxcbx8T0t4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168604678791163.150823539463886; Tue, 6 Jun 2023 03:19:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tme-0000Br-9X; Tue, 06 Jun 2023 06:19:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tmc-00006C-7a for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:19:22 -0400 Received: from mga05.intel.com ([192.55.52.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6TmZ-0007Nm-Jb for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:19:21 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2023 03:19:16 -0700 Received: from tdx-lm.sh.intel.com ([10.239.53.27]) by orsmga002.jf.intel.com with ESMTP; 06 Jun 2023 03:19:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686046759; x=1717582759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gfQ2g23Frf4Yd2X75DnzGcuHLOvhA17x9xeJUzT/+Xo=; b=NUEax+O+zOYozR33kKRjlnTaNw+YxAFekF05yb2n3eegonsSCS3LPPMw /IBcdYQZiVOi3Tb2U4T4UeTAH4UyRdryaRGbfrof0DksanmErH2mAlTKY DStOv9rXBarP73moYKvAULYfANP8ZvYx7PZKAvgk4xo/dxeyYXgrjPmO5 LtknnHwHSF45oBN9qtFHMYfKXkXYS8ovSBZKjrcX2v6senekYpTcltt50 xErDyjOYu5nUbBNDcdGlCTdlX74fk3+FGlGKEN+rSZ3suBXNNE168J0SX RP2FmdketVXxrmonyT1UdfuBMxlWZk8b7hVHqcbfYooXL5aP0WN16sA6j g==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="443004175" X-IronPort-AV: E=Sophos;i="6.00,221,1681196400"; d="scan'208";a="443004175" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="709032924" X-IronPort-AV: E=Sophos;i="6.00,221,1681196400"; d="scan'208";a="709032924" From: Wei Wang To: quintela@redhat.com, peterx@redhat.com, lei4.wang@intel.com Cc: qemu-devel@nongnu.org, Wei Wang Subject: [PATCH v2 1/2] migration: enfocre multifd and postcopy preempt to be set before incoming Date: Tue, 6 Jun 2023 18:19:09 +0800 Message-Id: <20230606101910.20456-2-wei.w.wang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230606101910.20456-1-wei.w.wang@intel.com> References: <20230606101910.20456-1-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.43; envelope-from=wei.w.wang@intel.com; helo=mga05.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1686046789906100003 Content-Type: text/plain; charset="utf-8" qemu_start_incoming_migration needs to check the number of multifd channels or postcopy ram channels to configure the backlog parameter (i.e. the maximum length to which the queue of pending connections for sockfd may grow) of listen(). So enforce the usage of postcopy-preempt and multifd as below: - need to use "-incoming defer" on the destination; and - set_capability and set_parameter need to be done before migrate_incoming Otherwise, disable the use of the features and report error messages to remind users to adjust the commands. Signed-off-by: Wei Wang Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- migration/options.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/migration/options.c b/migration/options.c index b62ab30cd5..01403e5eaa 100644 --- a/migration/options.c +++ b/migration/options.c @@ -415,6 +415,11 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snap= shot, MIGRATION_CAPABILITY_VALIDATE_UUID, MIGRATION_CAPABILITY_ZERO_COPY_SEND); =20 +static bool migrate_incoming_started(void) +{ + return !!migration_incoming_get_current()->transport_data; +} + /** * @migration_caps_check - check capability compatibility * @@ -538,6 +543,12 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Postcopy preempt not compatible with compres= s"); return false; } + + if (migrate_incoming_started()) { + error_setg(errp, + "Postcopy preempt must be set before incoming start= s"); + return false; + } } =20 if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { @@ -545,6 +556,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Multifd is not compatible with compress"); return false; } + if (migrate_incoming_started()) { + error_setg(errp, "Multifd must be set before incoming starts"); + return false; + } } =20 return true; @@ -998,11 +1013,22 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) =20 /* x_checkpoint_delay is now always positive */ =20 - if (params->has_multifd_channels && (params->multifd_channels < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", - "a value between 1 and 255"); - return false; + if (params->has_multifd_channels) { + if (params->multifd_channels < 1) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "multifd_channels", + "a value between 1 and 255"); + return false; + } + if (migrate_incoming_started()) { + MigrationState *ms =3D migrate_get_current(); + + ms->capabilities[MIGRATION_CAPABILITY_MULTIFD] =3D false; + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "multifd_channels", + "must be set before incoming starts"); + return false; + } } =20 if (params->has_multifd_zlib_level && --=20 2.27.0 From nobody Sat May 18 07:09:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686046772; cv=none; d=zohomail.com; s=zohoarc; b=AnAoS04zxdsw4a/5Wj84mxJHsE7MLlQr5W0N1XiLR80Jecmqm5BEXwNlrwExuwJX3yvtuOLA6IyVs+mzvUxtFta1IMDe04/ElNA52pnQUCo0SR/TzBON/8NjOJkTkA6IyVyJ4Ud2I4P+7CW8e8j8AxTJnT0s5jeG5f25t2Eu204= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686046772; h=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=O2pf/wqk2mRbxh+b30/70wXhLdUzvtGnrwXEGPgkVcg=; b=KnyKwCB4Kg86IUaXp3KlLD6FaK4ORXe3Xh5f8YBukjC2Fs1ynVdCn+akq7K/YXmGV0Un05juN6eqbe1VUdaXGfwaXh0rPtcV5hokX0OxwwA9YOBMaq7OvHcq8kFKALGlDKgTdaKlwveWP8iNEMxINO5I26VUxwhOblIKN1ia0qo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686046772177610.8924568175177; Tue, 6 Jun 2023 03:19:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tmd-0000BA-S3; Tue, 06 Jun 2023 06:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tmb-00005y-VC for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:19:21 -0400 Received: from mga05.intel.com ([192.55.52.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6TmZ-0007O2-8K for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:19:20 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2023 03:19:17 -0700 Received: from tdx-lm.sh.intel.com ([10.239.53.27]) by orsmga002.jf.intel.com with ESMTP; 06 Jun 2023 03:19:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686046759; x=1717582759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dC+lgwxg/JJaD9IXWM498G29WG/e8Pk7dHwJAztMx18=; b=neS6vFKa5xYOAJzxKSC1K0x/6K4NQhJ57x9eXrudIDXTMvblmKdDN+fQ AYDAjDMG/wc+qkiQEMLS0kv+xEYgYmC2pM0B0WnL1jMMv5DyFQ8G7w/Pn kYtBBoEaa4gaGrgxyb0hAA9RWm0fXffWaN0BK2wA2djrSschuNf749Nyz cN6hrSop9Mu29Wb5cSfLA9i/qI7vgv8IFFSj+tDYzSsdybq4J7U3I8V01 hjD55lYBmmGmam0ycBYyb99jvf8RHFy5YkkurJPkcjY/bldBqPqDZ4C1z aOV4ZXI1nx7x8ingzNcz4FRzQq6SATYRX938HthdXU26rDErfFMUhdH+b Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="443004181" X-IronPort-AV: E=Sophos;i="6.00,221,1681196400"; d="scan'208";a="443004181" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="709032931" X-IronPort-AV: E=Sophos;i="6.00,221,1681196400"; d="scan'208";a="709032931" From: Wei Wang To: quintela@redhat.com, peterx@redhat.com, lei4.wang@intel.com Cc: qemu-devel@nongnu.org, Wei Wang Subject: [PATCH v2 2/2] qtest/migration-tests.c: use "-incoming defer" for postcopy tests Date: Tue, 6 Jun 2023 18:19:10 +0800 Message-Id: <20230606101910.20456-3-wei.w.wang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230606101910.20456-1-wei.w.wang@intel.com> References: <20230606101910.20456-1-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.43; envelope-from=wei.w.wang@intel.com; helo=mga05.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1686046773046100001 Content-Type: text/plain; charset="utf-8" The Postcopy preempt capability is expected to be set before incoming starts, so change the postcopy tests to start with deferred incoming and call migrate-incoming after the cap has been set. Why the existing tests (without this patch) didn't fail? There could be two reasons: 1) "backlog" specifies the number of pending connections. As long as the server accepts the connections faster than the clients side connecting, connection will succeed. For the preempt test, it uses only 2 channels, so very likely to not have pending connections. 2) per my tests (on kernel 6.2), the number of pending connections allowed is actually "backlog + 1", which is 2 in this case. That said, the implementation of socket_start_incoming_migration_internal expects "migrate defer" to be used, and for safety, change the test to work with the expected usage. Signed-off-by: Wei Wang Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b0c355bbd9..cbdbc932de 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1143,10 +1143,11 @@ static int migrate_postcopy_prepare(QTestState **fr= om_ptr, QTestState **to_ptr, MigrateCommon *args) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + g_autofree char *uri =3D NULL; QTestState *from, *to; + QDict *rsp; =20 - if (test_migrate_start(&from, &to, uri, &args->start)) { + if (test_migrate_start(&from, &to, "defer", &args->start)) { return -1; } =20 @@ -1165,9 +1166,14 @@ static int migrate_postcopy_prepare(QTestState **fro= m_ptr, =20 migrate_ensure_non_converge(from); =20 + rsp =3D wait_command(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}"); + qobject_unref(rsp); + /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 + uri =3D migrate_get_socket_address(to, "socket-address"); migrate_qmp(from, uri, "{}"); =20 wait_for_migration_pass(from); --=20 2.27.0