{"id":831033,"url":"http://patchwork.ozlabs.org/api/1.2/patches/831033/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20171027030008.17200-1-aik@ozlabs.ru/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.2/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20171027030008.17200-1-aik@ozlabs.ru>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20171027030008.17200-1-aik@ozlabs.ru/","date":"2017-10-27T03:00:08","name":"[kernel] vfio/spapr: Add trace points for map/unmap","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"b0d950e6bfb032938424354cf0b258d9a5b03caf","submitter":{"id":7621,"url":"http://patchwork.ozlabs.org/api/1.2/people/7621/?format=json","name":"Alexey Kardashevskiy","email":"aik@ozlabs.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20171027030008.17200-1-aik@ozlabs.ru/mbox/","series":[{"id":10479,"url":"http://patchwork.ozlabs.org/api/1.2/series/10479/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=10479","date":"2017-10-27T03:00:08","name":"[kernel] vfio/spapr: Add trace points for map/unmap","version":1,"mbox":"http://patchwork.ozlabs.org/series/10479/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/831033/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/831033/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNTDW6XWCz9t2x\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 27 Oct 2017 14:01:47 +1100 (AEDT)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3yNTDW5m5DzDrc2\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 27 Oct 2017 14:01:47 +1100 (AEDT)","from ozlabs.ru (ozlabs.ru [107.173.13.209])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3yNTCK0bSBzDrbl\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 27 Oct 2017 14:00:44 +1100 (AEDT)","from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id 611FB3A60125;\n\tThu, 26 Oct 2017 22:59:05 -0400 (EDT)"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=ozlabs.ru\n\t(client-ip=107.173.13.209; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru;\n\treceiver=<UNKNOWN>)","From":"Alexey Kardashevskiy <aik@ozlabs.ru>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH kernel] vfio/spapr: Add trace points for map/unmap","Date":"Fri, 27 Oct 2017 14:00:08 +1100","Message-Id":"<20171027030008.17200-1-aik@ozlabs.ru>","X-Mailer":"git-send-email 2.11.0","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Alexey Kardashevskiy <aik@ozlabs.ru>,\n\tAlex Williamson <alex.williamson@redhat.com>, kvm@vger.kernel.org,\n\tkvm-ppc@vger.kernel.org, David Gibson <david@gibson.dropbear.id.au>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"This adds trace_map/trace_unmap tracepoints to spapr driver. Type1 already\nuses these via the IOMMU API (iommu_map/__iommu_unmap).\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\n\nExample:\n qemu-system-ppc-8655  [096]   724.662740: unmap:                IOMMU: iova=0x000000003ffff000 size=4096 unmapped_size=4096\n qemu-system-ppc-8656  [104]   724.970912: map:                  IOMMU: iova=0x0800000000000000 paddr=0x00007ffef7ff0000 size=65536\n---\n drivers/vfio/vfio_iommu_spapr_tce.c | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c\nindex 63112c36ab2d..4531486c77c6 100644\n--- a/drivers/vfio/vfio_iommu_spapr_tce.c\n+++ b/drivers/vfio/vfio_iommu_spapr_tce.c\n@@ -22,6 +22,7 @@\n #include <linux/vmalloc.h>\n #include <linux/sched/mm.h>\n #include <linux/sched/signal.h>\n+#include <trace/events/iommu.h>\n \n #include <asm/iommu.h>\n #include <asm/tce.h>\n@@ -502,17 +503,19 @@ static int tce_iommu_clear(struct tce_container *container,\n \t\tstruct iommu_table *tbl,\n \t\tunsigned long entry, unsigned long pages)\n {\n-\tunsigned long oldhpa;\n+\tunsigned long oldhpa, unmapped, firstentry = entry, totalpages = pages;\n \tlong ret;\n \tenum dma_data_direction direction;\n \n-\tfor ( ; pages; --pages, ++entry) {\n+\tfor (unmapped = 0; pages; --pages, ++entry) {\n \t\tdirection = DMA_NONE;\n \t\toldhpa = 0;\n \t\tret = iommu_tce_xchg(tbl, entry, &oldhpa, &direction);\n \t\tif (ret)\n \t\t\tcontinue;\n \n+\t\t++unmapped;\n+\n \t\tif (direction == DMA_NONE)\n \t\t\tcontinue;\n \n@@ -523,6 +526,9 @@ static int tce_iommu_clear(struct tce_container *container,\n \n \t\ttce_iommu_unuse_page(container, oldhpa);\n \t}\n+\ttrace_unmap(firstentry << tbl->it_page_shift,\n+\t\t\ttotalpages << tbl->it_page_shift,\n+\t\t\tunmapped << tbl->it_page_shift);\n \n \treturn 0;\n }\n@@ -965,6 +971,8 @@ static long tce_iommu_ioctl(void *iommu_data,\n \t\t\t\t\tdirection);\n \n \t\tiommu_flush_tce(tbl);\n+\t\tif (!ret)\n+\t\t\ttrace_map(param.iova, param.vaddr, param.size);\n \n \t\treturn ret;\n \t}\n","prefixes":["kernel"]}