From nobody Tue Nov 26 08:25:17 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; arc=pass (i=1 dmarc=pass fromdomain=nvidia.com); dmarc=pass(p=reject dis=none) header.from=nvidia.com ARC-Seal: i=2; a=rsa-sha256; t=1709549690; cv=pass; d=zohomail.com; s=zohoarc; b=HLJEJDDdfjgdRamPwt0UAXnxunZwcJ08jvWRoaYTaGUZbJ8n6XOVZTrNzSPWFbEG2RI1RebxOn10n9zNn+56ntcUzlJBDb7EXPk8MEOh1vrpEipuGTYc/25mR/vbgAT2AwNG5ktj8QOlNhwrefAQ79N8r+/rZ159mtVxiPhCr8Q= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709549690; 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=JVwuTJShlRAFgGKpN33gMlFEoL8O9HLOKs6/BcfdV4E=; b=kqnTcaqs8BX9Z43git9K+SZy8oCbidxpzd3tgCB6VfVsedTKP4i/Kgj0HVQpLHrMrPhZG+I4zFy469DYzt55SDGsOMW0ihoqpzS/QO3qo8B36SEf9+s1MlG7i1WMQ+gLO4D6GhXNhCvHv4CV8adEEXC5ec3AoHvfWBGi7A3yORA= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=nvidia.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709549690458745.6145121482581; Mon, 4 Mar 2024 02:54:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rh5xV-0003CR-11; Mon, 04 Mar 2024 05:54:13 -0500 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 1rh5xS-0003Bz-SG for qemu-devel@nongnu.org; Mon, 04 Mar 2024 05:54:10 -0500 Received: from mail-co1nam11on20601.outbound.protection.outlook.com ([2a01:111:f403:2416::601] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rh5xO-0005tY-Ha for qemu-devel@nongnu.org; Mon, 04 Mar 2024 05:54:10 -0500 Received: from BL0PR03CA0027.namprd03.prod.outlook.com (2603:10b6:208:2d::40) by CH3PR12MB7690.namprd12.prod.outlook.com (2603:10b6:610:14e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Mon, 4 Mar 2024 10:54:02 +0000 Received: from BL02EPF0001A101.namprd05.prod.outlook.com (2603:10b6:208:2d:cafe::4d) by BL0PR03CA0027.outlook.office365.com (2603:10b6:208:2d::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Mon, 4 Mar 2024 10:54:01 +0000 Received: from mail.nvidia.com (216.228.117.160) by BL02EPF0001A101.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Mon, 4 Mar 2024 10:54:01 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 4 Mar 2024 02:53:48 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Mon, 4 Mar 2024 02:53:47 -0800 Received: from vdi.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Mon, 4 Mar 2024 02:53:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IJCjeyL7T2GP134F5hpZkIk9pmSdZ3pkBPhuCTNcvsEB/7WNRjBw7imsVWQGa2KQjBGRlqc66PNcuBU6vdwaEcLacsW4t7CQB7YpYWuYIksAWujJNf8weYEXmZbvORhpOnWzsYH8kNUEomTcNZ8KJV7MEwoNBsNQtGqqqyLmJxBZPYnlvs8mYiIl6RJ95TFNhzRQC5UbCWLiZ5UvElvtRheKpg4aVgtO/K9irN4L9ePQ/7Yo7YWoZxOcbhMN0TIUofr7thOlNZ6ewYogvOdXQlmPNMzOFjFOwlIZRJMdjlEd57Pyt4nNUPNUQxvYaX9TIjXgDOBBrzqO5HWbnmHV8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JVwuTJShlRAFgGKpN33gMlFEoL8O9HLOKs6/BcfdV4E=; b=fLWMeKf/Z+rhwQg2TsWRVUXRS+DgMyO0Ut26rqUzsQ4g+id9uG1gZxL8uoHOY/BsBqvrXdMIqhAHCiXZf9jveu50BALH6wtr5R/SuwpVxBasvoY2224s/ytRpYrIBhykfUZ2JRuvvWJAKzqzqag8VKdN5fhb1E178ITijTRAIOhs8a5TtJmFQkouoLNHgKyAo23WAimdtnJQupE3TGlB+WwL0z2ewqgzyS3hSBObQqPzbuo2AQSKN4GDLXLcUzGR4EhTxuKzxcJLOw97aq/F8USiWXnYEFCs6PleSX+SydwED6y2idemJ9R66z98wuoNfPHmHfT74DSolRAKAzDvpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=nongnu.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JVwuTJShlRAFgGKpN33gMlFEoL8O9HLOKs6/BcfdV4E=; b=WzWlRc+GaWI/Ov0GnTQhPIvwr7wKLR53C846xOxdYcuxij5ZGC8NZjuZhtXV0L5KNHotcw4LS8xghs0KSdmJY5jNXGEBA4nb3ssiCD9gDK2rx3rKtgNM0itYZjvwt5xAgXpv4LrC2pQEnhM5Ms9tsideWMJL9UFNXB2RJgj/BwYZG9Hr5G1kUJEPgtj1tm1vd2AmJGuQ89YaYA+rIsj7VIREYSHxZI6h/b7udpiCf2QGic3mcfr7kAZtryxJqn/xdz/uGPK7XYErdgrfGzck+qHzZ2DIzIIN5milBY500YNvInAPH52PpS6KuRPQQGo2MnpTkzzx76Azx1qrTkgA2w== X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; 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 (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C From: Avihai Horon To: CC: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Xu , Fabiano Rosas , "Wang, Lei" , Joao Martins , Avihai Horon Subject: [PATCH v2 2/3] vfio/migration: Refactor vfio_save_state() return value Date: Mon, 4 Mar 2024 12:53:38 +0200 Message-ID: <20240304105339.20713-3-avihaih@nvidia.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20240304105339.20713-1-avihaih@nvidia.com> References: <20240304105339.20713-1-avihaih@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A101:EE_|CH3PR12MB7690:EE_ X-MS-Office365-Filtering-Correlation-Id: 07dd0b9c-45de-45ec-bc84-08dc3c3966c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mZH5Dbt360I7xTYGRCWmC4kD4MnnKWPdWb9z7vkPuY0E2zYtl24B/ljfxgSomWr82CWz0KsuGyYv+Dsrx3sexr//SEayARsycsv9dtdW+4+0gFEOh/G7WtYyrNUHNK2MKthIS+NWYVKKSCUcP9ECjFmYO2RYiUX4sRwsxgMGKpJT355pzsOPZJcoqMX6LMOtQ/lMiMOKYvPh45Btiz9z8ZC1AY9c3yijk9VDw0oWzp/uQDyuT2e5JSewNPxhQvesIVLf1VxTMWq07jRY0T4m/ncH9IcA1+YzUrGGh11LLJ5+khB3pzpo3ZW2JkFW7NOpBQtvjLMSum25fBrUAxzU01PEdp+nEVK7CHv/DxY5Or7umsHfDJqWh6EREIGlnzyL7c/F+ABP1TII1WOpaCXjk4siaSSBc+eKEH+uFSnRy+pjfyfUfi3x2d9MM30knli3hVaYvwknkcRpzIbAA+2FBrpBBOVsh/uiBFe677IxArB8WWMvBITUUIaojrEWqoRIZs1pGnIscnhjVd+nX2tPMrTMRyEba7dK2JHXsu02wC3LH4TX1/GerSGNuw7shgQjbIAenBdPuJnTGjPvLPkwQVKKOuWHpx/jAEBnFfQebF9QJWnalBnZSWTV5IHItrmG1r8l8PHrHkdbBTWMy2ie+HSIvtWyDgRPEYxQEo62masdusW288Ds/rgcnsal1v3FIcGfJoUlZxr8qhYe7zva9aAaVDWF1J+e04I0RcYJWRtMnA1+GcRVp3P2xIRixBxr X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2024 10:54:01.2904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07dd0b9c-45de-45ec-bc84-08dc3c3966c7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A101.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7690 Received-SPF: softfail client-ip=2a01:111:f403:2416::601; envelope-from=avihaih@nvidia.com; helo=NAM11-CO1-obe.outbound.protection.outlook.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.589, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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 @Nvidia.com) X-ZM-MESSAGEID: 1709549690799100005 Content-Type: text/plain; charset="utf-8" Currently, vfio_save_state() returns 1 regardless of whether there is more data to send or not. This was done to prevent a fast changing VFIO device from potentially blocking other devices from sending their data, as qemu_savevm_state_iterate() serialized devices. Now that qemu_savevm_state_iterate() no longer serializes devices, there is no need for that. Refactor vfio_save_state() to return 0 if more data is available and 1 if no more data is available. Signed-off-by: Avihai Horon --- hw/vfio/migration.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 50140eda872..0af783a5892 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -529,11 +529,7 @@ static int vfio_save_iterate(QEMUFile *f, void *opaque) trace_vfio_save_iterate(vbasedev->name, migration->precopy_init_size, migration->precopy_dirty_size); =20 - /* - * A VFIO device's pre-copy dirty_bytes is not guaranteed to reach zer= o. - * Return 1 so following handlers will not be potentially blocked. - */ - return 1; + return !migration->precopy_init_size && !migration->precopy_dirty_size; } =20 static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) --=20 2.26.3