From nobody Sat Nov 15 22:25: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=1746204260; cv=none; d=zohomail.com; s=zohoarc; b=E3a6Fw72w2YMCpovzKn4w9b5xhVKtBAVy2EncK3l+Jwx6fH1+95yFZoQzB9a0pY3zO3Kk25GhhjV+y+3UcNme95bZchPERMmIWvzv2NEyZ/GF6S9+CHYmkAiaH/muNJxjQv56cSkYUQ+UrY7poauWVwI0VKK9yhtGa17HrSwfRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204260; 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=9pnkzXpeaKPG6Ox9+z33hGrFEPUQdEVIPBVoCdXCEVQ=; b=PCGgej5LTRzge1zCIMZCYF0t4vWPcO7gBIFd193+A97CAj75Ert+QMAtwxxsPTUlxhqJz7Uuu39U+Fwmczg/6jnrY71XnABn8YU4SJ6tuMgUtndLdS/p7Sy5MJr68C69JwheL51JoAU8Spsa5s8jYCeZH7CmRvzlF9F3MLGQfJU= 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 1746204260524589.3425398101771; Fri, 2 May 2025 09:44:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSW-0007j5-Vr; Fri, 02 May 2025 12:41: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 1uAtST-0007dk-8X for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:53 -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 1uAtSP-0006Ql-Ov for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:53 -0400 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-690-g2yz11KcOW-IzCRSkEPpAA-1; Fri, 02 May 2025 12:41:48 -0400 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7c0a3ff7e81so395713485a.3 for ; Fri, 02 May 2025 09:41:48 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204109; 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=9pnkzXpeaKPG6Ox9+z33hGrFEPUQdEVIPBVoCdXCEVQ=; b=UQc1qnqsSQzvwr5B1hgoShjKwZuhZdkIJZGGA2e5gPIGijEy3WsEW88J7mTBWWrpZvNfpn jZAA/48ouNriu86zu9qe9XU5Qq9yTfh3aEax4B5nY/wwoHrIKKvP6AC1VngSnmX2VX+7Uj HgNUlooMmc4SJic9cvbwQNBV6cr8CSE= X-MC-Unique: g2yz11KcOW-IzCRSkEPpAA-1 X-Mimecast-MFC-AGG-ID: g2yz11KcOW-IzCRSkEPpAA_1746204107 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204107; x=1746808907; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9pnkzXpeaKPG6Ox9+z33hGrFEPUQdEVIPBVoCdXCEVQ=; b=MqCpjJNMbCfYlCwPD+KwpFDwhNd0CYKlbChEtF5YpcVZ1gFRIDMKLkhX3XdMJ7s+Wd bKtEYH5aBF7WpUwFJVFDqN6JxhhseV91iTwJTyGn4FpvrXSFwSVy+hnxdgYAtOg+omGo qvBwy7iLWo0FoRSoApiZoDC2OYawFTdDXJpLQWxbA1psbthwPL5Ydcp2gkl5BWasemO6 Hp55COcqbx6FoLAWf/Dwf1Wnfj2Bn/RU/+pJWl/VvYbqAFSg3DkNON6CX0P4Pj9jRqcF CVES4r9dXfYp0/NJVIAoiUtnHSF65gEQFBtPwLa/BBzRlChfEwm2gTL9pAMLn3vf714M EvLw== X-Gm-Message-State: AOJu0Yy8fkTjRBkTry63TTDOPl//iDAFp+a3mXhAsilJGjtta4+4dK3M VEHcPnOXlN7ZIyOEvQ7oqtNCI4VHNQ+Bcqy3iwaxYIHu8/VXCFWQ3Ah7ZrUeil0R8Qn//lMljJK h1jZUrxnj4/hStQUQTv4Sw+bDF5ekqFIhI1RFGApRKC7rozTppanX3e/+mfi4z1zNLfXJmJA7aD u+H7draWbu1ksNusq3RRNIm1BlduwW2Nh/Yw== X-Gm-Gg: ASbGncuvOW+9tZDvClxRZGm219me6Fylc5nR6u5IKyPEHAVQAsYpAv1OoZ+WBph+StX uQAPQ6i1MxgJEjZiwtowuwunF5qFKV9/5947hrzxT9YVL2Lv+viwXQm58elymsalJjSGQ9gs4C+ N9sZUTdSfvs5XobyaTRdTwC8GEEZty8Y2QdbfcSo345JqXjvL1EocrDMItDVzsQ2+mu2kHLJx/O YIXFmlJ9urvdBrLkCyFs9A158A564YDrkl16tuNHnz1xe7UkHjSDuB+IgU6vbrk5D/XAVKauiJf X-Received: by 2002:a05:620a:3708:b0:7c7:a614:7214 with SMTP id af79cd13be357-7cad5b2e1d3mr561914985a.5.1746204106800; Fri, 02 May 2025 09:41:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXXM/AI0yfy6HMeUvntalKHhg4ddS4pVx2PIBD/QE9ccJru6qYOey9GYC+BvKDBJ6iSxLNHA== X-Received: by 2002:a05:620a:3708:b0:7c7:a614:7214 with SMTP id af79cd13be357-7cad5b2e1d3mr561910885a.5.1746204106392; Fri, 02 May 2025 09:41:46 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Li Zhijian Subject: [PULL 01/14] migration: check RDMA and capabilities are compatible on both sides Date: Fri, 2 May 2025 12:41:28 -0400 Message-ID: <20250502164141.747202-2-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204261752019000 Content-Type: text/plain; charset="utf-8" From: Li Zhijian Depending on the order of starting RDMA and setting capability, they can be categorized into the following scenarios: Source: S1: [set capabilities] -> [Start RDMA outgoing] Destination: D1: [set capabilities] -> [Start RDMA incoming] D2: [Start RDMA incoming] -> [set capabilities] Previously, compatibility between RDMA and capabilities was verified only in scenario D1, potentially causing migration failures in other situations. For scenarios S1 and D1, we can seamlessly incorporate migration_transport_compatible() to address compatibility between channels and capabilities vs transport. For scenario D2, ensure compatibility within migrate_caps_check(). Reviewed-by: Peter Xu Signed-off-by: Li Zhijian Message-ID: <20250305062825.772629-3-lizhijian@fujitsu.com> Signed-off-by: Fabiano Rosas --- migration/options.h | 1 + migration/migration.c | 30 ++++++++++++++++++++---------- migration/options.c | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/migration/options.h b/migration/options.h index 762be4e641..82d839709e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -57,6 +57,7 @@ bool migrate_tls(void); =20 /* capabilities helpers */ =20 +bool migrate_rdma_caps_check(bool *caps, Error **errp); bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); =20 /* parameters */ diff --git a/migration/migration.c b/migration/migration.c index 55ec4bfab6..54fce997aa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -259,6 +259,24 @@ migration_channels_and_transport_compatible(MigrationA= ddress *addr, return true; } =20 +static bool +migration_capabilities_and_transport_compatible(MigrationAddress *addr, + Error **errp) +{ + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + return migrate_rdma_caps_check(migrate_get_current()->capabilities, + errp); + } + + return true; +} + +static bool migration_transport_compatible(MigrationAddress *addr, Error *= *errp) +{ + return migration_channels_and_transport_compatible(addr, errp) && + migration_capabilities_and_transport_compatible(addr, errp); +} + static gint page_request_addr_cmp(gconstpointer ap, gconstpointer bp) { uintptr_t a =3D (uintptr_t) ap, b =3D (uintptr_t) bp; @@ -750,7 +768,7 @@ static void qemu_start_incoming_migration(const char *u= ri, bool has_channels, } =20 /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(addr, errp)) { return; } =20 @@ -769,14 +787,6 @@ static void qemu_start_incoming_migration(const char *= uri, bool has_channels, } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - if (migrate_xbzrle()) { - error_setg(errp, "RDMA and XBZRLE can't be used together"); - return; - } - if (migrate_multifd()) { - error_setg(errp, "RDMA and multifd can't be used together"); - return; - } rdma_start_incoming_migration(&addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { @@ -2208,7 +2218,7 @@ void qmp_migrate(const char *uri, bool has_channels, } =20 /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(addr, errp)) { return; } =20 diff --git a/migration/options.c b/migration/options.c index b0ac2ea408..1f3602839d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -448,6 +448,20 @@ static bool migrate_incoming_started(void) return !!migration_incoming_get_current()->transport_data; } =20 +bool migrate_rdma_caps_check(bool *caps, Error **errp) +{ + if (caps[MIGRATION_CAPABILITY_XBZRLE]) { + error_setg(errp, "RDMA and XBZRLE can't be used together"); + return false; + } + if (caps[MIGRATION_CAPABILITY_MULTIFD]) { + error_setg(errp, "RDMA and multifd can't be used together"); + return false; + } + + return true; +} + /** * @migration_caps_check - check capability compatibility * @@ -611,6 +625,13 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) } } =20 + /* + * On destination side, check the cases that capability is being set + * after incoming thread has started. + */ + if (migrate_rdma() && !migrate_rdma_caps_check(new_caps, errp)) { + return false; + } return true; } =20 --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204252; cv=none; d=zohomail.com; s=zohoarc; b=QcQFvsa9T+DSPnHTg6b8csUdYJhMlsDhz7rr6XWIdIWsWRnOqIYj1PNgEpZyWUw7gSGCowIYptXSHnilB5HAV9I26hBN+l63qWUmW43V9/bszxgCqtGMFQ6Ig57LuJKe8T6NCBHfmXbBXLAlMf9VOgTE6u0jyp/QgmOZRqYJb6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204252; 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=YhEfo/crAEyxYhDSWP1l8LRwgjE5vzXQPMbrfXIzcrY=; b=AKrXXUIfekS/fDzy6IjrdAxEgrm+iNDyecWEGp6wd+eq0HpYFiXht7PBSLeUiVo8lhr9dmmRmwqcjKyNeVu6HqynWiiyMnqIIxId3FuV4olJPmKHxl/HbOcARGcIU606XNNlPjTU1L2Yp+LhO+ctRZbjqyBFKsjXdvGkqQKNnKg= 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 1746204252064860.3627173012364; Fri, 2 May 2025 09:44:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSV-0007eZ-8y; Fri, 02 May 2025 12:41:55 -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 1uAtST-0007dx-MS for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:53 -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 1uAtSR-0006R8-U3 for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:53 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-Ug5r5DfdMm2ROm0FPQIX7A-1; Fri, 02 May 2025 12:41:49 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c3c8f8ab79so342584585a.2 for ; Fri, 02 May 2025 09:41:49 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204110; 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=YhEfo/crAEyxYhDSWP1l8LRwgjE5vzXQPMbrfXIzcrY=; b=VXGprtUjKCUuMavORY1AI60jA9wLegbTdhafOaydeTXQ6uBlQ2IwjZOVZbFtl+rnJQcCde VFqXmbdmpRS+6BnEJG+W3QPjOddlRNSei6fv1AKLXl3VUJJUu4PQ8OilSjeYlGuNXK/Vqi 0a6WwRqxMGbaA8EPEdTgMgW/zMu4Ex0= X-MC-Unique: Ug5r5DfdMm2ROm0FPQIX7A-1 X-Mimecast-MFC-AGG-ID: Ug5r5DfdMm2ROm0FPQIX7A_1746204109 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204108; x=1746808908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YhEfo/crAEyxYhDSWP1l8LRwgjE5vzXQPMbrfXIzcrY=; b=ZF5srgpPMOqRIvVjjSU8/3llFXrxMikWyCyPuL2BdgJn3eTPavDXo4MhZDRijiuwLu GeU8l3mSrw5tzxNHPes1o5olZ6ADQqA0IyofuGoHHiMUHfmTLDis8psHd8/hosfFiP4P 5ExXpi6S/vNpXNrfqaUfD/KoJCxenVSbp9cPj4KtUqXS1Vdygi0MCn32+ZYq+StyUY2W pUtrG+cxtwLWJ6Kwp/RruCoxuClNVZFAas8nXUuGnwkHLIbeBx4Xtku/BKmXk1BTSWlK pB8ICCMnk4GGhdCuQH/rzeN0tZT/DYfa9ysduAyP0UJxEU96+wMg7Q9VosFv0CK1JHA4 8v4w== X-Gm-Message-State: AOJu0Yx1q2k5dtC2WJZzPeqNqeW1Y3k3jMdytfH1V4GCEzOe6KmKkhgL r0FNeMyeu1qJHwN386W/kU/mVzrCcmQqjB9cY7DU1iUom3ykf59645tTXcEwsiAoTwI2dFShw4E l9fFaQKvicEjGF17a3r/Dhzw8V2T/2+guFLxpGnqiGAwJPbzTPNH6LRCSJTymzcUst51R0L6BaO EO4zjP9wBEtQb/cvgXwr+2rU2PxWtxODiaFQ== X-Gm-Gg: ASbGncti/j/UBJjsZgvAulNP6x9hbRx810gayS97CCUZVG+d/9V+sWLsMnQfrNCECke JVf8yHkkSSiaTQ4PYM6Djx9LzIFUFIf592TCqQ9vrjMiCQcTIzUS8QX2wjp0wGkxeFgOZsN7P6+ NxkrDzRgW9KcOf9KwBETcUNAxSsz365sP8jkKBCBNecgGB+jK1ggOIgV9feI8dN8AYF/vWD/i2l 00Osmh8DbWyFFO+Z4bNZprGQgqU4e3Am+fHE+IE30abbsM1d/SL+yZWoLQ/lOx3xf342uByUHhb X-Received: by 2002:a05:620a:4111:b0:7c7:747f:89d0 with SMTP id af79cd13be357-7cad5b3e38cmr506280585a.18.1746204108477; Fri, 02 May 2025 09:41:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGs14xF8eu3NbGT/nPm0RNHfb80OXKRMVtgmQMULhElkPHy0CTxprx+fNpHHb2qr+h40WjWfw== X-Received: by 2002:a05:620a:4111:b0:7c7:747f:89d0 with SMTP id af79cd13be357-7cad5b3e38cmr506277785a.18.1746204108152; Fri, 02 May 2025 09:41:48 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Li Zhijian Subject: [PULL 02/14] migration: disable RDMA + postcopy-ram Date: Fri, 2 May 2025 12:41:29 -0400 Message-ID: <20250502164141.747202-3-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204252368116600 Content-Type: text/plain; charset="utf-8" From: Li Zhijian It's believed that RDMA + postcopy-ram has been broken for a while. Rather than spending time re-enabling it, let's simply disable it as a trade-off. Reviewed-by: Peter Xu Signed-off-by: Li Zhijian Message-ID: <20250305062825.772629-4-lizhijian@fujitsu.com> Signed-off-by: Fabiano Rosas --- migration/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/options.c b/migration/options.c index 1f3602839d..4ba8fcb7dc 100644 --- a/migration/options.c +++ b/migration/options.c @@ -458,6 +458,10 @@ bool migrate_rdma_caps_check(bool *caps, Error **errp) error_setg(errp, "RDMA and multifd can't be used together"); return false; } + if (caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + error_setg(errp, "RDMA and postcopy-ram can't be used together"); + return false; + } =20 return true; } --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204135; cv=none; d=zohomail.com; s=zohoarc; b=JXaMq/HgPRvMwGJQrUp1mJuOcCkP2cb0SQjUlUYGu0hbKD0tKD/A0Yt4Am6JcQcf3ZGNCUs6mIXHyIVLl3QmBlNCmJ1IiOQK5C0VdDB4aCp1wq4YeWywUwWuuf5MFDT4F5NBsj6Dqakbf1jmEbVMaaZ6+Qx5S5eIMaxIm6TeKPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204135; 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=F2w7J9EqC67G+9BHMZMRooN71UtnTrILiK+wTczOjWk=; b=J0M8NnIV9YTCqLY647zyBCzguq0zs+b34YhpITS9Qu0ykYGsNiC58Ee73ltN6/1egRCqfcUBK2LHSCsWbDabcjHhLRtrP8359g1taxN5FbZ3wbCMMWsEphtoYs8EOjDoDlFBctNvnD2rEMdHefRrNjDCza8NJlSIWdBc3N59MVk= 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 1746204135961847.7234238238797; Fri, 2 May 2025 09:42:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSY-0007kc-5J; Fri, 02 May 2025 12:41:58 -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 1uAtSV-0007i0-Uk for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:55 -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 1uAtSU-0006Rg-AT for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:55 -0400 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-360-zHbJUoh4OvqUp8UbT32vBw-1; Fri, 02 May 2025 12:41:51 -0400 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7c7c30d8986so756448785a.2 for ; Fri, 02 May 2025 09:41:51 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204113; 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=F2w7J9EqC67G+9BHMZMRooN71UtnTrILiK+wTczOjWk=; b=DdU+Sa8IuAjv7vu0LbITXv9eayOhLoPCEKByx7P54d22L9nwZh3TuEkULW+K4/REWn7j3H sKNEbTc7T3+7TzPanVGnfzbjDCL2d8DV0gpYqEswdBJDWlcn3LxN+rzlY7aJo9lSV4Pfx1 ANOyDix0IKUgdIfN7kMb7JUn65bk8iU= X-MC-Unique: zHbJUoh4OvqUp8UbT32vBw-1 X-Mimecast-MFC-AGG-ID: zHbJUoh4OvqUp8UbT32vBw_1746204110 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204110; x=1746808910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F2w7J9EqC67G+9BHMZMRooN71UtnTrILiK+wTczOjWk=; b=KmaQ5yEt+dy+5UTztUD9XVgW+sdJkUw2PmCFHpK+0mJb5ULq1jX3cR+E2Ez9qa+gxj DYTNauseyUCMn9wNA+0vcG9ukco87zZULRlpmayM8nj0nZGsYlCc+vkQBm2+Ezyc/noY bqtyJBsIKTm9R3+cJd000z4HphqJNS/v1aIc6ZCQ9deGUM2spxWaJZty8hjVq4Q3a9Yy QIYafCy0vLW4TO1WX6HmlKQkNC7K8hyojEOQU3m2+mj31xmAjrgGOPA/40aiVWJ15d2L InqbmPXkm5muGP68ERIgyamLZJOQigD25+vGJmlu7e+SgK1gY7y57+huyrn4Ju/tJquf Cmhw== X-Gm-Message-State: AOJu0Yz4Fe2YzUwZF5clRoqnWukHTTBbbR03kRP6S+61GfsFSgWGiy24 ig7oQypbBzz1Vi3bmWVJCiS2ccabHFBHkDYjWWKmA2EuJvFb28FT3UbqnVlVxrhyU+r9E6UOh28 AnOiPDPDeoWN02mkNpWpZDsySys5h4TPtVFu3lm8iW6xkWCBWui8HKFzcA3Xd46b7na5weGQZWk P6KiynjgE4ugySycUIci4+UHaCp+ttfT66bw== X-Gm-Gg: ASbGnctagsJLUZsXv5ucAzrpUbvcMuLIZ8eVu5e12krq59aWVZUnyRIF2BDzQ1JKxAt Pbn1cjBZJaTlK0ouxEYscG+/VoeFfA3isiXf/IkKy4UpRZmiy6QtLcF/3NOK/q5d1o06CCGUNhB DTbeDDUgTwyb37Eu9lKVEb1+P4Aysd9XgI1f3VEa3rD5UCSuO3PQasrl/vsyzRWlYoVLGYX82/O FBJGnnosLg+A5uXqi5Yp02OXGs7ruppGTYs1714//lfbUwKrq4lSHwZxZrzW6uINK3WwAipPccM X-Received: by 2002:a05:620a:29d0:b0:7c5:3e22:616f with SMTP id af79cd13be357-7cad5b3aca9mr422485485a.21.1746204109929; Fri, 02 May 2025 09:41:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLG6KOxlhYX4nJwSCFnpwLZE/HGeQlxQfZXsadeTGZCSqzpd/RunT6dYXb73DAqI5itkVVeg== X-Received: by 2002:a05:620a:29d0:b0:7c5:3e22:616f with SMTP id af79cd13be357-7cad5b3aca9mr422482985a.21.1746204109609; Fri, 02 May 2025 09:41:49 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Li Zhijian Subject: [PULL 03/14] migration/rdma: Remove redundant migration_in_postcopy checks Date: Fri, 2 May 2025 12:41:30 -0400 Message-ID: <20250502164141.747202-4-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204137377019000 Content-Type: text/plain; charset="utf-8" From: Li Zhijian Since we have disabled RDMA + postcopy, it's safe to remove the migration_in_postcopy() that follows the migrate_rdma(). Reviewed-by: Peter Xu Signed-off-by: Li Zhijian Message-ID: <20250305062825.772629-5-lizhijian@fujitsu.com> Signed-off-by: Fabiano Rosas --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index b31652baac..a3c3b432d1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3284,7 +3284,7 @@ err: int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - if (!migrate_rdma() || migration_in_postcopy()) { + if (!migrate_rdma()) { return RAM_SAVE_CONTROL_NOT_SUPP; } =20 @@ -3829,7 +3829,7 @@ int rdma_block_notification_handle(QEMUFile *f, const= char *name) =20 int rdma_registration_start(QEMUFile *f, uint64_t flags) { - if (!migrate_rdma() || migration_in_postcopy()) { + if (!migrate_rdma()) { return 0; } =20 @@ -3861,7 +3861,7 @@ int rdma_registration_stop(QEMUFile *f, uint64_t flag= s) RDMAControlHeader head =3D { .len =3D 0, .repeat =3D 1 }; int ret; =20 - if (!migrate_rdma() || migration_in_postcopy()) { + if (!migrate_rdma()) { return 0; } =20 --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204268; cv=none; d=zohomail.com; s=zohoarc; b=FhnCu0mCMVH1LSVAB4+fbxg3WpYhBB/h2So4eqXlry7H0z3JoxR0tLT83w/7GV7uvZnWxIwbRmZGiVHauYlWPZ8rTVYzszTAHcF4G3Yzx1k2fnrR9z5nl2kJr9DPoHZ7/vMSAMx92Q7p3PEnloNCycpHHrknEP3x0C1ML8MIfws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204268; 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=W/uc90W1ZOpsuuSkhOtgbizEm4VdHuE1qRbVF1rMbXw=; b=inM6Q9C95vqHQx9KLK+bh5aJ9cscIHsrY9btu8QKEh25c6oVpsaxZ+ND4VEnYqzSyGy0PPSZMJbeP6dddqVpw+tmp0bfPM7E5ixhWpJmYfQQWsu5/7cqRQTDKWlP0AvPcAGBoR9Y1YHX633cQhIxyaIdyag/wrTfsGzh9rZDD+I= 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 1746204268770141.77174342847627; Fri, 2 May 2025 09:44:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSX-0007ji-9D; Fri, 02 May 2025 12:41: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 1uAtSV-0007gL-LR for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:55 -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 1uAtST-0006RZ-Ug for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:55 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-1rUQA3y2MWam9lfPXZo_Ww-1; Fri, 02 May 2025 12:41:52 -0400 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7c955be751aso384372885a.2 for ; Fri, 02 May 2025 09:41:52 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204113; 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=W/uc90W1ZOpsuuSkhOtgbizEm4VdHuE1qRbVF1rMbXw=; b=N8fnE0TeAqsKklvE06heR/qegGnJeDk0plmLWDLh7/1h9a7gWAG2vNKlmvH9UaMxowz6r/ f0uAoJO7qz6EgC1Hdrj4mYXcamKtlRHn2gw/+Lr80fyNf5sXHnE3pf4qHsJFkZ3l2aB6Hw vAhnFlOeiAEHtQvNMAH881MajdF1bo8= X-MC-Unique: 1rUQA3y2MWam9lfPXZo_Ww-1 X-Mimecast-MFC-AGG-ID: 1rUQA3y2MWam9lfPXZo_Ww_1746204112 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204111; x=1746808911; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/uc90W1ZOpsuuSkhOtgbizEm4VdHuE1qRbVF1rMbXw=; b=Vu6OGCpGFm+M0S2FQl0LY37cSeKjiDOushc1GB2AQWN09K2DOOy6sMwRHKRshpnZUX gBxCfOOUYASbtsb6WhgX/eyQhqItar6FubbcoH2SWebYyaniI42e55+05kD+zKHwN5IQ KPl39zvOirk0Q2eFOfwt8RatJRU21ybO7qLxsacl1x2pqFo+nyIByacdEFZLSsmyWH22 hlnqYL45MGOcqJwKqQEDefVYbRhkmFct3Bt1OZ1V9MFOqHT9uGFUuftxDibPsFo0kIvm 0CGjSepZQIVxzFRWD9GFx7RBrb9n29gFUjsJ55nUqU9iqudDFQn8kto2hLrezyN94AX+ 5fCw== X-Gm-Message-State: AOJu0YwPL3Mm2FePLtw+YYUwvKf2r7UrWohe3rFeoLz7h8y8x0ltT0yJ 8sYsKUJGFdnRXOKVdWxxXJE91Q7fO5lkV4etf0OHYzb1U8twe++Dzna7KUA6oX0M/8f527sHKed O47NsBqS6iyV3Jj0RamWQLH+o9CZRrySsI/Bl/UXIOraU0y8RabAGAITTdit1HOyJqX3FmZDPdQ OwuMb53xBq0jfmotlnO1CMaq7clPg6a/pjtw== X-Gm-Gg: ASbGncve8HII6wObv5lsc1Qz7xQP4Rh28bknnvj9DZvNi/w/XX1F8r0SqEtVE13A06o Xp6JhWZWxOwagSDhRA2IZn8/qYWYldYU2UogsJmTFXw098PuExlSKFvbHNXTeq2ptWTuzCTHpLC Bpk6HkGrYm6JjEhWUdR3j0sFQYLXXMOxvaPDHTyPge2NLXHLBaP3ymTc45YtlSDA4YpM7Oaf8dm FUiRyzJ7MPXKrTShGk7VK181sFuRt+PSpcZs2C5f77orYgP2uF8G+Zar1VwOyERbcWGzmR94FY4 X-Received: by 2002:a05:620a:298d:b0:7c9:1335:633e with SMTP id af79cd13be357-7cad5b207f1mr564693585a.1.1746204111420; Fri, 02 May 2025 09:41:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdVjNTrsVg/SSGiIlfRGbkN/TRTZ6uH8WnIpfir49uoYTt7qJIzCY9WxX5j6ts+DRCHoBMlw== X-Received: by 2002:a05:620a:298d:b0:7c9:1335:633e with SMTP id af79cd13be357-7cad5b207f1mr564689485a.1.1746204111052; Fri, 02 May 2025 09:41:51 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Li Zhijian Subject: [PULL 04/14] migration: Unfold control_save_page() Date: Fri, 2 May 2025 12:41:31 -0400 Message-ID: <20250502164141.747202-5-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204270667116600 Content-Type: text/plain; charset="utf-8" From: Li Zhijian control_save_page() is for RDMA only, unfold it to make the code more clear. In addition: - Similar to other branches style in ram_save_target_page(), involve RDMA only if the condition 'migrate_rdma()' is true. - Further simplify the code by removing the RAM_SAVE_CONTROL_NOT_SUPP. Reviewed-by: Peter Xu Signed-off-by: Li Zhijian Message-ID: <20250305062825.772629-6-lizhijian@fujitsu.com> Signed-off-by: Fabiano Rosas --- migration/rdma.h | 3 +-- migration/ram.c | 34 +++++++--------------------------- migration/rdma.c | 7 ++----- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/migration/rdma.h b/migration/rdma.h index 4d3386b84a..f74f16a459 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -33,7 +33,6 @@ void rdma_start_incoming_migration(InetSocketAddress *hos= t_port, Error **errp); #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 =20 -#define RAM_SAVE_CONTROL_NOT_SUPP -1000 #define RAM_SAVE_CONTROL_DELAYED -2000 =20 #ifdef CONFIG_RDMA @@ -56,7 +55,7 @@ static inline int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - return RAM_SAVE_CONTROL_NOT_SUPP; + g_assert_not_reached(); } #endif #endif diff --git a/migration/ram.c b/migration/ram.c index cb8b2ed493..1181a99cf6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1143,32 +1143,6 @@ static int save_zero_page(RAMState *rs, PageSearchSt= atus *pss, return len; } =20 -/* - * @pages: the number of pages written by the control path, - * < 0 - error - * > 0 - number of pages written - * - * Return true if the pages has been saved, otherwise false is returned. - */ -static bool control_save_page(PageSearchStatus *pss, - ram_addr_t offset, int *pages) -{ - int ret; - - ret =3D rdma_control_save_page(pss->pss_channel, pss->block->offset, o= ffset, - TARGET_PAGE_SIZE); - if (ret =3D=3D RAM_SAVE_CONTROL_NOT_SUPP) { - return false; - } - - if (ret =3D=3D RAM_SAVE_CONTROL_DELAYED) { - *pages =3D 1; - return true; - } - *pages =3D ret; - return true; -} - /* * directly send the page to the stream * @@ -1965,7 +1939,13 @@ static int ram_save_target_page(RAMState *rs, PageSe= archStatus *pss) int res; =20 /* Hand over to RDMA first */ - if (control_save_page(pss, offset, &res)) { + if (migrate_rdma()) { + res =3D rdma_control_save_page(pss->pss_channel, pss->block->offse= t, + offset, TARGET_PAGE_SIZE); + + if (res =3D=3D RAM_SAVE_CONTROL_DELAYED) { + res =3D 1; + } return res; } =20 diff --git a/migration/rdma.c b/migration/rdma.c index a3c3b432d1..4875ca1987 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3284,14 +3284,11 @@ err: int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - if (!migrate_rdma()) { - return RAM_SAVE_CONTROL_NOT_SUPP; - } + assert(migrate_rdma()); =20 int ret =3D qemu_rdma_save_page(f, block_offset, offset, size); =20 - if (ret !=3D RAM_SAVE_CONTROL_DELAYED && - ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { + if (ret !=3D RAM_SAVE_CONTROL_DELAYED) { if (ret < 0) { qemu_file_set_error(f, ret); } --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204236; cv=none; d=zohomail.com; s=zohoarc; b=Vm2X7v5BfJTmvl3WIU57CrmWaEVICEK3Qx5DCWo8WjekYmGNUtxc0aXWFxvM93tu4mpIhpxOnJzWtPi6x+hNhzMmxQzn8+ZhXM/qHqQ7qpG5HnillXiOsB3j2uJa4tOk5zAOzb46M5K6jCBGgBIhcy5Lg+Z6KKOilflgha6qgp0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204236; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OGqTxK8VkxjZdabvpw9weeNFfQPKj3cmubMFJOmZiMc=; b=iK91220ywTgKMI+Gp2dUmidliWdeAEv8EA45QYWFcMvb2aS8TxO7OR+/meM67gJNMyS2aql3hKf37Qu41KX1V/8QzXbDK7Tu5F/24ZvG1WpO6sWkdbMtX7qg7bFDP/VLmAPybRmnLV25XbKqoapd7LNJ12jVS7YrFt+v1zXzZiA= 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 1746204236325591.5453752584021; Fri, 2 May 2025 09:43:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSb-0007mD-5F; Fri, 02 May 2025 12:42:01 -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 1uAtSY-0007l6-AX for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSW-0006Ry-4a for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:58 -0400 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-gACs0j0XPre2c-Vu6Jnm4Q-1; Fri, 02 May 2025 12:41:53 -0400 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7c53e316734so374560385a.2 for ; Fri, 02 May 2025 09:41:53 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204114; 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=OGqTxK8VkxjZdabvpw9weeNFfQPKj3cmubMFJOmZiMc=; b=F6N30hxzbq9213TDKoqVbs+KeCcxjtlg0xg9hBnDSqUDJPcW+XBe5x89/doWkL2r/VVQK+ gxhUgRXg6OsLem1otHkbsxeY9mGeOtViYAK6qVleVrcDfsCuHCGLSPnBMZd+CpM9bFRIL8 QBTvMVfXj0SsQIbuuN7TttETe4Z4Q+Y= X-MC-Unique: gACs0j0XPre2c-Vu6Jnm4Q-1 X-Mimecast-MFC-AGG-ID: gACs0j0XPre2c-Vu6Jnm4Q_1746204113 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204112; x=1746808912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OGqTxK8VkxjZdabvpw9weeNFfQPKj3cmubMFJOmZiMc=; b=K5SL+obf1FusYQxbvnqerX2s+q1p9p6En0v/jHaaqHkMA8K8XMKHsSLNxnRDy1By/F WtdkgmeqWAae+46hKPDV2sbDmMf1Bj7y8Kn3zITlTIYhBoXk0ZDo7IESXSEgG3RX/GrZ KkQFRW2gXNz+ado2GlcsKRFr4r4P1i/HCwn2XV+WoXa7mRgtvoAeJRGpvEdzkuzu+eyI 9zHXvLY32Uz9XBKVSBBPqugn/ThADsC9/O7ELLAAbJlfa9BUNatdc5OPHUreyV4509GC 74xhmWWrTHSEJu13aVVWUsdp+u1P1jeXjUKjcdD/ay3sxMnQAiqL8pYv4R81TlvYCLP0 3MRw== X-Gm-Message-State: AOJu0YxltmEwEPv65CrEG5i3ermFdiWZPLA08Bv0+ExapV1MhB06dO1s HQmMFFqBWy5xDcoTy4vpNbhGSYyjeA6F6u/Zku4dj63rS71SbMRkWKqo0/M1Xb4Ky4SdwBaoWes 36nr7o6bdS3jJdJOpjLAxDDf4DQeQrMZI6rnExRJlc/d9KWPTEjIsvQtGghjt5ua90OptIAXs41 7M431htQtLaApTO2l8BeJAlxktpv3xld+Tig== X-Gm-Gg: ASbGncvRPRVfd1bPYHqNNbQi4jgO1nTRk+mll/ZxWjlhILS+W7GY8Isv7v8xaljtfVo XWgu2M4im7dhLOXO0StFiUvMTKoCShPnhKwQOMsgxp25JSz/oRqH4BdpR6Pw8bFWLR6lwqTsoGi O4MPRsX+xlxgn34wQ3FQ3WF0EuQDMo96aTR3d42VoZZ7tQ13I/OuDcFUirKuKqad/aokH6UP9qz g+c6ejc7lb/6eQdYRD7H5thHjQYvg0wk2TUd1cwOP1sJRdUMWvn7Pimql3csDwQzq0PbdtYF7TO X-Received: by 2002:a05:620a:172b:b0:7c7:a62f:341b with SMTP id af79cd13be357-7cad5b2e160mr502783385a.8.1746204112645; Fri, 02 May 2025 09:41:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFb/VtIAKGfw9Yb3Z7+cxJmnOHHz7emruv0lZSHQxIIu4tFew5jLm9hIf0E1T6YeqbKyF1iwg== X-Received: by 2002:a05:620a:172b:b0:7c7:a62f:341b with SMTP id af79cd13be357-7cad5b2e160mr502779885a.8.1746204112276; Fri, 02 May 2025 09:41:52 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Li Zhijian , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi Subject: [PULL 05/14] migration: Add qtest for migration over RDMA Date: Fri, 2 May 2025 12:41:32 -0400 Message-ID: <20250502164141.747202-6-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204238367116600 From: Li Zhijian This qtest requires there is a RDMA(RoCE) link in the host. In order to make the test work smoothly, introduce a scripts/rdma-migration-helper.sh to detect existing RoCE link before running the test. Test will be skipped if there is no available RoCE link. # Start of rdma tests # Running /x86_64/migration/precopy/rdma/plain ok 1 /x86_64/migration/precopy/rdma/plain # SKIP No rdma link available # To enable the test: # Run 'scripts/rdma-migration-helper.sh setup' with root to setup a new rd= ma/rxe link and rerun the test # Optional: run 'scripts/rdma-migration-helper.sh clean' to revert the 'se= tup' # End of rdma tests Cc: Philippe Mathieu-Daud=C3=A9 Cc: Stefan Hajnoczi Reviewed-by: Peter Xu Signed-off-by: Li Zhijian Message-ID: <20250311024221.363421-1-lizhijian@fujitsu.com> [add 'head -1' to script, reformat test message] Signed-off-by: Fabiano Rosas --- MAINTAINERS | 1 + tests/qtest/migration/precopy-tests.c | 66 +++++++++++++++++++++++++ scripts/rdma-migration-helper.sh | 70 +++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100755 scripts/rdma-migration-helper.sh diff --git a/MAINTAINERS b/MAINTAINERS index b3f9f2680b..8cd96269b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3538,6 +3538,7 @@ R: Li Zhijian R: Peter Xu S: Odd Fixes F: migration/rdma* +F: scripts/rdma-migration-helper.sh =20 Migration dirty limit and dirty page rate M: Hyman Huang diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index ba273d10b9..565630dddf 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -99,6 +99,68 @@ static void test_precopy_unix_dirty_ring(void) test_precopy_common(&args); } =20 +#ifdef CONFIG_RDMA + +#define RDMA_MIGRATION_HELPER "scripts/rdma-migration-helper.sh" +static int new_rdma_link(char *buffer) +{ + char cmd[256]; + bool verbose =3D g_getenv("QTEST_LOG"); + + snprintf(cmd, sizeof(cmd), "%s detect %s", RDMA_MIGRATION_HELPER, + verbose ? "" : "2>/dev/null"); + + FILE *pipe =3D popen(cmd, "r"); + if (pipe =3D=3D NULL) { + perror("Failed to run script"); + return -1; + } + + int idx =3D 0; + while (fgets(buffer + idx, 128 - idx, pipe) !=3D NULL) { + idx +=3D strlen(buffer); + } + + int status =3D pclose(pipe); + if (status =3D=3D -1) { + perror("Error reported by pclose()"); + return -1; + } else if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } + + return -1; +} + +static void test_precopy_rdma_plain(void) +{ + char buffer[128] =3D {}; + + if (new_rdma_link(buffer)) { + g_test_skip("No rdma link available\n" + "# To enable the test:\n" + "# Run \'" RDMA_MIGRATION_HELPER " setup\' with root t= o " + "setup a new rdma/rxe link and rerun the test\n" + "# Optional: run 'scripts/rdma-migration-helper.sh cle= an' " + "to revert the 'setup'"); + return; + } + + /* + * TODO: query a free port instead of hard code. + * 29200=3D('R'+'D'+'M'+'A')*100 + **/ + g_autofree char *uri =3D g_strdup_printf("rdma:%s:29200", buffer); + + MigrateCommon args =3D { + .listen_uri =3D uri, + .connect_uri =3D uri, + }; + + test_precopy_common(&args); +} +#endif + static void test_precopy_tcp_plain(void) { MigrateCommon args =3D { @@ -1124,6 +1186,10 @@ static void migration_test_add_precopy_smoke(Migrati= onTestEnv *env) test_multifd_tcp_uri_none); migration_test_add("/migration/multifd/tcp/plain/cancel", test_multifd_tcp_cancel); +#ifdef CONFIG_RDMA + migration_test_add("/migration/precopy/rdma/plain", + test_precopy_rdma_plain); +#endif } =20 void migration_test_add_precopy(MigrationTestEnv *env) diff --git a/scripts/rdma-migration-helper.sh b/scripts/rdma-migration-help= er.sh new file mode 100755 index 0000000000..a39f2fb0e5 --- /dev/null +++ b/scripts/rdma-migration-helper.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Copied from blktests +get_ipv4_addr() +{ + ip -4 -o addr show dev "$1" | + sed -n 's/.*[[:blank:]]inet[[:blank:]]*\([^[:blank:]/]*\).*/\1/p' | + head -1 | tr -d '\n' +} + +# existing rdma interfaces +rdma_interfaces() +{ + rdma link show | sed -nE 's/^link .* netdev ([^ ]+).*$/\1 /p' +} + +# existing valid ipv4 interfaces +ipv4_interfaces() +{ + ip -o addr show | awk '/inet / {print $2}' | grep -v -w lo +} + +rdma_rxe_detect() +{ + for r in $(rdma_interfaces) + do + ipv4_interfaces | grep -qw $r && get_ipv4_addr $r && return + done + + return 1 +} + +rdma_rxe_setup() +{ + for i in $(ipv4_interfaces) + do + rdma_interfaces | grep -qw $i && continue + rdma link add "${i}_rxe" type rxe netdev "$i" && { + echo "Setup new rdma/rxe ${i}_rxe for $i with $(get_ipv4_addr = $i)" + return + } + done + + echo "Failed to setup any new rdma/rxe link" >&2 + return 1 +} + +rdma_rxe_clean() +{ + modprobe -r rdma_rxe +} + +operation=3D${1:-detect} + +command -v rdma >/dev/null || { + echo "Command 'rdma' is not available, please install it first." >&2 + exit 1 +} + +if [ "$operation" =3D=3D "setup" ] || [ "$operation" =3D=3D "clean" ]; then + [ "$UID" =3D=3D 0 ] || { + echo "Root privilege is required to setup/clean a rdma/rxe link" >= &2 + exit 1 + } + rdma_rxe_"$operation" +elif [ "$operation" =3D=3D "detect" ]; then + rdma_rxe_detect +else + echo "Usage: $0 [setup | detect | clean]" +fi --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204230; cv=none; d=zohomail.com; s=zohoarc; b=NORAjDnOLCONv3SORsmc2854HfBNKUhHlh9zDbrJWB8vEgbrh2eds4Yw3ymGMZeXfA178EBd0Jc9uw9UJVMoOj5iLTskBC5ElVpkWFK1aybSDBdiEFpjbqY5W6McbuNliSiYkbs285HhA+BmZG6pOAX2dwXVjud+AlTWS2aKPX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204230; 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=J05uCZYDooQWqsbggSNOzykE/w3MbifuSvd/nUion5w=; b=nNBvJZuZfan5acEncwPkPxRK4jtjubRejrmuZf98CRQAnY2+66XBZWJg+KLvXZV56m3yTxHmvcuDMARHtAx4H6GThQ4nzakAlIL55szsOAD5Vn7QhZwOWaUwTa/eHf1m/sDB85LOPOWIVi9XyUD600/id25m+iZ12ISWM5HJblI= 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 174620423082330.579630497549715; Fri, 2 May 2025 09:43:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSm-0007nI-6h; Fri, 02 May 2025 12:42:16 -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 1uAtSZ-0007le-Go for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSX-0006SM-1z for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:59 -0400 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-261-J-ORlkNONIi7p3gzv8QRGQ-1; Fri, 02 May 2025 12:41:55 -0400 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7c3c8f8ab79so342594285a.2 for ; Fri, 02 May 2025 09:41:55 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204116; 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=J05uCZYDooQWqsbggSNOzykE/w3MbifuSvd/nUion5w=; b=L6upVX471uAtHmAlbsPFUh7b/nW5WfyhyHHGOgAxtm7PauABGgImfGpEbHkM2F3YNDqOui CQ2GmViEWEW1FPOT7mTsnEjbkaXTcpLkR7K/8yYkrzRgl71HDKjvnc0KxNNk+oax9Vr2xS Fne9ZAo6eUJLRzhrf5fKKd6GuUmwOdY= X-MC-Unique: J-ORlkNONIi7p3gzv8QRGQ-1 X-Mimecast-MFC-AGG-ID: J-ORlkNONIi7p3gzv8QRGQ_1746204114 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204114; x=1746808914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J05uCZYDooQWqsbggSNOzykE/w3MbifuSvd/nUion5w=; b=UcbrH4DjMUr0s09oaYjadmIKx5ZUs2eBJEk4xSLlP0RL4j/Kpk48NqhuXaJDjN9xWs itCEiLBcIFf115Sj2/GR+FSO/MjJQL4s5IxasdFdzHJgjjxIN2Ap5BK0r8BlwZ740/+Y tREEFpGk0N3w/09nVKxtnTuEkwg9+epzu5Rf93PXFZ9HbFx7oXdV/L+KEw434iw3Kftb ydGSlneEf6zTVog8RrLln1RQxB6weEDcVC0OjfHh3DOKtwV6OZad0CvlnBksXdUj7Srj bjMvFnSi2etMe+xziFvZAQzXm0XqTc37eBvr7YfF4Nq3lpUsHFF7WYvB2PaAc9dY9bGF vF4A== X-Gm-Message-State: AOJu0YypcVWI/zWu8hzCEV9N9Ajko2HyZ6Q3o+Ba4ao1h4bqOw6Re6xy hSUty89jYeg5jpSJrGVSNxfWz093+cNO7sI8cBc8Dc70/QbRQLddkVAp1ecGCE/ctibdEQGmDWm +gKC2qx4WK7TezD//4xhjSpAfcxTMvwcnyPXRscsJdcn2mLhvZmRXUC58Bg4PVrJeMXB/Pg5PuH a2fN0cJxb5FY27w+MFN2QXDRPtKphnWwlgnA== X-Gm-Gg: ASbGncsU7J3UG3dYv6um7dRBzzgbEopuT0P8COfutIcmP+g2b+u5ruHjuTZ2MjJ0EBz LXJ5LQ9J7/8ft4mSF0RxhcYtndl12i0D32grbfnuCr016CCVyae+oLJDYwEHidrqGep96noIuzL ttCCQB2g/BP5hJ1Qxbi8id+wsCgLfJYIabJ2yAC5MoQmGIY+ioJVvSWlhYtE561D5FHdAU0i9jS kLi3/09EAdpm05eCrhbg6ZVPAnFcdGwcLxcrm6SO/Gb0UyYs+nQlN2U2sliVJaUbNmAlwbyxa9E X-Received: by 2002:a05:620a:29c3:b0:7c5:431f:f5e6 with SMTP id af79cd13be357-7cad5b572acmr414524585a.33.1746204114151; Fri, 02 May 2025 09:41:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFk6jQN/lf01rwuuCQGSrGrpAF221ei7p3mtGsZOyPkRfHNVy0q1akVQjyFJ6mitVp7T+0VmA== X-Received: by 2002:a05:620a:29c3:b0:7c5:431f:f5e6 with SMTP id af79cd13be357-7cad5b572acmr414521785a.33.1746204113817; Fri, 02 May 2025 09:41:53 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Markus Armbruster Subject: [PULL 06/14] migration: Fix latent bug in migrate_params_test_apply() Date: Fri, 2 May 2025 12:41:33 -0400 Message-ID: <20250502164141.747202-7-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204231537019000 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster migrate_params_test_apply() neglects to apply tls_authz. Currently harmless, because migrate_params_check() doesn't care. Fix it anyway. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Message-ID: <20250407072833.2118928-1-armbru@redhat.com> Signed-off-by: Fabiano Rosas --- migration/options.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/migration/options.c b/migration/options.c index 4ba8fcb7dc..b6ae95358d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1218,6 +1218,11 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, dest->tls_hostname =3D params->tls_hostname->u.s; } =20 + if (params->tls_authz) { + assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); + dest->tls_authz =3D params->tls_authz->u.s; + } + if (params->has_max_bandwidth) { dest->max_bandwidth =3D params->max_bandwidth; } --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204178; cv=none; d=zohomail.com; s=zohoarc; b=T/W0VXTqA3JxMioz06qCd7QXX81AXRVdywc6zdpFzmi+0aH61ZKuDFKOdntMFo3tPhlleCr4O4uO7XWOkXZ/h4a8ak/RqveCYSzhJ5nhpor4HGlAHPe5oeI1eTBozONYS6/ggkLQwx4f08tKBvuRZNNJ0M5DsoMRPf/dsGCBWsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204178; 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=A91K2f2iEcFS5/0lCkwRRzKMl7iUbP8Kzhy9MSsjHe0=; b=YaEX7YpKcVv425m1Qb3jfsoqrVpYZ1IWoBgsgZAtEEAeZqvK1Ggoz8GP+Ihd/mi7VLzBag5kZLpc3p2JwMTrVrrNRzU0+ezwLunVWtd+qEypWv+mEcWq8yf5C7YhiuYMQL97MxLoIxlti9rjojnu/0hsRRtttNUWL5mjuwIrcPk= 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 1746204178867222.64216585414613; Fri, 2 May 2025 09:42:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSc-0007mZ-Bh; Fri, 02 May 2025 12:42:02 -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 1uAtSZ-0007lf-Qv for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:00 -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 1uAtSY-0006SV-7z for qemu-devel@nongnu.org; Fri, 02 May 2025 12:41:59 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-KXbdbyu2MaeOIb_9feuGFQ-1; Fri, 02 May 2025 12:41:56 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c0a3ff7e81so395722385a.3 for ; Fri, 02 May 2025 09:41:56 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204117; 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=A91K2f2iEcFS5/0lCkwRRzKMl7iUbP8Kzhy9MSsjHe0=; b=aZ5Hw3NQS3QyNWUFedF++b7tcgi4y5usCG0IZYhm+jyCYK0Tr3ufue8tfqsXIQdVZNNPQZ Hy9rkirmP/2i6aWesZg+remo+hAF7PDoPhXAxulg1QpNhXfDoEqe+8SUtKD6pV8M3Q4OuG JiGFFrh4c2xwatuXnV8KNQdYMdshyIY= X-MC-Unique: KXbdbyu2MaeOIb_9feuGFQ-1 X-Mimecast-MFC-AGG-ID: KXbdbyu2MaeOIb_9feuGFQ_1746204116 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204115; x=1746808915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A91K2f2iEcFS5/0lCkwRRzKMl7iUbP8Kzhy9MSsjHe0=; b=aFJlo/PcUqEbclYrP7ot4E8CM4G2Nw1XPRAE2x+p1t9CzOZ4oNtEkAuW7KmBeHB3sV LXTk6037sx5ehO2G5Mo0umGjk2dkgzt/j0m8AoCO7fLe4V9lGU56I5Cnslt5eaz+BMKh 5t8IZo2a+SUQVZMvT+1KsAt2Ad/guRrf1W9ZOH9Cdrir7yp3M0nhSV+qcKTTjUc2e5jn 1Kt2MsjDnH17zU05z/NyDoY4KbKb6K5mUYnWl5LDOBitfoHqHQ+DdQMcEEW2W4u51WYl 4slwMFU2lrSipV32Gs1VOgnYZyMSwuw6/fo92AxTYDmhzThIbRvl3Gx5AkNCDoBq6Ui3 239g== X-Gm-Message-State: AOJu0YwhIv8q/8bB8Xxe6y92j+Rxo2AOg1YTNGOmX9yj7tztHEmVB936 xd38Tfof6j8OprfNEN0cXCneJa2JuGYxGBrzbcBAhzyCwugLEduUE467s1CwJQ1V7S813jzRVot mvgnbLLHe7elURQsm55DxJV+CJnvyu4NtI1PLU0KBPc0hE1D//HGk1DSchDHwA4P3GnG94GJltj YmRHBlQ3YN4IPVhNrd3eSIQAleu3imx+T4Tw== X-Gm-Gg: ASbGncvh2Bci29RKjFTpFkEh/1L3C8Ko7uBeTfTsZ3fw4Ny+eQuzEaLSYWI0zGIwJIM 43AO1iQRHoyb3VUHsyZ6VgPpZIKnytA7AOVSb7fnB8k+h6B6VheFmAEA+b5Av4W5cSZIGTHphJt vtbQYPbafx5BDSY4Q9xD6hygefD4DRTZIzejZEUjTZ77AO8lE3SAYNeMkyFHlJTUr0d9ELfJb8G z2OQYrIgNe4dErGWhhl1bMzorMpHIWHcDpqncTwsjFOPbolbBP6lfhQPMV458SeKLZAB34Mwb5t X-Received: by 2002:a05:620a:4414:b0:7c9:253d:f226 with SMTP id af79cd13be357-7cad5bb7addmr518421885a.51.1746204115443; Fri, 02 May 2025 09:41:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy0By6NYhfxhE4SizeIlhGDnryvdseEzbnAy9Cu+7NL8RfFPfLMpwGjKsefrnoOa+2SHMg+w== X-Received: by 2002:a05:620a:4414:b0:7c9:253d:f226 with SMTP id af79cd13be357-7cad5bb7addmr518418185a.51.1746204115122; Fri, 02 May 2025 09:41:55 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Prasad Pandit Subject: [PULL 07/14] migration/multifd: move macros to multifd header Date: Fri, 2 May 2025 12:41:34 -0400 Message-ID: <20250502164141.747202-8-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204179825116600 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit Move MULTIFD_ macros to the header file so that they are accessible from other source files. Reviewed-by: Fabiano Rosas Signed-off-by: Prasad Pandit Reviewed-by: Peter Xu Message-ID: <20250411114534.3370816-2-ppandit@redhat.com> Signed-off-by: Fabiano Rosas --- migration/multifd.h | 5 +++++ migration/multifd.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 2d337e7b3b..9b6d81e7ed 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -49,6 +49,11 @@ bool multifd_queue_page(RAMBlock *block, ram_addr_t offs= et); bool multifd_recv(void); MultiFDRecvData *multifd_get_recv_data(void); =20 +/* Multiple fd's */ + +#define MULTIFD_MAGIC 0x11223344U +#define MULTIFD_VERSION 1 + /* Multifd Compression flags */ #define MULTIFD_FLAG_SYNC (1 << 0) =20 diff --git a/migration/multifd.c b/migration/multifd.c index 86c83e43c0..ec108af624 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -36,11 +36,6 @@ #include "io/channel-socket.h" #include "yank_functions.h" =20 -/* Multiple fd's */ - -#define MULTIFD_MAGIC 0x11223344U -#define MULTIFD_VERSION 1 - typedef struct { uint32_t magic; uint32_t version; --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204269; cv=none; d=zohomail.com; s=zohoarc; b=VOcdEL8sHVG2vhgT1dkPOQMO06GttO7In5q8bt7HcArhPsQEwCXrMqLC16c1k1LUnxxMNWchT25QI53QLY04AkpdcYfiGVfqack+oUPui0tv/jfXWzsZbQoU9Zk+corGfYF7/xYM9o05D9qpTAIgGsFmYDHwMSQ9eAsXgudnBa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204269; 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=wWyBexoIRamceh81lwn3HjKOZqVQpjEmVJQs01FKpAY=; b=OffEYJM590aFF+Hqvlri9MgYwmvSfOsbAddgLgCUmOhflbO/70fcp2Is7XFMYFbRacpeW5NzKpsXRRDslF/tiDnW6qd2N9u2tL0+0hKmC0CWk5Aafwb6tFRjG8lwFmlORCRleaMzrZ8Mw+AtIr/9rQIAC9SJ573vi0rd1xMzNrk= 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 1746204269180690.6897646677832; Fri, 2 May 2025 09:44:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSx-0007tB-9c; Fri, 02 May 2025 12:42: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 1uAtSb-0007mY-R0 for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSZ-0006T0-TG for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:01 -0400 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-197-VN9kUWymNd2kaz8XCCclCw-1; Fri, 02 May 2025 12:41:58 -0400 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7c0a3ff7e81so395724685a.3 for ; Fri, 02 May 2025 09:41:58 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204119; 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=wWyBexoIRamceh81lwn3HjKOZqVQpjEmVJQs01FKpAY=; b=QB/S1ybB50ldWk0iPXKIaY/zBxgjDsQYsDDJC+/hchMbYINcnBMcNdalw4baJJzL4O2FNW ge8RFOC8R9xpr+TItLbjSJkoow/eqzcU77ntehp7/EpoxaV4q8tvL3dF3f+9C7d6UdDyTy qQ2W6nb+TWlA+nn59k8c6D8RQbDCSDo= X-MC-Unique: VN9kUWymNd2kaz8XCCclCw-1 X-Mimecast-MFC-AGG-ID: VN9kUWymNd2kaz8XCCclCw_1746204117 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204117; x=1746808917; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wWyBexoIRamceh81lwn3HjKOZqVQpjEmVJQs01FKpAY=; b=c8XmgHx4whyCjkp7XViuuzD5N5n3cUyfH3ulNywmboxqtr+92H4E2c1Uqn9AISyuGi Z6gQENDyJsnv/PlQHmLJV9ZtHjFTo6MjNz2fbtVNN8//HoapjJD5YI1nAKn7v0Hn7Hi3 RMKD54H5U5tiZz9Y4ceYQgMaz9/Io49AEyvmTbvY6HW38InzriIrsKpKSkcJgYTzQgXy ldENZCkhgGCOno8TlnGGWx6ecXeANcpzGXm6myzRO+BKfkUTv743oJV/1LhAfToiG5Lf VkveQYV//3ZmzmEH5gspM1mNMjwLCN/8Mqa0qTqx6OrcPVASRPLs699RkUgBXq/erMCX csIA== X-Gm-Message-State: AOJu0YyixUOVzf461XWtSuJyKWk3w/Dh0UDPAusfQY6ZHcZTpEwqc4Bs UznnVRzEWi8l9Zuui6ypYLx2zCSJXskRuwUMxouw2MRLvfQTDrDCIhJE7LD88BBnoJt6kEBReWb r4p6X4YS/9xLmMIezlnPhXLrTI+0zYwXGjfduiP5YIycBNFRvPe3p3kUvaDy//+no+qiOjLcfwp kN+qwzkzbKL5bcD6AsHoCQuJmWgMzNruCbUQ== X-Gm-Gg: ASbGnctje8L70CVaOCvp+lYoYBTiRVyUL/hHLTOC8r3tIddJfkFuxcPAcSuGvtXrgoo 9pI+t+wSFEcg8N+ypuCEixZ+RLrLnbIT90raILcIyIThcwYUyiciGtRdifNwrcWz+bs3bfKvG/7 6ZibwQyrm2ZqYjpaaFZlN1DgAAOeJXP9RgV082Ve0Mx/TnwakO2WdD2vcCLhzEEqFirn39Grl6Q flYVNvfAQzihaE00s17Gqi3V+eOIwudelxQJVaVfN7G/7POfQoSrHt6Zv2WPuYKwynVLqxqGwzw X-Received: by 2002:a05:620a:4250:b0:7ca:cb02:7942 with SMTP id af79cd13be357-7cad5b2ceefmr543326985a.1.1746204117149; Fri, 02 May 2025 09:41:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKqEkhHjvg0mCk6OQPEWL8nZ6Q7kStsPaPjAIduQB21nCkakaVJnePEOgLpO2KhMSeHtEWPw== X-Received: by 2002:a05:620a:4250:b0:7ca:cb02:7942 with SMTP id af79cd13be357-7cad5b2ceefmr543323185a.1.1746204116734; Fri, 02 May 2025 09:41:56 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Prasad Pandit Subject: [PULL 08/14] migration: refactor channel discovery mechanism Date: Fri, 2 May 2025 12:41:35 -0400 Message-ID: <20250502164141.747202-9-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204270749116600 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit The various logical migration channels don't have a standardized way of advertising themselves and their connections may be seen out of order by the migration destination. When a new connection arrives, the incoming migration currently make use of heuristics to determine which channel it belongs to. The next few patches will need to change how the multifd and postcopy capabilities interact and that affects the channel discovery heuristic. Refactor the channel discovery heuristic to make it less opaque and simplify the subsequent patches. Signed-off-by: Prasad Pandit Reviewed-by: Fabiano Rosas Message-ID: <20250411114534.3370816-3-ppandit@redhat.com> Signed-off-by: Fabiano Rosas --- migration/migration.c | 130 +++++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 54fce997aa..f18cadcc5e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -95,6 +95,9 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 +/* Migration channel types */ +enum { CH_MAIN, CH_MULTIFD, CH_POSTCOPY }; + /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -941,9 +944,8 @@ static void migration_incoming_setup(QEMUFile *f) { MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - if (!mis->from_src_file) { - mis->from_src_file =3D f; - } + assert(!mis->from_src_file); + mis->from_src_file =3D f; qemu_file_set_blocking(f, false); } =20 @@ -995,28 +997,19 @@ void migration_fd_process_incoming(QEMUFile *f) migration_incoming_process(); } =20 -/* - * Returns true when we want to start a new incoming migration process, - * false otherwise. - */ -static bool migration_should_start_incoming(bool main_channel) +static bool migration_has_main_and_multifd_channels(void) { - /* Multifd doesn't start unless all channels are established */ - if (migrate_multifd()) { - return migration_has_all_channels(); + MigrationIncomingState *mis =3D migration_incoming_get_current(); + if (!mis->from_src_file) { + /* main channel not established */ + return false; } =20 - /* Preempt channel only starts when the main channel is created */ - if (migrate_postcopy_preempt()) { - return main_channel; + if (migrate_multifd() && !multifd_recv_all_channels_created()) { + return false; } =20 - /* - * For all the rest types of migration, we should only reach here when - * it's the main channel that's being created, and we should always - * proceed with this channel. - */ - assert(main_channel); + /* main and all multifd channels are established */ return true; } =20 @@ -1025,59 +1018,81 @@ void migration_ioc_process_incoming(QIOChannel *ioc= , Error **errp) MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; QEMUFile *f; - bool default_channel =3D true; + uint8_t channel; uint32_t channel_magic =3D 0; int ret =3D 0; =20 - if (migrate_multifd() && !migrate_mapped_ram() && - !migrate_postcopy_ram() && - qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK)) { - /* - * With multiple channels, it is possible that we receive channels - * out of order on destination side, causing incorrect mapping of - * source channels on destination side. Check channel MAGIC to - * decide type of channel. Please note this is best effort, postco= py - * preempt channel does not send any magic number so avoid it for - * postcopy live migration. Also tls live migration already does - * tls handshake while initializing main channel so with tls this - * issue is not possible. - */ - ret =3D migration_channel_read_peek(ioc, (void *)&channel_magic, - sizeof(channel_magic), errp); + if (!migration_has_main_and_multifd_channels()) { + if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK= )) { + /* + * With multiple channels, it is possible that we receive chan= nels + * out of order on destination side, causing incorrect mapping= of + * source channels on destination side. Check channel MAGIC to + * decide type of channel. Please note this is best effort, + * postcopy preempt channel does not send any magic number so + * avoid it for postcopy live migration. Also tls live migrati= on + * already does tls handshake while initializing main channel = so + * with tls this issue is not possible. + */ + ret =3D migration_channel_read_peek(ioc, (void *)&channel_magi= c, + sizeof(channel_magic), errp); + if (ret !=3D 0) { + return; + } =20 - if (ret !=3D 0) { + channel_magic =3D be32_to_cpu(channel_magic); + if (channel_magic =3D=3D QEMU_VM_FILE_MAGIC) { + channel =3D CH_MAIN; + } else if (channel_magic =3D=3D MULTIFD_MAGIC) { + assert(migrate_multifd()); + channel =3D CH_MULTIFD; + } else if (!mis->from_src_file && + mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED= ) { + /* reconnect main channel for postcopy recovery */ + channel =3D CH_MAIN; + } else { + error_setg(errp, "unknown channel magic: %u", channel_magi= c); + return; + } + } else if (mis->from_src_file && migrate_multifd()) { + /* + * Non-peekable channels like tls/file are processed as + * multifd channels when multifd is enabled. + */ + channel =3D CH_MULTIFD; + } else if (!mis->from_src_file) { + channel =3D CH_MAIN; + } else { + error_setg(errp, "non-peekable channel used without multifd"); return; } - - default_channel =3D (channel_magic =3D=3D cpu_to_be32(QEMU_VM_FILE= _MAGIC)); } else { - default_channel =3D !mis->from_src_file; + assert(migrate_postcopy_preempt()); + channel =3D CH_POSTCOPY; } =20 if (multifd_recv_setup(errp) !=3D 0) { return; } =20 - if (default_channel) { + if (channel =3D=3D CH_MAIN) { f =3D qemu_file_new_input(ioc); migration_incoming_setup(f); - } else { + } else if (channel =3D=3D CH_MULTIFD) { /* Multiple connections */ - assert(migration_needs_multiple_sockets()); - if (migrate_multifd()) { - multifd_recv_new_channel(ioc, &local_err); - } else { - assert(migrate_postcopy_preempt()); - f =3D qemu_file_new_input(ioc); - postcopy_preempt_new_channel(mis, f); - } + multifd_recv_new_channel(ioc, &local_err); if (local_err) { error_propagate(errp, local_err); return; } + } else if (channel =3D=3D CH_POSTCOPY) { + assert(!mis->postcopy_qemufile_dst); + f =3D qemu_file_new_input(ioc); + postcopy_preempt_new_channel(mis, f); + return; } =20 - if (migration_should_start_incoming(default_channel)) { + if (migration_has_main_and_multifd_channels()) { /* If it's a recovery, we're done */ if (postcopy_try_recover()) { return; @@ -1094,18 +1109,13 @@ void migration_ioc_process_incoming(QIOChannel *ioc= , Error **errp) */ bool migration_has_all_channels(void) { - MigrationIncomingState *mis =3D migration_incoming_get_current(); - - if (!mis->from_src_file) { + if (!migration_has_main_and_multifd_channels()) { return false; } =20 - if (migrate_multifd()) { - return multifd_recv_all_channels_created(); - } - - if (migrate_postcopy_preempt()) { - return mis->postcopy_qemufile_dst !=3D NULL; + MigrationIncomingState *mis =3D migration_incoming_get_current(); + if (migrate_postcopy_preempt() && !mis->postcopy_qemufile_dst) { + return false; } =20 return true; --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204175; cv=none; d=zohomail.com; s=zohoarc; b=YR4NVYXq9+coCA0d1q/4od+03wu17tkb7GQpxpAgb9YG90kFiZmUBeEK1x2iEdMyt45yyesXDowkNOX9pFhWvzBZpXvYIUyYwzekoJH1oSBi8IbReYlxbS/Qp+kSW5SY306GcTXcdqADljvf97bFeup98xEXauHIA3g1rDEGz+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204175; 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=MjUEY/w6aKXWMnaO1KafHdGD7uLuFBPM5WJk9qOv8BE=; b=lRb7voVw7f2UysbzN06ZIFLrvvqjh1wlYPAFaBvMSmOcGB4mf+CSW/ICl0UXYq8DbkS69rJ0uoj4bY9zLy5La8ChXPuk+pcAbJ2EeIMVSQ4VLPlxRNIUwpWivrr3aNU2sPbpUoAeXBMqBUW6ekqqJZMFrucb38y6P29Z1jYkC9w= 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 1746204174997977.1293148429774; Fri, 2 May 2025 09:42:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSz-0007wW-Aj; Fri, 02 May 2025 12:42:25 -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 1uAtSd-0007nG-Cr for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSb-0006TO-Cq for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:03 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17-_p-wMnkfO52IH9ZPJh368w-1; Fri, 02 May 2025 12:41:59 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c793d573b2so293222685a.1 for ; Fri, 02 May 2025 09:41:59 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204120; 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=MjUEY/w6aKXWMnaO1KafHdGD7uLuFBPM5WJk9qOv8BE=; b=K51Pkk1cXCX6Jg7z6UzAa7pameKrRle60Jhn1s3+SiNTX+8R8E0OSCp1/aQcflU4LxGeQj BEc8Ri7uYzYVtBFxTNDaaV23m+7a6zBc2BW8GS7JydJrTZS7/vWy9N37DPiI+/YXWspquX 8D34FHHO5qQJwxX7PugKjrKysayuGnk= X-MC-Unique: _p-wMnkfO52IH9ZPJh368w-1 X-Mimecast-MFC-AGG-ID: _p-wMnkfO52IH9ZPJh368w_1746204119 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204118; x=1746808918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MjUEY/w6aKXWMnaO1KafHdGD7uLuFBPM5WJk9qOv8BE=; b=ZYpCC7dDJ73WL4KLW2+cCRz7+ceUZpiLrqxsd9fYgRP679LzQ6jiNS4fbvb69Z5J4q rpBx/wHxaw+nyAJm7UsZR13BojI8ILGthpQNgmsF01BJrW3FZTwr6Yz3ulE4VDMv6r91 DtBKKkBACqR7xrsRcvRw2JkMa9xbDAjnWQWzCvCHF4pY1gHM5IzRVDuXpYqkivTB04Ru Wr17MkEqdapjpWb7zxdV2i0NZ7JAlEXzSGMZgINRdSRIl1GuTS8KTLbiLWDrq/QRAQsW S07x1P0S/vJCyjNT0opBrjdeigG+6Y56bRRnGcLU48SnykMoGTjgKmyA9b7Cs6a2Ti9t B/jw== X-Gm-Message-State: AOJu0YymK+ClHDdS4JrULcZr3UVdQtonMkyv1VB2lfnaLbT7TZmwIMZt BZKN1GLbFId5+oNfrJilQ8e86WGkDp/ux1jnr7Jp05Rb+RooZKayUtAxgn2EY7ufISiB/qqpSNT zDKlYYNXQOMjzSVVFqaogQ7yEiPRlflZZ+1OZvhsnyFTMIC1dqD/LB7avHiRlEa/nhQFpuDXZwq Px5MSsAA1HheXswPAFqxVOvbFDHhBITGlWPw== X-Gm-Gg: ASbGncs4cwMNMq5eMh8wQUqSoAAZNa2oHfF/pjOZe2kPLwfimk5XjkDsBb6lHEwZd9h C6eaZfK4aUXsztH50DdiDoqRx7ZXhrcO0zjbsMIGgVb2YfMwOtSPNA6nIqEhLNvOjDpMy+HmVOx xu2fZ1w39LZJVADC1LA4IptTmSfhwKhV2S2P9jy5BIWgw8xjnTw3lHASnNg1x5lIum32ze8F39D eUM7Kt240j5TsJknA+XNHqdyIsUb3jdaLMjMNLt2Wg4RfCibFpuQoqV3buF7DWch6Nqlg8XD423 X-Received: by 2002:a05:620a:800b:b0:7c5:e92a:cba3 with SMTP id af79cd13be357-7cad5bb47ccmr630869185a.49.1746204118581; Fri, 02 May 2025 09:41:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqd1xypvE09vYjdZuoKFUbFo3gcCurOhzbT9FU4Mab/hK37fP4SBk3dAX3nsLyeDIMei3X3A== X-Received: by 2002:a05:620a:800b:b0:7c5:e92a:cba3 with SMTP id af79cd13be357-7cad5bb47ccmr630863985a.49.1746204118056; Fri, 02 May 2025 09:41:58 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Prasad Pandit Subject: [PULL 09/14] migration: Add save_postcopy_prepare() savevm handler Date: Fri, 2 May 2025 12:41:36 -0400 Message-ID: <20250502164141.747202-10-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204175477019000 Content-Type: text/plain; charset="utf-8" Add a savevm handler for a module to opt-in sending extra sections right before postcopy starts, and before VM is stopped. RAM will start to use this new savevm handler in the next patch to do flush and sync for multifd pages. Note that we choose to do it before VM stopped because the current only potential user is not sensitive to VM status, so doing it before VM is stopped is preferred to enlarge any postcopy downtime. It is still a bit unfortunate that we need to introduce such a new savevm handler just for the only use case, however it's so far the cleanest. Signed-off-by: Peter Xu Signed-off-by: Prasad Pandit Reviewed-by: Fabiano Rosas Message-ID: <20250411114534.3370816-4-ppandit@redhat.com> Signed-off-by: Fabiano Rosas --- include/migration/register.h | 15 +++++++++++++++ migration/savevm.h | 1 + migration/migration.c | 4 ++++ migration/savevm.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/include/migration/register.h b/include/migration/register.h index c041ce32f2..b79dc81b8d 100644 --- a/include/migration/register.h +++ b/include/migration/register.h @@ -189,6 +189,21 @@ typedef struct SaveVMHandlers { =20 /* This runs outside the BQL! */ =20 + /** + * @save_postcopy_prepare + * + * This hook will be invoked on the source side right before switching + * to postcopy (before VM stopped). + * + * @f: QEMUFile where to send the data + * @opaque: Data pointer passed to register_savevm_live() + * @errp: Error** used to report error message + * + * Returns: true if succeeded, false if error occured. When false is + * returned, @errp must be set. + */ + bool (*save_postcopy_prepare)(QEMUFile *f, void *opaque, Error **errp); + /** * @state_pending_estimate * diff --git a/migration/savevm.h b/migration/savevm.h index 138c39a7f9..2d5e9c7166 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -45,6 +45,7 @@ void qemu_savevm_state_pending_exact(uint64_t *must_preco= py, void qemu_savevm_state_pending_estimate(uint64_t *must_precopy, uint64_t *can_postcopy); int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy); +bool qemu_savevm_state_postcopy_prepare(QEMUFile *f, Error **errp); void qemu_savevm_send_ping(QEMUFile *f, uint32_t value); void qemu_savevm_send_open_return_path(QEMUFile *f); int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len); diff --git a/migration/migration.c b/migration/migration.c index f18cadcc5e..4697732bef 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2727,6 +2727,10 @@ static int postcopy_start(MigrationState *ms, Error = **errp) } } =20 + if (!qemu_savevm_state_postcopy_prepare(ms->to_dst_file, errp)) { + return -1; + } + trace_postcopy_start(); bql_lock(); trace_postcopy_start_set_run(); diff --git a/migration/savevm.c b/migration/savevm.c index 0c12e373b4..006514c3e3 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1523,6 +1523,39 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) qemu_fflush(f); } =20 +bool qemu_savevm_state_postcopy_prepare(QEMUFile *f, Error **errp) +{ + SaveStateEntry *se; + bool ret; + + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + if (!se->ops || !se->ops->save_postcopy_prepare) { + continue; + } + + if (se->ops->is_active) { + if (!se->ops->is_active(se->opaque)) { + continue; + } + } + + trace_savevm_section_start(se->idstr, se->section_id); + + save_section_header(f, se, QEMU_VM_SECTION_PART); + ret =3D se->ops->save_postcopy_prepare(f, se->opaque, errp); + save_section_footer(f, se); + + trace_savevm_section_end(se->idstr, se->section_id, ret); + + if (!ret) { + assert(*errp); + return false; + } + } + + return true; +} + int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy) { int64_t start_ts_each, end_ts_each; --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204210; cv=none; d=zohomail.com; s=zohoarc; b=JG9ydERkhH5VUAWdUJFuBeLvQfGWLSyR5aneCAXpdHM6V9Zn6x5phzEMGXUAO8f3IguII36N8JWbT4HRESMCJB+TIKjoKMkj8tUZg9/nYVkMfCAXl+E0jqZhdMVIkMMEJwUVr8UYXQQ+9W2QVOReaXrPjP00tdY2K1z+4wNQ6Ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204210; 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=z5iX6m9+qrQrDzgZbzFt+Gv7DkVpFoyTApZijRzVBoA=; b=UxKjNakdsrdtP5P26RDw1orVeqlXFwBfZl95cZ29LsKnyDdYaFt+YrXEzH1t3oXWy9Zlk17APBhf9whXnGKZiKsJvW5AATsFcUBHBKIa61lzdGgaH2Cq0mAePxfZ+cpeIlYm+gU5KdpGcdz44QlS38eNMY/ApXn9L0ON1gOm0CE= 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 1746204210131205.81957090180185; Fri, 2 May 2025 09:43:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSy-0007v6-5Q; Fri, 02 May 2025 12:42: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 1uAtSf-0007nV-V5 for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSd-0006U0-5I for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:04 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-581-SN1wn0LuNXioNoJxHk6uWQ-1; Fri, 02 May 2025 12:42:01 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c5c77aff55so492507185a.3 for ; Fri, 02 May 2025 09:42:01 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204122; 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=z5iX6m9+qrQrDzgZbzFt+Gv7DkVpFoyTApZijRzVBoA=; b=JFuw674F4HfbTKA1YajnVf+uSGhfA2zL/jX0FvoDJSbw4oRH/V6LaO5Fr4INAr7hZdTdqE OEt2ReL5k3W/3tIsds0JbWZRdBUjdmRDCoInkA3gvdQXHbk2tcD3CpsUtOIHZ/BMT0/FGb 7dI9wPxLURcvTGmyjiqtUzqFd/rNC1g= X-MC-Unique: SN1wn0LuNXioNoJxHk6uWQ-1 X-Mimecast-MFC-AGG-ID: SN1wn0LuNXioNoJxHk6uWQ_1746204120 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204120; x=1746808920; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z5iX6m9+qrQrDzgZbzFt+Gv7DkVpFoyTApZijRzVBoA=; b=NzqkBMhGFOifqKViG2nk8kRMjmlNCinUjxKs2Oml41pKxgzrvgBVX37uSVbR8GRgMA IojEvVHqZX5hgs/Nmr0JgMZlmqfiL83+x7BgKwBrCH+uQ+wsHeR51CqG1EsK/mXenBds n4dXuAL12QB0z53m4v/XqOQqOlKhSMNBmFnifM98yhV+dzexuvTK29LncTByFid67cDL 4spCoNB3UCdh6bkrVBGqy6/tLxfze+l8U5kdLxn8B2RT8Wdxx7vI5EVsOo8GeP8vfd60 9JvW5KsM8ooBpR+yFUYZNO6XbVfAtExR8PcBlDw/zk+L60XzC661FArcM7FcgdlQvtMk SAZw== X-Gm-Message-State: AOJu0Yxokf0SmtjzncEK3RT8D/fNHSAFltXyX8jwcgSjKGzit0ZAuBgi 4yDSCSuxPU423xx2Gz+25ygQSwrPCizZLKOhCz9usJKzU+CBKF4rZekJlr+MkxRK0w92y2xXyoH hCYFH+prkU0A+QO9M4EygKl928zJUVoihcX3TBXT2PlF2SxOOPi84ONSvFSqJS9fNC/8TtMy5xY yFqHzDKqoNcVbEsoG6GJV0lUF6DeqFnjW7Hg== X-Gm-Gg: ASbGnctKOJWQ24GkQjUwEyoPZUODejXOdrOSkaNOlfzxtzh+Ho43Ie7xRZnLKpUaiGv LngeyHRvF5J2zpewLtWpPh4JVikfxy7wkSyA3dcu+mIgVgp10T2iCWjwOOu5d0pHqyASKSmif5e jM4CvfallM+Tt4jJQoyjMxUToCok6sGSt9XOm2AH6O5jaRQ8R7MLVy1CPENKilFnvlJchvKK1HW g5NFd0BRxMDpixVuep9vlmy7qm+ohWTKFypOD2kEiOU/pTZZPH8ikHU5yjdoVyj5J8P2J3wHljk X-Received: by 2002:a05:620a:4442:b0:7c5:9a4e:7b8a with SMTP id af79cd13be357-7cad5ba5b8emr628657285a.54.1746204119924; Fri, 02 May 2025 09:41:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHE1lvHcDGV72kGzDKze0OlkIDIUP483PHYina4WYWOwFFIJsgZFF/F53YSuHwwwpe22G2qrQ== X-Received: by 2002:a05:620a:4442:b0:7c5:9a4e:7b8a with SMTP id af79cd13be357-7cad5ba5b8emr628651785a.54.1746204119443; Fri, 02 May 2025 09:41:59 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Prasad Pandit Subject: [PULL 10/14] migration/ram: Implement save_postcopy_prepare() Date: Fri, 2 May 2025 12:41:37 -0400 Message-ID: <20250502164141.747202-11-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204212100116600 Content-Type: text/plain; charset="utf-8" Implement save_postcopy_prepare(), preparing for the enablement of both multifd and postcopy. Signed-off-by: Peter Xu Signed-off-by: Prasad Pandit Reviewed-by: Fabiano Rosas Message-ID: <20250411114534.3370816-5-ppandit@redhat.com> Signed-off-by: Fabiano Rosas --- migration/ram.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 1181a99cf6..a749e4a421 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4398,6 +4398,42 @@ static int ram_resume_prepare(MigrationState *s, voi= d *opaque) return 0; } =20 +static bool ram_save_postcopy_prepare(QEMUFile *f, void *opaque, Error **e= rrp) +{ + int ret; + + if (migrate_multifd()) { + /* + * When multifd is enabled, source QEMU needs to make sure all the + * pages queued before postcopy starts have been flushed. + * + * The load of these pages must happen before switching to postcop= y. + * It's because loading of guest pages (so far) in multifd recv + * threads is still non-atomic, so the load cannot happen with vCP= Us + * running on the destination side. + * + * This flush and sync will guarantee that those pages are loaded + * _before_ postcopy starts on the destination. The rationale is, + * this happens before VM stops (and before source QEMU sends all + * the rest of the postcopy messages). So when the destination QE= MU + * receives the postcopy messages, it must have received the sync + * message on the main channel (either RAM_SAVE_FLAG_MULTIFD_FLUSH, + * or RAM_SAVE_FLAG_EOS), and such message would guarantee that + * all previous guest pages queued in the multifd channels are + * completely loaded. + */ + ret =3D multifd_ram_flush_and_sync(f); + if (ret < 0) { + error_setg(errp, "%s: multifd flush and sync failed", __func__= ); + return false; + } + } + + qemu_put_be64(f, RAM_SAVE_FLAG_EOS); + + return true; +} + void postcopy_preempt_shutdown_file(MigrationState *s) { qemu_put_be64(s->postcopy_qemufile_src, RAM_SAVE_FLAG_EOS); @@ -4417,6 +4453,7 @@ static SaveVMHandlers savevm_ram_handlers =3D { .load_setup =3D ram_load_setup, .load_cleanup =3D ram_load_cleanup, .resume_prepare =3D ram_resume_prepare, + .save_postcopy_prepare =3D ram_save_postcopy_prepare, }; =20 static void ram_mig_ram_block_resized(RAMBlockNotifier *n, void *host, --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204152; cv=none; d=zohomail.com; s=zohoarc; b=YaNo/rqfEsk2vdX891GuINXOFnPIpg59vVZ7PNUn8wYbpSC1WrEOUF3O3xe+OfKHMDMmlXEpAEADcHjNyU7gyoSLVixKsfOj/kniSym/w87VPE/0yYMjbJDsIF5eNGu8QCwq1qTNbFSEIr9q3HI3dAQIGg9s7a/YSrAwapKJ+lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204152; 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=/yyVmAMhJTDOQ6t8/5jDqz0Y+aQajW34hgAyEzYdjng=; b=JuwL5FYcDwO0TDTaN9nfYyKUKI3Bas3JTzDBjoIjZv3nB1fUJVl4DDdu6wrnagaZndlhDk6UaLkryWRdoiya/zs2n2DNC+9DyRJNG8i7cWw0meCltDpYIhFoMK0nzVLQVUBvcqspTz63rksx2L88ANgZQDWNeM08MvSJFe1AuFE= 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 1746204152885140.52329104265357; Fri, 2 May 2025 09:42:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtSz-0007vT-2a; Fri, 02 May 2025 12:42:25 -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 1uAtSi-0007nj-Ic for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:12 -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 1uAtSe-0006UL-QQ for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:08 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-kaGfrvn0N-6JdcuG87tm9A-1; Fri, 02 May 2025 12:42:03 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c760637fe5so397707885a.0 for ; Fri, 02 May 2025 09:42:02 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204124; 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=/yyVmAMhJTDOQ6t8/5jDqz0Y+aQajW34hgAyEzYdjng=; b=PnnspxqQ0s4StRu5jEY1UYmBgl8d3+/atPej3ikrU+0N/rGxpNlk1Cn3bEGk/iR2zC0iJR 8jiEGD1ZZqsfwqRrP7C1ebFwWKMsmNalJDtybeDpnIfkUqBEmUkg0bQFHHVpaA2vZGF754 GrEHgD9Dpy8vkxHnzhsIV1Xnp+2nCMA= X-MC-Unique: kaGfrvn0N-6JdcuG87tm9A-1 X-Mimecast-MFC-AGG-ID: kaGfrvn0N-6JdcuG87tm9A_1746204122 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204122; x=1746808922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/yyVmAMhJTDOQ6t8/5jDqz0Y+aQajW34hgAyEzYdjng=; b=TuVrG4744fxyP7coA9M8RsCz5u+fCe3bGnsIbcx147vmHqrgultGcyWAg+LOmnq2Bw dfBv+78xwGaDVYL4WM4xXCCwX0EBiGu76z/11EutEEsFnM+ekCEEqpzIW88hYw6rYQQ2 khXlQTwMql5eODOGa5I3XEOLyx6v1hae33SPP2HPeLTecPzDtIhd6yq+M+wnI0mLislu VL10rGVEAjm26lyTlqCAm5ZIazY+tmjqlErmU3PKm5jbOvE0Y+GJTjN6CW2ND7s7Tqgg sWIyvWULPDNEh/grrklrrpYei0CFWpqATMYagzpYyqn/I1uvFBDRdnCF8VKkgGWqT2mo 1SYg== X-Gm-Message-State: AOJu0YwRBNcoCOir7vmpqFf0OFO432gNlrt/VRx6DYYMxm6POVUCq54F Fgj8aOvsc6BADmeqd1c9Ad+zk8RAolDwUdDYhnhEpKa2cKRuliTq566+223X831jk0atv4QWuTo KRDR28wdlEhuuVHibp6peARRgwXjDcuCdWTpaR16lr3yeOk2QKmiuvKhDygL80AepLpD5AWwzxR ARgN0GkdGyteyr7FmzCS5b0m505EVyVcOpjg== X-Gm-Gg: ASbGnctsYTuE++DYG9rNsOGkOXubyd9YjCIMNzDw0SWxnSchOd5Q9ezVeNGmgChTtzo U3R2QPbfY2Q+S5Ah1NuiUBDbslPm5WfW6SL2lF7RKXSYndzSj2mqX2WesvRaiuR7/wVhiMukVkK 0c9580ixhEYQMz+t131U0iTSALQm+io5MubT1WSISokT9rBz6EKP9YASqscVVNcUSoQU/IEwEdb uCeJH01SQuEEs1UjLnqJSKu2dzoplVTE6kL+/DJ2ZkpLKSL9WK9B9XTaXtCQ8gIXS3j1VHG0IZu X-Received: by 2002:a05:620a:318c:b0:7c7:a5b7:b288 with SMTP id af79cd13be357-7cad5b3fe4amr438178885a.19.1746204121714; Fri, 02 May 2025 09:42:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENfU5gIhrYe/f/nl/oozzz3iYMVMw3WBONgYvAb3U5RJWsP6IateHtZbGxfbxrZ8cvpIJmhg== X-Received: by 2002:a05:620a:318c:b0:7c7:a5b7:b288 with SMTP id af79cd13be357-7cad5b3fe4amr438174885a.19.1746204121157; Fri, 02 May 2025 09:42:01 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Prasad Pandit Subject: [PULL 11/14] tests/qtest/migration: consolidate set capabilities Date: Fri, 2 May 2025 12:41:38 -0400 Message-ID: <20250502164141.747202-12-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204154572019000 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit Migration capabilities are set in multiple '.start_hook' functions for various tests. Instead, consolidate setting capabilities in 'migrate_start_set_capabilities()' function which is called from the 'migrate_start()' function. While simplifying the capabilities setting, it helps to declutter the qtest sources. Suggested-by: Fabiano Rosas Signed-off-by: Prasad Pandit Reviewed-by: Fabiano Rosas Message-ID: <20250411114534.3370816-7-ppandit@redhat.com> [fix open brace] Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.h | 9 ++- tests/qtest/migration/compression-tests.c | 22 +++++-- tests/qtest/migration/cpr-tests.c | 6 +- tests/qtest/migration/file-tests.c | 58 ++++++++---------- tests/qtest/migration/framework.c | 75 +++++++++++++++-------- tests/qtest/migration/misc-tests.c | 4 +- tests/qtest/migration/postcopy-tests.c | 8 ++- tests/qtest/migration/precopy-tests.c | 29 +++++---- tests/qtest/migration/tls-tests.c | 23 ++++++- 9 files changed, 150 insertions(+), 84 deletions(-) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index e4a11870f6..01e425e64e 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -12,6 +12,7 @@ #define TEST_FRAMEWORK_H =20 #include "libqtest.h" +#include =20 #define FILE_TEST_FILENAME "migfile" #define FILE_TEST_OFFSET 0x1000 @@ -120,6 +121,13 @@ typedef struct { =20 /* Do not connect to target monitor and qtest sockets in qtest_init */ bool defer_target_connect; + + /* + * Migration capabilities to be set in both source and + * destination. For unilateral capabilities, use + * migration_set_capabilities(). + */ + bool caps[MIGRATION_CAPABILITY__MAX]; } MigrateStart; =20 typedef enum PostcopyRecoveryFailStage { @@ -207,7 +215,6 @@ typedef struct { =20 /* Postcopy specific fields */ void *postcopy_data; - bool postcopy_preempt; PostcopyRecoveryFailStage postcopy_recovery_fail_stage; } MigrateCommon; =20 diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index 8b58401b84..41e79f031b 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -35,6 +35,9 @@ static void test_multifd_tcp_zstd(void) { MigrateCommon args =3D { .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, }; test_precopy_common(&args); @@ -56,6 +59,9 @@ static void test_multifd_tcp_qatzip(void) { MigrateCommon args =3D { .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, .start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip, }; test_precopy_common(&args); @@ -74,6 +80,9 @@ static void test_multifd_tcp_qpl(void) { MigrateCommon args =3D { .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, .start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl, }; test_precopy_common(&args); @@ -92,6 +101,9 @@ static void test_multifd_tcp_uadk(void) { MigrateCommon args =3D { .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, .start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk, }; test_precopy_common(&args); @@ -103,10 +115,6 @@ migrate_hook_start_xbzrle(QTestState *from, QTestState *to) { migrate_set_parameter_int(from, "xbzrle-cache-size", 33554432); - - migrate_set_capability(from, "xbzrle", true); - migrate_set_capability(to, "xbzrle", true); - return NULL; } =20 @@ -118,6 +126,9 @@ static void test_precopy_unix_xbzrle(void) .listen_uri =3D uri, .start_hook =3D migrate_hook_start_xbzrle, .iterations =3D 2, + .start =3D { + .caps[MIGRATION_CAPABILITY_XBZRLE] =3D true, + }, /* * XBZRLE needs pages to be modified when doing the 2nd+ round * iteration to have real data pushed to the stream. @@ -146,6 +157,9 @@ static void test_multifd_tcp_zlib(void) { MigrateCommon args =3D { .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib, }; test_precopy_common(&args); diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 4758841824..5536e14610 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -24,9 +24,6 @@ static void *migrate_hook_start_mode_reboot(QTestState *f= rom, QTestState *to) migrate_set_parameter_str(from, "mode", "cpr-reboot"); migrate_set_parameter_str(to, "mode", "cpr-reboot"); =20 - migrate_set_capability(from, "x-ignore-shared", true); - migrate_set_capability(to, "x-ignore-shared", true); - return NULL; } =20 @@ -39,6 +36,9 @@ static void test_mode_reboot(void) .connect_uri =3D uri, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_mode_reboot, + .start =3D { + .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, + }, }; =20 test_file_common(&args, true); diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index f260e2871d..4d78ce0855 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -107,15 +107,6 @@ static void test_precopy_file_offset_bad(void) test_file_common(&args, false); } =20 -static void *migrate_hook_start_mapped_ram(QTestState *from, - QTestState *to) -{ - migrate_set_capability(from, "mapped-ram", true); - migrate_set_capability(to, "mapped-ram", true); - - return NULL; -} - static void test_precopy_file_mapped_ram_live(void) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, @@ -123,7 +114,9 @@ static void test_precopy_file_mapped_ram_live(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_mapped_ram, + .start =3D { + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + }, }; =20 test_file_common(&args, false); @@ -136,26 +129,14 @@ static void test_precopy_file_mapped_ram(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_mapped_ram, + .start =3D { + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + }, }; =20 test_file_common(&args, true); } =20 -static void *migrate_hook_start_multifd_mapped_ram(QTestState *from, - QTestState *to) -{ - migrate_hook_start_mapped_ram(from, to); - - migrate_set_parameter_int(from, "multifd-channels", 4); - migrate_set_parameter_int(to, "multifd-channels", 4); - - migrate_set_capability(from, "multifd", true); - migrate_set_capability(to, "multifd", true); - - return NULL; -} - static void test_multifd_file_mapped_ram_live(void) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, @@ -163,7 +144,10 @@ static void test_multifd_file_mapped_ram_live(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + }, }; =20 test_file_common(&args, false); @@ -176,7 +160,10 @@ static void test_multifd_file_mapped_ram(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + }, }; =20 test_file_common(&args, true); @@ -185,8 +172,6 @@ static void test_multifd_file_mapped_ram(void) static void *migrate_hook_start_multifd_mapped_ram_dio(QTestState *from, QTestState *to) { - migrate_hook_start_multifd_mapped_ram(from, to); - migrate_set_parameter_bool(from, "direct-io", true); migrate_set_parameter_bool(to, "direct-io", true); =20 @@ -201,6 +186,10 @@ static void test_multifd_file_mapped_ram_dio(void) .connect_uri =3D uri, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_mapped_ram_dio, + .start =3D { + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; =20 if (!probe_o_direct_support(tmpfs)) { @@ -246,7 +235,6 @@ static void *migrate_hook_start_multifd_mapped_ram_fdse= t_dio(QTestState *from, fdset_add_fds(from, file, O_WRONLY, 2, true); fdset_add_fds(to, file, O_RDONLY, 2, true); =20 - migrate_hook_start_multifd_mapped_ram(from, to); migrate_set_parameter_bool(from, "direct-io", true); migrate_set_parameter_bool(to, "direct-io", true); =20 @@ -261,8 +249,6 @@ static void *migrate_hook_start_multifd_mapped_ram_fdse= t(QTestState *from, fdset_add_fds(from, file, O_WRONLY, 2, false); fdset_add_fds(to, file, O_RDONLY, 2, false); =20 - migrate_hook_start_multifd_mapped_ram(from, to); - return NULL; } =20 @@ -275,6 +261,10 @@ static void test_multifd_file_mapped_ram_fdset(void) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset, .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, + .start =3D { + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; =20 test_file_common(&args, true); @@ -289,6 +279,10 @@ static void test_multifd_file_mapped_ram_fdset_dio(voi= d) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio, .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, + .start =3D { + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; =20 if (!probe_o_direct_support(tmpfs)) { diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 10e1d04b58..e48b80a127 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -30,6 +30,7 @@ #define QEMU_VM_FILE_MAGIC 0x5145564d #define QEMU_ENV_SRC "QTEST_QEMU_BINARY_SRC" #define QEMU_ENV_DST "QTEST_QEMU_BINARY_DST" +#define MULTIFD_TEST_CHANNELS 4 =20 unsigned start_address; unsigned end_address; @@ -207,6 +208,51 @@ static QList *migrate_start_get_qmp_capabilities(const= MigrateStart *args) return capabilities; } =20 +static void migrate_start_set_capabilities(QTestState *from, QTestState *t= o, + MigrateStart *args) +{ + /* + * MigrationCapability_lookup and MIGRATION_CAPABILITY_ constants + * are from qapi-types-migration.h. + */ + for (uint8_t i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + if (!args->caps[i]) { + continue; + } + if (from) { + migrate_set_capability(from, + MigrationCapability_lookup.array[i], true); + } + if (to) { + migrate_set_capability(to, + MigrationCapability_lookup.array[i], true); + } + } + + /* + * Always enable migration events. Libvirt always uses it, let's try + * to mimic as closer as that. + */ + migrate_set_capability(from, "events", true); + if (!args->defer_target_connect) { + migrate_set_capability(to, "events", true); + } + + /* + * Default number of channels should be fine for most + * tests. Individual tests can override by calling + * migrate_set_parameter() directly. + */ + if (args->caps[MIGRATION_CAPABILITY_MULTIFD]) { + migrate_set_parameter_int(from, "multifd-channels", + MULTIFD_TEST_CHANNELS); + migrate_set_parameter_int(to, "multifd-channels", + MULTIFD_TEST_CHANNELS); + } + + return; +} + int migrate_start(QTestState **from, QTestState **to, const char *uri, MigrateStart *args) { @@ -379,14 +425,7 @@ int migrate_start(QTestState **from, QTestState **to, = const char *uri, unlink(shmem_path); } =20 - /* - * Always enable migration events. Libvirt always uses it, let's try - * to mimic as closer as that. - */ - migrate_set_capability(*from, "events", true); - if (!args->defer_target_connect) { - migrate_set_capability(*to, "events", true); - } + migrate_start_set_capabilities(*from, *to, args); =20 return 0; } @@ -432,6 +471,10 @@ static int migrate_postcopy_prepare(QTestState **from_= ptr, { QTestState *from, *to; =20 + /* set postcopy capabilities */ + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + if (migrate_start(&from, &to, "defer", &args->start)) { return -1; } @@ -440,17 +483,7 @@ static int migrate_postcopy_prepare(QTestState **from_= ptr, args->postcopy_data =3D args->start_hook(from, to); } =20 - migrate_set_capability(from, "postcopy-ram", true); - migrate_set_capability(to, "postcopy-ram", true); - migrate_set_capability(to, "postcopy-blocktime", true); - - if (args->postcopy_preempt) { - migrate_set_capability(from, "postcopy-preempt", true); - migrate_set_capability(to, "postcopy-preempt", true); - } - migrate_ensure_non_converge(from); - migrate_prepare_for_dirty_mem(from); qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," " 'arguments': { " @@ -948,15 +981,9 @@ void *migrate_hook_start_precopy_tcp_multifd_common(QT= estState *from, QTestState *to, const char *method) { - migrate_set_parameter_int(from, "multifd-channels", 16); - migrate_set_parameter_int(to, "multifd-channels", 16); - migrate_set_parameter_str(from, "multifd-compression", method); migrate_set_parameter_str(to, "multifd-compression", method); =20 - migrate_set_capability(from, "multifd", true); - migrate_set_capability(to, "multifd", true); - /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}"); =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 2e612d9e38..54995256d8 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -98,6 +98,7 @@ static void test_ignore_shared(void) QTestState *from, *to; MigrateStart args =3D { .use_shmem =3D true, + .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, }; =20 if (migrate_start(&from, &to, uri, &args)) { @@ -107,9 +108,6 @@ static void test_ignore_shared(void) migrate_ensure_non_converge(from); migrate_prepare_for_dirty_mem(from); =20 - migrate_set_capability(from, "x-ignore-shared", true); - migrate_set_capability(to, "x-ignore-shared", true); - /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 982457bed1..483e3ff99f 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -39,7 +39,9 @@ static void test_postcopy_suspend(void) static void test_postcopy_preempt(void) { MigrateCommon args =3D { - .postcopy_preempt =3D true, + .start =3D { + .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, + }, }; =20 test_postcopy_common(&args); @@ -73,7 +75,9 @@ static void test_postcopy_recovery_fail_reconnect(void) static void test_postcopy_preempt_recovery(void) { MigrateCommon args =3D { - .postcopy_preempt =3D true, + .start =3D { + .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, + }, }; =20 test_postcopy_recovery_common(&args); diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 565630dddf..87b0a7e8ef 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -170,23 +170,14 @@ static void test_precopy_tcp_plain(void) test_precopy_common(&args); } =20 -static void *migrate_hook_start_switchover_ack(QTestState *from, QTestStat= e *to) -{ - - migrate_set_capability(from, "return-path", true); - migrate_set_capability(to, "return-path", true); - - migrate_set_capability(from, "switchover-ack", true); - migrate_set_capability(to, "switchover-ack", true); - - return NULL; -} - static void test_precopy_tcp_switchover_ack(void) { MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_switchover_ack, + .start =3D { + .caps[MIGRATION_CAPABILITY_RETURN_PATH] =3D true, + .caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK] =3D true, + }, /* * Source VM must be running in order to consider the switchover A= CK * when deciding to do switchover or not. @@ -455,6 +446,9 @@ static void test_multifd_tcp_uri_none(void) MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_precopy_tcp_multifd, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, /* * Multifd is more complicated than most of the features, it * directly takes guest page buffers when sending, make sure @@ -470,6 +464,9 @@ static void test_multifd_tcp_zero_page_legacy(void) MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_l= egacy, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, /* * Multifd is more complicated than most of the features, it * directly takes guest page buffers when sending, make sure @@ -485,6 +482,9 @@ static void test_multifd_tcp_no_zero_page(void) MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pag= e, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, /* * Multifd is more complicated than most of the features, it * directly takes guest page buffers when sending, make sure @@ -501,6 +501,9 @@ static void test_multifd_tcp_channels_none(void) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_precopy_tcp_multifd, .live =3D true, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, .connect_channels =3D ("[ { 'channel-type': 'main'," " 'addr': { 'transport': 'socket'," " 'type': 'inet'," diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 2cb4a44bcd..72f44defbb 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -375,9 +375,11 @@ static void test_postcopy_tls_psk(void) static void test_postcopy_preempt_tls_psk(void) { MigrateCommon args =3D { - .postcopy_preempt =3D true, .start_hook =3D migrate_hook_start_tls_psk_match, .end_hook =3D migrate_hook_end_tls_psk, + .start =3D { + .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, + }, }; =20 test_postcopy_common(&args); @@ -397,9 +399,11 @@ static void test_postcopy_recovery_tls_psk(void) static void test_postcopy_preempt_all(void) { MigrateCommon args =3D { - .postcopy_preempt =3D true, .start_hook =3D migrate_hook_start_tls_psk_match, .end_hook =3D migrate_hook_end_tls_psk, + .start =3D { + .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, + }, }; =20 test_postcopy_recovery_common(&args); @@ -631,6 +635,9 @@ static void test_multifd_tcp_tls_psk_match(void) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match, .end_hook =3D migrate_hook_end_tls_psk, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; test_precopy_common(&args); } @@ -640,6 +647,7 @@ static void test_multifd_tcp_tls_psk_mismatch(void) MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, }, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch, @@ -656,6 +664,9 @@ static void test_multifd_tcp_tls_x509_default_host(void) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tls_x509_default_host, .end_hook =3D migrate_hook_end_tls_x509, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; test_precopy_common(&args); } @@ -666,6 +677,9 @@ static void test_multifd_tcp_tls_x509_override_host(voi= d) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tls_x509_override_host, .end_hook =3D migrate_hook_end_tls_x509, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; test_precopy_common(&args); } @@ -688,6 +702,7 @@ static void test_multifd_tcp_tls_x509_mismatch_host(voi= d) MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, }, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host, @@ -703,6 +718,9 @@ static void test_multifd_tcp_tls_x509_allow_anon_client= (void) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cli= ent, .end_hook =3D migrate_hook_end_tls_x509, + .start =3D { + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, + }, }; test_precopy_common(&args); } @@ -712,6 +730,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_clien= t(void) MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, + .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, }, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_cl= ient, --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204225; cv=none; d=zohomail.com; s=zohoarc; b=hxY04AypswZ9t9Xhg4v9UWQd9lQ13gJ9Oc0IEP21/qOxtB63Vm0URfmJYuBE33pqIFDYITdH2Ts8etnjn3uZGT/UoYiWxpjxjexFQjDsSJvHmDtg6Jqv+OG0cekISbjYG3LgdwF0UuZ9+9yFfUy+0Ng0Y+hFRWEHp/fwwS8n5S8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204225; 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=KYwm/MwdS+WEwVvT8ZltgPHE/zV2f/JvznZHRlv4PP4=; b=O4pY88oJyc4xfbPG7NaAcLfhFbfM4l9Q5SyM8mCRrpB9Ipncgm8u+cuo78Pc9ssS6HjhnXUL12IamAtq3c9s9hi5w0AE1+McSzW3sYCFeq+levtvfEFZ0uf0XQhK5NjRcBFEEmUha+aNqb8tcJTGinFoCYbXY3lCGX6oO4iVa0c= 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 17462042254111004.4536382320915; Fri, 2 May 2025 09:43:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtT1-0007zr-72; Fri, 02 May 2025 12:42:27 -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 1uAtSi-0007ni-Hs for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSg-0006Uc-9m for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:08 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-HasCnh74ODWniGYQq9V_uw-1; Fri, 02 May 2025 12:42:04 -0400 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7c3c8f8ab79so342609885a.2 for ; Fri, 02 May 2025 09:42:04 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204125; 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=KYwm/MwdS+WEwVvT8ZltgPHE/zV2f/JvznZHRlv4PP4=; b=e3eg6NkQX/CaiOhbJYxTLCngggpkmoSPRt2wuALZbt+xxHFEIMvFED+gGCMsjKAxkc1FnR psv2zEHbn4gmBtFFu2VRZunXlrHnzYY7bvdsBXjkxRgKthp+kJ/tPhvVGJiknjAY10045s +t1jA4PqUTHFS9zXpZouOlm9jw+Y7wc= X-MC-Unique: HasCnh74ODWniGYQq9V_uw-1 X-Mimecast-MFC-AGG-ID: HasCnh74ODWniGYQq9V_uw_1746204124 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204123; x=1746808923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KYwm/MwdS+WEwVvT8ZltgPHE/zV2f/JvznZHRlv4PP4=; b=A3N5SqwXXpU+pxestO0aw9+0LuWrF2gqUPwIw48YwZw62jgCAXa+daxfrTTL/x8fPd R+uldKQX6ayFC+skkEBvZj46zzcRy6cexIfL5E8itIog7WPTGW5KvYNq25LVCHJdnjbT zycCGnW3+Fj+txJ6a72qof1ef8n6W6XtWl658jzXQ6F+AADW5xyCfoep8R1b9BOPKFD1 HC9JCx8F+So00uB3Xspc2Ucr3qxZutlwvxRtoCymOGCKmzVZmw55VMIvpF7IdmQDFLfz CW9zKhjSeg/hTEHMFGLWzMsWPtB1VKRpTnNcZze8he3I9pI2j6vJB4606iTIQlwTzMq/ akHg== X-Gm-Message-State: AOJu0YxWuz6SEwBgdEYS5VOcZQSitZXmo6jN6OQyseHjSWs77JivzxXd rGdaQ4TwgSoUcT4t0N12qkE5pmDAukxMNYHo6CkAlAERImwOOkK8Qk92x4fU2XFCs9QjH930ZOk 5K2c65hmshxi1Thbswzo2+2MwHpHKtvV6zkbzEbslK09g1F67NO22hxvibTy8TLMyUoLKak6smB GeKWPyKC8m6WnBCyReILyZ0OIWq/7630OCQg== X-Gm-Gg: ASbGncvJOjn7Z13ma1611NdgozEmOVRn+9X7qvSr0LRoyx2+sQ46bRrJhLFnsZ2wa5C Xe6UAk0RyzO0wCi5FkTMlXTM6SxYtK9S5c1Rs9xOHsGiP8kRg/1GR1Tf2TBRM3Nq3dIGApkhGIQ MPwjcRNM7kvWUDVNaau8r4NQeEMpIOUdZ1cqFYba575+uS5xUQeWaPA0npPOOREqNeqsHJ4YiPd 7CU008h2cYXdNJc6WTx1VF9i75FDo2vqTjnv6lHpPqOBmMOsXlDtzCTuIIIfgptMIMaciJt4/5v X-Received: by 2002:a05:620a:19a6:b0:7c7:93ae:fe56 with SMTP id af79cd13be357-7cad5bc0a1dmr500726785a.51.1746204122792; Fri, 02 May 2025 09:42:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiu3LgihU8stdZhmxLqzpzMm0DhsIEMmRTHTRV76IeMlKh5vLc6WWhd1F6obUdpJnvnw7LVA== X-Received: by 2002:a05:620a:19a6:b0:7c7:93ae:fe56 with SMTP id af79cd13be357-7cad5bc0a1dmr500721985a.51.1746204122154; Fri, 02 May 2025 09:42:02 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Xiaohui Li , Juraj Marcin Subject: [PULL 12/14] migration/postcopy: Spatial locality page hint for preempt mode Date: Fri, 2 May 2025 12:41:39 -0400 Message-ID: <20250502164141.747202-13-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URG_BIZ=0.573 autolearn=no 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: 1746204226388116600 Content-Type: text/plain; charset="utf-8" The preempt mode postcopy has been introduced for a while. From latency POV, it should always win the vanilla postcopy. However there's one thing missing when preempt mode is enabled right now, which is the spatial locality hint when there're page requests from the destination side. In vanilla postcopy, as long as a page request was unqueued, it will update the PSS of the precopy background stream, so that after a page request the background thread will move the pages after whatever was requested. It's pretty much a natural behavior when there's only one channel anyway, and one scanner to send the pages. Preempt mode didn't follow that, because preempt mode has its own channel and its own PSS (which doesn't linearly scan the guest memory, but dedicated to resolve page requested from destination). So the page request process and the background migration process are completely separate. This patch adds the hint explicitly for preempt mode. With that, whenever the preempt mode receives a page request on the source, it will service the remote page fault in the return path, then it'll provide a hint to the background thread so that we'll start sending the pages right after the requested ones in the background, assuming the follow up pages have a higher chance to be accessed later. NOTE: since the background migration thread and return path thread run completely concurrently, it doesn't always mean the hint will be applied every single time. For example, it's possible that the return path thread receives multiple page requests in a row without the background thread getting the chance to consume one. In such case, the preempt thread only provide the hint if the previous hint has been consumed. After all, there's no point queuing hints when we only have one linear scanner. This could measureably improve the simple sequential memory access pattern during postcopy (when preempt is on). For random accesses, I can measure a slight increase of remote page fault latency from ~500us -> ~600us, that could be a trade-off to have such hint mechanism, and after all that's still greatly improved comparing to vanilla postcopy on random (~10ms). The patch is verified by our QE team in a video streaming test case, to reduce the pause of the video from ~1min to a few seconds when switching over to postcopy with preempt mode. Reported-by: Xiaohui Li Tested-by: Xiaohui Li Reviewed-by: Juraj Marcin Link: https://lore.kernel.org/r/20250424220705.195544-1-peterx@redhat.com Signed-off-by: Peter Xu --- migration/ram.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index a749e4a421..e12913b43e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -91,6 +91,36 @@ =20 XBZRLECacheStats xbzrle_counters; =20 +/* + * This structure locates a specific location of a guest page. In QEMU, + * it's described in a tuple of (ramblock, offset). + */ +struct PageLocation { + RAMBlock *block; + unsigned long offset; +}; +typedef struct PageLocation PageLocation; + +/** + * PageLocationHint: describes a hint to a page location + * + * @valid set if the hint is vaild and to be consumed + * @location: the hint content + * + * In postcopy preempt mode, the urgent channel may provide hints to the + * background channel, so that QEMU source can try to migrate whatever is + * right after the requested urgent pages. + * + * This is based on the assumption that the VM (already running on the + * destination side) tends to access the memory with spatial locality. + * This is also the default behavior of vanilla postcopy (preempt off). + */ +struct PageLocationHint { + bool valid; + PageLocation location; +}; +typedef struct PageLocationHint PageLocationHint; + /* used by the search for pages to send */ struct PageSearchStatus { /* The migration channel used for a specific host page */ @@ -395,6 +425,13 @@ struct RAMState { * RAM migration. */ unsigned int postcopy_bmap_sync_requested; + /* + * Page hint during postcopy when preempt mode is on. Return path + * thread sets it, while background migration thread consumes it. + * + * Protected by @bitmap_mutex. + */ + PageLocationHint page_hint; }; typedef struct RAMState RAMState; =20 @@ -2019,6 +2056,21 @@ static void pss_host_page_finish(PageSearchStatus *p= ss) pss->host_page_start =3D pss->host_page_end =3D 0; } =20 +static void ram_page_hint_update(RAMState *rs, PageSearchStatus *pss) +{ + PageLocationHint *hint =3D &rs->page_hint; + + /* If there's a pending hint not consumed, don't bother */ + if (hint->valid) { + return; + } + + /* Provide a hint to the background stream otherwise */ + hint->location.block =3D pss->block; + hint->location.offset =3D pss->page; + hint->valid =3D true; +} + /* * Send an urgent host page specified by `pss'. Need to be called with * bitmap_mutex held. @@ -2064,6 +2116,7 @@ out: /* For urgent requests, flush immediately if sent */ if (sent) { qemu_fflush(pss->pss_channel); + ram_page_hint_update(rs, pss); } return ret; } @@ -2151,6 +2204,30 @@ static int ram_save_host_page(RAMState *rs, PageSear= chStatus *pss) return (res < 0 ? res : pages); } =20 +static bool ram_page_hint_valid(RAMState *rs) +{ + /* There's only page hint during postcopy preempt mode */ + if (!postcopy_preempt_active()) { + return false; + } + + return rs->page_hint.valid; +} + +static void ram_page_hint_collect(RAMState *rs, RAMBlock **block, + unsigned long *page) +{ + PageLocationHint *hint =3D &rs->page_hint; + + assert(hint->valid); + + *block =3D hint->location.block; + *page =3D hint->location.offset; + + /* Mark the hint consumed */ + hint->valid =3D false; +} + /** * ram_find_and_save_block: finds a dirty page and sends it to f * @@ -2167,6 +2244,8 @@ static int ram_save_host_page(RAMState *rs, PageSearc= hStatus *pss) static int ram_find_and_save_block(RAMState *rs) { PageSearchStatus *pss =3D &rs->pss[RAM_CHANNEL_PRECOPY]; + unsigned long next_page; + RAMBlock *next_block; int pages =3D 0; =20 /* No dirty page as there is zero RAM */ @@ -2186,7 +2265,14 @@ static int ram_find_and_save_block(RAMState *rs) rs->last_page =3D 0; } =20 - pss_init(pss, rs->last_seen_block, rs->last_page); + if (ram_page_hint_valid(rs)) { + ram_page_hint_collect(rs, &next_block, &next_page); + } else { + next_block =3D rs->last_seen_block; + next_page =3D rs->last_page; + } + + pss_init(pss, next_block, next_page); =20 while (true){ if (!get_queued_page(rs, pss)) { @@ -2319,6 +2405,13 @@ static void ram_save_cleanup(void *opaque) ram_state_cleanup(rsp); } =20 +static void ram_page_hint_reset(PageLocationHint *hint) +{ + hint->location.block =3D NULL; + hint->location.offset =3D 0; + hint->valid =3D false; +} + static void ram_state_reset(RAMState *rs) { int i; @@ -2331,6 +2424,8 @@ static void ram_state_reset(RAMState *rs) rs->last_page =3D 0; rs->last_version =3D ram_list.version; rs->xbzrle_started =3D false; + + ram_page_hint_reset(&rs->page_hint); } =20 #define MAX_WAIT 50 /* ms, half buffered_file limit */ --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204263; cv=none; d=zohomail.com; s=zohoarc; b=Fp8fIs2C2iFv5lv7fN0V9QClMnXUDrsqTs6FlxapYBfDQ0NV0oTCVrW0Y82l5VEagXQ75+iqS0N64TLvCI0wi01QaCsj1UqOHDPFio8DkjrTl5nZEQjiLQnnhaLXZSi4v9f6Vho3GUGvNqJXiu4c/MMCFguQWXbmKXaLf2B6q0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204263; 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=nQ6LGo3EmUQNiuDdGer7Pnmf83Ixx9VZUInNoC4VPuU=; b=Z6HLIENs8UHyqjmOhIOlnB2QmYq/RRfXyv8dBFT4MAdkPbcZInlLOdn2Fs68fdsOEXdXUMNiSKtBLFwEu7EFYysDhx8gyrjB6QMn22Tp4PPUzqg0GWnROC6r345Awz0RaS64v+yKgsH7hESlck8J/5TGcAjNgb8JbatEW+f6CEs= 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 1746204263341915.3324534540895; Fri, 2 May 2025 09:44:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtT4-00082U-9f; Fri, 02 May 2025 12:42:30 -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 1uAtSl-0007nx-Pp for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSh-0006Uu-Pp for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:10 -0400 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-385-YxZtR40XPrikl_8i19m-ew-1; Fri, 02 May 2025 12:42:06 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-47ae87b5182so46188221cf.2 for ; Fri, 02 May 2025 09:42:05 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204127; 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=nQ6LGo3EmUQNiuDdGer7Pnmf83Ixx9VZUInNoC4VPuU=; b=S2DDsaz1SajkkE1kG+Y++qAceWHpwFl/z4ivl3WcTJgS5KgxrVkEhq1oDpcBUHIwgY1P5d eMU5wHm478mZVQ+0uNfKpt/3VAqL0szOSPZTBcQF5HKqcsDhwU6jBpvlivV2aXZsA3pWvi gokoAiFnc8veNjs1fTKDqahH5fi/k5k= X-MC-Unique: YxZtR40XPrikl_8i19m-ew-1 X-Mimecast-MFC-AGG-ID: YxZtR40XPrikl_8i19m-ew_1746204125 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204125; x=1746808925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nQ6LGo3EmUQNiuDdGer7Pnmf83Ixx9VZUInNoC4VPuU=; b=pL8DnCfiYn6nnuDu5rZeXLRfOzz/ld/GODmBBoAQCTzyAOc/wq5TuBPxMeN35wjy5/ 9LehEtbACaqtYJNHXBuPtHNy475cN09MTVhMiHvoaNEFrmFw1wjuIqW9LrK8ui9MJdjZ FdZusflihcZdqJg+RSaCRlfyynNDuqNHwSWWTBcHbqNFO03816oGlCXig+urLcXwVukl ye4HBmCDOxeVT9XsdOb4ZFyph+5250hK02EVsGtjUPkR4ENjeBTgm3AYE6+kDzmFhjnr xYTiIJ4ghQwN/i8SVwvZ0XUKlvLFppRW+co0fxrc0kLqhYHHHhoLlBYSK4emaWyCL2p4 Z3bA== X-Gm-Message-State: AOJu0Yx/+qWbQvhCqwZHNAPK4dUIRF80SHjp2f5nBYYg2sIS8X1x4nsH HnJWO+KeVcvkDtnRglSILmEtwliwF3Sz3HvqMPMUJvo+enGI6ARwz4+Gb3iacGd2EHMZQoacyQR prsHLblZVBwWsS18mkzgQIwqt++zIkZh9RtOJAKqYHKgrikx5v/74ImXSzY4eqw52YKKBBDQyq7 cU/yh8v/MlyZuhAjbnB8puYs1JYPizAMz6AA== X-Gm-Gg: ASbGncsTWx23K7ozY5SkSTkrR6JTTqhKbMMVw3bYrQUM5AM/SeTjxSO1NcCyy0OlzhP XWrMUAIF0TRac9NDNsoldKjeG3wsvdK3vZLvxtjM8EGgXEMoTJMDsgED/V0bUwWTkEySZ8cy4v1 EdNqSi09xEtw2QgKjWszGmLacsFAI6P3hjinnwFDmU91E8lnWM7HMSFisXPnz24K5JEslx0NUxj RGlhDn7yR2XptvfIsok49IMKq/2q5JAzqiirS9cIHuyHuMrP9bo2PPx2vsuhvx2vs60T5IRmys1 X-Received: by 2002:a05:622a:ed5:b0:48b:5656:bb01 with SMTP id d75a77b69052e-48c311649cfmr39084081cf.10.1746204125140; Fri, 02 May 2025 09:42:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYLdRbciPNTI8T2YmCs7k44odWgi3wpbc6/Iw57N6IsUYOnrdyJ+dZuiBRoWddHNXCnzQ6tw== X-Received: by 2002:a05:622a:ed5:b0:48b:5656:bb01 with SMTP id d75a77b69052e-48c311649cfmr39083691cf.10.1746204124694; Fri, 02 May 2025 09:42:04 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Jack Wang , Li Zhijian , Yu Zhang , linux-rdma@vger.kernel.org, michael@flatgalaxy.com, Michael Galaxy Subject: [PULL 13/14] migration/rdma: Remove qemu_rdma_broken_ipv6_kernel Date: Fri, 2 May 2025 12:41:40 -0400 Message-ID: <20250502164141.747202-14-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204264661116600 Content-Type: text/plain; charset="utf-8" From: Jack Wang I hit following error which testing migration in pure RoCE env: "-incoming rdma:[::]:8089: RDMA ERROR: You only have RoCE / iWARP devices i= n your systems and your management software has specified '[::]', but IPv6 over Ro= CE / iWARP is not supported in Linux.#012'." In our setup, we use rdma bind on ipv6 on target host, while connect from s= ource with ipv4, remove the qemu_rdma_broken_ipv6_kernel, migration just work fine. Checking the git history, the function was added since introducing of rdma migration, which is more than 10 years ago. linux-rdma has improved support on RoCE/iWARP for ipv6 over past years. There are a few fi= xes back in 2016 seems related to the issue, eg: aeb76df46d11 ("IB/core: Set routable RoCE gid type for ipv4/ipv6 networks") other fixes back in 2018, eg: 052eac6eeb56 RDMA/cma: Update RoCE multicast routines to use net namespace 8d20a1f0ecd5 RDMA/cma: Fix rdma_cm raw IB path setting for RoCE 9327c7afdce3 RDMA/cma: Provide a function to set RoCE path record L2 parame= ters 5c181bda77f4 RDMA/cma: Set default GID type as RoCE when resolving RoCE rou= te 3c7f67d1880d IB/cma: Fix default RoCE type setting be1d325a3358 IB/core: Set RoCEv2 MGID according to spec 63a5f483af0e IB/cma: Set default gid type to RoCEv2 So remove the outdated function and it's usage. Cc: Peter Xu Cc: Li Zhijian Cc: Yu Zhang Cc: Fabiano Rosas Cc: qemu-devel@nongnu.org Cc: linux-rdma@vger.kernel.org Cc: michael@flatgalaxy.com Signed-off-by: Jack Wang Tested-by: Li zhijian Reviewed-by: Michael Galaxy Link: https://lore.kernel.org/r/20250402051306.6509-1-jinpu.wang@ionos.com [peterx: some cosmetic changes] Signed-off-by: Peter Xu --- migration/rdma.c | 180 ++--------------------------------------------- 1 file changed, 4 insertions(+), 176 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 4875ca1987..2d839fce6c 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -767,149 +767,6 @@ static void qemu_rdma_dump_gid(const char *who, struc= t rdma_cm_id *id) trace_qemu_rdma_dump_gid(who, sgid, dgid); } =20 -/* - * As of now, IPv6 over RoCE / iWARP is not supported by linux. - * We will try the next addrinfo struct, and fail if there are - * no other valid addresses to bind against. - * - * If user is listening on '[::]', then we will not have a opened a device - * yet and have no way of verifying if the device is RoCE or not. - * - * In this case, the source VM will throw an error for ALL types of - * connections (both IPv4 and IPv6) if the destination machine does not ha= ve - * a regular infiniband network available for use. - * - * The only way to guarantee that an error is thrown for broken kernels is - * for the management software to choose a *specific* interface at bind ti= me - * and validate what time of hardware it is. - * - * Unfortunately, this puts the user in a fix: - * - * If the source VM connects with an IPv4 address without knowing that the - * destination has bound to '[::]' the migration will unconditionally fail - * unless the management software is explicitly listening on the IPv4 - * address while using a RoCE-based device. - * - * If the source VM connects with an IPv6 address, then we're OK because = we can - * throw an error on the source (and similarly on the destination). - * - * But in mixed environments, this will be broken for a while until it is= fixed - * inside linux. - * - * We do provide a *tiny* bit of help in this function: We can list all of= the - * devices in the system and check to see if all the devices are RoCE or - * Infiniband. - * - * If we detect that we have a *pure* RoCE environment, then we can safely - * thrown an error even if the management software has specified '[::]' as= the - * bind address. - * - * However, if there is are multiple hetergeneous devices, then we cannot = make - * this assumption and the user just has to be sure they know what they are - * doing. - * - * Patches are being reviewed on linux-rdma. - */ -static int qemu_rdma_broken_ipv6_kernel(struct ibv_context *verbs, Error *= *errp) -{ - /* This bug only exists in linux, to our knowledge. */ -#ifdef CONFIG_LINUX - struct ibv_port_attr port_attr; - - /* - * Verbs are only NULL if management has bound to '[::]'. - * - * Let's iterate through all the devices and see if there any pure IB - * devices (non-ethernet). - * - * If not, then we can safely proceed with the migration. - * Otherwise, there are no guarantees until the bug is fixed in linux. - */ - if (!verbs) { - int num_devices; - struct ibv_device **dev_list =3D ibv_get_device_list(&num_devices); - bool roce_found =3D false; - bool ib_found =3D false; - - for (int x =3D 0; x < num_devices; x++) { - verbs =3D ibv_open_device(dev_list[x]); - /* - * ibv_open_device() is not documented to set errno. If - * it does, it's somebody else's doc bug. If it doesn't, - * the use of errno below is wrong. - * TODO Find out whether ibv_open_device() sets errno. - */ - if (!verbs) { - if (errno =3D=3D EPERM) { - continue; - } else { - error_setg_errno(errp, errno, - "could not open RDMA device context"); - return -1; - } - } - - if (ibv_query_port(verbs, 1, &port_attr)) { - ibv_close_device(verbs); - error_setg(errp, - "RDMA ERROR: Could not query initial IB port"); - return -1; - } - - if (port_attr.link_layer =3D=3D IBV_LINK_LAYER_INFINIBAND) { - ib_found =3D true; - } else if (port_attr.link_layer =3D=3D IBV_LINK_LAYER_ETHERNET= ) { - roce_found =3D true; - } - - ibv_close_device(verbs); - - } - - if (roce_found) { - if (ib_found) { - warn_report("migrations may fail:" - " IPv6 over RoCE / iWARP in linux" - " is broken. But since you appear to have a" - " mixed RoCE / IB environment, be sure to only" - " migrate over the IB fabric until the kernel " - " fixes the bug."); - } else { - error_setg(errp, "RDMA ERROR: " - "You only have RoCE / iWARP devices in your sys= tems" - " and your management software has specified '[= ::]'" - ", but IPv6 over RoCE / iWARP is not supported = in Linux."); - return -1; - } - } - - return 0; - } - - /* - * If we have a verbs context, that means that some other than '[::]' = was - * used by the management software for binding. In which case we can - * actually warn the user about a potentially broken kernel. - */ - - /* IB ports start with 1, not 0 */ - if (ibv_query_port(verbs, 1, &port_attr)) { - error_setg(errp, "RDMA ERROR: Could not query initial IB port"); - return -1; - } - - if (port_attr.link_layer =3D=3D IBV_LINK_LAYER_ETHERNET) { - error_setg(errp, "RDMA ERROR: " - "Linux kernel's RoCE / iWARP does not support IPv6 " - "(but patches on linux-rdma in progress)"); - return -1; - } - -#endif - - return 0; -} - /* * Figure out which RDMA device corresponds to the requested IP hostname * Also create the initial connection manager identifiers for opening @@ -917,7 +774,6 @@ static int qemu_rdma_broken_ipv6_kernel(struct ibv_cont= ext *verbs, Error **errp) */ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp) { - Error *err =3D NULL; int ret; struct rdma_addrinfo *res; char port_str[16]; @@ -953,9 +809,8 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Er= ror **errp) goto err_resolve_get_addr; } =20 - /* Try all addresses, saving the first error in @err */ + /* Try all addresses, exit loop on first success of resolving address = */ for (struct rdma_addrinfo *e =3D res; e !=3D NULL; e =3D e->ai_next) { - Error **local_errp =3D err ? NULL : &err; =20 inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof= ip); @@ -964,25 +819,12 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, = Error **errp) ret =3D rdma_resolve_addr(rdma->cm_id, NULL, e->ai_dst_addr, RDMA_RESOLVE_TIMEOUT_MS); if (ret >=3D 0) { - if (e->ai_family =3D=3D AF_INET6) { - ret =3D qemu_rdma_broken_ipv6_kernel(rdma->cm_id->verbs, - local_errp); - if (ret < 0) { - continue; - } - } - error_free(err); goto route; } } =20 rdma_freeaddrinfo(res); - if (err) { - error_propagate(errp, err); - } else { - error_setg(errp, "RDMA ERROR: could not resolve address %s", - rdma->host); - } + error_setg(errp, "RDMA ERROR: could not resolve address %s", rdma->hos= t); goto err_resolve_get_addr; =20 route: @@ -2611,7 +2453,6 @@ err_rdma_source_connect: =20 static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp) { - Error *err =3D NULL; int ret; struct rdma_cm_id *listen_id; char ip[40] =3D "unknown"; @@ -2661,9 +2502,8 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Err= or **errp) goto err_dest_init_bind_addr; } =20 - /* Try all addresses, saving the first error in @err */ + /* Try all addresses */ for (e =3D res; e !=3D NULL; e =3D e->ai_next) { - Error **local_errp =3D err ? NULL : &err; =20 inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof= ip); @@ -2672,24 +2512,12 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, E= rror **errp) if (ret < 0) { continue; } - if (e->ai_family =3D=3D AF_INET6) { - ret =3D qemu_rdma_broken_ipv6_kernel(listen_id->verbs, - local_errp); - if (ret < 0) { - continue; - } - } - error_free(err); break; } =20 rdma_freeaddrinfo(res); if (!e) { - if (err) { - error_propagate(errp, err); - } else { - error_setg(errp, "RDMA ERROR: Error: could not rdma_bind_addr!= "); - } + error_setg(errp, "RDMA ERROR: Error: could not rdma_bind_addr!"); goto err_dest_init_bind_addr; } =20 --=20 2.48.1 From nobody Sat Nov 15 22:25: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=1746204242; cv=none; d=zohomail.com; s=zohoarc; b=BVUURAFrcuulUG71Vc395cL6ZPawSw0y+V4Oy97taEFOXwMYfiD3jtE1nuV283p5933Qez0cFTWkaEuHMD5Ymj7vDTtr0VAIAHGslBF45vCMPkmgQtmlO3FKKvnsbOZv3bp1rTnaWz3Y9oW5xlqUS43QMQAcLOyt/TgzimFhfU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746204242; 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=yxAXCRgMFBUrR/bs744IU7o+At9NXW4bLRS1vlLvNyo=; b=oFeKh8wrz2xtZ136WTl6edsOmohG0EBkt/p8CG8SppoWQC18e8ibLLrtBNlXQzOBlRvgAO0fwW7Spt5OMkkrgtIplw4DamuHBlkY24iThNAcHmKmd31cxvf9uAzMTBjJ9pqdWzF6VP+9Iss/fHE5o7RffjLrMMEJBicC5uhlis4= 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 1746204242146625.9547918382923; Fri, 2 May 2025 09:44:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAtT0-0007xG-3D; Fri, 02 May 2025 12:42:26 -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 1uAtSn-0007om-DY for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAtSl-0006VG-I7 for qemu-devel@nongnu.org; Fri, 02 May 2025 12:42:12 -0400 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-215-fSMIj9wgNV6FIA_shm3yYQ-1; Fri, 02 May 2025 12:42:07 -0400 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7c54a6b0c70so211000985a.0 for ; Fri, 02 May 2025 09:42:07 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cad23d1c8dsm203108385a.60.2025.05.02.09.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 May 2025 09:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746204128; 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=yxAXCRgMFBUrR/bs744IU7o+At9NXW4bLRS1vlLvNyo=; b=ERICSb7t/7PYLAjIQbHpJ9fApsZX1g3hPG7Z46+iavTBKY6tkdQX1/kU6Z1Y8VKp0zpSMY qCcPeTKsbbYQVH+Pcv2/GTEyRoEc7t/Fk1zvtWFQ2FUjjLAqXisdAUJsrnLMpOc2CW8W4Z U4b6XhijxtQLt8Jr3tBKpLxFV7ld89c= X-MC-Unique: fSMIj9wgNV6FIA_shm3yYQ-1 X-Mimecast-MFC-AGG-ID: fSMIj9wgNV6FIA_shm3yYQ_1746204127 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746204126; x=1746808926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yxAXCRgMFBUrR/bs744IU7o+At9NXW4bLRS1vlLvNyo=; b=ZJE2CZPfoyiXB00SxAZiPOCIUk2Kq37ML6Y4rsP5yp2mAaB0HGITBJaPPOgHM22o52 q6z8oUWhhjegyzbgNahb7kJBoqt27cQoHUYnB6YxY/ejLs4bt2zhLGvv+vRkxpzTF8l1 7npacnIUYuAVkc6ERQZgpWshVwG0b6HznK1XErBszC5jbzkgunVwgJUDwYH1cByvXUVr Gd1+HRKM8i+KBA/qi3INwq8rlGMe0+pDzSfc/dnvhmVskExPbaB+BkSHZAzsaToUbQUh +4YBScGIjucW80pYk+SyWwNPzyTBcjEWsVYxgzaeS8NTXubuViCSCUoMn+WdSHUfCbLQ h9JQ== X-Gm-Message-State: AOJu0YzhVYTota7yI6MbBgriGHgxR5MLQqAWboTlqo8QTrxc8UPenHnl c4KD6z4zexatAjoZ9VwCdU+iCSE03aySejX+hULesl7yQaEHOd1OKXPrKh89Pl2mNrhR0cZ3a4n 37Lzih0VabFarmlope9WuHLt1oZgEFvHLU5KhS4KfKXh1bRd7oVtgwPaGRRWCoFdO1d53ns6Y5+ 4e5beqJKHigT0Vzr8IF1vr8RgkbRnUf1mDXQ== X-Gm-Gg: ASbGncvHQBTSZUp+aYUMPnNwy1JvWarikuutateAj0BjRvpDz3HJJi1DO2Hx+e+YhpR Dd4nmcb5juTl0a5xIO09mnz7+xFromvhfxAdmJ8694zHDOcCLw1TLBsLXqeLgfJjE4eGZR4haR3 izKwU37CsBaQF31ysSMK5u3kLJjeps6S1JC7FWSHf6DZCFoD0XKOjKHucRwoJ/YwxbcOhx0JFsK f4ChxsMpSjgi8T79JFi1RbKNlbliYrAS5bOQ5uNGzV2RHZRwzPJb+/A4VibH1b4VgCBPOsHMjlS X-Received: by 2002:a05:620a:2724:b0:7c7:a604:d432 with SMTP id af79cd13be357-7cad5b4cc54mr593144285a.30.1746204126459; Fri, 02 May 2025 09:42:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7wwibhixRfqal2VlS13xB8xJzXoVhjjDXGhxF4DGn/37sb3XmwW07w/mILlQSdjMFyt2Tqw== X-Received: by 2002:a05:620a:2724:b0:7c7:a604:d432 with SMTP id af79cd13be357-7cad5b4cc54mr593139285a.30.1746204126021; Fri, 02 May 2025 09:42:06 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Stefan Hajnoczi , peterx@redhat.com, Thomas Huth Subject: [PULL 14/14] scripts/vmstate-static-checker.py: Allow new name for ghes_addr_le field Date: Fri, 2 May 2025 12:41:41 -0400 Message-ID: <20250502164141.747202-15-peterx@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250502164141.747202-1-peterx@redhat.com> References: <20250502164141.747202-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.644, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1746204243536019000 Content-Type: text/plain; charset="utf-8" From: Thomas Huth ghes_addr_le has been renamed to hw_error_le in commit 652f6d86cbb ("acpi/ghes: better name the offset of the hardware error firmware"). Adjust the checker script to allow that changed field name. Signed-off-by: Thomas Huth Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20250429152141.294380-3-thuth@redhat.com Signed-off-by: Peter Xu --- scripts/vmstate-static-checker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-che= cker.py index 9c0e6b81f2..25aca839a0 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -42,6 +42,7 @@ def check_fields_match(name, s_field, d_field): # Some fields changed names between qemu versions. This list # is used to allow such changes in each section / description. changed_names =3D { + 'acpi-ghes': ['ghes_addr_le', 'hw_error_le'], 'apic': ['timer', 'timer_expiry'], 'e1000': ['dev', 'parent_obj'], 'ehci': ['dev', 'pcidev'], --=20 2.48.1