From nobody Tue Feb 10 01:35:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1653374900; cv=none; d=zohomail.com; s=zohoarc; b=adNhFgtolZ7YH45Tge57UW2iuWQ+9xM5Pl7z+nbyeyoN0VCGX/BbDlQ2MjeokVcff8JFcZterWgk3Okjt833pjdwAluwwzvDjklJZOt23A37+EqAzyjkjeHMSzV83Y3xmjKM2TOH6a3UPMXcVzVWqYKoNPmrkbUnzZVnnlWQtEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653374900; 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=NNJ7A3yNy+KHwCz204Fdk9lCHlExpE7iyo7eYQn0pE8=; b=AKGpRnYFCcahvRUfEM2kBkfMQBIkv83/ngmM6WMPou+HjF2ywylMOuTqHScWAO25oODU8QsKqtN1Fmak2nkMDGDjhls8xmKbGNZoEI9ZUTRaT1Z0uG+Q1QKh3CQCj2w0JPc713bQzyOs2Y8FLFlb1qt26ElifIQUJqX+fUJUNfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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 1653374900750925.2398279524768; Mon, 23 May 2022 23:48:20 -0700 (PDT) Received: from localhost ([::1]:38020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntOL5-0004cm-Nb for importer@patchew.org; Tue, 24 May 2022 02:48:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntNtb-00005M-9i for qemu-devel@nongnu.org; Tue, 24 May 2022 02:19:55 -0400 Received: from mga17.intel.com ([192.55.52.151]:42013) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntNtZ-0000MN-Hi for qemu-devel@nongnu.org; Tue, 24 May 2022 02:19:55 -0400 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2022 23:19:52 -0700 Received: from leirao-pc.bj.intel.com ([10.238.156.102]) by orsmga008.jf.intel.com with ESMTP; 23 May 2022 23:19:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653373193; x=1684909193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BidQ/Lj4AzL1srh2FSCncmHpFcQXw1WY/Lep5pe1iY4=; b=V6dcbX6q1+r0g2WLfnZYyW3JiVduC/fshsd3yqLxLtudN3ozKHg1oJo5 Qo5w/oBHKn0JI3Mc99Fps6nKV6jHEKGp0Pn2rcgoslZsB1tskGNq/BtZT wSBFcsbuTXTB5s/rbYStAgRFDhTJ1+D6OVBy4b9QNvU41x+NQCW2VBs3v DdOYRjioXMPrf5Z4clm7m40ZSMU/O/CgkYxRAIZuYL9lEe5cpxjoq0W0t FX6FEYwwJWnVOuIz7NrkB3aEqHKsyT3fIQwBon1y5fzNMaZFkt9aoWTFk qbzY/9F2JUTMkpdo9De13micMCV5aj99ncn5gOoW7DIeiaye2w8fGCN2D Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10356"; a="253943289" X-IronPort-AV: E=Sophos;i="5.91,248,1647327600"; d="scan'208";a="253943289" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,248,1647327600"; d="scan'208";a="601059892" From: Lei Rao To: alex.williamson@redhat.com, kevin.tian@intel.com, eddie.dong@intel.com, jason.zeng@intel.com, quintela@redhat.com, dgilbert@redhat.com, yadong.li@intel.com, yi.l.liu@intel.com Cc: qemu-devel@nongnu.org, Lei Rao , Eddie Dong Subject: [RFC PATCH 12/13] vfio/migration: add some trace-events for vfio migration plugin Date: Tue, 24 May 2022 14:18:47 +0800 Message-Id: <20220524061848.1615706-13-lei.rao@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220524061848.1615706-1-lei.rao@intel.com> References: <20220524061848.1615706-1-lei.rao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.151; envelope-from=lei.rao@intel.com; helo=mga17.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1653374902739100003 Content-Type: text/plain; charset="utf-8" Add some trace-events including trace_vfio_migration_plugin_probe trace_vfio_plugin_save_buffer, trace_vfio_plugin_load_state_device_data trace_vfio_update_pending, and trace_vfio_migration_set_state to make debugging easier. Signed-off-by: Lei Rao Reviewed-by: Eddie Dong --- hw/vfio/migration-plugin.c | 10 +++++++--- hw/vfio/trace-events | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/vfio/migration-plugin.c b/hw/vfio/migration-plugin.c index 63124e1571..c545cbe334 100644 --- a/hw/vfio/migration-plugin.c +++ b/hw/vfio/migration-plugin.c @@ -19,6 +19,7 @@ #include "qapi/error.h" #include "hw/vfio/vfio-migration-plugin.h" #include "sysemu/sysemu.h" +#include "trace.h" =20 #define CHUNK_SIZE (1024 * 1024) =20 @@ -128,7 +129,7 @@ static int vfio_migration_update_pending_plugin(VFIODev= ice *vbasedev) return ret; } migration->pending_bytes =3D pending_bytes; - + trace_vfio_update_pending(vbasedev->name, pending_bytes); return 0; } =20 @@ -159,7 +160,7 @@ static int vfio_migration_set_state_plugin(VFIODevice *= vbasedev, uint32_t mask, } =20 vbasedev->migration->device_state =3D device_state; - + trace_vfio_migration_set_state(vbasedev->name, device_state); return 0; } =20 @@ -179,6 +180,7 @@ static int vfio_migration_save_buffer_plugin(QEMUFile *= f, VFIODevice *vbasedev, qemu_put_be64(f, data_size); tmp_size =3D data_size; =20 + trace_vfio_save_buffer_plugin(vbasedev->name, data_size); while (tmp_size) { uint64_t sz =3D tmp_size <=3D CHUNK_SIZE ? tmp_size : CHUNK_SIZE; void *buf =3D g_try_malloc(sz); @@ -214,6 +216,7 @@ static int vfio_migration_load_buffer_plugin(QEMUFile *= f, VFIODevice *vbasedev, int ret =3D 0; VFIOMigrationPlugin *plugin =3D vbasedev->migration->plugin; =20 + trace_vfio_load_state_device_data_plugin(vbasedev->name, data_size); while (data_size) { uint64_t sz =3D data_size <=3D CHUNK_SIZE ? data_size : CHUNK_SIZE; void *buf =3D g_try_malloc(sz); @@ -257,6 +260,7 @@ int vfio_migration_probe_plugin(VFIODevice *vbasedev) } =20 migration->ops =3D &vfio_plugin_method; - + trace_vfio_migration_probe_plugin(vbasedev->name, vbasedev->desc.path, + vbasedev->desc.arg); return 0; } diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index ca85edeb11..6c2cba29fd 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -149,12 +149,14 @@ vfio_display_edid_write_error(void) "" =20 # migration.c vfio_migration_probe_local(const char *name, uint32_t index) " (%s) Region= %d" +vfio_migration_probe_plugin(const char *name, const char *path, const char= *arg) " (%s) Plugin path=3D%s arg=3D%s" vfio_migration_set_state(const char *name, uint32_t state) " (%s) state %d" vfio_vmstate_change(const char *name, int running, const char *reason, uin= t32_t dev_state) " (%s) running %d reason %s device state %d" vfio_migration_state_notifier(const char *name, const char *state) " (%s) = state %s" vfio_save_setup(const char *name) " (%s)" vfio_save_cleanup(const char *name) " (%s)" vfio_save_buffer_local(const char *name, uint64_t data_offset, uint64_t da= ta_size, uint64_t pending) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64" pendi= ng 0x%"PRIx64 +vfio_save_buffer_plugin(const char *name, uint64_t data_size) " (%s) data = size 0x%"PRIx64 vfio_update_pending(const char *name, uint64_t pending) " (%s) pending 0x%= "PRIx64 vfio_save_device_config_state(const char *name) " (%s)" vfio_save_pending(const char *name, uint64_t precopy, uint64_t postcopy, u= int64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" compati= ble 0x%"PRIx64 @@ -163,6 +165,7 @@ vfio_save_complete_precopy(const char *name) " (%s)" 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_local(const char *name, uint64_t data_offset, = uint64_t data_size) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64 +vfio_load_state_device_data_plugin(const char *name, uint64_t data_size) "= (%s) data size 0x%"PRIx64 vfio_load_cleanup(const char *name) " (%s)" vfio_get_dirty_bitmap(int fd, uint64_t iova, uint64_t size, uint64_t bitma= p_size, uint64_t start) "container fd=3D%d, iova=3D0x%"PRIx64" size=3D 0x%"= PRIx64" bitmap_size=3D0x%"PRIx64" start=3D0x%"PRIx64 vfio_iommu_map_dirty_notify(uint64_t iova_start, uint64_t iova_end) "iommu= dirty @ 0x%"PRIx64" - 0x%"PRIx64 --=20 2.32.0