From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [patch 3/3] KVM: MMU: prepopulate the shadow on invlpg
Date: Sun, 26 Oct 2008 13:48:22 +0200 [thread overview]
Message-ID: <49045906.7070305@redhat.com> (raw)
In-Reply-To: <20081025223243.946600413@localhost.localdomain>
Marcelo Tosatti wrote:
> If the guest executes invlpg on a non present entry, peek into th
> pagetable and attempt to prepopulate the shadow entry.
>
> Also stop dirty fault updates from interfering with the fork dete
>
> For RHEL3 and 32-bit Vista guests the success rate is high. With Win2003
> there is a 1:2 success/fail ratio, but even then compilation benchmarks
> are slightly faster. 2000 and XP rarely execute invlpg on non present
> entries.
>
> 2% improvement on RHEL3/AIM7.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> Index: kvm/arch/x86/kvm/mmu.c
> ===================================================================
> --- kvm.orig/arch/x86/kvm/mmu.c
> +++ kvm/arch/x86/kvm/mmu.c
> @@ -2365,7 +2365,8 @@ static void kvm_mmu_access_page(struct k
> }
>
> void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
> - const u8 *new, int bytes)
> + const u8 *new, int bytes,
> + bool speculative)
>
kvm_mmu_pte_write()s are always speculative. Maybe this is misnamed?
Perhaps 'guest_initiated' (with the opposite meaning).
> @@ -222,7 +223,7 @@ walk:
> if (ret)
> goto walk;
> pte |= PT_DIRTY_MASK;
> - kvm_mmu_pte_write(vcpu, pte_gpa, (u8 *)&pte, sizeof(pte));
> + kvm_mmu_pte_write(vcpu, pte_gpa, (u8 *)&pte, sizeof(pte), 1);
>
This is definitely not a speculative write. But it is !guest_initiated.
> @@ -467,10 +468,18 @@ static int FNAME(shadow_invlpg_entry)(st
> struct kvm_vcpu *vcpu, u64 addr,
> u64 *sptep, int level)
> {
> + struct shadow_walker *sw =
> + container_of(_sw, struct shadow_walker, walker);
>
> if (level == PT_PAGE_TABLE_LEVEL) {
> - if (is_shadow_present_pte(*sptep))
> + struct kvm_mmu_page *sp = page_header(__pa(sptep));
>
blank line after declarations. Or move to head of function.
> + sw->pte_gpa = (sp->gfn << PAGE_SHIFT);
> + sw->pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
> +
> + if (is_shadow_present_pte(*sptep)) {
> rmap_remove(vcpu->kvm, sptep);
> + sw->pte_gpa = -1;
>
Why? The pte could have heen replaced (for example, a write access to a
cow page).
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-10-26 11:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-25 22:31 [patch 0/3] oos shadow optimizations Marcelo Tosatti
2008-10-25 22:31 ` [patch 1/3] KVM: MMU: collapse remote TLB flushes on root sync Marcelo Tosatti
2008-10-26 11:17 ` Avi Kivity
2008-10-29 23:26 ` Marcelo Tosatti
2008-10-30 10:04 ` Avi Kivity
2008-10-31 19:30 ` Marcelo Tosatti
2008-10-25 22:31 ` [patch 2/3] KVM: MMU: skip global pgtables on sync due to cr3 switch Marcelo Tosatti
2008-10-26 11:27 ` Avi Kivity
2008-10-31 19:36 ` Marcelo Tosatti
2008-10-31 19:43 ` Avi Kivity
2008-10-31 19:50 ` Marcelo Tosatti
2008-10-31 19:59 ` Avi Kivity
2008-10-25 22:31 ` [patch 3/3] KVM: MMU: prepopulate the shadow on invlpg Marcelo Tosatti
2008-10-26 11:48 ` Avi Kivity [this message]
2008-10-31 19:47 ` Marcelo Tosatti
2008-10-31 19:58 ` Avi Kivity
2008-10-31 22:33 ` Marcelo Tosatti
2008-11-02 8:39 ` Avi Kivity
2008-11-02 16:08 ` Marcelo Tosatti
2008-11-02 16:14 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49045906.7070305@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).