From nobody Thu Dec 18 03:17:07 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747054353; cv=none; d=zohomail.com; s=zohoarc; b=AqHNo7BvYG8hK4xhflDZIJ9JoeZQif4vTIzl/E+/gXR13h/MdS6mgjKgkh4JGXiqKLXyr9yGy1vhAaEarlDS/opcBle4jJvRgSB30ZPTbgwoc2no7n3gfHprNTrpZeLqPvxR8oHtnG3oIlog/hqStNnaVjBlbXV2Ue9/feTszO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747054353; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NqO6v2f8ptpnS0y81ZBzuNwN7yATriyketYADzQ9aB8=; b=EV3CJTouIEGcyfWsZIAwbaArmxCe06HciPiP4Qg8uJnXsLZZ2pcxVJXAr1P5p6NNp/0vKVLhkUy5iA1pzI9oEeifmL8dyJW3c8RS1MrmCIBCF5hralVd9xR3juGDlfruyWafkLvBk00x6fDXrqRLrrmM9qYMQ0S5owGai5ud4Ic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747054353322562.1206636707451; Mon, 12 May 2025 05:52:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uESdR-0008WA-A5; Mon, 12 May 2025 08:51:57 -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 1uESdO-0008VD-Tu for qemu-devel@nongnu.org; Mon, 12 May 2025 08:51:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uESdL-0005cE-Ph for qemu-devel@nongnu.org; Mon, 12 May 2025 08:51:54 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-S0ui_tnmPEehuukHWdJGXg-1; Mon, 12 May 2025 08:51:43 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 00BAE1800446; Mon, 12 May 2025 12:51:41 +0000 (UTC) Received: from kaapi.redhat.com (unknown [10.74.80.184]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6A71219560A3; Mon, 12 May 2025 12:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747054305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NqO6v2f8ptpnS0y81ZBzuNwN7yATriyketYADzQ9aB8=; b=P30EsmX/PeCvUqMuDARfoFVDaa7f1YGktvlnfUztScy7loZU4VNi/J/b2zJc3hGWCx7g04 T1UFGP43TxrlcFs1Mq/7N3r98PVHlz+xi+cB8ukQcPp77y3N8RrdkrCgAg+dIQNRwoQ4h5 iSyDfjDjo0R1FOtSTqGYUhowyIQpq4c= X-MC-Unique: S0ui_tnmPEehuukHWdJGXg-1 X-Mimecast-MFC-AGG-ID: S0ui_tnmPEehuukHWdJGXg_1747054301 From: Prasad Pandit To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, berrange@redhat.com, Prasad Pandit Subject: [PATCH v11 1/3] migration: write zero pages when postcopy enabled Date: Mon, 12 May 2025 18:21:22 +0530 Message-ID: <20250512125124.147064-2-ppandit@redhat.com> In-Reply-To: <20250512125124.147064-1-ppandit@redhat.com> References: <20250512125124.147064-1-ppandit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.551, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1747054354568019000 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit During multifd migration, zero pages are written if they are migrated more than once. This may result in a migration thread hang issue when multifd and postcopy are enabled together. When postcopy is enabled, always write zero pages as and when they are migrated. Signed-off-by: Prasad Pandit Reviewed-by: Fabiano Rosas --- migration/multifd-zero-page.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) v11: - s/ones/once, remove capitalisations and call _test_byte_offset() once v10: - https://lore.kernel.org/qemu-devel/20250508122849.207213-2-ppandit@redhat= .com/T/#t diff --git a/migration/multifd-zero-page.c b/migration/multifd-zero-page.c index dbc1184921..4cde868159 100644 --- a/migration/multifd-zero-page.c +++ b/migration/multifd-zero-page.c @@ -85,9 +85,27 @@ void multifd_recv_zero_page_process(MultiFDRecvParams *p) { for (int i =3D 0; i < p->zero_num; i++) { void *page =3D p->host + p->zero[i]; - if (ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) { + bool received =3D + ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i]= ); + + /* + * During multifd migration zero page is written to the memory + * only if it is migrated more than once. + * + * It becomes a problem when both multifd & postcopy options are + * enabled. If the zero page which was skipped during multifd phas= e, + * is accessed during the postcopy phase of the migration, a page + * fault occurs. But this page fault is not served because the + * 'receivedmap' says the zero page is already received. Thus the + * thread accessing that page may hang. + * + * When postcopy is enabled, always write the zero page as and when + * it is migrated. + */ + if (migrate_postcopy_ram() || received) { memset(page, 0, multifd_ram_page_size()); - } else { + } + if (!received) { ramblock_recv_bitmap_set_offset(p->block, p->zero[i]); } } -- 2.49.0 From nobody Thu Dec 18 03:17:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747054356; cv=none; d=zohomail.com; s=zohoarc; b=MyXhsQ/JBvmeCfPeOxA4ypHeVlMjVvpBHGKpDOawztAvEygY7Byr/Nsr98M4xi7+8r75pIZ9jBLKjD6ABuAQS7Y3T0Te7hyb3A5Ij8HqZyvHQavmLn3w4jLQ/UOOpqTHCcQpe1s3X/XfRV+hgVPNlPCUrXLvyprGIET+jnLKCu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747054356; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zDghDSaq3msh0zZ+NRRPA6233k6POL9VgMxo+25bh0Q=; b=WWgQ6Y/ku7eY9PBg695a47+J50hyf45a4QgkQ2SbNJE8VLhgzHbCOSnycFoICg3rb1VWxiIG55DsRBUiqR9GYnFF8fpTa58ncx6aZ88bHr11M8ZiP7hmpa1hA22514MQ4bQcSyb/Cl7cEdUhQSGwn715V0niB2WN0hdtuJ6hz1A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747054356332663.5602937902339; Mon, 12 May 2025 05:52:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uESdZ-0000Gm-KY; Mon, 12 May 2025 08:52:05 -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 1uESdX-00008A-LS for qemu-devel@nongnu.org; Mon, 12 May 2025 08:52:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uESdS-0005cv-8i for qemu-devel@nongnu.org; Mon, 12 May 2025 08:52:02 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-voI1f0HQOUS1EpfNQnZ6Qw-1; Mon, 12 May 2025 08:51:46 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7C16318001EA; Mon, 12 May 2025 12:51:45 +0000 (UTC) Received: from kaapi.redhat.com (unknown [10.74.80.184]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1BBA719560A3; Mon, 12 May 2025 12:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747054315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zDghDSaq3msh0zZ+NRRPA6233k6POL9VgMxo+25bh0Q=; b=SYUfZTo/amDyejzNhIAt4F9k6eHwuZCzg2H3wB6LCDJcvTBb3/r/Sc1npl5r/xAdxZ3Iqp GsMinO8fqKWnu8TkoyFOzHl43Xjhpfy4Q0DOPbbl2fFcTBNhCh7SjNgQZxz/QHiEjUZbIQ XyQx49BRD4NOsUDNXJiUJJwyApUZ3uQ= X-MC-Unique: voI1f0HQOUS1EpfNQnZ6Qw-1 X-Mimecast-MFC-AGG-ID: voI1f0HQOUS1EpfNQnZ6Qw_1747054305 From: Prasad Pandit To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, berrange@redhat.com, Prasad Pandit Subject: [PATCH v11 2/3] migration: enable multifd and postcopy together Date: Mon, 12 May 2025 18:21:23 +0530 Message-ID: <20250512125124.147064-3-ppandit@redhat.com> In-Reply-To: <20250512125124.147064-1-ppandit@redhat.com> References: <20250512125124.147064-1-ppandit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.551, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1747054359971019000 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit Enable Multifd and Postcopy migration together. The migration_ioc_process_incoming() routine checks magic value sent on each channel and helps to properly setup multifd and postcopy channels. The Precopy and Multifd threads work during the initial guest RAM transfer. When migration moves to the Postcopy phase, the multifd threads cease to send data on multifd channels and Postcopy threads on the destination request/pull data from the source side. Reviewed-by: Fabiano Rosas Signed-off-by: Prasad Pandit --- migration/multifd-nocomp.c | 3 ++- migration/multifd.c | 7 +++++++ migration/options.c | 5 ----- migration/ram.c | 5 ++--- 4 files changed, 11 insertions(+), 9 deletions(-) v11: no change v10: - https://lore.kernel.org/qemu-devel/20250508122849.207213-2-ppandit@redhat= .com/T/#t diff --git a/migration/multifd-nocomp.c b/migration/multifd-nocomp.c index 88fe0f99f2..b48eae3d86 100644 --- a/migration/multifd-nocomp.c +++ b/migration/multifd-nocomp.c @@ -17,6 +17,7 @@ #include "migration-stats.h" #include "multifd.h" #include "options.h" +#include "migration.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "qemu/error-report.h" @@ -398,7 +399,7 @@ int multifd_ram_flush_and_sync(QEMUFile *f) MultiFDSyncReq req; int ret; =20 - if (!migrate_multifd()) { + if (!migrate_multifd() || migration_in_postcopy()) { return 0; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index ec108af624..f18b166bcf 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1379,6 +1379,13 @@ static void *multifd_recv_thread(void *opaque) } =20 if (has_data) { + /* + * multifd thread should not be active and receive data + * when migration is in the Postcopy phase. Two threads + * writing the same memory area could easily corrupt + * the guest state. + */ + assert(!migration_in_postcopy()); if (is_device_state) { assert(use_packets); ret =3D multifd_device_state_recv(p, &local_err); diff --git a/migration/options.c b/migration/options.c index b6ae95358d..3fcd577cd7 100644 --- a/migration/options.c +++ b/migration/options.c @@ -509,11 +509,6 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Postcopy is not compatible with ignore-share= d"); return false; } - - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { - error_setg(errp, "Postcopy is not yet compatible with multifd"= ); - return false; - } } =20 if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { diff --git a/migration/ram.c b/migration/ram.c index e12913b43e..d26dbd37c4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1993,9 +1993,8 @@ static int ram_save_target_page(RAMState *rs, PageSea= rchStatus *pss) } } =20 - if (migrate_multifd()) { - RAMBlock *block =3D pss->block; - return ram_save_multifd_page(block, offset); + if (migrate_multifd() && !migration_in_postcopy()) { + return ram_save_multifd_page(pss->block, offset); } =20 return ram_save_page(rs, pss); --=20 2.49.0 From nobody Thu Dec 18 03:17:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747054388; cv=none; d=zohomail.com; s=zohoarc; b=Rmeg2i6KpYINpkkmUjFwXg+DgL1iENp5YxkxrO9AFmOU2cCQk6e03rOxHUmfBD+enrJEf7jmt4JXmUqTA1U6DsvVSB6oIfec+yad1nov/FOCpayu5bEG/cxlwuHTdqeBXVYGZY8+oaLGbbM60gBxrlebaU46lNrwz696AbVkVn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747054388; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=INMiUaVSUgvLHBl7tRgUfahKVjmWBDS10MCf0ya/xmE=; b=KR2O4zbPRteOn7fmTVWLgtkqzetWf4xVM3nwikjH1g6ChVjNc3OT/9iZsyY++pkaBsF6oHv0LXRkwHRzodVbt6uyCln1JnO2B5jkwrR+Hl7rAEHhYFJe0E90QvxmHbydL5LiQAbhXmdaIugk+aTvTTLwwsU9Vx11naKP2TUs93U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747054388798474.217231876243; Mon, 12 May 2025 05:53:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uESdU-000053-Dq; Mon, 12 May 2025 08:52:00 -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 1uESdS-0008WO-Ia for qemu-devel@nongnu.org; Mon, 12 May 2025 08:51:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uESdQ-0005cx-8f for qemu-devel@nongnu.org; Mon, 12 May 2025 08:51:58 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-308-aE20mgsSNgOq6vT7wB5wAA-1; Mon, 12 May 2025 08:51:52 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 195481956046; Mon, 12 May 2025 12:51:51 +0000 (UTC) Received: from kaapi.redhat.com (unknown [10.74.80.184]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7293319560A3; Mon, 12 May 2025 12:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747054315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=INMiUaVSUgvLHBl7tRgUfahKVjmWBDS10MCf0ya/xmE=; b=K4Fqwb5EuOcyKQyDYPeIUB+XaW2PbcmMrGH8XRy6qq87Q6VMB5in8aktF8NL8AmawQn/Q3 4rMmdZ4JfSXCMm2KMEAsr9mEFJHXnD7NF5njIh7WZUCKcPX540i+R8+u816grwrlvoJjCl RQGjJy/TxSXIQiyKLREDvFW+sWW50x8= X-MC-Unique: aE20mgsSNgOq6vT7wB5wAA-1 X-Mimecast-MFC-AGG-ID: aE20mgsSNgOq6vT7wB5wAA_1747054311 From: Prasad Pandit To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, berrange@redhat.com, Prasad Pandit Subject: [PATCH v11 3/3] tests/qtest/migration: add postcopy tests with multifd Date: Mon, 12 May 2025 18:21:24 +0530 Message-ID: <20250512125124.147064-4-ppandit@redhat.com> In-Reply-To: <20250512125124.147064-1-ppandit@redhat.com> References: <20250512125124.147064-1-ppandit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.551, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1747054390858116600 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit Add new qtests to run postcopy migration with multifd channels enabled. Signed-off-by: Prasad Pandit --- tests/qtest/migration/compression-tests.c | 18 ++++++++ tests/qtest/migration/postcopy-tests.c | 27 ++++++++++++ tests/qtest/migration/precopy-tests.c | 28 ++++++++++++- tests/qtest/migration/tls-tests.c | 50 +++++++++++++++++++++++ 4 files changed, 121 insertions(+), 2 deletions(-) v11: - pass 'postcopy_ram' variable as a function argument v10: - https://lore.kernel.org/qemu-devel/20250508122849.207213-2-ppandit@redhat= .com/T/#t diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index 41e79f031b..b827665b8e 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -42,6 +42,20 @@ static void test_multifd_tcp_zstd(void) }; test_precopy_common(&args); } + +static void test_multifd_postcopy_tcp_zstd(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + .caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true, + }, + .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, + }; + + test_precopy_common(&args); +} #endif /* CONFIG_ZSTD */ =20 #ifdef CONFIG_QATZIP @@ -184,6 +198,10 @@ void migration_test_add_compression(MigrationTestEnv *= env) #ifdef CONFIG_ZSTD migration_test_add("/migration/multifd/tcp/plain/zstd", test_multifd_tcp_zstd); + if (env->has_uffd) { + migration_test_add("/migration/multifd+postcopy/tcp/plain/zstd", + test_multifd_postcopy_tcp_zstd); + } #endif =20 #ifdef CONFIG_QATZIP diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 483e3ff99f..eb637f94f7 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -94,6 +94,29 @@ static void migration_test_add_postcopy_smoke(MigrationT= estEnv *env) } } =20 +static void test_multifd_postcopy(void) +{ + MigrateCommon args =3D { + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, + }; + + test_postcopy_common(&args); +} + +static void test_multifd_postcopy_preempt(void) +{ + MigrateCommon args =3D { + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, + }, + }; + + test_postcopy_common(&args); +} + void migration_test_add_postcopy(MigrationTestEnv *env) { migration_test_add_postcopy_smoke(env); @@ -114,6 +137,10 @@ void migration_test_add_postcopy(MigrationTestEnv *env) "/migration/postcopy/recovery/double-failures/reconnect", test_postcopy_recovery_fail_reconnect); =20 + migration_test_add("/migration/postcopy/multifd/plain", + test_multifd_postcopy); + migration_test_add("/migration/postcopy/multifd/preempt/plain", + test_multifd_postcopy_preempt); if (env->is_x86) { migration_test_add("/migration/postcopy/suspend", test_postcopy_suspend); diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 87b0a7e8ef..441a65bcf5 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -524,7 +524,7 @@ static void test_multifd_tcp_channels_none(void) * * And see that it works */ -static void test_multifd_tcp_cancel(void) +static void test_multifd_tcp_cancel(bool postcopy_ram) { MigrateStart args =3D { .hide_stderr =3D true, @@ -538,6 +538,11 @@ static void test_multifd_tcp_cancel(void) migrate_ensure_non_converge(from); migrate_prepare_for_dirty_mem(from); =20 + if (postcopy_ram) { + migrate_set_capability(from, "postcopy-ram", true); + migrate_set_capability(to, "postcopy-ram", true); + } + migrate_set_parameter_int(from, "multifd-channels", 16); migrate_set_parameter_int(to, "multifd-channels", 16); =20 @@ -579,6 +584,10 @@ static void test_multifd_tcp_cancel(void) return; } =20 + if (postcopy_ram) { + migrate_set_capability(to2, "postcopy-ram", true); + } + migrate_set_parameter_int(to2, "multifd-channels", 16); =20 migrate_set_capability(to2, "multifd", true); @@ -602,6 +611,16 @@ static void test_multifd_tcp_cancel(void) migrate_end(from, to2, true); } =20 +static void test_multifd_precopy_tcp_cancel(void) +{ + test_multifd_tcp_cancel(false); +} + +static void test_multifd_postcopy_tcp_cancel(void) +{ + test_multifd_tcp_cancel(true); +} + static void test_cancel_src_after_failed(QTestState *from, QTestState *to, const char *uri, const char *phas= e) { @@ -1188,7 +1207,12 @@ static void migration_test_add_precopy_smoke(Migrati= onTestEnv *env) migration_test_add("/migration/multifd/tcp/uri/plain/none", test_multifd_tcp_uri_none); migration_test_add("/migration/multifd/tcp/plain/cancel", - test_multifd_tcp_cancel); + test_multifd_precopy_tcp_cancel); + if (env->has_uffd) { + migration_test_add("/migration/multifd+postcopy/tcp/plain/cancel", + test_multifd_postcopy_tcp_cancel); + } + #ifdef CONFIG_RDMA migration_test_add("/migration/precopy/rdma/plain", test_precopy_rdma_plain); diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 72f44defbb..50a07a1c0f 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -395,6 +395,19 @@ static void test_postcopy_recovery_tls_psk(void) test_postcopy_recovery_common(&args); } =20 +static void test_multifd_postcopy_recovery_tls_psk(void) +{ + MigrateCommon args =3D { + .start_hook =3D migrate_hook_start_tls_psk_match, + .end_hook =3D migrate_hook_end_tls_psk, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, + }; + + test_postcopy_recovery_common(&args); +} + /* This contains preempt+recovery+tls test altogether */ static void test_postcopy_preempt_all(void) { @@ -409,6 +422,20 @@ static void test_postcopy_preempt_all(void) test_postcopy_recovery_common(&args); } =20 +static void test_multifd_postcopy_preempt_recovery_tls_psk(void) +{ + MigrateCommon args =3D { + .start_hook =3D migrate_hook_start_tls_psk_match, + .end_hook =3D migrate_hook_end_tls_psk, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, + }, + }; + + test_postcopy_recovery_common(&args); +} + static void test_precopy_unix_tls_psk(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); @@ -657,6 +684,21 @@ static void test_multifd_tcp_tls_psk_mismatch(void) test_precopy_common(&args); } =20 +static void test_multifd_postcopy_tcp_tls_psk_match(void) +{ + MigrateCommon args =3D { + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + .caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true, + }, + .listen_uri =3D "defer", + .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match, + .end_hook =3D migrate_hook_end_tls_psk, + }; + + test_precopy_common(&args); +} + #ifdef CONFIG_TASN1 static void test_multifd_tcp_tls_x509_default_host(void) { @@ -774,6 +816,10 @@ void migration_test_add_tls(MigrationTestEnv *env) test_postcopy_preempt_tls_psk); migration_test_add("/migration/postcopy/preempt/recovery/tls/psk", test_postcopy_preempt_all); + migration_test_add("/migration/postcopy/multifd/recovery/tls/psk", + test_multifd_postcopy_recovery_tls_psk); + migration_test_add("/migration/postcopy/multifd/preempt/recovery/t= ls/psk", + test_multifd_postcopy_preempt_recovery_tls_psk); } #ifdef CONFIG_TASN1 migration_test_add("/migration/precopy/unix/tls/x509/default-host", @@ -805,6 +851,10 @@ void migration_test_add_tls(MigrationTestEnv *env) test_multifd_tcp_tls_psk_match); migration_test_add("/migration/multifd/tcp/tls/psk/mismatch", test_multifd_tcp_tls_psk_mismatch); + if (env->has_uffd) { + migration_test_add("/migration/multifd+postcopy/tcp/tls/psk/match", + test_multifd_postcopy_tcp_tls_psk_match); + } #ifdef CONFIG_TASN1 migration_test_add("/migration/multifd/tcp/tls/x509/default-host", test_multifd_tcp_tls_x509_default_host); -- 2.49.0