Skip to content

Commit 7c15ef6

Browse files
committed
CP-308875: set Xen PCI MMIO BAR to WB
The default for the Xen PCI MMIO BAR is UnCachable. Setting this to WriteBack in the MTRR shows a massive performance improvement on AMD, at least for Linux guests. On Intel this is already set to WriteBack by Xen via another mechanism. To be effective this also requires the corresponding [Xen commit](https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=22650d6054625be10172fe0c78b9cadd1a39bd63), old versions will just ignore this xenstore key. The optimization is not enabled by default in Xen due to the wide range of guests it supports, but XAPI supports a much narrower set of guest OSes. Setting the cache attribute to WB is done by setting UC=false. Signed-off-by: Edwin Török <[email protected]>
1 parent 8378a9d commit 7c15ef6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ocaml/xenopsd/lib/xenopsd.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ let default_vbd_backend_kind = ref "vbd"
4949

5050
let ca_140252_workaround = ref false
5151

52-
let xen_platform_pci_bar_uc = ref true
52+
(* Optimize performance: set MTRR WB attribute on Xen PCI MMIO BAR.
53+
This is useful for AMD, and mostly a noop on Intel (which achieves a similar
54+
affect using Intel-only features in Xen)
55+
56+
Turning on WB is done by disabling UC:
57+
UnCached=false -> WriteBack=true
58+
*)
59+
let xen_platform_pci_bar_uc = ref false
5360

5461
let action_after_qemu_crash = ref None
5562

ocaml/xenopsd/xenopsd.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,6 @@ disable-logging-for=http tracing tracing_export
113113
# by grant tables is mapped as Uncached (UC, the default) or WriteBack
114114
# (WB, the workaround). WB mapping could improve performance of devices
115115
# using grant tables. This is useful on AMD platform only.
116-
# xen-platform-pci-bar-uc=true
116+
# On Intel a similar effect is already achieved with iPAT in Xen,
117+
# but setting this to 0 works on Intel too.
118+
# xen-platform-pci-bar-uc=false

0 commit comments

Comments
 (0)