Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343560
b: refs/heads/master
c: c219346
h: refs/heads/master
v: v3
  • Loading branch information
Xiao Guangrong authored and Gleb Natapov committed Dec 6, 2012
1 parent e587a09 commit bb6c690
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66f7b72e117180d0007e7a65b8dc5bd1c8126e3b
refs/heads/master: c21934632549910188fb5cf40e79033f27a0741b
16 changes: 12 additions & 4 deletions trunk/arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,12 +2382,20 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
|| (!vcpu->arch.mmu.direct_map && write_fault
&& !is_write_protection(vcpu) && !user_fault)) {

/*
* There are two cases:
* - the one is other vcpu creates new sp in the window
* between mapping_level() and acquiring mmu-lock.
* - the another case is the new sp is created by itself
* (page-fault path) when guest uses the target gfn as
* its page table.
* Both of these cases can be fixed by allowing guest to
* retry the access, it will refault, then we can establish
* the mapping by using small page.
*/
if (level > PT_PAGE_TABLE_LEVEL &&
has_wrprotected_page(vcpu->kvm, gfn, level)) {
ret = 1;
drop_spte(vcpu->kvm, sptep);
has_wrprotected_page(vcpu->kvm, gfn, level))
goto done;
}

spte |= PT_WRITABLE_MASK | SPTE_MMU_WRITEABLE;

Expand Down

0 comments on commit bb6c690

Please sign in to comment.