From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>, kvm@vger.kernel.org
Subject: Re: cr3 OOS optimisation breaks 32-bit GNU/kFreeBSD guest
Date: Tue, 24 Mar 2009 11:47:33 +0200 [thread overview]
Message-ID: <49C8AC35.3030803@redhat.com> (raw)
In-Reply-To: <20090323172725.GA28775@amt.cnet>
Marcelo Tosatti wrote:
>> Maybe it's best to resync when relinking a global page?
>>
>
> How about this. It will shorten the unsync period of global pages,
> unfortunately.
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 2a36f7f..bccdcc7 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -1238,6 +1238,10 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
> set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests);
> kvm_mmu_mark_parents_unsync(vcpu, sp);
> }
> + if (role.level != PT_PAGE_TABLE_LEVEL &&
> + !list_empty(&vcpu->kvm->arch.oos_global_pages))
> + set_bit(KVM_REQ_MMU_GLOBAL_SYNC, &vcpu->requests);
> +
> pgprintk("%s: found\n", __func__);
> return sp;
> }
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 2ea8262..48169d7 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3109,6 +3109,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> kvm_write_guest_time(vcpu);
> if (test_and_clear_bit(KVM_REQ_MMU_SYNC, &vcpu->requests))
> kvm_mmu_sync_roots(vcpu);
> + if (test_and_clear_bit(KVM_REQ_MMU_GLOBAL_SYNC, &vcpu->requests))
> + kvm_mmu_sync_global(vcpu);
> if (test_and_clear_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests))
> kvm_x86_ops->tlb_flush(vcpu);
> if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS
Windows will (I think) write a PDE on every context switch, so this
effectively disables global unsync for that guest.
What about recursively syncing the newly linked page in FNAME(fetch)()?
If the page isn't global, this becomes a no-op, so no new overhead. The
only question is the expense when linking a populated top-level page,
especially in long mode.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
next prev parent reply other threads:[~2009-03-24 9:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-23 0:33 cr3 OOS optimisation breaks 32-bit GNU/kFreeBSD guest Aurelien Jarno
2009-02-23 1:47 ` Marcelo Tosatti
2009-02-23 14:01 ` Aurelien Jarno
2009-02-23 14:52 ` Marcelo Tosatti
2009-02-23 14:59 ` Avi Kivity
2009-02-23 15:06 ` Marcelo Tosatti
2009-02-23 15:16 ` Avi Kivity
2009-03-20 23:14 ` Marcelo Tosatti
2009-03-21 8:51 ` Aurelien Jarno
2009-03-22 9:35 ` Avi Kivity
2009-03-23 17:27 ` Marcelo Tosatti
2009-03-24 9:47 ` Avi Kivity [this message]
2009-03-24 11:49 ` Marcelo Tosatti
2009-04-03 21:45 ` Marcelo Tosatti
2009-04-04 10:37 ` Avi Kivity
2009-04-04 17:01 ` Marcelo Tosatti
2009-04-05 8:41 ` Avi Kivity
2009-04-05 11:29 ` Marcelo Tosatti
2009-04-05 11:41 ` Avi Kivity
2009-04-04 23:23 ` Aurelien Jarno
2009-03-24 10:39 ` Aurelien Jarno
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=49C8AC35.3030803@redhat.com \
--to=avi@redhat.com \
--cc=aurelien@aurel32.net \
--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 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.