From: Tim Deegan Subject: Re: [xen-unstable test] 11574: tolerable FAIL Date: Tue, 24 Jan 2012 16:48:15 +0000 Message-ID: <20120124164815.GA14906@ocelot.phlegethon.org> References: <20254.39351.854362.661374@mariner.uk.xensource.com> <20254.54700.872146.773765@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="2oS5YaxWCcQjTEyO" Return-path: Content-Disposition: inline In-Reply-To: <20254.54700.872146.773765@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" , Adin Scannell , Keir Fraser , Andres Lagar-Cavilla List-Id: xen-devel@lists.xenproject.org --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Hi, At 16:00 +0000 on 24 Jan (1327420844), Ian Jackson wrote: > Ian Jackson writes ("Re: [xen-unstable test] 11574: tolerable FAIL"): > > This is a host-specific, but deterministic, failure. > > Improve handling of nested page faults > > Add checks for access type. Be less reliant on implicit semantics. > > Signed-off-by: Andres Lagar-Cavilla > Acked-by: Tim Deegan > Committed-by: Tim Deegan Hmm, Didn't have to pull on that thread too hard to find it's not tied to anything. The access_* arguments to hvm_hap_nested_page_fault() aren't plumbed in on AMD: ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul, 0, 0, 0, 0); so gating behaviour on them is not going to work so well. Sorry about that - I should definitely have caught this. (But Andres, did you test this, or any of your mm work, on AMD?) The attached patch ought to fix it. Smoke-tested but I won't have good enough access to my test machines to check Windows installs before Thursday. Cheers, Tim. --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=npt-access-bits # HG changeset patch # User Tim Deegan SVM: Plumb NPT error-code bits into nested-fault access_X arguments. Signed-off-by: Tim Deegan diff -r 4cd3560aec0b -r 5f77c1f5aac6 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Tue Jan 24 15:36:19 2012 +0000 +++ b/xen/arch/x86/hvm/hvm.c Tue Jan 24 16:40:35 2012 +0000 @@ -1185,7 +1185,6 @@ void hvm_inject_exception(unsigned int t int hvm_hap_nested_page_fault(unsigned long gpa, bool_t gla_valid, unsigned long gla, - bool_t access_valid, bool_t access_r, bool_t access_w, bool_t access_x) @@ -1234,7 +1233,7 @@ int hvm_hap_nested_page_fault(unsigned l mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL); /* Check access permissions first, then handle faults */ - if ( access_valid && (mfn_x(mfn) != INVALID_MFN) ) + if ( mfn_x(mfn) != INVALID_MFN ) { int violation = 0; /* If the access is against the permissions, then send to mem_event */ diff -r 4cd3560aec0b -r 5f77c1f5aac6 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Tue Jan 24 15:36:19 2012 +0000 +++ b/xen/arch/x86/hvm/svm/svm.c Tue Jan 24 16:40:35 2012 +0000 @@ -1143,7 +1143,7 @@ struct hvm_function_table * __init start } static void svm_do_nested_pgfault(struct vcpu *v, - struct cpu_user_regs *regs, paddr_t gpa) + struct cpu_user_regs *regs, uint32_t npfec, paddr_t gpa) { int ret; unsigned long gfn = gpa >> PAGE_SHIFT; @@ -1152,7 +1152,10 @@ static void svm_do_nested_pgfault(struct p2m_access_t p2ma; struct p2m_domain *p2m = NULL; - ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul, 0, 0, 0, 0); + ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul, + 1, /* All NPFs count as reads */ + npfec & PFEC_write_access, + npfec & PFEC_insn_fetch); if ( tb_init_done ) { @@ -1181,7 +1184,7 @@ static void svm_do_nested_pgfault(struct case -1: ASSERT(nestedhvm_enabled(v->domain) && nestedhvm_vcpu_in_guestmode(v)); /* inject #VMEXIT(NPF) into guest. */ - nestedsvm_vmexit_defer(v, VMEXIT_NPF, regs->error_code, gpa); + nestedsvm_vmexit_defer(v, VMEXIT_NPF, npfec, gpa); return; } @@ -2198,10 +2201,9 @@ void svm_vmexit_handler(struct cpu_user_ case VMEXIT_NPF: perfc_incra(svmexits, VMEXIT_NPF_PERFC); - regs->error_code = vmcb->exitinfo1; if ( cpu_has_svm_decode ) v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf; - svm_do_nested_pgfault(v, regs, vmcb->exitinfo2); + svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2); v->arch.hvm_svm.cached_insn_len = 0; break; diff -r 4cd3560aec0b -r 5f77c1f5aac6 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue Jan 24 15:36:19 2012 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Jan 24 16:40:35 2012 +0000 @@ -2106,7 +2106,6 @@ static void ept_handle_violation(unsigne qualification & EPT_GLA_VALID ? 1 : 0, qualification & EPT_GLA_VALID ? __vmread(GUEST_LINEAR_ADDRESS) : ~0ull, - 1, /* access types are as follows */ qualification & EPT_READ_VIOLATION ? 1 : 0, qualification & EPT_WRITE_VIOLATION ? 1 : 0, qualification & EPT_EXEC_VIOLATION ? 1 : 0) ) diff -r 4cd3560aec0b -r 5f77c1f5aac6 xen/include/asm-x86/hvm/hvm.h --- a/xen/include/asm-x86/hvm/hvm.h Tue Jan 24 15:36:19 2012 +0000 +++ b/xen/include/asm-x86/hvm/hvm.h Tue Jan 24 16:40:35 2012 +0000 @@ -409,7 +409,6 @@ int hvm_debug_op(struct vcpu *v, int32_t int hvm_hap_nested_page_fault(unsigned long gpa, bool_t gla_valid, unsigned long gla, - bool_t access_valid, bool_t access_r, bool_t access_w, bool_t access_x); --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --2oS5YaxWCcQjTEyO--