]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: MMU: Push clean gpte write protection out of gpte_access()
authorAvi Kivity <avi@redhat.com>
Wed, 12 Sep 2012 10:44:53 +0000 (13:44 +0300)
committerAvi Kivity <avi@redhat.com>
Thu, 20 Sep 2012 10:00:07 +0000 (13:00 +0300)
commit8f2666bbcdc8e2420f2671bbe9963679092b9a41
treed9fd33bd07ac8c497ba5fc94528da5b28626edef
parent27cce6b7b4edc32cc740ff950e437e18b25f65dd
KVM: MMU: Push clean gpte write protection out of gpte_access()

gpte_access() computes the access permissions of a guest pte and also
write-protects clean gptes.  This is wrong when we are servicing a
write fault (since we'll be setting the dirty bit momentarily) but
correct when instantiating a speculative spte, or when servicing a
read fault (since we'll want to trap a following write in order to
set the dirty bit).

It doesn't seem to hurt in practice, but in order to make the code
readable, push the write protection out of gpte_access() and into
a new protect_clean_gpte() which is called explicitly when needed.

Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/mmu.h
arch/x86/kvm/paging_tmpl.h