* KVM: MMU: handle large host sptes on invlpg/resync
@ 2008-12-22 20:49 Marcelo Tosatti
2008-12-22 22:29 ` Bernhard Held
2008-12-23 10:16 ` Avi Kivity
0 siblings, 2 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2008-12-22 20:49 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Bernhard Held
The invlpg and sync walkers lack knowledge of large host sptes,
descending to non-existant pagetable level.
Stop at directory level in such case.
Fixes SMP Windows XP with hugepages.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 9871d9d..3b86df6 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1006,7 +1006,7 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
for_each_unsync_children(sp->unsync_child_bitmap, i) {
u64 ent = sp->spt[i];
- if (is_shadow_present_pte(ent)) {
+ if (is_shadow_present_pte(ent) && !is_large_pte(ent)) {
struct kvm_mmu_page *child;
child = page_header(ent & PT64_BASE_ADDR_MASK);
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index d206401..9fd78b6 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -472,14 +472,19 @@ static int FNAME(shadow_invlpg_entry)(struct kvm_shadow_walk *_sw,
struct shadow_walker *sw =
container_of(_sw, struct shadow_walker, walker);
- if (level == PT_PAGE_TABLE_LEVEL) {
+ /* FIXME: properly handle invlpg on large guest pages */
+ if (level == PT_PAGE_TABLE_LEVEL ||
+ ((level == PT_DIRECTORY_LEVEL) && is_large_pte(*sptep))) {
struct kvm_mmu_page *sp = page_header(__pa(sptep));
sw->pte_gpa = (sp->gfn << PAGE_SHIFT);
sw->pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
- if (is_shadow_present_pte(*sptep))
+ if (is_shadow_present_pte(*sptep)) {
rmap_remove(vcpu->kvm, sptep);
+ if (is_large_pte(*sptep))
+ --vcpu->kvm->stat.lpages;
+ }
set_shadow_pte(sptep, shadow_trap_nonpresent_pte);
return 1;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: KVM: MMU: handle large host sptes on invlpg/resync
2008-12-22 20:49 KVM: MMU: handle large host sptes on invlpg/resync Marcelo Tosatti
@ 2008-12-22 22:29 ` Bernhard Held
2008-12-23 10:16 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Bernhard Held @ 2008-12-22 22:29 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Avi Kivity, kvm-devel
> The invlpg and sync walkers lack knowledge of large host sptes,
> descending to non-existant pagetable level.
>
> Stop at directory level in such case.
>
> Fixes SMP Windows XP with hugepages.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
I happily confirm that with Marcelo's patch applied on kvm-81 my WXP
guest is working again with hugepages and SMP.
Thanks for the quick fix!
Bernhard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: KVM: MMU: handle large host sptes on invlpg/resync
2008-12-22 20:49 KVM: MMU: handle large host sptes on invlpg/resync Marcelo Tosatti
2008-12-22 22:29 ` Bernhard Held
@ 2008-12-23 10:16 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2008-12-23 10:16 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kvm-devel, Bernhard Held
Marcelo Tosatti wrote:
> The invlpg and sync walkers lack knowledge of large host sptes,
> descending to non-existant pagetable level.
>
> Stop at directory level in such case.
>
> Fixes SMP Windows XP with hugepages.
>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-23 10:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-22 20:49 KVM: MMU: handle large host sptes on invlpg/resync Marcelo Tosatti
2008-12-22 22:29 ` Bernhard Held
2008-12-23 10:16 ` Avi Kivity
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.