]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: MMU: Fix false flooding when a pte points to page table
authorAvi Kivity <avi@qumranet.com>
Thu, 15 May 2008 10:51:35 +0000 (13:51 +0300)
committerAvi Kivity <avi@qumranet.com>
Sun, 20 Jul 2008 09:40:50 +0000 (12:40 +0300)
commit431824aa09c085ab7c976192f8cf0ab480918193
tree7f8d9679404f0b46803c6b1cf926235d170606ee
parent9c77fa51bb36de6a509736c6245f17b25a6e232c
KVM: MMU: Fix false flooding when a pte points to page table

The KVM MMU tries to detect when a speculative pte update is not actually
used by demand fault, by checking the accessed bit of the shadow pte.  If
the shadow pte has not been accessed, we deem that page table flooded and
remove the shadow page table, allowing further pte updates to proceed
without emulation.

However, if the pte itself points at a page table and only used for write
operations, the accessed bit will never be set since all access will happen
through the emulator.

This is exactly what happens with kscand on old (2.4.x) HIGHMEM kernels.
The kernel points a kmap_atomic() pte at a page table, and then
proceeds with read-modify-write operations to look at the dirty and accessed
bits.  We get a false flood trigger on the kmap ptes, which results in the
mmu spending all its time setting up and tearing down shadows.

Fix by setting the shadow accessed bit on emulated accesses.

Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/mmu.h
include/asm-x86/kvm_host.h