vhost-user-blk: add some useful trace-points
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Daniil Tatianin <d-tatianin@yandex-team.ru> Reviewed-by: Raphael Norwitz <raphael.s.norwitz@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Lei Yang <leiyang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260420200339.708640-22-vsementsov@yandex-team.ru>
Vladimir Sementsov-Ogievskiy committed
Apr 20, 2026 at 23:03 UTC
587c9d91cd9cb2ee09813afa60e952a1d47a9932
2 files changed
+29
hw/block/trace-events
+10
@@ -58,6 +58,16 @@ virtio_blk_handle_zone_mgmt(void *vdev, void *req, uint8_t op, int64_t sector, i
58
virtio_blk_handle_zone_reset_all(void *vdev, void *req, int64_t sector, int64_t len) "vdev %p req %p sector 0x%" PRIx64 " cap 0x%" PRIx64 ""
59
virtio_blk_handle_zone_append(void *vdev, void *req, int64_t sector) "vdev %p req %p, append sector 0x%" PRIx64 ""
60
61
+# vhost-user-blk.c
62
+vhost_user_blk_start_in(void *vdev) "vdev %p"
63
+vhost_user_blk_start_out(void *vdev) "vdev %p"
64
+vhost_user_blk_stop_in(void *vdev) "vdev %p"
65
+vhost_user_blk_stop_out(void *vdev) "vdev %p"
66
+vhost_user_blk_connect_in(void *vdev) "vdev %p"
67
+vhost_user_blk_connect_out(void *vdev) "vdev %p"
68
+vhost_user_blk_device_realize_in(void *vdev) "vdev %p"
69
+vhost_user_blk_device_realize_out(void *vdev) "vdev %p"
70
+
71
# hd-geometry.c
72
hd_geometry_lchs_guess(void *blk, int cyls, int heads, int secs) "blk %p LCHS %d %d %d"
73
hd_geometry_guess(void *blk, uint32_t cyls, uint32_t heads, uint32_t secs, int trans) "blk %p CHS %u %u %u trans %d"
hw/block/vhost-user-blk.c
+19
@@ -31,6 +31,7 @@
31
#include "hw/virtio/virtio-access.h"
32
#include "system/system.h"
33
#include "system/runstate.h"
34
+#include "trace.h"
35
36
static const int user_feature_bits[] = {
37
VIRTIO_BLK_F_SIZE_MAX,
@@ -137,6 +138,8 @@ static int vhost_user_blk_start(VirtIODevice *vdev, Error **errp)
138
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
139
int i, ret;
140
141
+ trace_vhost_user_blk_start_in(vdev);
142
+
143
if (!k->set_guest_notifiers) {
144
error_setg(errp, "binding does not support guest notifiers");
145
return -ENOSYS;
@@ -192,6 +195,8 @@ static int vhost_user_blk_start(VirtIODevice *vdev, Error **errp)
195
}
196
s->started_vu = true;
197
198
+ trace_vhost_user_blk_start_out(vdev);
199
+
200
return ret;
201
202
err_guest_notifiers:
@@ -212,6 +217,8 @@ static int vhost_user_blk_stop(VirtIODevice *vdev)
217
int ret;
218
bool force_stop = false;
219
220
+ trace_vhost_user_blk_stop_in(vdev);
221
+
222
if (!s->started_vu) {
223
return 0;
224
}
@@ -233,6 +240,9 @@ static int vhost_user_blk_stop(VirtIODevice *vdev)
240
}
241
242
vhost_dev_disable_notifiers(&s->dev, vdev);
243
+
244
+ trace_vhost_user_blk_stop_out(vdev);
245
+
246
return ret;
247
}
248
@@ -340,6 +350,8 @@ static int vhost_user_blk_connect(DeviceState *dev, Error **errp)
350
VHostUserBlk *s = VHOST_USER_BLK(vdev);
351
int ret = 0;
352
353
+ trace_vhost_user_blk_connect_in(vdev);
354
+
355
if (s->connected) {
356
return 0;
357
}
@@ -366,6 +378,8 @@ static int vhost_user_blk_connect(DeviceState *dev, Error **errp)
378
ret = vhost_user_blk_start(vdev, errp);
379
}
380
381
+ trace_vhost_user_blk_connect_out(vdev);
382
+
383
return ret;
384
}
385
@@ -456,6 +470,8 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
470
int retries;
471
int i, ret;
472
473
+ trace_vhost_user_blk_device_realize_in(vdev);
474
+
475
if (!s->chardev.chr) {
476
error_setg(errp, "chardev is mandatory");
477
return;
@@ -515,6 +531,9 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
531
qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL,
532
vhost_user_blk_event, NULL, (void *)dev,
533
NULL, true);
534
+
535
+ trace_vhost_user_blk_device_realize_out(vdev);
536
+
537
return;
538
539
virtio_err: