Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/908469/?format=api
{ "id": 908469, "url": "http://patchwork.ozlabs.org/api/patches/908469/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20180504030811.28111-10-peterx@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20180504030811.28111-10-peterx@redhat.com>", "list_archive_url": null, "date": "2018-05-04T03:08:10", "name": "[v2,09/10] intel-iommu: don't unmap all for shadow page table", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "943624bb1f6a8bb01951a3a14a3261aa700af0f3", "submitter": { "id": 67717, "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api", "name": "Peter Xu", "email": "peterx@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20180504030811.28111-10-peterx@redhat.com/mbox/", "series": [ { "id": 42502, "url": "http://patchwork.ozlabs.org/api/series/42502/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=42502", "date": "2018-05-04T03:08:01", "name": "intel-iommu: nested vIOMMU, cleanups, bug fixes", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/42502/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/908469/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/908469/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 40ccb007K9z9s3D\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 4 May 2018 13:15:24 +1000 (AEST)", "from localhost ([::1]:60195 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1fERBp-0006cl-Jk\n\tfor incoming@patchwork.ozlabs.org; Thu, 03 May 2018 23:15:21 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:33441)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1fER5x-000244-Rf\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:09:21 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1fER5w-0005uH-Q6\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:09:17 -0400", "from mx3-rdu2.redhat.com ([66.187.233.73]:45960\n\thelo=mx1.redhat.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <peterx@redhat.com>) id 1fER5w-0005t5-ME\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:09:16 -0400", "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 6B784EFDFA;\n\tFri, 4 May 2018 03:09:16 +0000 (UTC)", "from xz-mi.redhat.com (ovpn-12-46.pek2.redhat.com [10.72.12.46])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 8957211166E0;\n\tFri, 4 May 2018 03:09:12 +0000 (UTC)" ], "From": "Peter Xu <peterx@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 4 May 2018 11:08:10 +0800", "Message-Id": "<20180504030811.28111-10-peterx@redhat.com>", "In-Reply-To": "<20180504030811.28111-1-peterx@redhat.com>", "References": "<20180504030811.28111-1-peterx@redhat.com>", "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.3", "X-Greylist": [ "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.1]);\n\tFri, 04 May 2018 03:09:16 +0000 (UTC)", "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.1]); \n\tFri, 04 May 2018 03:09:16 +0000 (UTC) for IP:'10.11.54.3'\n\tDOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:''" ], "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "66.187.233.73", "Subject": "[Qemu-devel] [PATCH v2 09/10] intel-iommu: don't unmap all for\n\tshadow page table", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Tian Kevin <kevin.tian@intel.com>, \"Michael S . Tsirkin\" <mst@redhat.com>,\n\tJason Wang <jasowang@redhat.com>, peterx@redhat.com,\n\tAlex Williamson <alex.williamson@redhat.com>,\n\tJintack Lim <jintack@cs.columbia.edu>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "IOMMU replay was carried out before in many use cases, e.g., context\ncache invalidations, domain flushes. We used this mechanism to sync the\nshadow page table by firstly (1) unmap the whole address space, then\n(2) walk the page table to remap what's in the table.\n\nThis is very dangerous.\n\nThe problem is that we'll have a very small window (in my measurement,\nit can be about 3ms) during above step (1) and (2) that the device will\nsee no (or incomplete) device page table. Howerver the device never\nknows that. This can cause DMA error of devices, who assumes the page\ntable is always there.\n\nSo the point is that, for MAP typed notifiers (vfio-pci, for example)\nthey'll need the mapped page entries always be there. We can never\nunmap any existing page entries like what we did in (1) above.\n\nThe only solution is to remove step (1). We can't do that before since\nwe didn't know what device page was mapped and what was not, so we unmap\nthem all. Now with the new IOVA tree QEMU knows what has mapped and\nwhat has not. We don't need this step (1) any more. Remove it.\n\nNote that after removing that global unmap flushing, we'll need to\nnotify unmap now during page walkings.\n\nThis should fix the DMA error problem that Jintack Lim reported with\nnested device assignment. This problem won't not happen always, e.g., I\ncannot reproduce the error. However after collecting logs it shows that\nthis is the possible cause to Jintack's problem.\n\nReported-by: Jintack Lim <jintack@cs.columbia.edu>\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n hw/i386/intel_iommu.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)", "diff": "diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c\nindex 16b3514afb..9439103cac 100644\n--- a/hw/i386/intel_iommu.c\n+++ b/hw/i386/intel_iommu.c\n@@ -3003,10 +3003,8 @@ static void vtd_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)\n \n /*\n * The replay can be triggered by either a invalidation or a newly\n- * created entry. No matter what, we release existing mappings\n- * (it means flushing caches for UNMAP-only registers).\n+ * created entry.\n */\n- vtd_address_space_unmap(vtd_as, n);\n \n if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) {\n trace_vtd_replay_ce_valid(bus_n, PCI_SLOT(vtd_as->devfn),\n@@ -3015,8 +3013,10 @@ static void vtd_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)\n ce.hi, ce.lo);\n if (vtd_as_notify_mappings(vtd_as)) {\n /* This is required only for MAP typed notifiers */\n- vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)n, false,\n+ vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)n, true,\n vtd_as);\n+ } else {\n+ vtd_address_space_unmap(vtd_as, n);\n }\n } else {\n trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn),\n", "prefixes": [ "v2", "09/10" ] }