1
0
Fork 0
alistair23-linux/arch
Avi Kivity 97d64b7881 KVM: MMU: Optimize pte permission checks
walk_addr_generic() permission checks are a maze of branchy code, which is
performed four times per lookup.  It depends on the type of access, efer.nxe,
cr0.wp, cr4.smep, and in the near future, cr4.smap.

Optimize this away by precalculating all variants and storing them in a
bitmap.  The bitmap is recalculated when rarely-changing variables change
(cr0, cr4) and is indexed by the often-changing variables (page fault error
code, pte access permissions).

The permission check is moved to the end of the loop, otherwise an SMEP
fault could be reported as a false positive, when PDE.U=1 but PTE.U=0.
Noted by Xiao Guangrong.

The result is short, branch-free code.

Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-09-20 13:00:08 +03:00
..
alpha alpha: Fix fall-out from disintegrating asm/system.h 2012-08-19 08:41:19 -07:00
arm arm-soc fixes for v3.6-rc3 2012-08-25 17:33:33 -07:00
avr32 ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION 2012-07-30 17:25:21 -07:00
blackfin Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2012-08-03 10:52:41 -07:00
c6x Enable atomic64 ops in C6X 2012-08-17 08:10:12 -07:00
cris ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION 2012-07-30 17:25:21 -07:00
frv Merge branch 'akpm' (Andrew's patch-bomb) 2012-07-30 17:25:34 -07:00
h8300 ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION 2012-07-30 17:25:21 -07:00
hexagon Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2012-07-30 11:24:53 -07:00
ia64 KVM: split kvm_arch_flush_shadow 2012-09-06 16:37:25 +03:00
m32r ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION 2012-07-30 17:25:21 -07:00
m68k m68k: select CONFIG_GENERIC_ATOMIC64 for all m68k CPU types 2012-08-17 10:04:24 +10:00
microblaze Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2012-08-03 10:52:41 -07:00
mips MIPS: pci-ar724x: avoid data bus error due to a missing PCIe module 2012-08-23 15:44:47 +02:00
mn10300 Merge branch 'akpm' (Andrew's patch-bomb) 2012-07-30 17:25:34 -07:00
openrisc Remove useless wrappers of asm-generic/rmap.h 2012-06-28 11:29:26 +02:00
parisc PCI changes for the 3.6 merge window: 2012-07-24 16:17:07 -07:00
powerpc KVM: split kvm_arch_flush_shadow 2012-09-06 16:37:25 +03:00
s390 KVM: split kvm_arch_flush_shadow 2012-09-06 16:37:25 +03:00
score new helper: signal_delivered() 2012-06-01 12:58:52 -04:00
sh Merge branches 'sh/urgent' and 'sh/gpiolib' into sh-latest 2012-08-09 13:21:13 +09:00
sparc sparc64: Be less verbose during vmemmap population. 2012-08-15 00:37:29 -07:00
tile memcg: rename config variables 2012-07-31 18:42:43 -07:00
um Merge branch 'for-linus-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml 2012-08-01 16:45:02 -07:00
unicore32 PCI changes for the 3.6 merge window: 2012-07-24 16:17:07 -07:00
x86 KVM: MMU: Optimize pte permission checks 2012-09-20 13:00:08 +03:00
xtensa xtensa: select generic atomic64_t support 2012-07-31 18:42:39 -07:00
.gitignore
Kconfig ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION 2012-07-30 17:25:21 -07:00