KVM: MMU: don't write-protect if have new mapping to unsync page
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Sat, 15 May 2010 10:52:34 +0000 (18:52 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:35:50 +0000 (10:35 +0300)
commite02aa901b1aa41fb541521800cc2a4774c162485
treec2b19ce292c996b25166a9a123ae848f7dfcd8e4
parent1d9dc7e000915b9607b480e34fcb4238b789fbb1
KVM: MMU: don't write-protect if have new mapping to unsync page

Two cases maybe happen in kvm_mmu_get_page() function:

- one case is, the goal sp is already in cache, if the sp is unsync,
  we only need update it to assure this mapping is valid, but not
  mark it sync and not write-protect sp->gfn since it not broke unsync
  rule(one shadow page for a gfn)

- another case is, the goal sp not existed, we need create a new sp
  for gfn, i.e, gfn (may)has another shadow page, to keep unsync rule,
  we should sync(mark sync and write-protect) gfn's unsync shadow page.
  After enabling multiple unsync shadows, we sync those shadow pages
  only when the new sp not allow to become unsync(also for the unsyc
  rule, the new rule is: allow all pte page become unsync)

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c