From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532827; cv=none; d=zohomail.com; s=zohoarc; b=L7J6knjWqn3WGwIq6J+SUxNBLWlXU26xogMxMBITBJTIvBKw6E8zRFIAVrKAGXumvs8bNrJbvfzX5RHVgyiFuXLVrkkF18qfSnhXYELaPsPn3wNZGqTx4bLifx++ZZsZQXKpIUYyUB/AHtwapWCHkkNz+hhFW5qoBD7zxz0I2EE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532827; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nYn3wZrMyYymeyCClVIgJvkXVp6ydFMMtRwUBbQ6kf0=; b=dQjpi/bkjyUkc5XsA1Ol+oCfp7ibEF49xYkZWBGOgbyQJqTN+fepAr1+XX/qgGNrJuYHZ4p73YvbvAVSMlSAFNYzmvETPjYAHd447qr/0RwJDpZ9iomRdNwD8jlrxDODfQ08FiOZ8lu2PPZp0OrdJUA+6mQbj0F8ljDjfjie9x4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682532827755100.20840154511541; Wed, 26 Apr 2023 11:13:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjdY-0003c8-LG; Wed, 26 Apr 2023 14:13:04 -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 1prjdW-0003bt-AY for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13: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 1prjdU-0000lG-Sh for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:02 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-319-2p0A78sdPZK-IDxuW0SiGA-1; Wed, 26 Apr 2023 14:12:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 492F981B154 for ; Wed, 26 Apr 2023 18:12:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D3041121314; Wed, 26 Apr 2023 18:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532780; 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=nYn3wZrMyYymeyCClVIgJvkXVp6ydFMMtRwUBbQ6kf0=; b=f4Q0pQiX5/t6n6/hu8sHYjAN1Tk2L23Zcbr8rScBim15YcYSdu/JeCymk5AyQjkAaC4BUo jLg/avncsmRHojJP1e5A7sGgbQ/2EJAh53fxT6hlRfPZlPiST6fwycSTgboKXrmW1wAGcB qJdpfMnHaWgGt65w/n3b3hb+a7sIbe4= X-MC-Unique: 2p0A78sdPZK-IDxuW0SiGA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras , "Dr . David Alan Gilbert" Subject: [PULL 1/7] migration: Disable postcopy + multifd migration Date: Wed, 26 Apr 2023 20:12:47 +0200 Message-Id: <20230426181253.13286-2-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532829930100011 Content-Type: text/plain; charset="utf-8" From: Leonardo Bras Since the introduction of multifd, it's possible to perform a multifd migration and finish it using postcopy. A bug introduced by yank (fixed on cfc3bcf373) was previously preventing a successful use of this migration scenario, and now thing should be working on most scenarios. But since there is not enough testing/support nor any reported users for this scenario, we should disable this combination before it may cause any problems for users. Suggested-by: Dr. David Alan Gilbert Signed-off-by: Leonardo Bras Acked-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/options.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/migration/options.c b/migration/options.c index 8e8753d9be..dd97c99391 100644 --- a/migration/options.c +++ b/migration/options.c @@ -322,6 +322,11 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Postcopy is not compatible with ignore-share= d"); return false; } + + if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + error_setg(errp, "Postcopy is not yet compatible with multifd"= ); + return false; + } } =20 if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { --=20 2.40.0 From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532827; cv=none; d=zohomail.com; s=zohoarc; b=CBpnddOstTZcNk0dXDEdwLCbbgHapbj8EElgNrJ8Te8ZUP6FSPCeY39a7Y4w2l0q7LPLJAjTctEhGC/jsTdCsmWnDQcUsWCDl6czE1wVmcfbc4/JbPgWaZzIj2Y0EeLJbz1IWYHTC8Gwkn/t/DVl02lNv4TcQlcy7k0Uma6P41o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532827; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6+LHntU332C7StE+J4m/fBdi6PH2GlmOaf3MvIwUPBE=; b=d/BNdcfvlZQ7B7cXsUlQuB1hk2y5lKVg/X5eS+UOAwVHBiJslujkZ0FbdJcgG0jcN6tnohSU6QQUrYl4lOqOm3lUS76Wwaruaqn0Mgvl5/vh2u+g9mLOp4ul4O3ZDIROvkooV3SGtHhnW+ptRJAo7Po+wqS2OPdwHrB/mt2yUCM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682532827166891.0916920761147; Wed, 26 Apr 2023 11:13:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjdd-0003d8-3S; Wed, 26 Apr 2023 14:13:09 -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 1prjdb-0003ce-MA for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:07 -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 1prjdW-0000lY-Nq for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:07 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-CyUlyysaOY6NVgNZnofVew-1; Wed, 26 Apr 2023 14:13:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2AF5A0F387 for ; Wed, 26 Apr 2023 18:12:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D7A31121314; Wed, 26 Apr 2023 18:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532782; 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=6+LHntU332C7StE+J4m/fBdi6PH2GlmOaf3MvIwUPBE=; b=YXIp2TLif4saRqssQvCtJPaxyX07EHcf5XoNw2U4Q+xLxFBRtjR1oWZ9ysDvpqShjqgRh0 3CXuwT1r2hnvYIGds2PEnkaLg5bG80dXFQdD79KBoRFaUllXETP72jMMBrTuEBk8mKPFEw 02nFsNpVMa89Z5wz3cZCwRsOKcDXurA= X-MC-Unique: CyUlyysaOY6NVgNZnofVew-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras Subject: [PULL 2/7] MAINTAINERS: Add Leonardo and Peter as reviewers Date: Wed, 26 Apr 2023 20:12:48 +0200 Message-Id: <20230426181253.13286-3-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532828468100001 Content-Type: text/plain; charset="utf-8" Now that David has stepped down with Migration maintainership, Leonardo and Peter has volunteer to review the migration patches. This way they got CC'd on every migration patch. Signed-off-by: Juan Quintela Acked-by: Peter Xu Acked-by: Leonardo Bras --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 24154f5721..1aa50c0fe2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3150,6 +3150,8 @@ F: scripts/checkpatch.pl =20 Migration M: Juan Quintela +R: Peter Xu +R: Leonardo Bras S: Maintained F: hw/core/vmstate-if.c F: include/hw/vmstate-if.h --=20 2.40.0 From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532851; cv=none; d=zohomail.com; s=zohoarc; b=adI8wi0cW7ENLi1wtkFc8JEf70+P/3jjeR0cGH/3d/Q9CKnXwu0p5uPDWTWrPDV9Mz/awNIHmYP2dCiuFqJ9jkPScfbu5GUfiwdeOztz1yRXLIcciMzMbLOARMcb0ivAQkCGm+ZcMJ8NS29btgIYajsCCqy3CwNiPOn1ZAwTYT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532851; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZgIH6ip8ba6VQ6/6CNScjncdL1YBECwLG9beCYfsVXY=; b=QrtaqPgwtx9F6CUJBN6y7fyhX8fhAg53pj/4W9x3pbg61orKieza/SO2u5q+phomFzyM4qtnC2zrf2NWTioNy3KG3ogvnf5svZq/AelXYEs8+eWzE444cRFie8VXd5TCnToXg0haqGbnzghNqi7cgqFTw0hLvSDjZkXucWAxbLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682532851416230.32507810449306; Wed, 26 Apr 2023 11:14:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjde-0003dW-Am; Wed, 26 Apr 2023 14:13:10 -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 1prjdc-0003d0-PL for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:08 -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 1prjda-0000oH-Mh for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:08 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-107-hGlj91p6MsuyGQ76PVYulw-1; Wed, 26 Apr 2023 14:13:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BCCBB3806623; Wed, 26 Apr 2023 18:13:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 406921121314; Wed, 26 Apr 2023 18:13:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532786; 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=ZgIH6ip8ba6VQ6/6CNScjncdL1YBECwLG9beCYfsVXY=; b=A+S15JFZ14aKF8pr9xpQBZfwq5FpO7MgdCBnOoQHX5bb0q4T8utCEbfwiSLm3/gJSchh0a Oxo2JdioxiGVUlgreVXaaqIHzPTrEou+J7mzyVA2dm4AJLfLUF8X1lJVXml6ucxOFBN0pd A6GUjl7FWsewkHelH0LtErVQeI7zJYk= X-MC-Unique: hGlj91p6MsuyGQ76PVYulw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras , Vladimir Sementsov-Ogievskiy Subject: [PULL 3/7] migration: Move migrate_use_tls() to options.c Date: Wed, 26 Apr 2023 20:12:49 +0200 Message-Id: <20230426181253.13286-4-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532852614100001 Content-Type: text/plain; charset="utf-8" Once there, rename it to migrate_tls() and make it return bool for consistency. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- Fix typos found by fabiano --- migration/migration.c | 9 --------- migration/migration.h | 2 -- migration/options.c | 11 ++++++++++- migration/options.h | 1 + migration/tls.c | 3 ++- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 53dd59f6f6..02c2355d0d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2177,15 +2177,6 @@ void qmp_migrate_continue(MigrationStatus state, Err= or **errp) qemu_sem_post(&s->pause_sem); } =20 -int migrate_use_tls(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.tls_creds && *s->parameters.tls_creds; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index dcf906868d..2b71df8617 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -447,8 +447,6 @@ bool migration_is_blocked(Error **errp); bool migration_in_postcopy(void); MigrationState *migrate_get_current(void); =20 -int migrate_use_tls(void); - uint64_t ram_get_total_transferred_pages(void); =20 /* Sending on the return path - generic and then for each message type */ diff --git a/migration/options.c b/migration/options.c index dd97c99391..943936a320 100644 --- a/migration/options.c +++ b/migration/options.c @@ -214,6 +214,15 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 +bool migrate_tls(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.tls_creds && *s->parameters.tls_creds; +} + typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, @@ -368,7 +377,7 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps,= Error **errp) new_caps[MIGRATION_CAPABILITY_COMPRESS] || new_caps[MIGRATION_CAPABILITY_XBZRLE] || migrate_multifd_compression() || - migrate_use_tls())) { + migrate_tls())) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; diff --git a/migration/options.h b/migration/options.h index 1b78fa9f3d..13318a16c7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,6 +46,7 @@ bool migrate_zero_copy_send(void); */ =20 bool migrate_postcopy(void); +bool migrate_tls(void); =20 /* capabilities helpers */ =20 diff --git a/migration/tls.c b/migration/tls.c index 4d2166a209..acd38e0b62 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -22,6 +22,7 @@ #include "channel.h" #include "migration.h" #include "tls.h" +#include "options.h" #include "crypto/tlscreds.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -165,7 +166,7 @@ void migration_tls_channel_connect(MigrationState *s, =20 bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc) { - if (!migrate_use_tls()) { + if (!migrate_tls()) { return false; } =20 --=20 2.40.0 From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532874; cv=none; d=zohomail.com; s=zohoarc; b=d49ZPAO4GhyaFDvczd2Qdknp40RgnTbfJWZrE29vs4SXjhX/Dd9B/gXgZoll+T8L3ttYyE69YdXRekju8opWUIqEyUVV2qzDYlpM/4SXjjjatlhozCDtDXZokUVUNckBtQEJP+OtC0M73L6MVpZB3/NPBH7X8LJU7HuQCKLzpuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532874; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=r49GhQxzXX7Zk2fCZWIDoDXJGCAHCiemWIaNzj9NuPo=; b=MOqp3RCaq8iKV5493LnkjWWxsuJRVAGLwYPj3GGX0T9hnTrRnGDE9VUSbpcIav/+lSJRWy/hqLfyPJ0Gt5ZpfYa3E2wt5cz/i/BXoqbyixydRZ3o8Y8+Hr0sEx++v4CZyzmFsDaA2/AH9U4o0OUxQgJXsUM4f22r2Or+3PH2gvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682532874634276.07444199688143; Wed, 26 Apr 2023 11:14:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjdg-0003eO-7y; Wed, 26 Apr 2023 14:13:12 -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 1prjde-0003dZ-SE for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:10 -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 1prjdb-0000p4-VE for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:10 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-595-LwTG0xtHMkCvuoxs8BeWfQ-1; Wed, 26 Apr 2023 14:13:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E57A80D091; Wed, 26 Apr 2023 18:13:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F9031121315; Wed, 26 Apr 2023 18:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532787; 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=r49GhQxzXX7Zk2fCZWIDoDXJGCAHCiemWIaNzj9NuPo=; b=VuRft6Ac6h83r9X6HAxOSDvqiMShqOcE+TRwcMqKLcnSos14/4CYowl0rRlvmiGLW3wBTa lOLQhRaJeKJq+VM9TlgYaeotm+jeQdwzve4Ij+H3u71a4luzPeZdVlq6r2oOOoVIviAawa Cj/hliNoCTBtrf1A4WKjQ9JjTKzpC3I= X-MC-Unique: LwTG0xtHMkCvuoxs8BeWfQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras , Vladimir Sementsov-Ogievskiy Subject: [PULL 4/7] migration: Move qmp_migrate_set_parameters() to options.c Date: Wed, 26 Apr 2023 20:12:50 +0200 Message-Id: <20230426181253.13286-5-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532876427100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 420 ------------------------------------------ migration/options.c | 418 +++++++++++++++++++++++++++++++++++++++++ migration/options.h | 11 ++ 3 files changed, 429 insertions(+), 420 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 02c2355d0d..22e8586623 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -67,19 +67,10 @@ =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 -/* Amount of time to allocate to each "chunk" of bandwidth-throttled - * data. */ -#define BUFFER_DELAY 100 -#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) - /* Time in milliseconds we are allowed to stop the source, * for sending the last part */ #define DEFAULT_MIGRATE_SET_DOWNTIME 300 =20 -/* Maximum migrate downtime set to 2000 seconds */ -#define MAX_MIGRATE_DOWNTIME_SECONDS 2000 -#define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) - /* Default compression thread count */ #define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 /* Default decompression thread count, usually decompression is at @@ -1140,417 +1131,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) return info; } =20 -/* - * Check whether the parameters are valid. Error will be put into errp - * (if provided). Return true if valid, otherwise false. - */ -static bool migrate_params_check(MigrationParameters *params, Error **errp) -{ - if (params->has_compress_level && - (params->compress_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", - "a value between 0 and 9"); - return false; - } - - if (params->has_compress_threads && (params->compress_threads < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "compress_threads", - "a value between 1 and 255"); - return false; - } - - if (params->has_decompress_threads && (params->decompress_threads < 1)= ) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "decompress_threads", - "a value between 1 and 255"); - return false; - } - - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", - "an integer in the range of 1 to 100"); - return false; - } - - if (params->has_cpu_throttle_initial && - (params->cpu_throttle_initial < 1 || - params->cpu_throttle_initial > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", - "an integer in the range of 1 to 99"); - return false; - } - - if (params->has_cpu_throttle_increment && - (params->cpu_throttle_increment < 1 || - params->cpu_throttle_increment > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", - "an integer in the range of 1 to 99"); - return false; - } - - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", - "an integer in the range of 0 to "stringify(SIZE_MAX) - " bytes/second"); - return false; - } - - if (params->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", - "an integer in the range of 0 to " - stringify(MAX_MIGRATE_DOWNTIME)" ms"); - return false; - } - - /* x_checkpoint_delay is now always positive */ - - if (params->has_multifd_channels && (params->multifd_channels < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", - "a value between 1 and 255"); - return false; - } - - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", - "a value between 0 and 9"); - return false; - } - - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", - "a value between 0 and 20"); - return false; - } - - if (params->has_xbzrle_cache_size && - (params->xbzrle_cache_size < qemu_target_page_size() || - !is_power_of_2(params->xbzrle_cache_size))) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", - "a power of two no less than the target page size"); - return false; - } - - if (params->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", - "an integer in the range of cpu_throttle_initial to 99"= ); - return false; - } - - if (params->has_announce_initial && - params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", - "a value between 0 and 100000"); - return false; - } - if (params->has_announce_max && - params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", - "a value between 0 and 100000"); - return false; - } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", - "a value between 0 and 1000"); - return false; - } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", - "a value between 0 and 10000"); - return false; - } - - if (params->has_block_bitmap_mapping && - !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { - error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); - return false; - } - -#ifdef CONFIG_LINUX - if (migrate_zero_copy_send() && - ((params->has_multifd_compression && params->multifd_compression) = || - (params->tls_creds && *params->tls_creds))) { - error_setg(errp, - "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); - return false; - } -#endif - - return true; -} - -static void migrate_params_test_apply(MigrateSetParameters *params, - MigrationParameters *dest) -{ - *dest =3D migrate_get_current()->parameters; - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_compress_level) { - dest->compress_level =3D params->compress_level; - } - - if (params->has_compress_threads) { - dest->compress_threads =3D params->compress_threads; - } - - if (params->has_compress_wait_thread) { - dest->compress_wait_thread =3D params->compress_wait_thread; - } - - if (params->has_decompress_threads) { - dest->decompress_threads =3D params->decompress_threads; - } - - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; - } - - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; - } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D params->tls_creds->u.s; - } - - if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; - } - - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_block_incremental) { - dest->block_incremental =3D params->block_incremental; - } - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - dest->multifd_compression =3D params->multifd_compression; - } - if (params->has_xbzrle_cache_size) { - dest->xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; - } - if (params->has_max_cpu_throttle) { - dest->max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - dest->announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - dest->announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - dest->announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - dest->announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - dest->has_block_bitmap_mapping =3D true; - dest->block_bitmap_mapping =3D params->block_bitmap_mapping; - } -} - -static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) -{ - MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_compress_level) { - s->parameters.compress_level =3D params->compress_level; - } - - if (params->has_compress_threads) { - s->parameters.compress_threads =3D params->compress_threads; - } - - if (params->has_compress_wait_thread) { - s->parameters.compress_wait_thread =3D params->compress_wait_threa= d; - } - - if (params->has_decompress_threads) { - s->parameters.decompress_threads =3D params->decompress_threads; - } - - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; - } - - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } - - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; - } - - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; - } - - if (params->tls_creds) { - g_free(s->parameters.tls_creds); - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); - } - - if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); - } - - if (params->tls_authz) { - g_free(s->parameters.tls_authz); - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); - } - - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file && !migration_in_postcopy()) { - qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); - } - } - - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - if (migration_in_colo_state()) { - colo_checkpoint_notify(s); - } - } - - if (params->has_block_incremental) { - s->parameters.block_incremental =3D params->block_incremental; - } - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; - } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - xbzrle_cache_resize(params->xbzrle_cache_size, errp); - } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - if (s->to_dst_file && migration_in_postcopy()) { - qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); - } - } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); - - s->parameters.has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); - } -} - -void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) -{ - MigrationParameters tmp; - - /* TODO Rewrite "" to null instead */ - if (params->tls_creds - && params->tls_creds->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_creds->u.n); - params->tls_creds->type =3D QTYPE_QSTRING; - params->tls_creds->u.s =3D strdup(""); - } - /* TODO Rewrite "" to null instead */ - if (params->tls_hostname - && params->tls_hostname->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_hostname->u.n); - params->tls_hostname->type =3D QTYPE_QSTRING; - params->tls_hostname->u.s =3D strdup(""); - } - - migrate_params_test_apply(params, &tmp); - - if (!migrate_params_check(&tmp, errp)) { - /* Invalid parameter */ - return; - } - - migrate_params_apply(params, errp); -} - - void qmp_migrate_start_postcopy(Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.c b/migration/options.c index 943936a320..fe7d7754c4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,17 +12,25 @@ */ =20 #include "qemu/osdep.h" +#include "exec/target_page.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qnull.h" #include "sysemu/runstate.h" +#include "migration/colo.h" #include "migration/misc.h" #include "migration.h" +#include "qemu-file.h" #include "ram.h" #include "options.h" =20 +/* Maximum migrate downtime set to 2000 seconds */ +#define MAX_MIGRATE_DOWNTIME_SECONDS 2000 +#define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) + bool migrate_auto_converge(void) { MigrationState *s; @@ -734,3 +742,413 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 return params; } + +/* + * Check whether the parameters are valid. Error will be put into errp + * (if provided). Return true if valid, otherwise false. + */ +bool migrate_params_check(MigrationParameters *params, Error **errp) +{ + if (params->has_compress_level && + (params->compress_level > 9)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", + "a value between 0 and 9"); + return false; + } + + if (params->has_compress_threads && (params->compress_threads < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "compress_threads", + "a value between 1 and 255"); + return false; + } + + if (params->has_decompress_threads && (params->decompress_threads < 1)= ) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "decompress_threads", + "a value between 1 and 255"); + return false; + } + + if (params->has_throttle_trigger_threshold && + (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "throttle_trigger_threshold", + "an integer in the range of 1 to 100"); + return false; + } + + if (params->has_cpu_throttle_initial && + (params->cpu_throttle_initial < 1 || + params->cpu_throttle_initial > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "cpu_throttle_initial", + "an integer in the range of 1 to 99"); + return false; + } + + if (params->has_cpu_throttle_increment && + (params->cpu_throttle_increment < 1 || + params->cpu_throttle_increment > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "cpu_throttle_increment", + "an integer in the range of 1 to 99"); + return false; + } + + if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "max_bandwidth", + "an integer in the range of 0 to "stringify(SIZE_MAX) + " bytes/second"); + return false; + } + + if (params->has_downtime_limit && + (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "downtime_limit", + "an integer in the range of 0 to " + stringify(MAX_MIGRATE_DOWNTIME)" ms"); + return false; + } + + /* x_checkpoint_delay is now always positive */ + + if (params->has_multifd_channels && (params->multifd_channels < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "multifd_channels", + "a value between 1 and 255"); + return false; + } + + if (params->has_multifd_zlib_level && + (params->multifd_zlib_level > 9)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", + "a value between 0 and 9"); + return false; + } + + if (params->has_multifd_zstd_level && + (params->multifd_zstd_level > 20)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", + "a value between 0 and 20"); + return false; + } + + if (params->has_xbzrle_cache_size && + (params->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(params->xbzrle_cache_size))) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "xbzrle_cache_size", + "a power of two no less than the target page size"); + return false; + } + + if (params->has_max_cpu_throttle && + (params->max_cpu_throttle < params->cpu_throttle_initial || + params->max_cpu_throttle > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "max_cpu_throttle", + "an integer in the range of cpu_throttle_initial to 99"= ); + return false; + } + + if (params->has_announce_initial && + params->announce_initial > 100000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_initial", + "a value between 0 and 100000"); + return false; + } + if (params->has_announce_max && + params->announce_max > 100000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_max", + "a value between 0 and 100000"); + return false; + } + if (params->has_announce_rounds && + params->announce_rounds > 1000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_rounds", + "a value between 0 and 1000"); + return false; + } + if (params->has_announce_step && + (params->announce_step < 1 || + params->announce_step > 10000)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_step", + "a value between 0 and 10000"); + return false; + } + + if (params->has_block_bitmap_mapping && + !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { + error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); + return false; + } + +#ifdef CONFIG_LINUX + if (migrate_zero_copy_send() && + ((params->has_multifd_compression && params->multifd_compression) = || + (params->tls_creds && *params->tls_creds))) { + error_setg(errp, + "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); + return false; + } +#endif + + return true; +} + +static void migrate_params_test_apply(MigrateSetParameters *params, + MigrationParameters *dest) +{ + *dest =3D migrate_get_current()->parameters; + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + + if (params->has_compress_level) { + dest->compress_level =3D params->compress_level; + } + + if (params->has_compress_threads) { + dest->compress_threads =3D params->compress_threads; + } + + if (params->has_compress_wait_thread) { + dest->compress_wait_thread =3D params->compress_wait_thread; + } + + if (params->has_decompress_threads) { + dest->decompress_threads =3D params->decompress_threads; + } + + if (params->has_throttle_trigger_threshold) { + dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; + } + + if (params->has_cpu_throttle_initial) { + dest->cpu_throttle_initial =3D params->cpu_throttle_initial; + } + + if (params->has_cpu_throttle_increment) { + dest->cpu_throttle_increment =3D params->cpu_throttle_increment; + } + + if (params->has_cpu_throttle_tailslow) { + dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; + } + + if (params->tls_creds) { + assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); + dest->tls_creds =3D params->tls_creds->u.s; + } + + if (params->tls_hostname) { + assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); + dest->tls_hostname =3D params->tls_hostname->u.s; + } + + if (params->has_max_bandwidth) { + dest->max_bandwidth =3D params->max_bandwidth; + } + + if (params->has_downtime_limit) { + dest->downtime_limit =3D params->downtime_limit; + } + + if (params->has_x_checkpoint_delay) { + dest->x_checkpoint_delay =3D params->x_checkpoint_delay; + } + + if (params->has_block_incremental) { + dest->block_incremental =3D params->block_incremental; + } + if (params->has_multifd_channels) { + dest->multifd_channels =3D params->multifd_channels; + } + if (params->has_multifd_compression) { + dest->multifd_compression =3D params->multifd_compression; + } + if (params->has_xbzrle_cache_size) { + dest->xbzrle_cache_size =3D params->xbzrle_cache_size; + } + if (params->has_max_postcopy_bandwidth) { + dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; + } + if (params->has_max_cpu_throttle) { + dest->max_cpu_throttle =3D params->max_cpu_throttle; + } + if (params->has_announce_initial) { + dest->announce_initial =3D params->announce_initial; + } + if (params->has_announce_max) { + dest->announce_max =3D params->announce_max; + } + if (params->has_announce_rounds) { + dest->announce_rounds =3D params->announce_rounds; + } + if (params->has_announce_step) { + dest->announce_step =3D params->announce_step; + } + + if (params->has_block_bitmap_mapping) { + dest->has_block_bitmap_mapping =3D true; + dest->block_bitmap_mapping =3D params->block_bitmap_mapping; + } +} + +static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) +{ + MigrationState *s =3D migrate_get_current(); + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + + if (params->has_compress_level) { + s->parameters.compress_level =3D params->compress_level; + } + + if (params->has_compress_threads) { + s->parameters.compress_threads =3D params->compress_threads; + } + + if (params->has_compress_wait_thread) { + s->parameters.compress_wait_thread =3D params->compress_wait_threa= d; + } + + if (params->has_decompress_threads) { + s->parameters.decompress_threads =3D params->decompress_threads; + } + + if (params->has_throttle_trigger_threshold) { + s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; + } + + if (params->has_cpu_throttle_initial) { + s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; + } + + if (params->has_cpu_throttle_increment) { + s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; + } + + if (params->has_cpu_throttle_tailslow) { + s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; + } + + if (params->tls_creds) { + g_free(s->parameters.tls_creds); + assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); + } + + if (params->tls_hostname) { + g_free(s->parameters.tls_hostname); + assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); + } + + if (params->tls_authz) { + g_free(s->parameters.tls_authz); + assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + } + + if (params->has_max_bandwidth) { + s->parameters.max_bandwidth =3D params->max_bandwidth; + if (s->to_dst_file && !migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); + } + } + + if (params->has_downtime_limit) { + s->parameters.downtime_limit =3D params->downtime_limit; + } + + if (params->has_x_checkpoint_delay) { + s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; + if (migration_in_colo_state()) { + colo_checkpoint_notify(s); + } + } + + if (params->has_block_incremental) { + s->parameters.block_incremental =3D params->block_incremental; + } + if (params->has_multifd_channels) { + s->parameters.multifd_channels =3D params->multifd_channels; + } + if (params->has_multifd_compression) { + s->parameters.multifd_compression =3D params->multifd_compression; + } + if (params->has_xbzrle_cache_size) { + s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; + xbzrle_cache_resize(params->xbzrle_cache_size, errp); + } + if (params->has_max_postcopy_bandwidth) { + s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; + if (s->to_dst_file && migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); + } + } + if (params->has_max_cpu_throttle) { + s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; + } + if (params->has_announce_initial) { + s->parameters.announce_initial =3D params->announce_initial; + } + if (params->has_announce_max) { + s->parameters.announce_max =3D params->announce_max; + } + if (params->has_announce_rounds) { + s->parameters.announce_rounds =3D params->announce_rounds; + } + if (params->has_announce_step) { + s->parameters.announce_step =3D params->announce_step; + } + + if (params->has_block_bitmap_mapping) { + qapi_free_BitmapMigrationNodeAliasList( + s->parameters.block_bitmap_mapping); + + s->parameters.has_block_bitmap_mapping =3D true; + s->parameters.block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + params->block_bitmap_mapping); + } +} + +void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) +{ + MigrationParameters tmp; + + /* TODO Rewrite "" to null instead */ + if (params->tls_creds + && params->tls_creds->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->tls_creds->u.n); + params->tls_creds->type =3D QTYPE_QSTRING; + params->tls_creds->u.s =3D strdup(""); + } + /* TODO Rewrite "" to null instead */ + if (params->tls_hostname + && params->tls_hostname->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->tls_hostname->u.n); + params->tls_hostname->type =3D QTYPE_QSTRING; + params->tls_hostname->u.s =3D strdup(""); + } + + migrate_params_test_apply(params, &tmp); + + if (!migrate_params_check(&tmp, errp)) { + /* Invalid parameter */ + return; + } + + migrate_params_apply(params, errp); +} diff --git a/migration/options.h b/migration/options.h index 13318a16c7..89067e59a0 100644 --- a/migration/options.h +++ b/migration/options.h @@ -14,6 +14,13 @@ #ifndef QEMU_MIGRATION_OPTIONS_H #define QEMU_MIGRATION_OPTIONS_H =20 +/* constants */ + +/* Amount of time to allocate to each "chunk" of bandwidth-throttled + * data. */ +#define BUFFER_DELAY 100 +#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) + /* capabilities */ =20 bool migrate_auto_converge(void); @@ -74,4 +81,8 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 +/* parameters helpers */ + +bool migrate_params_check(MigrationParameters *params, Error **errp); + #endif --=20 2.40.0 From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532841; cv=none; d=zohomail.com; s=zohoarc; b=V+gQ5eKtMuK6/v/3FoAmprO62L0H8/9HqlOVLgopcqIZpripnrk89Vr/4x4DzTEeSBeIwOgKnshQpGNpWB/b6zC3LWYm02dMp6RP0p8sH1fR57cgMdjAU/yXaxa3FYMqgSc1EId9uj9hWuotro8QEi0EMMcsCRdJ2uT08m7TLqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532841; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/s7UAUcbsEmewctVD2X/hH1bANxEwzpfbYRtNV0ek8c=; b=aM4ZLsuHzJxqb5EHZNm/kDozkvXlr+bSiAeAQYm247lyQ+uSwdubeRoa6gfjdHbQhQAKDsJjzEuHfAQq86d6jMmDWkq5nP3K9LNmtxq5W7Z7EU+f24XlpDhFeZCCoqBJZTc1bZE0JhE8kWwKOJ0X/k0pmSF+vObYunBH1P/MAsc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682532841387527.6063305519365; Wed, 26 Apr 2023 11:14:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjdf-0003dv-Jl; Wed, 26 Apr 2023 14:13:11 -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 1prjdd-0003dA-P0 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:09 -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 1prjdb-0000ol-F6 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:09 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-536-8xPH3N0-MP699ZldIOjMJQ-1; Wed, 26 Apr 2023 14:13:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D124299E759 for ; Wed, 26 Apr 2023 18:13:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id D61201121314; Wed, 26 Apr 2023 18:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532786; 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=/s7UAUcbsEmewctVD2X/hH1bANxEwzpfbYRtNV0ek8c=; b=NUoRlSdNoQwVwJPXmDbwz24mgjWCii3iQLerTPqFxBcEwr98sf8HmzdWPgg5J+bpRu8xQ+ 3WUbrDfbzqKlQ0la4cZaQuLdgKfGRFkFpayKm/om33Rb+4lkGl1R7FlumHSsg86qKBC3JI dfJ6tYl5+miwwQmK2uM47WBq47qqFXc= X-MC-Unique: 8xPH3N0-MP699ZldIOjMJQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras Subject: [PULL 5/7] migration: Allow postcopy_ram_supported_by_host() to report err Date: Wed, 26 Apr 2023 20:12:51 +0200 Message-Id: <20230426181253.13286-6-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532842207100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu Instead of print it to STDERR, bring the error upwards so that it can be reported via QMP responses. E.g.: { "execute": "migrate-set-capabilities" , "arguments": { "capabilities": [ { "capability": "postcopy-ram", "state": true } ] } } { "error": { "class": "GenericError", "desc": "Postcopy is not supported: Host backend files need to be TMPFS or HUGETLBFS only" } } Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/options.c | 8 ++---- migration/postcopy-ram.c | 59 ++++++++++++++++++++++------------------ migration/postcopy-ram.h | 3 +- migration/savevm.c | 3 +- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/migration/options.c b/migration/options.c index fe7d7754c4..c6030587cf 100644 --- a/migration/options.c +++ b/migration/options.c @@ -302,6 +302,7 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps,= Error **errp) { MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + ERRP_GUARD(); #ifndef CONFIG_LIVE_BLOCK_MIGRATION if (new_caps[MIGRATION_CAPABILITY_BLOCK]) { error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " @@ -327,11 +328,8 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) */ if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host(mis)) { - /* postcopy_ram_supported_by_host will have emitted a more - * detailed message - */ - error_setg(errp, "Postcopy is not supported"); + !postcopy_ram_supported_by_host(mis, errp)) { + error_prepend(errp, "Postcopy is not supported: "); return false; } =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 0711500036..7c280480c2 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -283,11 +283,13 @@ static bool request_ufd_features(int ufd, uint64_t fe= atures) return true; } =20 -static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) +static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis, + Error **errp) { uint64_t asked_features =3D 0; static uint64_t supported_features; =20 + ERRP_GUARD(); /* * it's not possible to * request UFFD_API twice per one fd @@ -295,7 +297,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncom= ingState *mis) */ if (!supported_features) { if (!receive_ufd_features(&supported_features)) { - error_report("%s failed", __func__); + error_setg(errp, "Userfault feature detection failed"); return false; } } @@ -317,8 +319,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncom= ingState *mis) * userfault file descriptor */ if (!request_ufd_features(ufd, asked_features)) { - error_report("%s failed: features %" PRIu64, __func__, - asked_features); + error_setg(errp, "Failed features %" PRIu64, asked_features); return false; } =20 @@ -329,7 +330,8 @@ static bool ufd_check_and_apply(int ufd, MigrationIncom= ingState *mis) have_hp =3D supported_features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { - error_report("Userfault on this host does not support huge pag= es"); + error_setg(errp, + "Userfault on this host does not support huge pages= "); return false; } } @@ -338,7 +340,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncom= ingState *mis) =20 /* Callback from postcopy_ram_supported_by_host block iterator. */ -static int test_ramblock_postcopiable(RAMBlock *rb) +static int test_ramblock_postcopiable(RAMBlock *rb, Error **errp) { const char *block_name =3D qemu_ram_get_idstr(rb); ram_addr_t length =3D qemu_ram_get_used_length(rb); @@ -346,16 +348,18 @@ static int test_ramblock_postcopiable(RAMBlock *rb) QemuFsType fs; =20 if (length % pagesize) { - error_report("Postcopy requires RAM blocks to be a page size multi= ple," - " block %s is 0x" RAM_ADDR_FMT " bytes with a " - "page size of 0x%zx", block_name, length, pagesize); + error_setg(errp, + "Postcopy requires RAM blocks to be a page size multipl= e," + " block %s is 0x" RAM_ADDR_FMT " bytes with a " + "page size of 0x%zx", block_name, length, pagesize); return 1; } =20 if (rb->fd >=3D 0) { fs =3D qemu_fd_getfs(rb->fd); if (fs !=3D QEMU_FS_TYPE_TMPFS && fs !=3D QEMU_FS_TYPE_HUGETLBFS) { - error_report("Host backend files need to be TMPFS or HUGETLBFS= only"); + error_setg(errp, + "Host backend files need to be TMPFS or HUGETLBFS o= nly"); return 1; } } @@ -368,7 +372,8 @@ static int test_ramblock_postcopiable(RAMBlock *rb) * normally fine since if the postcopy succeeds it gets turned back on at = the * end. */ -bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, + Error **errp) { long pagesize =3D qemu_real_host_page_size(); int ufd =3D -1; @@ -377,29 +382,27 @@ bool postcopy_ram_supported_by_host(MigrationIncoming= State *mis) struct uffdio_register reg_struct; struct uffdio_range range_struct; uint64_t feature_mask; - Error *local_err =3D NULL; RAMBlock *block; =20 + ERRP_GUARD(); if (qemu_target_page_size() > pagesize) { - error_report("Target page size bigger than host page size"); + error_setg(errp, "Target page size bigger than host page size"); goto out; } =20 ufd =3D uffd_open(O_CLOEXEC); if (ufd =3D=3D -1) { - error_report("%s: userfaultfd not available: %s", __func__, - strerror(errno)); + error_setg(errp, "Userfaultfd not available: %s", strerror(errno)); goto out; } =20 /* Give devices a chance to object */ - if (postcopy_notify(POSTCOPY_NOTIFY_PROBE, &local_err)) { - error_report_err(local_err); + if (postcopy_notify(POSTCOPY_NOTIFY_PROBE, errp)) { goto out; } =20 /* Version and features check */ - if (!ufd_check_and_apply(ufd, mis)) { + if (!ufd_check_and_apply(ufd, mis, errp)) { goto out; } =20 @@ -417,7 +420,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis) * affect in reality, or we can revisit. */ RAMBLOCK_FOREACH(block) { - if (test_ramblock_postcopiable(block)) { + if (test_ramblock_postcopiable(block, errp)) { goto out; } } @@ -427,7 +430,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis) * it was enabled. */ if (munlockall()) { - error_report("%s: munlockall: %s", __func__, strerror(errno)); + error_setg(errp, "munlockall() failed: %s", strerror(errno)); goto out; } =20 @@ -439,8 +442,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis) testarea =3D mmap(NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (testarea =3D=3D MAP_FAILED) { - error_report("%s: Failed to map test area: %s", __func__, - strerror(errno)); + error_setg(errp, "Failed to map test area: %s", strerror(errno)); goto out; } g_assert(QEMU_PTR_IS_ALIGNED(testarea, pagesize)); @@ -450,14 +452,14 @@ bool postcopy_ram_supported_by_host(MigrationIncoming= State *mis) reg_struct.mode =3D UFFDIO_REGISTER_MODE_MISSING; =20 if (ioctl(ufd, UFFDIO_REGISTER, ®_struct)) { - error_report("%s userfault register: %s", __func__, strerror(errno= )); + error_setg(errp, "UFFDIO_REGISTER failed: %s", strerror(errno)); goto out; } =20 range_struct.start =3D (uintptr_t)testarea; range_struct.len =3D pagesize; if (ioctl(ufd, UFFDIO_UNREGISTER, &range_struct)) { - error_report("%s userfault unregister: %s", __func__, strerror(err= no)); + error_setg(errp, "UFFDIO_UNREGISTER failed: %s", strerror(errno)); goto out; } =20 @@ -465,8 +467,8 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis) (__u64)1 << _UFFDIO_COPY | (__u64)1 << _UFFDIO_ZEROPAGE; if ((reg_struct.ioctls & feature_mask) !=3D feature_mask) { - error_report("Missing userfault map features: %" PRIx64, - (uint64_t)(~reg_struct.ioctls & feature_mask)); + error_setg(errp, "Missing userfault map features: %" PRIx64, + (uint64_t)(~reg_struct.ioctls & feature_mask)); goto out; } =20 @@ -1188,6 +1190,8 @@ static int postcopy_temp_pages_setup(MigrationIncomin= gState *mis) =20 int postcopy_ram_incoming_setup(MigrationIncomingState *mis) { + Error *local_err =3D NULL; + /* Open the fd for the kernel to give us userfaults */ mis->userfault_fd =3D uffd_open(O_CLOEXEC | O_NONBLOCK); if (mis->userfault_fd =3D=3D -1) { @@ -1200,7 +1204,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingStat= e *mis) * Although the host check already tested the API, we need to * do the check again as an ABI handshake on the new fd. */ - if (!ufd_check_and_apply(mis->userfault_fd, mis)) { + if (!ufd_check_and_apply(mis->userfault_fd, mis, &local_err)) { + error_report_err(local_err); return -1; } =20 diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index b4867a32d5..442ab89752 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -14,7 +14,8 @@ #define QEMU_POSTCOPY_RAM_H =20 /* Return true if the host supports everything we need to do postcopy-ram = */ -bool postcopy_ram_supported_by_host(MigrationIncomingState *mis); +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, + Error **errp); =20 /* * Make all of RAM sensitive to accesses to areas that haven't yet been wr= itten diff --git a/migration/savevm.c b/migration/savevm.c index 9671211339..211eff3a8b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1753,7 +1753,8 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis, return -EINVAL; } =20 - if (!postcopy_ram_supported_by_host(mis)) { + if (!postcopy_ram_supported_by_host(mis, &local_err)) { + error_report_err(local_err); postcopy_state_set(POSTCOPY_INCOMING_NONE); return -1; } --=20 2.40.0 From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532852; cv=none; d=zohomail.com; s=zohoarc; b=QvyFrLHnQHmYX1BRVEUxMdo16Pi2KToF+k/B+ruA1+8dqJExYq4Q1nbJsBcLi1w3FmDISfabQ4OkDg/APkk/Ni1caG+fMJ4McfisvRz2YEGHwsFc6KwP4mZ1n7RMJDXIeUj5IbVGm/nmgiJawubzvaerCY+p07BRIXVrGzJuzOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532852; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7hpFxDZgTL4tlOiN3Iw3xMAXDUUXTaaX8jXP0Fljze0=; b=UYUVemxYLC4fCdF4QyCU+/9gPBGYS2gvZgkycDaahyKdV9e1bWFd9GWNQEwFXqtceprE3Ybz9A2FSjt26N1ENKBosYekcbg7qvezRqcMlX4z6iwLV4gn0lFZBnnT2t7sU2Dve7cbwyxwbVWJA8qxRBlzmhAHcQ0PoirR8XSAt8g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682532852977397.3613141463712; Wed, 26 Apr 2023 11:14:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjdh-0003f8-Qb; Wed, 26 Apr 2023 14:13:13 -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 1prjdf-0003dx-TA for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:11 -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 1prjde-0000qc-D9 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:11 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-567-4DYSCHB1MmKrW-b0wizx5w-1; Wed, 26 Apr 2023 14:13:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F0F553C0F662 for ; Wed, 26 Apr 2023 18:13:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61ED01121314; Wed, 26 Apr 2023 18:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532789; 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=7hpFxDZgTL4tlOiN3Iw3xMAXDUUXTaaX8jXP0Fljze0=; b=INzHnZBknhk7B6hhnd3WctlgXFJzwCafcUvrnVtFbwPdgDGNTsbt3o/KiA7knX7reetDKV QpWn5krRFd05au1DRIAqIxq83G9O4YWSCLs8d68EleTXPoeMmB95dcc8iM6YvXzkJ1wwym 2DgLuv9NIDjKujYrm7fHEsP602MCo8A= X-MC-Unique: 4DYSCHB1MmKrW-b0wizx5w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras Subject: [PULL 6/7] migration/vmstate-dump: Dump array size too as "num" Date: Wed, 26 Apr 2023 20:12:52 +0200 Message-Id: <20230426181253.13286-7-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532854048100006 Content-Type: text/plain; charset="utf-8" From: Peter Xu For VMS_ARRAY typed vmsd fields, also dump the number of entries in the array in -vmstate-dump. Without such information, vmstate static checker can report false negatives of incompatible vmsd on VMS_ARRAY typed fields, when the src/dst do not have the same type of array defined. It's because in the checker we only check against size of fields within a VMSD field. One example: e1000e used to have a field defined as a boolean array with 5 entries, then removed it and replaced it with UNUSED (in 31e3f318c8b535): - VMSTATE_BOOL_ARRAY(core.eitr_intr_pending, E1000EState, - E1000E_MSIX_VEC_NUM), + VMSTATE_UNUSED(E1000E_MSIX_VEC_NUM), It's a legal replacement but vmstate static checker is not happy with it, because it checks only against the "size" field between the two fields (here one is BOOL_ARRAY, the other is UNUSED): For BOOL_ARRAY: { "field": "core.eitr_intr_pending", "version_id": 0, "field_exists": false, "size": 1 }, For UNUSED: { "field": "unused", "version_id": 0, "field_exists": false, "size": 5 }, It's not the script to blame because there's just not enough information dumped to show the total size of the entry for an array. Add it. Note that this will not break old vmstate checker because the field will just be ignored. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/savevm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index 211eff3a8b..a9181b444b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -536,6 +536,9 @@ static void dump_vmstate_vmsf(FILE *out_file, const VMS= tateField *field, field->version_id); fprintf(out_file, "%*s\"field_exists\": %s,\n", indent, "", field->field_exists ? "true" : "false"); + if (field->flags & VMS_ARRAY) { + fprintf(out_file, "%*s\"num\": %d,\n", indent, "", field->num); + } fprintf(out_file, "%*s\"size\": %zu", indent, "", field->size); if (field->vmsd !=3D NULL) { fprintf(out_file, ",\n"); --=20 2.40.0 From nobody Sat May 11 18:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682532828; cv=none; d=zohomail.com; s=zohoarc; b=LiKUjzeuNiasIm/TaK3lHcJWRU5dFKUCe2YtiFKQphnd4GNp+ym79gpDRWmyQhq0lpzxJvRPffMa4uYwwlGQh7EXJUypvpMOVSO8SfG+l40iJBOCFsf4iJHEuS0wzNBcnBMFaQUGJBr+dFrzODPmMbKUFc78tIt6M3y1X9qokuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682532828; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UoK20VJYECljxZGu5SogV8Sm4YAvjCko+hnBoo3d0K8=; b=XXe7NmLnScU79V+UkOYeXG/hKa+/tRWoOtCjLOIHfvt035zVMPFVujFh3/lkAq5Xnw3mM9eMKcY5467trvJlWoBTL9DHDXdGiRRfGL8xTr8A2OJPJChJt5Ecz8uv0MAZunvqQu4H+LwXjC8GaAA9SNnQJD9KTL2SSvlF8CbmzMY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16825328280111003.3730990862908; Wed, 26 Apr 2023 11:13:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prjdi-0003fD-4x; Wed, 26 Apr 2023 14:13:14 -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 1prjdh-0003ek-34 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:13 -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 1prjdf-0000rT-Jf for qemu-devel@nongnu.org; Wed, 26 Apr 2023 14:13:12 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-542-NmZ59YaKPjqpaSKTJihtlQ-1; Wed, 26 Apr 2023 14:13:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0A711049B98 for ; Wed, 26 Apr 2023 18:13:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40F3D1121314; Wed, 26 Apr 2023 18:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682532790; 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=UoK20VJYECljxZGu5SogV8Sm4YAvjCko+hnBoo3d0K8=; b=iwjaPZfolLP6axrLz3ARl0tHYRgvh91PkaW/2SN1oX3M4up6Mgkk+H/N9qVkZWaElME9iY 5PwYDqQlTQsVXv9lpg8MbdWdeLEGrpV1c8xx78VtajWtTQv8WUsnPsyOs01AOrETmazlXk h2LUIemzni9yHq4lpXFVF4UXJ3BKD4U= X-MC-Unique: NmZ59YaKPjqpaSKTJihtlQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Cleber Rosa , Juan Quintela , John Snow , Leonardo Bras Subject: [PULL 7/7] vmstate-static-checker: Recognize "num" field Date: Wed, 26 Apr 2023 20:12:53 +0200 Message-Id: <20230426181253.13286-8-quintela@redhat.com> In-Reply-To: <20230426181253.13286-1-quintela@redhat.com> References: <20230426181253.13286-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682532829930100012 Content-Type: text/plain; charset="utf-8" From: Peter Xu Recognize this field for VMS_ARRAY typed vmsd fields, then we can do proper size matching with previous patch. Note that this is compatible with old -dump-vmstate output, because when "num" is not there we'll still use the old "size" only. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- scripts/vmstate-static-checker.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-che= cker.py index dfeee8231a..9c0e6b81f2 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -134,6 +134,11 @@ def exists_in_substruct(fields, item): return check_fields_match(fields["Description"]["name"], substruct_fields[0]["field"], item) =20 +def size_total(entry): + size =3D entry["size"] + if "num" not in entry: + return size + return size * entry["num"] =20 def check_fields(src_fields, dest_fields, desc, sec): # This function checks for all the fields in a section. If some @@ -249,17 +254,19 @@ def check_fields(src_fields, dest_fields, desc, sec): continue =20 if s_item["field"] =3D=3D "unused" or d_item["field"] =3D=3D "= unused": - if s_item["size"] =3D=3D d_item["size"]: + s_size =3D size_total(s_item) + d_size =3D size_total(d_item) + if s_size =3D=3D d_size: continue =20 if d_item["field"] =3D=3D "unused": advance_dest =3D False - unused_count =3D d_item["size"] - s_item["size"] + unused_count =3D d_size - s_size; continue =20 if s_item["field"] =3D=3D "unused": advance_src =3D False - unused_count =3D s_item["size"] - d_item["size"] + unused_count =3D s_size - d_size continue =20 print("Section \"" + sec + "\",", end=3D' ') --=20 2.40.0