linux/drivers
Daniel Jordan 4d83de6da2 vfio/type1: Batch page pinning
Pinning one 4K page at a time is inefficient, so do it in batches of 512
instead.  This is just an optimization with no functional change
intended, and in particular the driver still calls iommu_map() with the
largest physically contiguous range possible.

Add two fields in vfio_batch to remember where to start between calls to
vfio_pin_pages_remote(), and use vfio_batch_unpin() to handle remaining
pages in the batch in case of error.

qemu pins pages for guests around 8% faster on my test system, a
two-node Broadwell server with 128G memory per node.  The qemu process
was bound to one node with its allocations constrained there as well.

                             base               test
          guest              ----------------   ----------------
       mem (GB)   speedup    avg sec    (std)   avg sec    (std)
              1      7.4%       0.61   (0.00)      0.56   (0.00)
              2      8.3%       0.93   (0.00)      0.85   (0.00)
              4      8.4%       1.46   (0.00)      1.34   (0.00)
              8      8.6%       2.54   (0.01)      2.32   (0.00)
             16      8.3%       4.66   (0.00)      4.27   (0.01)
             32      8.3%       8.94   (0.01)      8.20   (0.01)
             64      8.2%      17.47   (0.01)     16.04   (0.03)
            120      8.5%      32.45   (0.13)     29.69   (0.01)

perf diff confirms less time spent in pup.  Here are the top ten
functions:

             Baseline  Delta Abs  Symbol

               78.63%     +6.64%  clear_page_erms
                1.50%     -1.50%  __gup_longterm_locked
                1.27%     -0.78%  __get_user_pages
                          +0.76%  kvm_zap_rmapp.constprop.0
                0.54%     -0.53%  vmacache_find
                0.55%     -0.51%  get_pfnblock_flags_mask
                0.48%     -0.48%  __get_user_pages_remote
                          +0.39%  slot_rmap_walk_next
                          +0.32%  vfio_pin_map_dma
                          +0.26%  kvm_handle_hva_range
                ...

Suggested-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2021-02-22 16:30:47 -07:00
..
accessibility
acpi ACPI updates for 5.12-rc1 2021-02-20 21:50:59 -08:00
amba
android
ata
atm atm: idt77252: fix build broken on amd64 2021-02-15 12:36:27 -08:00
auxdisplay
base - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
bcma
block xen: branch for v5.12-rc1 2021-02-21 13:06:08 -08:00
bluetooth TTY/Serial driver changes for 5.12-rc1 2021-02-20 21:28:04 -08:00
bus ARM: SoC drivers for v5.12 2021-02-20 18:42:28 -08:00
cdrom
char - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
clk Power management updates for 5.12-rc1 2021-02-20 21:42:18 -08:00
clocksource hyperv-next for 5.12 2021-02-21 13:24:39 -08:00
connector
counter
cpufreq Merge branch 'pm-opp' into pm 2021-02-15 17:01:46 +01:00
cpuidle
crypto x86: 2021-02-21 13:31:43 -08:00
dax
dca
devfreq Merge branches 'pm-devfreq' and 'pm-tools' 2021-02-15 17:02:04 +01:00
dio
dma dmaengine dw: Revert "dmaengine: dw: Enable runtime PM" 2021-02-08 17:36:12 +05:30
dma-buf
edac Merge branch 'edac-misc' into edac-updates-for-v5.12 2021-02-15 10:06:58 +01:00
eisa
extcon
firewire
firmware arm64 updates for 5.12 2021-02-21 13:08:42 -08:00
fpga
fsi
gnss
gpio gpio: ep93xx: Fix single irqchip with multi gpiochips 2021-02-10 14:47:27 +01:00
gpu x86: 2021-02-21 13:31:43 -08:00
greybus
hid Staging/IIO driver patches for 5.12-rc1 2021-02-20 21:36:51 -08:00
hsi
hv Revert "Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer" 2021-02-15 10:49:11 +00:00
hwmon
hwspinlock
hwtracing
i2c SoC platform removal 2021-02-20 18:16:30 -08:00
i3c
ide
idle
iio
infiniband
input TTY/Serial driver changes for 5.12-rc1 2021-02-20 21:28:04 -08:00
interconnect
iommu hyperv-next for 5.12 2021-02-21 13:24:39 -08:00
ipack
irqchip irqchip updates for Linux 5.12: 2021-02-15 15:41:56 +01:00
isdn
leds TTY/Serial driver changes for 5.12-rc1 2021-02-20 21:28:04 -08:00
lightnvm lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid() 2021-02-14 21:27:24 -07:00
macintosh
mailbox
mcb
md for-5.12/drivers-2021-02-17 2021-02-21 11:06:54 -08:00
media
memory Memory controller drivers for v5.12, part two 2021-02-11 13:48:49 +01:00
memstick
message
mfd
misc
mmc for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
most
mtd SoC platform removal 2021-02-20 18:16:30 -08:00
mux
net hyperv-next for 5.12 2021-02-21 13:24:39 -08:00
nfc nfc: st-nci: Remove unnecessary variable 2021-02-08 14:56:20 -08:00
ntb
nubus
nvdimm for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
nvme for-5.12/drivers-2021-02-17 2021-02-21 11:06:54 -08:00
nvmem
of
opp
parisc
parport
pci hyperv-next for 5.12 2021-02-21 13:24:39 -08:00
pcmcia
perf drivers/perf: Replace spin_lock_irqsave to spin_lock 2021-02-10 18:50:42 +00:00
phy
pinctrl
platform ACPI updates for 5.12-rc1 2021-02-20 21:50:59 -08:00
pnp
power
powercap powercap: intel_rapl: Use topology interface in rapl_init_domains() 2021-02-12 16:53:01 +01:00
pps
ps3
ptp ptp: ptp_clockmatrix: clean-up - parenthesis around a == b are unnecessary 2021-02-17 13:49:26 -08:00
pwm
rapidio
ras
regulator
remoteproc
reset ARM: SoC drivers for v5.12 2021-02-20 18:42:28 -08:00
rpmsg
rtc
s390 These are the v5.12 updates for the locking subsystem: 2021-02-21 12:12:01 -08:00
sbus
scsi for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
sfi
sh
siox
slimbus
soc ARM: SoC drivers for v5.12 2021-02-20 18:42:28 -08:00
soundwire
spi ACPI updates for 5.12-rc1 2021-02-20 21:50:59 -08:00
spmi
ssb
staging Staging/IIO driver patches for 5.12-rc1 2021-02-20 21:36:51 -08:00
target for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
tc
tee Simplify i2c acess in OP-TEE driver 2021-02-09 16:10:49 +01:00
thermal Scheduler updates for v5.12: 2021-02-21 12:35:04 -08:00
thunderbolt thunderbolt: Changes for v5.12 merge window 2021-02-09 13:00:07 +01:00
tty TTY/Serial driver changes for 5.12-rc1 2021-02-20 21:28:04 -08:00
uio
usb usb: misc: usb3503: Fix logic in usb3503_init() 2021-02-11 13:52:04 +01:00
vdpa vdpa/mlx5: Restore the hardware used index after change map 2021-02-05 10:28:04 -05:00
vfio vfio/type1: Batch page pinning 2021-02-22 16:30:47 -07:00
vhost
video
virt
virtio
visorbus
vlynq
vme
w1
watchdog
xen xen: branch for v5.12-rc1 2021-02-21 13:06:08 -08:00
zorro
Kconfig
Makefile