Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202345
b: refs/heads/master
c: 1047df1
h: refs/heads/master
i:
  202343: a00dda6
v: v3
  • Loading branch information
Xiao Guangrong authored and Avi Kivity committed Aug 1, 2010
1 parent 372e19f commit 480585e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 45 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: 7a8f1a74e4193d21e55b35928197486f2c047efb
refs/heads/master: 1047df1fb682a41eb9885d6b3f2d04d6c8fd3756
61 changes: 17 additions & 44 deletions trunk/arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ struct kvm_shadow_walk_iterator {
shadow_walk_okay(&(_walker)); \
shadow_walk_next(&(_walker)))

typedef int (*mmu_parent_walk_fn) (struct kvm_mmu_page *sp);
typedef void (*mmu_parent_walk_fn) (struct kvm_mmu_page *sp, u64 *spte);

static struct kmem_cache *pte_chain_cache;
static struct kmem_cache *rmap_desc_cache;
Expand Down Expand Up @@ -1024,7 +1024,6 @@ static void mmu_page_remove_parent_pte(struct kvm_mmu_page *sp,
BUG();
}


static void mmu_parent_walk(struct kvm_mmu_page *sp, mmu_parent_walk_fn fn)
{
struct kvm_pte_chain *pte_chain;
Expand All @@ -1034,63 +1033,37 @@ static void mmu_parent_walk(struct kvm_mmu_page *sp, mmu_parent_walk_fn fn)

if (!sp->multimapped && sp->parent_pte) {
parent_sp = page_header(__pa(sp->parent_pte));
fn(parent_sp);
mmu_parent_walk(parent_sp, fn);
fn(parent_sp, sp->parent_pte);
return;
}

hlist_for_each_entry(pte_chain, node, &sp->parent_ptes, link)
for (i = 0; i < NR_PTE_CHAIN_ENTRIES; ++i) {
if (!pte_chain->parent_ptes[i])
u64 *spte = pte_chain->parent_ptes[i];

if (!spte)
break;
parent_sp = page_header(__pa(pte_chain->parent_ptes[i]));
fn(parent_sp);
mmu_parent_walk(parent_sp, fn);
parent_sp = page_header(__pa(spte));
fn(parent_sp, spte);
}
}

static void kvm_mmu_update_unsync_bitmap(u64 *spte)
static void mark_unsync(struct kvm_mmu_page *sp, u64 *spte);
static void kvm_mmu_mark_parents_unsync(struct kvm_mmu_page *sp)
{
unsigned int index;
struct kvm_mmu_page *sp = page_header(__pa(spte));

index = spte - sp->spt;
if (!__test_and_set_bit(index, sp->unsync_child_bitmap))
sp->unsync_children++;
WARN_ON(!sp->unsync_children);
mmu_parent_walk(sp, mark_unsync);
}

static void kvm_mmu_update_parents_unsync(struct kvm_mmu_page *sp)
static void mark_unsync(struct kvm_mmu_page *sp, u64 *spte)
{
struct kvm_pte_chain *pte_chain;
struct hlist_node *node;
int i;
unsigned int index;

if (!sp->parent_pte)
index = spte - sp->spt;
if (__test_and_set_bit(index, sp->unsync_child_bitmap))
return;

if (!sp->multimapped) {
kvm_mmu_update_unsync_bitmap(sp->parent_pte);
if (sp->unsync_children++)
return;
}

hlist_for_each_entry(pte_chain, node, &sp->parent_ptes, link)
for (i = 0; i < NR_PTE_CHAIN_ENTRIES; ++i) {
if (!pte_chain->parent_ptes[i])
break;
kvm_mmu_update_unsync_bitmap(pte_chain->parent_ptes[i]);
}
}

static int unsync_walk_fn(struct kvm_mmu_page *sp)
{
kvm_mmu_update_parents_unsync(sp);
return 1;
}

static void kvm_mmu_mark_parents_unsync(struct kvm_mmu_page *sp)
{
mmu_parent_walk(sp, unsync_walk_fn);
kvm_mmu_update_parents_unsync(sp);
kvm_mmu_mark_parents_unsync(sp);
}

static void nonpaging_prefetch_page(struct kvm_vcpu *vcpu,
Expand Down

0 comments on commit 480585e

Please sign in to comment.