{"id":1152984,"url":"http://patchwork.ozlabs.org/api/patches/1152984/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20190826061705.92048-4-aik@ozlabs.ru/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/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":"<20190826061705.92048-4-aik@ozlabs.ru>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20190826061705.92048-4-aik@ozlabs.ru/","date":"2019-08-26T06:17:04","name":"[kernel,v2,3/4] vfio/spapr_tce: Invalidate multiple TCEs at once","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"91056b941e6639bf23c1f35d788d6e099cd7b6db","submitter":{"id":7621,"url":"http://patchwork.ozlabs.org/api/people/7621/?format=json","name":"Alexey Kardashevskiy","email":"aik@ozlabs.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20190826061705.92048-4-aik@ozlabs.ru/mbox/","series":[{"id":127248,"url":"http://patchwork.ozlabs.org/api/series/127248/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=127248","date":"2019-08-26T06:17:02","name":"powerpc/powernv/kvm: Invalidate multiple TCEs at once","version":2,"mbox":"http://patchwork.ozlabs.org/series/127248/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1152984/comments/","check":"fail","checks":"http://patchwork.ozlabs.org/api/patches/1152984/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 [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 46H2846ctmz9sMr\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 26 Aug 2019 16:26:12 +1000 (AEST)","from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 46H28403LKzDqbY\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 26 Aug 2019 16:26:12 +1000 (AEST)","from ozlabs.ru (ozlabs.ru [107.173.13.209])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 46H1yV50ChzDqb1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 26 Aug 2019 16:17:54 +1000 (AEST)","from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id 7A381AE80597;\n\tMon, 26 Aug 2019 02:17:01 -0400 (EDT)"],"Authentication-Results":["ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=ozlabs.ru","lists.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>)","lists.ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=ozlabs.ru"],"From":"Alexey Kardashevskiy <aik@ozlabs.ru>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH kernel v2 3/4] vfio/spapr_tce: Invalidate multiple TCEs at\n\tonce","Date":"Mon, 26 Aug 2019 16:17:04 +1000","Message-Id":"<20190826061705.92048-4-aik@ozlabs.ru>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20190826061705.92048-1-aik@ozlabs.ru>","References":"<20190826061705.92048-1-aik@ozlabs.ru>","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","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":"kvm@vger.kernel.org, Alexey Kardashevskiy <aik@ozlabs.ru>,\n\tkvm-ppc@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com>,\n\tAlistair Popple <alistair@popple.id.au>,\n\tDavid 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":"Invalidating a TCE cache entry for each updated TCE is quite expensive.\nThis makes use of the new iommu_table_ops::xchg_no_kill()/tce_kill()\ncallbacks to bring down the time spent in mapping a huge guest DMA window.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\n drivers/vfio/vfio_iommu_spapr_tce.c | 18 ++++++++++++------\n 1 file changed, 12 insertions(+), 6 deletions(-)","diff":"diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c\nindex babef8b00daf..3b18fa4d090a 100644\n--- a/drivers/vfio/vfio_iommu_spapr_tce.c\n+++ b/drivers/vfio/vfio_iommu_spapr_tce.c\n@@ -435,7 +435,7 @@ static int tce_iommu_clear(struct tce_container *container,\n \tunsigned long oldhpa;\n \tlong ret;\n \tenum dma_data_direction direction;\n-\tunsigned long lastentry = entry + pages;\n+\tunsigned long lastentry = entry + pages, firstentry = entry;\n \n \tfor ( ; entry < lastentry; ++entry) {\n \t\tif (tbl->it_indirect_levels && tbl->it_userspace) {\n@@ -460,7 +460,7 @@ static int tce_iommu_clear(struct tce_container *container,\n \n \t\tdirection = DMA_NONE;\n \t\toldhpa = 0;\n-\t\tret = iommu_tce_xchg(container->mm, tbl, entry, &oldhpa,\n+\t\tret = iommu_tce_xchg_no_kill(container->mm, tbl, entry, &oldhpa,\n \t\t\t\t&direction);\n \t\tif (ret)\n \t\t\tcontinue;\n@@ -476,6 +476,8 @@ static int tce_iommu_clear(struct tce_container *container,\n \t\ttce_iommu_unuse_page(container, oldhpa);\n \t}\n \n+\tiommu_tce_kill(tbl, firstentry, pages);\n+\n \treturn 0;\n }\n \n@@ -518,8 +520,8 @@ static long tce_iommu_build(struct tce_container *container,\n \n \t\thpa |= offset;\n \t\tdirtmp = direction;\n-\t\tret = iommu_tce_xchg(container->mm, tbl, entry + i, &hpa,\n-\t\t\t\t&dirtmp);\n+\t\tret = iommu_tce_xchg_no_kill(container->mm, tbl, entry + i,\n+\t\t\t\t&hpa, &dirtmp);\n \t\tif (ret) {\n \t\t\ttce_iommu_unuse_page(container, hpa);\n \t\t\tpr_err(\"iommu_tce: %s failed ioba=%lx, tce=%lx, ret=%ld\\n\",\n@@ -536,6 +538,8 @@ static long tce_iommu_build(struct tce_container *container,\n \n \tif (ret)\n \t\ttce_iommu_clear(container, tbl, entry, i);\n+\telse\n+\t\tiommu_tce_kill(tbl, entry, pages);\n \n \treturn ret;\n }\n@@ -572,8 +576,8 @@ static long tce_iommu_build_v2(struct tce_container *container,\n \t\tif (mm_iommu_mapped_inc(mem))\n \t\t\tbreak;\n \n-\t\tret = iommu_tce_xchg(container->mm, tbl, entry + i, &hpa,\n-\t\t\t\t&dirtmp);\n+\t\tret = iommu_tce_xchg_no_kill(container->mm, tbl, entry + i,\n+\t\t\t\t&hpa, &dirtmp);\n \t\tif (ret) {\n \t\t\t/* dirtmp cannot be DMA_NONE here */\n \t\t\ttce_iommu_unuse_page_v2(container, tbl, entry + i);\n@@ -593,6 +597,8 @@ static long tce_iommu_build_v2(struct tce_container *container,\n \n \tif (ret)\n \t\ttce_iommu_clear(container, tbl, entry, i);\n+\telse\n+\t\tiommu_tce_kill(tbl, entry, pages);\n \n \treturn ret;\n }\n","prefixes":["kernel","v2","3/4"]}