All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-balloon: Add some trace events
@ 2014-09-12  7:06 zhanghailiang
  2014-09-17  0:44 ` zhanghailiang
  0 siblings, 1 reply; 2+ messages in thread
From: zhanghailiang @ 2014-09-12  7:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: zhanghailiang, mst, luonengjun, peter.huangpeng, kraxel, aliguori

Add some trace events for easier debugging

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
 hw/virtio/virtio-balloon.c | 6 ++++++
 trace-events               | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 2c30b3d..112f97c 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -25,6 +25,7 @@
 #include "exec/address-spaces.h"
 #include "qapi/visitor.h"
 #include "qapi-event.h"
+#include "trace.h"
 
 #if defined(__linux__)
 #include <sys/mman.h>
@@ -217,6 +218,8 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
             if (!int128_nz(section.size) || !memory_region_is_ram(section.mr))
                 continue;
 
+            trace_virtio_balloon_handle_output(memory_region_name(section.mr),
+                                               pa);
             /* Using memory_region_get_ram_ptr is bending the rules a bit, but
                should be OK because we only want a single page.  */
             addr = section.offset_within_region;
@@ -280,6 +283,7 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data)
     config.num_pages = cpu_to_le32(dev->num_pages);
     config.actual = cpu_to_le32(dev->actual);
 
+    trace_virtio_balloon_get_config(config.num_pages, config.actual);
     memcpy(config_data, &config, sizeof(struct virtio_balloon_config));
 }
 
@@ -296,6 +300,7 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,
                         ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT),
                         &error_abort);
     }
+    trace_virtio_balloon_set_config(dev->actual, oldactual);
 }
 
 static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
@@ -323,6 +328,7 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
         dev->num_pages = (ram_size - target) >> VIRTIO_BALLOON_PFN_SHIFT;
         virtio_notify_config(vdev);
     }
+    trace_virtio_balloon_to_target(target, dev->num_pages);
 }
 
 static void virtio_balloon_save(QEMUFile *f, void *opaque)
diff --git a/trace-events b/trace-events
index fb58963..fedd7e7 100644
--- a/trace-events
+++ b/trace-events
@@ -143,6 +143,10 @@ cpu_out(unsigned int addr, unsigned int val) "addr %#x value %u"
 # balloon.c
 # Since requests are raised via monitor, not many tracepoints are needed.
 balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
+virtio_balloon_handle_output(const char *name, uint64_t gpa) "setion name: %s gpa: %"PRIx64""
+virtio_balloon_get_config(uint32_t num_pages, uint32_t acutal) "num_pages: %d acutal: %d"
+virtio_balloon_set_config(uint32_t acutal, uint32_t oldacutal) "acutal: %d oldacutal: %d"
+virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d"
 
 # hw/intc/apic_common.c
 cpu_set_apic_base(uint64_t val) "%016"PRIx64
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-balloon: Add some trace events
  2014-09-12  7:06 [Qemu-devel] [PATCH] virtio-balloon: Add some trace events zhanghailiang
@ 2014-09-17  0:44 ` zhanghailiang
  0 siblings, 0 replies; 2+ messages in thread
From: zhanghailiang @ 2014-09-17  0:44 UTC (permalink / raw)
  To: zhanghailiang
  Cc: mst, luonengjun, peter.huangpeng, qemu-devel, kraxel, aliguori

Hi,

Ping...
Is this acceptable?

Thanks,
zhanghailiang

On 2014/9/12 15:06, zhanghailiang wrote:
> Add some trace events for easier debugging
>
> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
> ---
>   hw/virtio/virtio-balloon.c | 6 ++++++
>   trace-events               | 4 ++++
>   2 files changed, 10 insertions(+)
>
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index 2c30b3d..112f97c 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -25,6 +25,7 @@
>   #include "exec/address-spaces.h"
>   #include "qapi/visitor.h"
>   #include "qapi-event.h"
> +#include "trace.h"
>
>   #if defined(__linux__)
>   #include<sys/mman.h>
> @@ -217,6 +218,8 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
>               if (!int128_nz(section.size) || !memory_region_is_ram(section.mr))
>                   continue;
>
> +            trace_virtio_balloon_handle_output(memory_region_name(section.mr),
> +                                               pa);
>               /* Using memory_region_get_ram_ptr is bending the rules a bit, but
>                  should be OK because we only want a single page.  */
>               addr = section.offset_within_region;
> @@ -280,6 +283,7 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data)
>       config.num_pages = cpu_to_le32(dev->num_pages);
>       config.actual = cpu_to_le32(dev->actual);
>
> +    trace_virtio_balloon_get_config(config.num_pages, config.actual);
>       memcpy(config_data,&config, sizeof(struct virtio_balloon_config));
>   }
>
> @@ -296,6 +300,7 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,
>                           ((ram_addr_t) dev->actual<<  VIRTIO_BALLOON_PFN_SHIFT),
>                           &error_abort);
>       }
> +    trace_virtio_balloon_set_config(dev->actual, oldactual);
>   }
>
>   static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
> @@ -323,6 +328,7 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
>           dev->num_pages = (ram_size - target)>>  VIRTIO_BALLOON_PFN_SHIFT;
>           virtio_notify_config(vdev);
>       }
> +    trace_virtio_balloon_to_target(target, dev->num_pages);
>   }
>
>   static void virtio_balloon_save(QEMUFile *f, void *opaque)
> diff --git a/trace-events b/trace-events
> index fb58963..fedd7e7 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -143,6 +143,10 @@ cpu_out(unsigned int addr, unsigned int val) "addr %#x value %u"
>   # balloon.c
>   # Since requests are raised via monitor, not many tracepoints are needed.
>   balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
> +virtio_balloon_handle_output(const char *name, uint64_t gpa) "setion name: %s gpa: %"PRIx64""
> +virtio_balloon_get_config(uint32_t num_pages, uint32_t acutal) "num_pages: %d acutal: %d"
> +virtio_balloon_set_config(uint32_t acutal, uint32_t oldacutal) "acutal: %d oldacutal: %d"
> +virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d"
>
>   # hw/intc/apic_common.c
>   cpu_set_apic_base(uint64_t val) "%016"PRIx64

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-17  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12  7:06 [Qemu-devel] [PATCH] virtio-balloon: Add some trace events zhanghailiang
2014-09-17  0:44 ` zhanghailiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.