From: Tim Deegan Subject: Re: [PATCH 20 of 20] n2 MSR handling and capability exposure Date: Tue, 26 Jul 2011 15:21:41 +0100 Message-ID: <20110726142141.GL8970@whitby.uk.xensource.com> References: <1A42CE6F5F474C41B63392A5F80372B212DAC025EB@shsmsx501.ccr.corp.intel.com> <4E26E23D.4030000@grosc.com> <20110725140843.GC8970@whitby.uk.xensource.com> <20110725161657.GF8970@whitby.uk.xensource.com> <4E2E6992.9030407@grosc.com> <20110726100018.GH8970@whitby.uk.xensource.com> <20110726101140.GI8970@whitby.uk.xensource.com> <4E2E9B05.7030206@grosc.com> <20110726114233.GJ8970@whitby.uk.xensource.com> <4E2EC245.2030905@grosc.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+nBD6E3TurpgldQp" Return-path: Content-Disposition: inline In-Reply-To: <4E2EC245.2030905@grosc.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: Jeroen Groenewegen van der Weyden Cc: "Christoph.Egger@amd.com" , "xen-devel@lists.xensource.com" , "Dong, Eddie" List-Id: xen-devel@lists.xenproject.org --+nBD6E3TurpgldQp Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline At 15:33 +0200 on 26 Jul (1311694437), Jeroen Groenewegen van der Weyden wrote: > Tim, This improved a lot. the domu does not become in-responsive > anymore. However, all four l2 guest are started. but 2 out of 4 are > hanging/in-responsive after 30 to 60 seconds. > > L1 domu (sles11sp1) > -> seems to be ok > > L2-1 propetary OS, seems to be ok > L2-2 propetary OS, seems to be ok > l2-3 sles10sp3, hanging/in-responsive > l2-4 sles10sp3, hanging/in-responsive > > no degug/error messages in dmesg. Anything in the l1 dmesg? I'm trying to repro with actual linux guests but I've found that PXELINUX is hanging for me. :( I'll have a look at that later if I can. In the meantime I realised I didn't quite get the logic right in the first patch; there's one case missing. Can you please try this one? Tim. -- Tim Deegan Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) --+nBD6E3TurpgldQp Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: attachment; filename="vmclear" diff -r 9dbbf1631193 xen/arch/x86/hvm/vmx/vvmx.c --- a/xen/arch/x86/hvm/vmx/vvmx.c Mon Jul 25 14:21:13 2011 +0100 +++ b/xen/arch/x86/hvm/vmx/vvmx.c Tue Jul 26 15:19:30 2011 +0100 @@ -1070,11 +1070,17 @@ int nvmx_handle_vmresume(struct cpu_user int launched; struct vcpu *v = current; + if ( vcpu_nestedhvm(v).nv_vvmcxaddr == VMCX_EADDR ) + { + vmreturn (regs, VMFAIL_INVALID); + return X86EMUL_OKAY; + } + launched = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, NVMX_LAUNCH_STATE); if ( !launched ) { vmreturn (regs, VMFAIL_VALID); - return X86EMUL_EXCEPTION; + return X86EMUL_OKAY; } return nvmx_vmresume(v,regs); } @@ -1085,11 +1091,17 @@ int nvmx_handle_vmlaunch(struct cpu_user int rc; struct vcpu *v = current; + if ( vcpu_nestedhvm(v).nv_vvmcxaddr == VMCX_EADDR ) + { + vmreturn (regs, VMFAIL_INVALID); + return X86EMUL_OKAY; + } + launched = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, NVMX_LAUNCH_STATE); if ( launched ) { vmreturn (regs, VMFAIL_VALID); - rc = X86EMUL_EXCEPTION; + return X86EMUL_OKAY; } else { rc = nvmx_vmresume(v,regs); @@ -1162,6 +1174,7 @@ int nvmx_handle_vmclear(struct cpu_user_ struct vmx_inst_decoded decode; struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v); unsigned long gpa = 0; + void *vvmcs; int rc; rc = decode_vmx_inst(regs, &decode, &gpa, 0); @@ -1171,24 +1184,28 @@ int nvmx_handle_vmclear(struct cpu_user_ if ( gpa & 0xfff ) { vmreturn(regs, VMFAIL_INVALID); - goto out; + return X86EMUL_OKAY; + } + + if ( gpa == nvcpu->nv_vvmcxaddr ) + { + __set_vvmcs(nvcpu->nv_vvmcx, NVMX_LAUNCH_STATE, 0); + nvmx_purge_vvmcs(v); + } + else + { + /* Even if this VMCS isn't the current one, we must clear it. */ + vvmcs = hvm_map_guest_frame_rw(gpa >> PAGE_SHIFT); + if ( vvmcs ) + __set_vvmcs(vvmcs, NVMX_LAUNCH_STATE, 0); + hvm_unmap_guest_frame(vvmcs); + + if ( nvcpu->nv_vvmcxaddr != VMCX_EADDR ) + gdprintk(XENLOG_WARNING, "vmclear gpa %lx != %"PRIpaddr"\n", + gpa, nvcpu->nv_vvmcxaddr); } - if ( gpa != nvcpu->nv_vvmcxaddr && nvcpu->nv_vvmcxaddr != VMCX_EADDR ) - { - gdprintk(XENLOG_WARNING, - "vmclear gpa %lx not the same as current vmcs %"PRIpaddr"\n", - gpa, nvcpu->nv_vvmcxaddr); - vmreturn(regs, VMSUCCEED); - goto out; - } - if ( nvcpu->nv_vvmcxaddr != VMCX_EADDR ) - __set_vvmcs(nvcpu->nv_vvmcx, NVMX_LAUNCH_STATE, 0); - nvmx_purge_vvmcs(v); - vmreturn(regs, VMSUCCEED); - -out: return X86EMUL_OKAY; } --+nBD6E3TurpgldQp 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 --+nBD6E3TurpgldQp--