From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Alex Williamson <alex.williamson@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: [PATCH kernel] vfio/spapr: Add trace points for map/unmap
Date: Fri, 27 Oct 2017 14:00:08 +1100 [thread overview]
Message-ID: <20171027030008.17200-1-aik@ozlabs.ru> (raw)
This adds trace_map/trace_unmap tracepoints to spapr driver. Type1 already
uses these via the IOMMU API (iommu_map/__iommu_unmap).
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Example:
qemu-system-ppc-8655 [096] 724.662740: unmap: IOMMU: iova=0x000000003ffff000 size=4096 unmapped_size=4096
qemu-system-ppc-8656 [104] 724.970912: map: IOMMU: iova=0x0800000000000000 paddr=0x00007ffef7ff0000 size=65536
---
drivers/vfio/vfio_iommu_spapr_tce.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 63112c36ab2d..4531486c77c6 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -22,6 +22,7 @@
#include <linux/vmalloc.h>
#include <linux/sched/mm.h>
#include <linux/sched/signal.h>
+#include <trace/events/iommu.h>
#include <asm/iommu.h>
#include <asm/tce.h>
@@ -502,17 +503,19 @@ static int tce_iommu_clear(struct tce_container *container,
struct iommu_table *tbl,
unsigned long entry, unsigned long pages)
{
- unsigned long oldhpa;
+ unsigned long oldhpa, unmapped, firstentry = entry, totalpages = pages;
long ret;
enum dma_data_direction direction;
- for ( ; pages; --pages, ++entry) {
+ for (unmapped = 0; pages; --pages, ++entry) {
direction = DMA_NONE;
oldhpa = 0;
ret = iommu_tce_xchg(tbl, entry, &oldhpa, &direction);
if (ret)
continue;
+ ++unmapped;
+
if (direction == DMA_NONE)
continue;
@@ -523,6 +526,9 @@ static int tce_iommu_clear(struct tce_container *container,
tce_iommu_unuse_page(container, oldhpa);
}
+ trace_unmap(firstentry << tbl->it_page_shift,
+ totalpages << tbl->it_page_shift,
+ unmapped << tbl->it_page_shift);
return 0;
}
@@ -965,6 +971,8 @@ static long tce_iommu_ioctl(void *iommu_data,
direction);
iommu_flush_tce(tbl);
+ if (!ret)
+ trace_map(param.iova, param.vaddr, param.size);
return ret;
}
--
2.11.0
next reply other threads:[~2017-10-27 3:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 3:00 Alexey Kardashevskiy [this message]
2017-11-13 23:47 ` [PATCH kernel] vfio/spapr: Add trace points for map/unmap Alexey Kardashevskiy
2017-11-17 0:13 ` Alex Williamson
2017-11-17 6:58 ` Alexey Kardashevskiy
2017-11-23 4:13 ` Alexey Kardashevskiy
2017-11-29 16:32 ` Alex Williamson
2017-11-29 16:43 ` Robin Murphy
2017-11-29 16:44 ` Shuah Khan
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=20171027030008.17200-1-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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).