]> xenbits.xensource.com Git - people/jgross/xen.git/commit
x86/hvm: set 'ipat' in EPT for special pages
authorPaul Durrant <pdurrant@amazon.com>
Fri, 31 Jul 2020 15:42:47 +0000 (17:42 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 31 Jul 2020 15:42:47 +0000 (17:42 +0200)
commitca24b2ffdbd9a25b2d313a547ccbe97baf3e5a8d
tree5408c4d570e1e7b7b027e22ebd5c37cf8b3f3683
parentb6a907f8c83d37886d0523f1aeff61b98e133498
x86/hvm: set 'ipat' in EPT for special pages

All non-MMIO ranges (i.e those not mapping real device MMIO regions) that
map valid MFNs are normally marked MTRR_TYPE_WRBACK and 'ipat' is set. Hence
when PV drivers running in a guest populate the BAR space of the Xen Platform
PCI Device with pages such as the Shared Info page or Grant Table pages,
accesses to these pages will be cachable.

However, should IOMMU mappings be enabled be enabled for the guest then these
accesses become uncachable. This has a substantial negative effect on I/O
throughput of PV devices. Arguably PV drivers should bot be using BAR space to
host the Shared Info and Grant Table pages but it is currently commonplace for
them to do this and so this problem needs mitigation. Hence this patch makes
sure the 'ipat' bit is set for any special page regardless of where in GFN
space it is mapped.

NOTE: Clearly this mitigation only applies to Intel EPT. It is not obvious
      that there is any similar mitigation possible for AMD NPT. Downstreams
      such as Citrix XenServer have been carrying a patch similar to this for
      several releases though.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/mtrr.c