Skip to content

Commit

Permalink
vhost: add traces for memory listeners
Browse files Browse the repository at this point in the history
Trace these operations on two memory listeners.  It helps to verify the
new memory listener fix, and good to keep them there.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180122060244.29368-2-peterx@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
xzpeter authored and bonzini committed Feb 7, 2018
1 parent d83414e commit 0750b06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/virtio/trace-events
Expand Up @@ -25,3 +25,9 @@ virtio_balloon_handle_output(const char *name, uint64_t gpa) "section name: %s g
virtio_balloon_get_config(uint32_t num_pages, uint32_t actual) "num_pages: %d actual: %d"
virtio_balloon_set_config(uint32_t actual, uint32_t oldactual) "actual: %d oldactual: %d"
virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: 0x%"PRIx64" num_pages: %d"

# hw/virtio/vhost.c
vhost_region_add(void *p, const char *mr) "dev %p mr %s"
vhost_region_del(void *p, const char *mr) "dev %p mr %s"
vhost_iommu_region_add(void *p, const char *mr) "dev %p mr %s"
vhost_iommu_region_del(void *p, const char *mr) "dev %p mr %s"
7 changes: 7 additions & 0 deletions hw/virtio/vhost.c
Expand Up @@ -27,6 +27,7 @@
#include "hw/virtio/virtio-access.h"
#include "migration/blocker.h"
#include "sysemu/dma.h"
#include "trace.h"

/* enabled until disconnected backend stabilizes */
#define _VHOST_DEBUG 1
Expand Down Expand Up @@ -687,6 +688,7 @@ static void vhost_region_add(MemoryListener *listener,
return;
}

trace_vhost_region_add(dev, section->mr->name ?: NULL);
++dev->n_mem_sections;
dev->mem_sections = g_renew(MemoryRegionSection, dev->mem_sections,
dev->n_mem_sections);
Expand All @@ -706,6 +708,7 @@ static void vhost_region_del(MemoryListener *listener,
return;
}

trace_vhost_region_del(dev, section->mr->name ?: NULL);
vhost_set_memory(listener, section, false);
memory_region_unref(section->mr);
for (i = 0; i < dev->n_mem_sections; ++i) {
Expand Down Expand Up @@ -743,6 +746,8 @@ static void vhost_iommu_region_add(MemoryListener *listener,
return;
}

trace_vhost_iommu_region_add(dev, section->mr->name ?: NULL);

iommu = g_malloc0(sizeof(*iommu));
end = int128_add(int128_make64(section->offset_within_region),
section->size);
Expand Down Expand Up @@ -771,6 +776,8 @@ static void vhost_iommu_region_del(MemoryListener *listener,
return;
}

trace_vhost_iommu_region_del(dev, section->mr->name ?: NULL);

QLIST_FOREACH(iommu, &dev->iommu_list, iommu_next) {
if (iommu->mr == section->mr &&
iommu->n.start == section->offset_within_region) {
Expand Down

0 comments on commit 0750b06

Please sign in to comment.