diff mbox series

virtio-pmem: add trace events

Message ID 20201117115705.32195-1-pankaj.gupta.linux@gmail.com (mailing list archive)
State New, archived
Headers show
Series virtio-pmem: add trace events | expand

Commit Message

Pankaj Gupta Nov. 17, 2020, 11:57 a.m. UTC
This patch adds trace events for virtio-pmem functionality.
Adding trace events for virtio pmem request, reponse and host
side fsync functionality.

Signed-off-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
---
 hw/virtio/trace-events  | 5 +++++
 hw/virtio/virtio-pmem.c | 4 ++++
 2 files changed, 9 insertions(+)

Comments

Pankaj Gupta Dec. 9, 2020, 5:49 p.m. UTC | #1
ping.

> This patch adds trace events for virtio-pmem functionality.
> Adding trace events for virtio pmem request, reponse and host
> side fsync functionality.
>
> Signed-off-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
> ---
>  hw/virtio/trace-events  | 5 +++++
>  hw/virtio/virtio-pmem.c | 4 ++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
> index 2060a144a2..c62727f879 100644
> --- a/hw/virtio/trace-events
> +++ b/hw/virtio/trace-events
> @@ -122,3 +122,8 @@ virtio_mem_unplug_all_request(void) ""
>  virtio_mem_resized_usable_region(uint64_t old_size, uint64_t new_size) "old_size=0x%" PRIx64 "new_size=0x%" PRIx64
>  virtio_mem_state_request(uint64_t addr, uint16_t nb_blocks) "addr=0x%" PRIx64 " nb_blocks=%" PRIu16
>  virtio_mem_state_response(uint16_t state) "state=%" PRIu16
> +
> +# virtio-pmem.c
> +virtio_pmem_flush_request(void) "flush request"
> +virtio_pmem_response(void) "flush response"
> +virtio_pmem_flush_done(int type) "fsync return=%d"
> diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
> index ddb0125901..d83e973bf2 100644
> --- a/hw/virtio/virtio-pmem.c
> +++ b/hw/virtio/virtio-pmem.c
> @@ -24,6 +24,7 @@
>  #include "sysemu/hostmem.h"
>  #include "block/aio.h"
>  #include "block/thread-pool.h"
> +#include "trace.h"
>
>  typedef struct VirtIODeviceRequest {
>      VirtQueueElement elem;
> @@ -41,6 +42,7 @@ static int worker_cb(void *opaque)
>
>      /* flush raw backing image */
>      err = fsync(req_data->fd);
> +    trace_virtio_pmem_flush_done(err);
>      if (err != 0) {
>          err = 1;
>      }
> @@ -59,6 +61,7 @@ static void done_cb(void *opaque, int ret)
>      /* Callbacks are serialized, so no need to use atomic ops. */
>      virtqueue_push(req_data->pmem->rq_vq, &req_data->elem, len);
>      virtio_notify((VirtIODevice *)req_data->pmem, req_data->pmem->rq_vq);
> +    trace_virtio_pmem_response();
>      g_free(req_data);
>  }
>
> @@ -69,6 +72,7 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
>      HostMemoryBackend *backend = MEMORY_BACKEND(pmem->memdev);
>      ThreadPool *pool = aio_get_thread_pool(qemu_get_aio_context());
>
> +    trace_virtio_pmem_flush_request();
>      req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
>      if (!req_data) {
>          virtio_error(vdev, "virtio-pmem missing request data");
> --
> 2.20.1
>
David Hildenbrand Dec. 9, 2020, 7:15 p.m. UTC | #2
On 17.11.20 12:57, Pankaj Gupta wrote:
> This patch adds trace events for virtio-pmem functionality.
> Adding trace events for virtio pmem request, reponse and host
> side fsync functionality.
> 
> Signed-off-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
> ---
>  hw/virtio/trace-events  | 5 +++++
>  hw/virtio/virtio-pmem.c | 4 ++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
> index 2060a144a2..c62727f879 100644
> --- a/hw/virtio/trace-events
> +++ b/hw/virtio/trace-events
> @@ -122,3 +122,8 @@ virtio_mem_unplug_all_request(void) ""
>  virtio_mem_resized_usable_region(uint64_t old_size, uint64_t new_size) "old_size=0x%" PRIx64 "new_size=0x%" PRIx64
>  virtio_mem_state_request(uint64_t addr, uint16_t nb_blocks) "addr=0x%" PRIx64 " nb_blocks=%" PRIu16
>  virtio_mem_state_response(uint16_t state) "state=%" PRIu16
> +
> +# virtio-pmem.c
> +virtio_pmem_flush_request(void) "flush request"
> +virtio_pmem_response(void) "flush response"
> +virtio_pmem_flush_done(int type) "fsync return=%d"
> diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
> index ddb0125901..d83e973bf2 100644
> --- a/hw/virtio/virtio-pmem.c
> +++ b/hw/virtio/virtio-pmem.c
> @@ -24,6 +24,7 @@
>  #include "sysemu/hostmem.h"
>  #include "block/aio.h"
>  #include "block/thread-pool.h"
> +#include "trace.h"
>  
>  typedef struct VirtIODeviceRequest {
>      VirtQueueElement elem;
> @@ -41,6 +42,7 @@ static int worker_cb(void *opaque)
>  
>      /* flush raw backing image */
>      err = fsync(req_data->fd);
> +    trace_virtio_pmem_flush_done(err);
>      if (err != 0) {
>          err = 1;
>      }
> @@ -59,6 +61,7 @@ static void done_cb(void *opaque, int ret)
>      /* Callbacks are serialized, so no need to use atomic ops. */
>      virtqueue_push(req_data->pmem->rq_vq, &req_data->elem, len);
>      virtio_notify((VirtIODevice *)req_data->pmem, req_data->pmem->rq_vq);
> +    trace_virtio_pmem_response();
>      g_free(req_data);
>  }
>  
> @@ -69,6 +72,7 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
>      HostMemoryBackend *backend = MEMORY_BACKEND(pmem->memdev);
>      ThreadPool *pool = aio_get_thread_pool(qemu_get_aio_context());
>  
> +    trace_virtio_pmem_flush_request();
>      req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
>      if (!req_data) {
>          virtio_error(vdev, "virtio-pmem missing request data");
> 

LGTM

Reviewed-by: David Hildenbrand <david@redhat.com>
Pankaj Gupta Feb. 2, 2021, 2:54 p.m. UTC | #3
Ping

@M

On Wed, 9 Dec 2020 at 20:15, David Hildenbrand <david@redhat.com> wrote:
>
> On 17.11.20 12:57, Pankaj Gupta wrote:
> > This patch adds trace events for virtio-pmem functionality.
> > Adding trace events for virtio pmem request, reponse and host
> > side fsync functionality.
> >
> > Signed-off-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
> > ---
> >  hw/virtio/trace-events  | 5 +++++
> >  hw/virtio/virtio-pmem.c | 4 ++++
> >  2 files changed, 9 insertions(+)
> >
> > diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
> > index 2060a144a2..c62727f879 100644
> > --- a/hw/virtio/trace-events
> > +++ b/hw/virtio/trace-events
> > @@ -122,3 +122,8 @@ virtio_mem_unplug_all_request(void) ""
> >  virtio_mem_resized_usable_region(uint64_t old_size, uint64_t new_size) "old_size=0x%" PRIx64 "new_size=0x%" PRIx64
> >  virtio_mem_state_request(uint64_t addr, uint16_t nb_blocks) "addr=0x%" PRIx64 " nb_blocks=%" PRIu16
> >  virtio_mem_state_response(uint16_t state) "state=%" PRIu16
> > +
> > +# virtio-pmem.c
> > +virtio_pmem_flush_request(void) "flush request"
> > +virtio_pmem_response(void) "flush response"
> > +virtio_pmem_flush_done(int type) "fsync return=%d"
> > diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
> > index ddb0125901..d83e973bf2 100644
> > --- a/hw/virtio/virtio-pmem.c
> > +++ b/hw/virtio/virtio-pmem.c
> > @@ -24,6 +24,7 @@
> >  #include "sysemu/hostmem.h"
> >  #include "block/aio.h"
> >  #include "block/thread-pool.h"
> > +#include "trace.h"
> >
> >  typedef struct VirtIODeviceRequest {
> >      VirtQueueElement elem;
> > @@ -41,6 +42,7 @@ static int worker_cb(void *opaque)
> >
> >      /* flush raw backing image */
> >      err = fsync(req_data->fd);
> > +    trace_virtio_pmem_flush_done(err);
> >      if (err != 0) {
> >          err = 1;
> >      }
> > @@ -59,6 +61,7 @@ static void done_cb(void *opaque, int ret)
> >      /* Callbacks are serialized, so no need to use atomic ops. */
> >      virtqueue_push(req_data->pmem->rq_vq, &req_data->elem, len);
> >      virtio_notify((VirtIODevice *)req_data->pmem, req_data->pmem->rq_vq);
> > +    trace_virtio_pmem_response();
> >      g_free(req_data);
> >  }
> >
> > @@ -69,6 +72,7 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
> >      HostMemoryBackend *backend = MEMORY_BACKEND(pmem->memdev);
> >      ThreadPool *pool = aio_get_thread_pool(qemu_get_aio_context());
> >
> > +    trace_virtio_pmem_flush_request();
> >      req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
> >      if (!req_data) {
> >          virtio_error(vdev, "virtio-pmem missing request data");
> >
>
> LGTM
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
>
> --
> Thanks,
>
> David / dhildenb
>
diff mbox series

Patch

diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 2060a144a2..c62727f879 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -122,3 +122,8 @@  virtio_mem_unplug_all_request(void) ""
 virtio_mem_resized_usable_region(uint64_t old_size, uint64_t new_size) "old_size=0x%" PRIx64 "new_size=0x%" PRIx64
 virtio_mem_state_request(uint64_t addr, uint16_t nb_blocks) "addr=0x%" PRIx64 " nb_blocks=%" PRIu16
 virtio_mem_state_response(uint16_t state) "state=%" PRIu16
+
+# virtio-pmem.c
+virtio_pmem_flush_request(void) "flush request"
+virtio_pmem_response(void) "flush response"
+virtio_pmem_flush_done(int type) "fsync return=%d"
diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
index ddb0125901..d83e973bf2 100644
--- a/hw/virtio/virtio-pmem.c
+++ b/hw/virtio/virtio-pmem.c
@@ -24,6 +24,7 @@ 
 #include "sysemu/hostmem.h"
 #include "block/aio.h"
 #include "block/thread-pool.h"
+#include "trace.h"
 
 typedef struct VirtIODeviceRequest {
     VirtQueueElement elem;
@@ -41,6 +42,7 @@  static int worker_cb(void *opaque)
 
     /* flush raw backing image */
     err = fsync(req_data->fd);
+    trace_virtio_pmem_flush_done(err);
     if (err != 0) {
         err = 1;
     }
@@ -59,6 +61,7 @@  static void done_cb(void *opaque, int ret)
     /* Callbacks are serialized, so no need to use atomic ops. */
     virtqueue_push(req_data->pmem->rq_vq, &req_data->elem, len);
     virtio_notify((VirtIODevice *)req_data->pmem, req_data->pmem->rq_vq);
+    trace_virtio_pmem_response();
     g_free(req_data);
 }
 
@@ -69,6 +72,7 @@  static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
     HostMemoryBackend *backend = MEMORY_BACKEND(pmem->memdev);
     ThreadPool *pool = aio_get_thread_pool(qemu_get_aio_context());
 
+    trace_virtio_pmem_flush_request();
     req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
     if (!req_data) {
         virtio_error(vdev, "virtio-pmem missing request data");