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

Re: [Xen-devel] Single step in HVM domU on Intel machine may see wrong DB6


  • To: "Zhang, Yang Z" <yang.z.zhang@xxxxxxxxx>
  • From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
  • Date: Fri, 21 Feb 2014 06:36:19 +0100
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Dong, Eddie" <eddie.dong@xxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>
  • Delivery-date: Fri, 21 Feb 2014 05:36:48 +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=OvYKNuHEb4MT2DGwjrBIWRtIPHm7xYsIbzc8guV0WM5dW59DGETuC19E fFn/PaYFZtSW4i31Ue6nNrv/sTeDv7zPJVh7zttrU5HrNh6T/FJGmLCgC 4g7sph7Gf/4MpGDYm+8XXVI6MehQTXdQf41ce3/+dakk9f/GpHUb50ght klBuDzSSIcS29HLQgacnRjDWSzeWMCnTGzRouoASSelTmQInQx3DwGs4P p0d64irXsVDr9BDe6hnCQqIZZOR89;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On 21.02.2014 02:26, Zhang, Yang Z wrote:
Juergen Gross wrote on 2014-02-20:
Hi,

Hi, Juergen


I think I've found a bug in debug trap handling in the Xen hypervisor
in case of a HVM domu using single stepping:

Debug registers are restored on vcpu switch only if db7 has any debug
events activated or if the debug registers are marked to be used by
the domU. This leads to problems if the domU uses single stepping 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.

Jan suggested to intercept the debug trap in the hypervisor and mark
the debug registers to be used by the domU to enable saving and
restoring the debug registers in case of a context switch. I used the
attached patch (applies to Xen 4.2.3) to verify this solution and it
worked (without the patch a test was able to reproduce the bug once in
about 3 hours, with the patch the test ran for more than 12 hours without 
problem).

Obviously the patch isn't the final one, as I deactivated the "monitor trap 
flag"
feature to avoid any strange dependencies. Jan wanted someone from the
VMX folks to put together a proper fix to avoid overlooking some corner case.


Thanks for reporting this issue.
Actually, I don't know the scenario that you saw this issue. Are you using 
single step inside guest? Or running gdb to debug VM remotely?

Single step inside guest:

1. Guest sets TF flag in status loaded by IRET and does IRET
2. Debug trap in guest occurs, physical DB6 holds single step indicator
3. vcpu scheduling event occurs, debug registers are NOT saved as not marked
   being dirty and DB7 has no debug events configured
4. when guest vcpu is scheduled again, DB6 has lost single step indicator


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®.