From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] VMX: fix/adjust trap injection Date: Tue, 24 Nov 2015 11:15:29 +0000 Message-ID: <565446D1.2010202@citrix.com> References: <5653195202000078000B7CF0@prv-mh.provo.novell.com> <56532A38.5020209@citrix.com> <56533DCF02000078000B7EED@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a1BZP-00076u-BC for xen-devel@lists.xenproject.org; Tue, 24 Nov 2015 11:15:35 +0000 In-Reply-To: <56533DCF02000078000B7EED@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , Kevin Tian , Jun Nakajima List-Id: xen-devel@lists.xenproject.org On 23/11/15 15:24, Jan Beulich wrote: >>>> On 23.11.15 at 16:01, wrote: >> On 23/11/15 12:49, Jan Beulich wrote: >>> @@ -1525,6 +1516,16 @@ static void vmx_inject_trap(struct hvm_t >>> __restore_debug_registers(curr); >>> write_debugreg(6, read_debugreg(6) | DR_STEP); >>> } >>> + if ( !nestedhvm_vcpu_in_guestmode(curr) || >>> + !nvmx_intercepts_exception(curr, TRAP_debug, _trap.error_code) ) >>> + { >>> + unsigned long val; >>> + >>> + __vmread(GUEST_DR7, &val); >>> + __vmwrite(GUEST_DR7, val & ~DR_GENERAL_DETECT); >>> + __vmread(GUEST_IA32_DEBUGCTL, &val); >>> + __vmwrite(GUEST_IA32_DEBUGCTL, val & ~IA32_DEBUGCTLMSR_LBR); >> Is it worth eliding the __vmwrite's if possible? It will be fewer >> VMexits if this Xen is running nested, and ISTR it will avoid slowing >> down the vmentry with further consistency checks. > I've considered this, but then decided #DB shouldn't really be > raised on any fast paths (or such paths become non-fast anyway > due to the many exceptions). The code certainly is easier to read > without further conditionals. Ok. Reviewed-by: Andrew Cooper