From: Mukesh Rathor Subject: Re: [V0 PATCH] SVM: set/unset TF flag for single_step Date: Wed, 2 Jul 2014 18:33:03 -0700 Message-ID: <20140702183303.5913aab7@mantra.us.oracle.com> References: <4c14b668-c76b-4a82-9236-9ed6840aefaa@default> <53B3E130020000780001F57D@mail.emea.novell.com> <20140702145238.68265fa0@mantra.us.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 1X2Vtj-0008BD-Da for xen-devel@lists.xenproject.org; Thu, 03 Jul 2014 01:33:15 +0000 In-Reply-To: <20140702145238.68265fa0@mantra.us.oracle.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: Mukesh Rathor Cc: Jan Beulich , keir.xen@gmail.com, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com, xen-devel@lists.xenproject.org, Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On Wed, 2 Jul 2014 14:52:38 -0700 Mukesh Rathor wrote: > On Wed, 02 Jul 2014 09:38:40 +0100 > "Jan Beulich" wrote: > > > >>> On 02.07.14 at 05:36, wrote: > > >> --- a/xen/arch/x86/hvm/svm/svm.c > > >> +++ b/xen/arch/x86/hvm/svm/svm.c > > >> @@ -2350,6 +2350,8 @@ void svm_vmexit_handler(struct > > >> cpu_user_regs *regs) > > >> case VMEXIT_EXCEPTION_DB: > > >> if ( !v->domain->debugger_attached ) > > >> goto exit_and_crash; > > >> + else > > >> + regs->eflags &= ~X86_EFLAGS_TF; > > >> domain_pause_for_debugger(); > > >> break; > > > > > > > > > I poked around debugger code and it looks to me that > > > tools/debugger/gdbsx/xg:_change_TF() manages this flag. > > _change_TF() only manages TF if XEN_DOMCTL_debug_op fails. Moreover, > TF handling is intended for PV. For HVM, xen provides > XEN_DOMCTL_debug_op which sets v->arch.hvm_vcpu.single_step. > > > Indeed it shouldn't be the hypervisor to deal with that (unless it > > had a built-in one), but the debugger attached. > > Correct. But, the hyp provides abi hvm_debug_op > (XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON) that it needs to honor for svm > like it does for vmx. I should rephrase that from "it needs" to "it would be nice to" as all debuggers then can just use hvm_vcpu.single_step internally or via hvm_debug_op(). Boris rightly points out that the cpu_has_monitor_trap_flag check in hvm_debug_op() would still be an issue, and I missed that check. It could be removed or an intel check could be added in that if statement. hvm_debug_op(): rc = -ENOSYS; if ( !cpu_has_monitor_trap_flag ) <--- break; hope that makes sense. if in agreement, i can send v1. thanks Mukesh