qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: John Johnson <john.g.johnson@oracle.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v1 24/24] vfio-user: add trace points
Date: Thu, 15 Dec 2022 13:59:37 +0100	[thread overview]
Message-ID: <3744c12e-547a-c837-8548-6d7e5ee72698@redhat.com> (raw)
In-Reply-To: <a91ec93b532f7951e7dd1c1e66aa9c304774584f.1667542066.git.john.g.johnson@oracle.com>

On 11/9/22 00:13, John Johnson wrote:
> Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
> Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
>   hw/vfio/trace-events | 15 +++++++++++++++
>   hw/vfio/user.c       | 26 ++++++++++++++++++++++++++
>   2 files changed, 41 insertions(+)


I would introduce the traces progressively in the patchset with the
routine being traced.

Thanks,

C.

> 
> diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
> index 73dffe9..c27cec7 100644
> --- a/hw/vfio/trace-events
> +++ b/hw/vfio/trace-events
> @@ -166,3 +166,18 @@ vfio_load_state_device_data(const char *name, uint64_t data_offset, uint64_t dat
>   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
> +
> +# user.c
> +vfio_user_recv_hdr(const char *name, uint16_t id, uint16_t cmd, uint32_t size, uint32_t flags) " (%s) id 0x%x cmd 0x%x size 0x%x flags 0x%x"
> +vfio_user_recv_read(uint16_t id, int read) " id 0x%x read 0x%x"
> +vfio_user_recv_request(uint16_t cmd) " command 0x%x"
> +vfio_user_send_write(uint16_t id, int wrote) " id 0x%x wrote 0x%x"
> +vfio_user_version(uint16_t major, uint16_t minor, const char *caps) " major %d minor %d caps: %s"
> +vfio_user_dma_map(uint64_t iova, uint64_t size, uint64_t off, uint32_t flags, bool will_commit) " iova 0x%"PRIx64" size 0x%"PRIx64" off 0x%"PRIx64" flags 0x%x will_commit %d"
> +vfio_user_dma_unmap(uint64_t iova, uint64_t size, uint32_t flags, bool dirty, bool will_commit) " iova 0x%"PRIx64" size 0x%"PRIx64" flags 0x%x dirty %d will_commit %d"
> +vfio_user_get_info(uint32_t nregions, uint32_t nirqs) " #regions %d #irqs %d"
> +vfio_user_get_region_info(uint32_t index, uint32_t flags, uint64_t size) " index %d flags 0x%x size 0x%"PRIx64
> +vfio_user_get_irq_info(uint32_t index, uint32_t flags, uint32_t count) " index %d flags 0x%x count %d"
> +vfio_user_set_irqs(uint32_t index, uint32_t start, uint32_t count, uint32_t flags) " index %d start %d count %d flags 0x%x"
> +vfio_user_region_rw(uint32_t region, uint64_t off, uint32_t count) " region %d offset 0x%"PRIx64" count %d"
> +vfio_user_wrmulti(const char *s, uint64_t wr_cnt) " %s count 0x%"PRIx64
> diff --git a/hw/vfio/user.c b/hw/vfio/user.c
> index 4ed305b..74e1714 100644
> --- a/hw/vfio/user.c
> +++ b/hw/vfio/user.c
> @@ -30,6 +30,8 @@
>   #include "qapi/qmp/qnum.h"
>   #include "qapi/qmp/qbool.h"
>   #include "user.h"
> +#include "trace.h"
> +
>   
>   
>   /*
> @@ -108,6 +110,8 @@ static int vfio_user_send_qio(VFIOProxy *proxy, VFIOUserMsg *msg)
>           vfio_user_shutdown(proxy);
>           error_report_err(local_err);
>       }
> +    trace_vfio_user_send_write(msg->hdr->id, ret);
> +
>       return ret;
>   }
>   
> @@ -225,6 +229,7 @@ static int vfio_user_complete(VFIOProxy *proxy, Error **errp)
>               }
>               return ret;
>           }
> +        trace_vfio_user_recv_read(msg->hdr->id, ret);
>   
>           msgleft -= ret;
>           data += ret;
> @@ -332,6 +337,8 @@ static int vfio_user_recv_one(VFIOProxy *proxy)
>           error_setg(&local_err, "unknown message type");
>           goto fatal;
>       }
> +    trace_vfio_user_recv_hdr(proxy->sockname, hdr.id, hdr.command, hdr.size,
> +                             hdr.flags);
>   
>       /*
>        * For replies, find the matching pending request.
> @@ -408,6 +415,7 @@ static int vfio_user_recv_one(VFIOProxy *proxy)
>           if (ret <= 0) {
>               goto fatal;
>           }
> +        trace_vfio_user_recv_read(hdr.id, ret);
>   
>           msgleft -= ret;
>           data += ret;
> @@ -546,6 +554,7 @@ static void vfio_user_request(void *opaque)
>       QTAILQ_INIT(&free);
>       QTAILQ_FOREACH_SAFE(msg, &new, next, m1) {
>           QTAILQ_REMOVE(&new, msg, next);
> +        trace_vfio_user_recv_request(msg->hdr->command);
>           proxy->request(proxy->req_arg, msg);
>           QTAILQ_INSERT_HEAD(&free, msg, next);
>       }
> @@ -1265,6 +1274,7 @@ int vfio_user_validate_version(VFIOProxy *proxy, Error **errp)
>       msgp->minor = VFIO_USER_MINOR_VER;
>       memcpy(&msgp->capabilities, caps->str, caplen);
>       g_string_free(caps, true);
> +    trace_vfio_user_version(msgp->major, msgp->minor, msgp->capabilities);
>   
>       vfio_user_send_wait(proxy, &msgp->hdr, NULL, 0, false);
>       if (msgp->hdr.flags & VFIO_USER_ERROR) {
> @@ -1288,6 +1298,7 @@ int vfio_user_validate_version(VFIOProxy *proxy, Error **errp)
>           return -1;
>       }
>   
> +    trace_vfio_user_version(msgp->major, msgp->minor, msgp->capabilities);
>       return 0;
>   }
>   
> @@ -1305,6 +1316,8 @@ static int vfio_user_dma_map(VFIOProxy *proxy,
>       msgp->offset = map->vaddr;
>       msgp->iova = map->iova;
>       msgp->size = map->size;
> +    trace_vfio_user_dma_map(msgp->iova, msgp->size, msgp->offset, msgp->flags,
> +                        will_commit);
>   
>       /*
>        * The will_commit case sends without blocking or dropping BQL.
> @@ -1371,6 +1384,8 @@ static int vfio_user_dma_unmap(VFIOProxy *proxy,
>       msgp->msg.flags = unmap->flags;
>       msgp->msg.iova = unmap->iova;
>       msgp->msg.size = unmap->size;
> +    trace_vfio_user_dma_unmap(msgp->msg.iova, msgp->msg.size, msgp->msg.flags,
> +                         bitmap != NULL, will_commit);
>   
>       if (blocking) {
>           vfio_user_send_wait(proxy, &msgp->msg.hdr, NULL, rsize, will_commit);
> @@ -1400,6 +1415,7 @@ static int vfio_user_get_info(VFIOProxy *proxy, struct vfio_device_info *info)
>       if (msg.hdr.flags & VFIO_USER_ERROR) {
>           return -msg.hdr.error_reply;
>       }
> +    trace_vfio_user_get_info(msg.num_regions, msg.num_irqs);
>   
>       memcpy(info, &msg.argsz, sizeof(*info));
>       return 0;
> @@ -1434,6 +1450,7 @@ static int vfio_user_get_region_info(VFIOProxy *proxy,
>       if (msgp->hdr.flags & VFIO_USER_ERROR) {
>           return -msgp->hdr.error_reply;
>       }
> +    trace_vfio_user_get_region_info(msgp->index, msgp->flags, msgp->size);
>   
>       memcpy(info, &msgp->argsz, info->argsz);
>       return 0;
> @@ -1454,6 +1471,7 @@ static int vfio_user_get_irq_info(VFIOProxy *proxy,
>       if (msg.hdr.flags & VFIO_USER_ERROR) {
>           return -msg.hdr.error_reply;
>       }
> +    trace_vfio_user_get_irq_info(msg.index, msg.flags, msg.count);
>   
>       memcpy(info, &msg.argsz, sizeof(*info));
>       return 0;
> @@ -1499,6 +1517,8 @@ static int vfio_user_set_irqs(VFIOProxy *proxy, struct vfio_irq_set *irq)
>           msgp->index = irq->index;
>           msgp->start = irq->start;
>           msgp->count = irq->count;
> +        trace_vfio_user_set_irqs(msgp->index, msgp->start, msgp->count,
> +                                 msgp->flags);
>   
>           vfio_user_send_wait(proxy, &msgp->hdr, NULL, 0, false);
>           if (msgp->hdr.flags & VFIO_USER_ERROR) {
> @@ -1535,6 +1555,8 @@ static int vfio_user_set_irqs(VFIOProxy *proxy, struct vfio_irq_set *irq)
>           msgp->index = irq->index;
>           msgp->start = irq->start + sent_fds;
>           msgp->count = send_fds;
> +        trace_vfio_user_set_irqs(msgp->index, msgp->start, msgp->count,
> +                                 msgp->flags);
>   
>           loop_fds.send_fds = send_fds;
>           loop_fds.recv_fds = 0;
> @@ -1565,6 +1587,7 @@ static int vfio_user_region_read(VFIOProxy *proxy, uint8_t index, off_t offset,
>       msgp->offset = offset;
>       msgp->region = index;
>       msgp->count = count;
> +    trace_vfio_user_region_rw(msgp->region, msgp->offset, msgp->count);
>   
>       vfio_user_send_wait(proxy, &msgp->hdr, NULL, size, false);
>       if (msgp->hdr.flags & VFIO_USER_ERROR) {
> @@ -1593,6 +1616,7 @@ static void vfio_user_flush_multi(VFIOProxy *proxy)
>       msg->id = wm->hdr.id;
>       msg->rsize = 0;
>       msg->type = VFIO_MSG_ASYNC;
> +    trace_vfio_user_wrmulti("flush", wm->wr_cnt);
>   
>       ret = vfio_user_send_queued(proxy, msg);
>       if (ret < 0) {
> @@ -1622,6 +1646,7 @@ static void vfio_user_add_multi(VFIOProxy *proxy, uint8_t index, off_t offset,
>       memcpy(&w1->data, data, count);
>   
>       wm->wr_cnt++;
> +    trace_vfio_user_wrmulti("add", wm->wr_cnt);
>       if (wm->wr_cnt == VFIO_USER_MULTI_MAX ||
>           proxy->num_outgoing < VFIO_USER_OUT_LOW) {
>           vfio_user_flush_multi(proxy);
> @@ -1689,6 +1714,7 @@ static int vfio_user_region_write(VFIOProxy *proxy, uint8_t index, off_t offset,
>       msgp->region = index;
>       msgp->count = count;
>       memcpy(&msgp->data, data, count);
> +    trace_vfio_user_region_rw(msgp->region, msgp->offset, msgp->count);
>   
>       /* async send will free msg after it's sent */
>       if (post) {



  reply	other threads:[~2022-12-15 13:20 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 23:13 [PATCH v1 00/24] vfio-user client John Johnson
2022-11-08 23:13 ` [PATCH v1 01/24] vfio-user: introduce vfio-user protocol specification John Johnson
2022-11-08 23:13 ` [PATCH v1 02/24] vfio-user: add VFIO base abstract class John Johnson
2022-12-09 13:54   ` John Levon
2022-12-09 16:04   ` Cédric Le Goater
2022-12-12 20:30     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 03/24] vfio-user: add container IO ops vector John Johnson
2022-12-09 14:10   ` John Levon
2022-12-09 16:10   ` Cédric Le Goater
2022-12-12  9:40     ` Philippe Mathieu-Daudé
2022-11-08 23:13 ` [PATCH v1 04/24] vfio-user: add region cache John Johnson
2022-12-09 14:15   ` John Levon
2022-12-12  7:44   ` Cédric Le Goater
2022-12-12 11:42   ` Philippe Mathieu-Daudé
2023-02-02  5:21     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 05/24] vfio-user: add device IO ops vector John Johnson
2022-12-09 14:43   ` John Levon
2022-12-12  7:59   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 06/24] vfio-user: Define type vfio_user_pci_dev_info John Johnson
2022-12-09 15:23   ` John Levon
2022-12-12  9:01   ` Cédric Le Goater
2022-12-12 11:03     ` John Levon
2022-12-12 11:46       ` Philippe Mathieu-Daudé
2022-12-12 20:44         ` John Johnson
2022-12-12 21:32     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 07/24] vfio-user: connect vfio proxy to remote server John Johnson
2022-12-09 15:23   ` John Levon
2022-12-12 16:24   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 08/24] vfio-user: define socket receive functions John Johnson
2022-12-09 15:34   ` John Levon
2022-12-13 10:45   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 09/24] vfio-user: define socket send functions John Johnson
2022-12-09 15:52   ` John Levon
2022-12-13 13:48   ` Cédric Le Goater
2023-02-02  5:21     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 10/24] vfio-user: get device info John Johnson
2022-12-09 15:57   ` John Levon
2022-12-12 20:28     ` John Johnson
2022-12-13 14:06   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 11/24] vfio-user: get region info John Johnson
2022-12-09 17:04   ` John Levon
2022-12-13 15:15   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 12/24] vfio-user: region read/write John Johnson
2022-12-09 17:11   ` John Levon
2022-12-13 16:13   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 13/24] vfio-user: pci_user_realize PCI setup John Johnson
2022-12-09 17:22   ` John Levon
2022-12-13 16:13   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 14/24] vfio-user: get and set IRQs John Johnson
2022-12-09 17:29   ` John Levon
2022-12-12 20:28     ` John Johnson
2022-12-13 16:39   ` Cédric Le Goater
2022-12-13 23:10     ` John Johnson
2023-02-02  5:21     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 15/24] vfio-user: forward msix BAR accesses to server John Johnson
2022-12-09 17:45   ` John Levon
2022-12-14 17:00   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 16/24] vfio-user: proxy container connect/disconnect John Johnson
2022-12-09 17:54   ` John Levon
2022-12-14 17:59   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 17/24] vfio-user: dma map/unmap operations John Johnson
2022-12-15 12:39   ` Cédric Le Goater
2022-11-08 23:13 ` [PATCH v1 18/24] vfio-user: add dma_unmap_all John Johnson
2022-12-09 17:58   ` John Levon
2022-11-08 23:13 ` [PATCH v1 19/24] vfio-user: secure DMA support John Johnson
2022-12-09 18:01   ` John Levon
2022-12-12 20:31     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 20/24] vfio-user: dma read/write operations John Johnson
2022-12-09 18:11   ` John Levon
2022-11-08 23:13 ` [PATCH v1 21/24] vfio-user: pci reset John Johnson
2022-12-09 18:13   ` John Levon
2022-11-08 23:13 ` [PATCH v1 22/24] vfio-user: add 'x-msg-timeout' option that specifies msg wait times John Johnson
2022-12-09 18:14   ` John Levon
2022-12-15 12:56   ` Cédric Le Goater
2022-12-16  4:22     ` John Johnson
2022-11-08 23:13 ` [PATCH v1 23/24] vfio-user: add coalesced posted writes John Johnson
2022-12-09 18:16   ` John Levon
2022-11-08 23:13 ` [PATCH v1 24/24] vfio-user: add trace points John Johnson
2022-12-15 12:59   ` Cédric Le Goater [this message]
2022-12-12  9:41 ` [PATCH v1 00/24] vfio-user client Philippe Mathieu-Daudé
2022-12-16 11:31 ` Cédric Le Goater
2023-02-02  5:20   ` John Johnson

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=3744c12e-547a-c837-8548-6d7e5ee72698@redhat.com \
    --to=clg@redhat.com \
    --cc=john.g.johnson@oracle.com \
    --cc=qemu-devel@nongnu.org \
    /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).