x86/pv: Optimise prefetching in svm_load_segs()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Sep 2020 17:53:25 +0000 (18:53 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Sep 2020 12:46:13 +0000 (13:46 +0100)
commitfca8d65d94939e05f7eff147358e58ffeb424e6e
tree2b449ca5b8c2c0e442b67a9ca2ba881dcd97c16e
parentecc9553a12cb14537c851bca43a9f55f23eb6bf0
x86/pv: Optimise prefetching in svm_load_segs()

Split into two functions.  Passing a load of zeros in results in unnecessary
caller setup code.

Update the prefetching comment to note that the main point is the TLB fill.

Reorder the writes in svm_load_segs() to access the VMCB fields in ascending
order, which gets better next-line prefetch behaviour out of hardware.  Update
the prefetch instruction to match.

The net delta is:

  add/remove: 1/0 grow/shrink: 0/2 up/down: 38/-39 (-1)
  Function                                     old     new   delta
  svm_load_segs_prefetch                         -      38     +38
  __context_switch                             967     951     -16
  svm_load_segs                                291     268     -23

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/hvm/svm/svm.c
xen/include/asm-x86/hvm/svm/svm.h