From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH][RFC] FPU LWP 4/5: enable LWP for SVM guest Date: Fri, 15 Apr 2011 10:17:30 +0100 Message-ID: <4DA8294A020000780003C9D3@vpn.id2.novell.com> References: <4DA75B64.30709@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <4DA75B64.30709@amd.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Wei Huang Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org >>> On 14.04.11 at 22:39, Wei Huang wrote: >+static void svm_lwp_save(struct vcpu *v) >+{ >+ if ( cpu_has_lwp ) >+ { >+ rdmsrl(MSR_AMD64_LWP_CFG, v->arch.hvm_svm.guest_lwp_cfg); >+ wrmsrl(MSR_AMD64_LWP_CFG, 0x0); >+ /* Disable LWP for next VCPU */ >+ wrmsrl(MSR_AMD64_LWP_CBADDR, 0x0); >+ } >+} >+ >+static void svm_lwp_load(struct vcpu *v) >+{ >+ if ( cpu_has_lwp )=20 >+ { >+ /* Only LWP_CFG is reloaded. LWP_CBADDR will be reloaded via = xrstor */ >+ wrmsrl(MSR_AMD64_LWP_CFG, v->arch.hvm_svm.guest_lwp_cfg); >+ } >+} I think I had pointed this out before - to avoid these MSR accesses for guests not using LWP, you should track whether the vCPU has LWP support enabled (e.g. non-zero written into LWP_CFG) and key off of that instead of cpu_has_lwp. Jan