From: "Jan Beulich" Subject: Re: [PATCH 2/4] VMX/vPMU: fix DebugCtl MSR handling Date: Thu, 14 Aug 2014 18:14:16 +0100 Message-ID: <53ECFC7802000078000BA7C5@mail.emea.novell.com> References: <53E9F5A0020000780002B70C@mail.emea.novell.com> <53E9F73E020000780002B726@mail.emea.novell.com> <53EA531D.4000604@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XHybT-0004Fh-U2 for xen-devel@lists.xenproject.org; Thu, 14 Aug 2014 17:14:20 +0000 In-Reply-To: <53EA531D.4000604@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel , Boris Ostrovsky Cc: Kevin Tian , Eddie Dong , Jun Nakajima List-Id: xen-devel@lists.xenproject.org >>> On 12.08.14 at 19:47, wrote: > On 08/12/2014 05:15 AM, Jan Beulich wrote: >> - if ( msr_content & supported ) >> - { >> - if ( vpmu_is_set(vpmu, VPMU_CPU_HAS_BTS) ) >> - return 1; >> - gdprintk(XENLOG_WARNING, "Debug Store is not supported on this cpu\n"); >> - hvm_inject_hw_exception(TRAP_gp_fault, 0); >> - return 0; >> - } >> + if ( !(msr_content & ~supported) && >> + vpmu_is_set(vpmu, VPMU_CPU_HAS_BTS) ) >> + return 1; >> + if ( (msr_content & supported) && >> + !vpmu_is_set(vpmu, VPMU_CPU_HAS_BTS) ) >> + printk(XENLOG_G_WARNING >> + "%pv: Debug Store unsupported on this CPU\n", >> + current); > > Can we move this if statement out of VPMU code into > vmx_msr_write_intercept()? There is not a whole lot of VPMU-specific > logic here and I am not sure I see much reason to go through > vendor-independent code (vpmu.c) to do something that is very much > Intel-specific. I'd rather not (at least not in this patch), not the least that I can see the "supported" function parameter to potentially be useful elsewhere when use of certain bits within an MSR is split across components. Jan