1
0
Fork 0
alistair23-linux/arch/x86/kvm
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
..
Kconfig KVM: Depend on HIGH_RES_TIMERS 2012-09-10 11:10:03 +03:00
Makefile KVM: Remove internal timer abstraction 2012-08-01 00:21:06 -03:00
cpuid.c KVM: x86: minor size optimization 2012-09-05 12:41:09 +03:00
cpuid.h KVM: VMX: Implement PCID/INVPCID for guests with EPT 2012-07-12 13:07:34 +03:00
emulate.c KVM: emulator: optimize "rep ins" handling 2012-09-06 18:07:38 +03:00
i8254.c KVM: fold kvm_pit_timer into kvm_kpit_state 2012-08-01 00:21:07 -03:00
i8254.h KVM: fold kvm_pit_timer into kvm_kpit_state 2012-08-01 00:21:07 -03:00
i8259.c KVM: cleanup pic reset 2012-09-04 14:53:51 +03:00
irq.c KVM: fix typo in copyright notice 2010-10-24 10:53:14 +02:00
irq.h KVM: switch to symbolic name for irq_states size 2012-07-20 16:12:16 -03:00
kvm_cache_regs.h KVM: MMU: Do not unconditionally read PDPTE from guest memory 2011-09-25 19:18:01 +03:00
lapic.c KVM: x86: lapic: Clean up find_highest_vector() and count_vectors() 2012-09-12 13:38:23 -03:00
lapic.h KVM: correctly detect APIC SW state in kvm_apic_post_state_restore() 2012-08-09 12:44:46 +03:00
mmu.c KVM: MMU: Optimize pte permission checks 2012-09-20 13:00:08 +03:00
mmu.h KVM: MMU: Optimize pte permission checks 2012-09-20 13:00:08 +03:00
mmu_audit.c KVM: do not release the error pfn 2012-08-06 16:04:57 +03:00
mmutrace.h KVM: MMU: fix kvm_mmu_pagetable_walk tracepoint 2012-07-11 16:51:22 +03:00
paging_tmpl.h KVM: MMU: Optimize pte permission checks 2012-09-20 13:00:08 +03:00
pmu.c Merge branch 'queue' into next 2012-07-26 11:54:21 +03:00
svm.c KVM: SVM: Make use of asm.h 2012-09-17 10:38:05 -03:00
trace.h KVM updates for the 3.6 merge window 2012-07-24 12:01:20 -07:00
tss.h KVM: x86: hardware task switching support 2008-04-27 12:00:39 +03:00
vmx.c KVM: VMX: Make use of asm.h 2012-09-17 10:38:04 -03:00
x86.c KVM: MMU: Optimize pte permission checks 2012-09-20 13:00:08 +03:00
x86.h KVM: use jump label to optimize checking for in kernel local apic presence 2012-08-06 19:00:44 +03:00