From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: Re: [PATCH] nestedhvm: ASID emulation Date: Fri, 15 Apr 2011 15:40:44 +0200 Message-ID: <4DA84ADC.1020706@amd.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000902030209060908010203" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --------------000902030209060908010203 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit On 04/15/11 14:53, Keir Fraser wrote: > On 15/04/2011 10:57, "Christoph Egger" wrote: > >> On 04/15/11 11:24, Keir Fraser wrote: >>> On 15/04/2011 10:08, "Christoph Egger" wrote: >> >> Just found another fallout that got lost from my original patch. >> >> After shutting down XP mode in Windows 7, Win7 turns off SVM in EFER >> after about 30 seconds. When starting XP mode again, Win 7 turns SVM on >> again. >> >> Then nv_n2asid can be stale. Attached patch fixes this. > > Should be using hvm_asid_flush_vcpu_asid(), so I'll fix the patch to use > that and then check it in. There are a lot of regressions now... I assume the non-nested virtualization case got broken. Attached patch covers the non-nested case (and contains the above discussed hvm_asid_flush_vcpu_asid() as it didn't appear yet upstream). Signed-off-by: Christoph Egger -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 --------------000902030209060908010203 Content-Type: text/plain; name="xen_nh_asid.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_nh_asid.diff" Content-Description: xen_nh_asid.diff diff -r ad5960696d68 xen/arch/x86/hvm/nestedhvm.c --- a/xen/arch/x86/hvm/nestedhvm.c Fri Apr 15 12:00:13 2011 +0200 +++ b/xen/arch/x86/hvm/nestedhvm.c Fri Apr 15 15:43:15 2011 +0200 @@ -61,7 +61,7 @@ nestedhvm_vcpu_reset(struct vcpu *v) nv->nv_vvmcxaddr = VMCX_EADDR; nv->nv_flushp2m = 0; nv->nv_p2m = NULL; + hvm_asid_flush_vcpu_asid(&nv->nv_n2asid); if ( hvm_funcs.nhvm_vcpu_reset ) hvm_funcs.nhvm_vcpu_reset(v); diff -r ad5960696d68 xen/arch/x86/hvm/svm/asid.c --- a/xen/arch/x86/hvm/svm/asid.c Fri Apr 15 12:00:13 2011 +0200 +++ b/xen/arch/x86/hvm/svm/asid.c Fri Apr 15 15:43:15 2011 +0200 @@ -43,10 +43,16 @@ asmlinkage void svm_asid_handle_vmrun(vo { struct vcpu *curr = current; struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb; - struct hvm_vcpu_asid *p_asid = - nestedhvm_vcpu_in_guestmode(curr) - ? &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid; - bool_t need_flush = hvm_asid_handle_vmenter(p_asid); + struct hvm_vcpu_asid *p_asid; + bool_t need_flush; + bool_t vcpu_guestmode = 0; + + if (nestedhvm_enabled(curr->domain) && nestedhvm_vcpu_in_guestmode(curr)) + vcpu_guestmode = 1; + + p_asid = vcpu_guestmode ? + &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid; + need_flush = hvm_asid_handle_vmenter(p_asid); /* ASID 0 indicates that ASIDs are disabled. */ if ( p_asid->asid == 0 ) --------------000902030209060908010203 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 --------------000902030209060908010203--