From nobody Mon Nov 25 12:39:51 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=1715779421; cv=pass; d=zohomail.com; s=zohoarc; b=k97mHWcRubUHIk3ZYif5gbflarBbzLxhX4C4iEL8NfwZKHKtAz/QYtUFImb/JxvVkPFnbFl7gYXIiETxbeyxAn2CTBgl62XCfEjgBcWVjtRxD5fqbTG7syhV69F+zXB7X01rRftmFvwj4pmViu3wteCWcAKGOLJYGsxQGEBoqYM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715779421; 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=ysncH/GXbkCkfqKlt0YJah71gRqhJesgEfziDyTDuLI=; b=nxATvGKho8LNs/2FNVdGx+JQdGizzTkAhtzYZodjFBiD2Z7seQqhtxXtW0Qmf04RQbp0fHhBL4cHIyzrdHllO4GlhXSlxX1p46cYxsBCPAjCJ8TSvCnb8BftYh0sBQX64ZzvnVcHS/M9gHKFn3hxnehSAyEOZGHlUo4O7O8Cya4= 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 1715779421601324.9848734720937; Wed, 15 May 2024 06:23:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7EaI-0001It-KC; Wed, 15 May 2024 09:22:18 -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 1s7EaH-0001Ib-3b for qemu-devel@nongnu.org; Wed, 15 May 2024 09:22:17 -0400 Received: from mail-bn8nam12on20600.outbound.protection.outlook.com ([2a01:111:f403:2418::600] helo=NAM12-BN8-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 1s7EaB-0007Fu-B9 for qemu-devel@nongnu.org; Wed, 15 May 2024 09:22:15 -0400 Received: from CH2PR07CA0066.namprd07.prod.outlook.com (2603:10b6:610:5b::40) by SA0PR12MB7479.namprd12.prod.outlook.com (2603:10b6:806:24b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Wed, 15 May 2024 13:22:04 +0000 Received: from CH1PEPF0000A34B.namprd04.prod.outlook.com (2603:10b6:610:5b:cafe::5b) by CH2PR07CA0066.outlook.office365.com (2603:10b6:610:5b::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34 via Frontend Transport; Wed, 15 May 2024 13:22:04 +0000 Received: from mail.nvidia.com (216.228.118.233) by CH1PEPF0000A34B.mail.protection.outlook.com (10.167.244.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.21 via Frontend Transport; Wed, 15 May 2024 13:22:04 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 15 May 2024 06:21:54 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 15 May 2024 06:21:54 -0700 Received: from vdi.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 15 May 2024 06:21:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8IY5wFAeA4xV6Dyzx7NwV5bY1ze7oBjIWiF21nfpBzBLi5ag2R81Vx0DaF+rROcvnLwUtBZjQLH5QCin0z83XCFu4gvIS2/VMsp42jqsmd6BecxYBllMYyPQub/p3Ucb9dQZznqFrc2hOhOaU6Po+98KOS/Ozryn6iktfCT4hubT5c6SskEeic/gL9hbDCAz/Ys37KJFODq48QZgLd+g+7SmaKi4YMJHcNh5AlP7zIKfq5qr9C+NNAo/UOqhwj4EW5XV+hfJbG6M3nyzuYx8cjRhn9OUHbxubg1e1g7h3yPptoFHCo3Es04YjemQPM5RN/jODnq6EMPHByD7hRelg== 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=ysncH/GXbkCkfqKlt0YJah71gRqhJesgEfziDyTDuLI=; b=iJ1irTOKOJiWzsiT4ADdtSiu12SKg3WW/BA6JGdlQ8tbZddawGJ9s5nmGvNQGPlSHsRxZbinRw/Df6x6Z7Tv5HCv5llxINdzxofXr5rhCrtQFkmAvEl/uf1kziv1zETyDXJWJv5IcSmlqa4pGjUN86sMrlYcdFJ26kE66V2h3lh42mH/3fqd4H8poyCmK+ubNvsTdHLFZkhg91k3SkbQupZC0OTDzm+xp961/9S5Cd5TisZpf/XmrUf9/bclPtKpOQ9+xrtutd2lQaCgPyhL+c7tBcySRZHc08lAu9E80sriAe/i7aU3YZKJd346Tzm27YswvaSS4dWEJRTlZO/9lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=ysncH/GXbkCkfqKlt0YJah71gRqhJesgEfziDyTDuLI=; b=nSeaI6UsSJzbrV4jv42mhDUBt/gtRufiB8zDElDhKEHrZRTgpX2WGScYz2PlY8XD1nF/V2ojIyCNs8Wvcs8u4fh9L25Catus7w8Nf5C2+NzZ9jmA8riINs522GN6sTu56EyQEsMTp/8lzGrX9riTciahvBbtyI52oe0Gt+2PnmaZrwPSWE/lWqgWCGmORdZhzHUSw5HpAHbA/EdsXVzjE2ROHZdzWAcpMiiOKHJQK1yruzjW7nYm+jBnl+H8UpIdriGD10L+dfe9Xb38V/nNJCtD9iK0j5T6kYLl4/O0waPVI2jWKYimC0SNEfAvIs2jITz0v2BqsYQT8Tp4ScTXEw== X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C From: Avihai Horon To: CC: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Markus Armbruster , Michael Roth , Eric Blake , Peter Xu , Fabiano Rosas , Joao Martins , Maor Gottlieb , Avihai Horon Subject: [PATCH v3 4/4] vfio/migration: Enhance VFIO migration state tracing Date: Wed, 15 May 2024 16:21:38 +0300 Message-ID: <20240515132138.4560-5-avihaih@nvidia.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20240515132138.4560-1-avihaih@nvidia.com> References: <20240515132138.4560-1-avihaih@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34B:EE_|SA0PR12MB7479:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ad208f3-f970-45fe-92f4-08dc74e20328 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|376005|36860700004|1800799015; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MVFvamN6SnRXY2RkdmRidy9WcWdRZjkzbFl5QXcxaVFHbE5odHpYWXUyQ1RF?= =?utf-8?B?Rysyd24rL3NrS1NJTENoOEVzb1QyUGFpNWNBMlQ5aXc2b2ZORm9GRU5rb1RT?= =?utf-8?B?OEUxeFA0WmdoVmJtSDBUem04VVJ2YjV6dlBld0hycTQ3bERpajROVDJxdTNQ?= =?utf-8?B?SG5haEFKdjEvaTlzOGFWcU8xNnBCNWdiL0Fpai9KRStwYndxRkZtcW5ESVNz?= =?utf-8?B?TjNyY0JHdUdYZEpkeTVFNjFHb1RUSDZiN0wxQVZ6RzFrL0JTSUl1TU8yM3c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1Nys3TDNzT2NwR3VL?= =?utf-8?B?OTZ2a09NVVpjeTRvR2NPQUR2VHdDYXM2V005SndHQ0NVa0l4Rkg0aXFkLzF6?= =?utf-8?B?ZmJBQXNYWDRKRkMvdjlZQ2dkWFpVU0Y2UVlFKzdReTA0ZGcxUkhxRjN0MUZ2?= =?utf-8?B?ZUtYSjFQWWZJaGF6QThjVGF0eW5GaTB0eFJQQXMwdzQvRVZmeTBTbG05U3No?= =?utf-8?B?eXBHVE5DbVl6ZVJWWlY3MGtwQWt6MEU3RGVhNWd1b0puQ3B0R05YVHE1Znc2?= =?utf-8?B?b1lpM2xCeWJiblU2VjNyVmt1V1RPVVlkQXdaWWVCSXQ3YTZod3c3ZG84NGJM?= =?utf-8?B?eXlkc0JIUnhBc0Nrem5Lb2ZtMzkyMmZ3N21VSDk5enViSTZVVFBOMmhJa3M0?= =?utf-8?B?ZDNxVEhFY09LL1RkcC8xQVpqWjAvRWI3S1c3K0hTZjhXSnE5WFNya09DbnFa?= =?utf-8?B?bXFIRE16LzlrMDU0MmJzcWN0UWZ6VE1SZTN2QjArNjBiajRxbmJETDVxZS9J?= =?utf-8?B?S1A4UnliaW1malNIbDFPbzBpM2Rwa0NlUllSS1pEM0FYdlJwZHZrOXlDejY2?= =?utf-8?B?Rm9mZElxcnpLZCtNWGJjSU81VVV0UDNhLy9WaTQvTzRVdjVuUE5LVHdwZFBh?= =?utf-8?B?QjVqUHZGR2lyZGdUODBCbjZwajNxU21RSnBqK2pNSk9RM1I1cnR1c2dkM20w?= =?utf-8?Q?IJu7NiCzh6Wjd?= X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230031)(82310400017)(376005)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2024 13:22:04.2470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ad208f3-f970-45fe-92f4-08dc74e20328 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000A34B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7479 Received-SPF: softfail client-ip=2a01:111:f403:2418::600; envelope-from=avihaih@nvidia.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.935, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-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 @Nvidia.com) X-ZM-MESSAGEID: 1715779422760100005 Move trace_vfio_migration_set_state() to the top of the function, add recover_state to it, and add a new trace event to vfio_migration_set_device_state(). This improves tracing of device state changes as state changes are now also logged when vfio_migration_set_state() fails (covering recover state and device reset transitions) and in no-op state transitions to the same state. Suggested-by: C=C3=A9dric Le Goater Signed-off-by: Avihai Horon Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/migration.c | 8 ++++++-- hw/vfio/trace-events | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index f2b7a3067b..7f0d76ab50 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -129,6 +129,9 @@ static void vfio_migration_set_device_state(VFIODevice = *vbasedev, { VFIOMigration *migration =3D vbasedev->migration; =20 + trace_vfio_migration_set_device_state(vbasedev->name, + mig_state_to_str(state)); + migration->device_state =3D state; vfio_migration_send_event(vbasedev); } @@ -146,6 +149,9 @@ static int vfio_migration_set_state(VFIODevice *vbasede= v, (struct vfio_device_feature_mig_state *)feature->data; int ret; =20 + trace_vfio_migration_set_state(vbasedev->name, mig_state_to_str(new_st= ate), + mig_state_to_str(recover_state)); + if (new_state =3D=3D migration->device_state) { return 0; } @@ -203,8 +209,6 @@ static int vfio_migration_set_state(VFIODevice *vbasede= v, migration->data_fd =3D mig_state->data_fd; } =20 - trace_vfio_migration_set_state(vbasedev->name, mig_state_to_str(new_st= ate)); - return 0; =20 reset_device: diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index f0474b244b..64161bf6f4 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -152,7 +152,8 @@ vfio_load_device_config_state(const char *name) " (%s)" vfio_load_state(const char *name, uint64_t data) " (%s) data 0x%"PRIx64 vfio_load_state_device_data(const char *name, uint64_t data_size, int ret)= " (%s) size 0x%"PRIx64" ret %d" vfio_migration_realize(const char *name) " (%s)" -vfio_migration_set_state(const char *name, const char *state) " (%s) state= %s" +vfio_migration_set_device_state(const char *name, const char *state) " (%s= ) state %s" +vfio_migration_set_state(const char *name, const char *new_state, const ch= ar *recover_state) " (%s) new state %s, recover state %s" vfio_migration_state_notifier(const char *name, int state) " (%s) state %d" vfio_save_block(const char *name, int data_size) " (%s) data_size %d" vfio_save_cleanup(const char *name) " (%s)" --=20 2.26.3