lkml.org 
[lkml]   [2010]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 09/12] Retry fault before vmentry
On Tue, Jul 06, 2010 at 07:24:57PM +0300, Gleb Natapov wrote:
> When page is swapped in it is mapped into guest memory only after guest
> tries to access it again and generate another fault. To save this fault
> we can map it immediately since we know that guest is going to access
> the page.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
> arch/x86/include/asm/kvm_host.h | 7 ++++++-
> arch/x86/kvm/mmu.c | 27 ++++++++++++++++++++-------
> arch/x86/kvm/paging_tmpl.h | 37 +++++++++++++++++++++++++++++++++----
> arch/x86/kvm/x86.c | 9 +++++++++
> virt/kvm/kvm_main.c | 2 ++
> 5 files changed, 70 insertions(+), 12 deletions(-)
>

> +static int FNAME(page_fault_other_cr3)(struct kvm_vcpu *vcpu, gpa_t cr3,
> + gva_t addr, u32 error_code)
> +{
> + int r = 0;
> + gpa_t curr_cr3 = vcpu->arch.cr3;
> +
> + if (curr_cr3 != cr3) {
> + /*
> + * We do page fault on behalf of a process that is sleeping
> + * because of async PF. PV guest takes reference to mm that cr3
> + * belongs too, so it has to be valid here.
> + */
> + kvm_set_cr3(vcpu, cr3);
> + if (kvm_mmu_reload(vcpu))
> + goto switch_cr3;
> + }
> +
> + r = FNAME(page_fault)(vcpu, addr, error_code, true);

KVM_REQ_MMU_SYNC request generated here must be processed before
switching to a different cr3 (otherwise vcpu_enter_guest will process it
with the wrong cr3 in place).



\
 
 \ /
  Last update: 2010-07-08 18:55    [W:0.123 / U:12.552 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site