lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100708161711.GB13855@amt.cnet>
Date:	Thu, 8 Jul 2010 13:17:11 -0300
From:	Marcelo Tosatti <mtosatti@...hat.com>
To:	Gleb Natapov <gleb@...hat.com>
Cc:	kvm@...r.kernel.org, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, avi@...hat.com, mingo@...e.hu,
	a.p.zijlstra@...llo.nl, tglx@...utronix.de, hpa@...or.com,
	riel@...hat.com, cl@...ux-foundation.org
Subject: Re: [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@...hat.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).

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ