Hello all, I''m adding the lazy save/restore of hardware debug registers to the SVM part of HVM and I''m slightly confused about something done in the VMX counterpart. The intercept for debug registers is enabled until the first access. The hypervisor takes note that the guests debug registers are now dirty and disables the debug register intercept allowing the guest free access to the registers. My question is this. On the debug register access, why is the EIP updated? I don''t understand some of the finer details of VT but by updating the EIP, doesn''t this initial debug register access get lost? I''ve included the two snippets of code in question below and a patch to remove EIP update if it is wrong. --travis --- static void vmx_dr_access(unsigned long exit_qualification, struct cpu_user_regs *regs) { struct vcpu *v = current; v->arch.hvm_vcpu.flag_dr_dirty = 1; /* We could probably be smarter about this */ __restore_debug_registers(v); /* Allow guest direct access to DR registers */ v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_MOV_DR_EXITING; __vmwrite(CPU_BASED_VM_EXEC_CONTROL, v->arch.hvm_vcpu.u.vmx.exec_control); } [snip ...] case EXIT_REASON_DR_ACCESS: __vmread(EXIT_QUALIFICATION, &exit_qualification); vmx_dr_access(exit_qualification, ®s); __get_instruction_length(inst_len); __update_guest_eip(inst_len); break; --- _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Good catch. Do you have a simple test to verify that the new patch works properly? -George On 8/17/06, Travis Betak <travis.betak@amd.com> wrote:> Hello all, > > I''m adding the lazy save/restore of hardware debug registers to the SVM > part of HVM and I''m slightly confused about something done in the VMX > counterpart. > > The intercept for debug registers is enabled until the first access. The > hypervisor takes note that the guests debug registers are now dirty and > disables the debug register intercept allowing the guest free access to > the registers. > > My question is this. On the debug register access, why is the EIP > updated? I don''t understand some of the finer details of VT but by > updating the EIP, doesn''t this initial debug register access get lost? > I''ve included the two snippets of code in question below and a patch to > remove EIP update if it is wrong. > > --travis > > --- > > static void vmx_dr_access(unsigned long exit_qualification, > struct cpu_user_regs *regs) > { > struct vcpu *v = current; > > v->arch.hvm_vcpu.flag_dr_dirty = 1; > > /* We could probably be smarter about this */ > __restore_debug_registers(v); > > /* Allow guest direct access to DR registers */ > v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_MOV_DR_EXITING; > __vmwrite(CPU_BASED_VM_EXEC_CONTROL, > v->arch.hvm_vcpu.u.vmx.exec_control); > } > > [snip ...] > > case EXIT_REASON_DR_ACCESS: > __vmread(EXIT_QUALIFICATION, &exit_qualification); > vmx_dr_access(exit_qualification, ®s); > __get_instruction_length(inst_len); > __update_guest_eip(inst_len); > break; > > --- > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Fri, 18 Aug 2006, George Dunlap wrote:> Good catch. Do you have a simple test to verify that the new patch > works properly? > -George >Hi, George, No, I don''t exactly have a simple test that can verify it. I haven''t been doing very thorough testing on the SVM side of things, I''ve just playing with gdb in a guest and setting breakpoints in a simple app with ''hbreak'' and it seems to be catching them properly. If you''d like, I can try and test things out with and without my patch using my very simple smoke test to see if there''s a noticible difference. --travis BTW, sorry for the late reply. My filter misplaced your message.> On 8/17/06, Travis Betak <travis.betak@amd.com> wrote: >> >> My question is this. On the debug register access, why is the EIP >> updated? I don''t understand some of the finer details of VT but by >> updating the EIP, doesn''t this initial debug register access get lost? >> I''ve included the two snippets of code in question below and a patch to >> remove EIP update if it is wrong. >>_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel