qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lei Rao <lei.rao@intel.com>
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 <lei.rao@intel.com>,
	Eddie Dong <eddie.dong@Intel.com>
Subject: [RFC PATCH 12/13] vfio/migration: add some trace-events for vfio migration plugin
Date: Tue, 24 May 2022 14:18:47 +0800	[thread overview]
Message-ID: <20220524061848.1615706-13-lei.rao@intel.com> (raw)
In-Reply-To: <20220524061848.1615706-1-lei.rao@intel.com>

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 <lei.rao@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@Intel.com>
---
 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"
 
 #define CHUNK_SIZE (1024 * 1024)
 
@@ -128,7 +129,7 @@ static int vfio_migration_update_pending_plugin(VFIODevice *vbasedev)
         return ret;
     }
     migration->pending_bytes = pending_bytes;
-
+    trace_vfio_update_pending(vbasedev->name, pending_bytes);
     return 0;
 }
 
@@ -159,7 +160,7 @@ static int vfio_migration_set_state_plugin(VFIODevice *vbasedev, uint32_t mask,
     }
 
     vbasedev->migration->device_state = device_state;
-
+    trace_vfio_migration_set_state(vbasedev->name, device_state);
     return 0;
 }
 
@@ -179,6 +180,7 @@ static int vfio_migration_save_buffer_plugin(QEMUFile *f, VFIODevice *vbasedev,
     qemu_put_be64(f, data_size);
     tmp_size = data_size;
 
+    trace_vfio_save_buffer_plugin(vbasedev->name, data_size);
     while (tmp_size) {
         uint64_t sz = tmp_size <= CHUNK_SIZE ? tmp_size : CHUNK_SIZE;
         void *buf = g_try_malloc(sz);
@@ -214,6 +216,7 @@ static int vfio_migration_load_buffer_plugin(QEMUFile *f, VFIODevice *vbasedev,
     int ret = 0;
     VFIOMigrationPlugin *plugin = vbasedev->migration->plugin;
 
+    trace_vfio_load_state_device_data_plugin(vbasedev->name, data_size);
     while (data_size) {
         uint64_t sz = data_size <= CHUNK_SIZE ? data_size : CHUNK_SIZE;
         void *buf = g_try_malloc(sz);
@@ -257,6 +260,7 @@ int vfio_migration_probe_plugin(VFIODevice *vbasedev)
     }
 
     migration->ops = &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) ""
 
 # 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=%s arg=%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, uint32_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 data_size, uint64_t pending) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64" pending 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, uint64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" compatible 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 bitmap_size, uint64_t start) "container fd=%d, iova=0x%"PRIx64" size= 0x%"PRIx64" bitmap_size=0x%"PRIx64" start=0x%"PRIx64
 vfio_iommu_map_dirty_notify(uint64_t iova_start, uint64_t iova_end) "iommu dirty @ 0x%"PRIx64" - 0x%"PRIx64
-- 
2.32.0



  parent reply	other threads:[~2022-05-24  6:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  6:18 [RFC PATCH 00/13] Add a plugin to support out-of-band live migration for VFIO pass-through device Lei Rao
2022-05-24  6:18 ` [RFC PATCH 01/13] vfio/migration: put together checks of migration initialization conditions Lei Rao
2022-05-24  6:18 ` [RFC PATCH 02/13] vfio/migration: move migration struct allocation out of vfio_migration_init Lei Rao
2022-05-24  6:18 ` [RFC PATCH 03/13] vfio/migration: move vfio_get_dev_region_info out of vfio_migration_probe Lei Rao
2022-05-24  6:18 ` [RFC PATCH 04/13] vfio/migration: Separated functions that relate to the In-Band approach Lei Rao
2022-05-24  6:18 ` [RFC PATCH 05/13] vfio/migration: rename " Lei Rao
2022-05-24  6:18 ` [RFC PATCH 06/13] vfio/migration: introduce VFIOMigrationOps layer in VFIO live migration framework Lei Rao
2022-05-24  6:18 ` [RFC PATCH 07/13] vfio/migration: move the statistics of bytes_transferred to generic VFIO migration layer Lei Rao
2022-05-24  6:18 ` [RFC PATCH 08/13] vfio/migration: split migration handler registering from vfio_migration_init Lei Rao
2022-05-24  6:18 ` [RFC PATCH 09/13] vfio/migration: move the functions of In-Band approach to a new file Lei Rao
2022-05-24  6:18 ` [RFC PATCH 10/13] vfio/pci: introduce command-line parameters to specify migration method Lei Rao
2022-05-24  6:18 ` [RFC PATCH 11/13] vfio/migration: add a plugin layer to support out-of-band live migration Lei Rao
2022-05-24  6:18 ` Lei Rao [this message]
2022-05-24  6:18 ` [RFC PATCH 13/13] vfio/migration: make the region and plugin member of struct VFIOMigration to be a union Lei Rao
2022-05-26 18:44 ` [RFC PATCH 00/13] Add a plugin to support out-of-band live migration for VFIO pass-through device Alex Williamson
2022-06-01 17:09   ` Dong, Eddie
2022-06-01 18:01     ` Alex Williamson
2022-06-02  4:24       ` Tian, Kevin
2022-06-14 21:10       ` Dong, Eddie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220524061848.1615706-13-lei.rao@intel.com \
    --to=lei.rao@intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=jason.zeng@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=yadong.li@intel.com \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).