[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 00/18] IOMMU: superpage support when not sharing pagetables

  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 24 Sep 2021 11:39:39 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sAh4qxCYW2BkeZSUGmjdagQLfFE+wJDwsdXfXjxI/CY=; b=ciw3/yDfpd8ZR31w9h0em2oW1DTy5GzO4pgW6YLrohKmio2D2bQODcUvutnv7SJPHXy/T9U/Ix3rizn4ufwbPpTC7ESTZrivsgNUvZYYiPUGDWL/XwmDhLIlyHW1QgD8WiEId0C/mV42SXnuWTXkOWXPZa3DVV+rLsCxw3JMq0G0viXMOPPdIzM/kIJyCtZz3O8wO6i8PDu4yBjhYYtGUeXG+5BKeVJZtRb8c7ly5JxaqizZxt8UBsEKbZPsRKGH70RMf5nOo4Ydwh/L0pt/p25oGQ7dnrjACMh/3VBJS0w5Sk6msBh2lixj96UuYr+VVCo861apbeZeQw7HW4JKUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nVK3FASUw85h6qK8WZk/uv0Y9e8+D4ac3zipZ28Gjj13aPWlhKWTxvIIOkwJSntuU4YDbWD8jJuWgMjrfH5OlvCzhlG3FKFS/un3Zf/SyXssNp3cDbQKXvCO54CIr9w8EfnE8VSfiNVJviGCyR+OIhqJdo41BihWKK0KXud/2c6qEGebIb6VsOYNblz5hH/4yKpptZEVZCcX94eF8j5TCK8P2ZrhM9pqBKkAiNWCvdR8Ws4hJV74xI4kl8rRrjOvXHRkAZwEF/CZyvuabSF8k1dFLoP9R7nUHkVhb529UtseKgND5T3NmM3oSBG6ao8vN6nMS9JZGLtlwXkm6zQdxg==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Fri, 24 Sep 2021 09:39:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

For a long time we've been rather inefficient with IOMMU page table
management when not sharing page tables, i.e. in particular for PV (and
further specifically also for PV Dom0) and AMD (where nowadays we never
share page tables). While up to about 2.5 years ago AMD code had logic
to un-shatter page mappings, that logic was ripped out for being buggy
(XSA-275 plus follow-on).

This series enables use of large pages in AMD and Intel (VT-d) code;
Arm is presently not in need of any enabling as pagetables are always
shared there. It also augments PV Dom0 creation with suitable explicit
IOMMU mapping calls to facilitate use of large pages there without
getting into the business of un-shattering page mappings just yet.
Depending on the amount of memory handed to Dom0 this improves booting
time (latency until Dom0 actually starts) quite a bit; subsequent
shattering of some of the large pages may of course consume some of the
saved time.

Known fallout has been spelled out here:

I'm inclined to say "of course" there are also a few seemingly unrelated
changes included here, which I just came to consider necessary or at
least desirable (in part for having been in need of adjustment for a
long time) along the way. Some of these changes are likely independent
of the bulk of the work here, and hence may be fine to go in ahead of
earlier patches.

While, as said above, un-shattering of mappings isn't an immediate goal,
teh last few patches now at least arrange for freeing page tables which
have ended up all empty. This also introduces the underlying support to
then un-shatter large pages (potentially re-usable elsewhere as well),
but that's not part of this v2 of the series.

01: AMD/IOMMU: have callers specify the target level for page table walks
02: VT-d: have callers specify the target level for page table walks
03: IOMMU: have vendor code announce supported page sizes
04: IOMMU: add order parameter to ->{,un}map_page() hooks
05: IOMMU: have iommu_{,un}map() split requests into largest possible chunks
06: IOMMU/x86: restrict IO-APIC mappings for PV Dom0
07: IOMMU/x86: perform PV Dom0 mappings in batches
08: IOMMU/x86: support freeing of pagetables
09: AMD/IOMMU: drop stray TLB flush
10: AMD/IOMMU: walk trees upon page fault
11: AMD/IOMMU: return old PTE from {set,clear}_iommu_pte_present()
12: AMD/IOMMU: allow use of superpage mappings
13: VT-d: allow use of superpage mappings
14: IOMMU: fold flush-all hook into "flush one"
15: IOMMU/x86: prefill newly allocate page tables
16: x86: introduce helper for recording degree of contiguity in page tables
17: AMD/IOMMU: free all-empty page tables
18: VT-d: free all-empty page tables

While not directly related (except that making this mode work properly
here was a fair part of the overall work), at this occasion I'd also
like to renew my proposal to make "iommu=dom0-strict" the default going
forward. It already is not only the default, but the only possible mode
for PVH Dom0.




Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.