[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Debug-Registers in HVM domain destroyed


  • To: Jan Beulich <JBeulich@xxxxxxxx>
  • From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
  • Date: Fri, 14 Feb 2014 13:18:42 +0100
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Feb 2014 12:26:45 +0000
  • Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Message-ID:Date:From:Organization:User-Agent: MIME-Version:To:CC:Subject:References:In-Reply-To: Content-Type:Content-Transfer-Encoding; b=fGS9Iq/2YLqJ4kxtO8y6yUZx+KqoqYr5Bt7EXiJgMaq8Cauvhs8m0QjH 0R9qxUL+Vz3q3J7a5ATuRnH8OAmrsQJCTIvChAQ7UCto0ImSun15LZE/9 Mccgc3p4NS3sLMIh71W/0qrrhWRFD4v6NVCtpM/SXD1AXWPL0iW4kpLl7 CPelVp1kBVTzL+mYiQY5RiRqh9ZKalqkPd11NK5nPUXhI8IzAFlR68MZB ACwcKbovNsfgheU1hyArxWVSdDFWw;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On 14.02.2014 11:40, Jan Beulich wrote:
On 14.02.14 at 10:33, Juergen Gross <juergen.gross@xxxxxxxxxxxxxx> wrote:
Debug registers are restored on vcpu switch only if db7 has any debug events
activated. This leads to problems in the following cases:

- db0-3 are changed by the guest before events are set "active" in db7. In case
    of a vcpu switch between setting db0-3 and db7, db0-3 are lost. BTW: setting
    db7 before db0-3 is no option, as this could trigger debug interrupts due to
    stale db0-3 contents.

- single stepping is used and vcpu switch occurs between the single step trap
    and reading of db6 in the guest. db6 contents (single step indicator) are
    lost in this case.

Not exactly, at least not looking at how things are supposed to work:
__restore_debug_registers() gets called when
- context switching in (vmx_restore_dr())
- injecting TRAP_debug

Is this the case when the guest itself uses single stepping? Initially the
debug trap shouldn't cause a VMEXIT, I think. And I'm not sure the hypervisor
will see a guest setting TF via an IRET.

I _have_ seen a debug trap in the guest after single stepping without db6
having the single step indicator set...

- any DRn is being accessed

So when your guest writes DR[0-3], debug registers should get
restored (from their original zero values) and the guest would be
permitted direct access to the hardware registers. Once context
switched out, vmx_save_dr() ought to be saving the values
(irrespective of DR7 contents, only depending upon
v->arch.hvm_vcpu.flag_dr_dirty). During the next context
switch in, they would get restored immediately if DR7 already has
some breakpoint enabled, or again during first DR access if not.

Okay, I'll check that. A little test routine in my domU should be able to
verify that debug registers won't change under it's feet in case of no
activated events in db7.


Juergen

--
Juergen Gross                 Principal Developer Operating Systems
PBG PDG ES&S SWE OS6                   Telephone: +49 (0) 89 62060 2932
Fujitsu                                   e-mail: juergen.gross@xxxxxxxxxxxxxx
Mies-van-der-Rohe-Str. 8                Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.