All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Juergen Gross <juergen.gross@ts.fujitsu.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: Debug-Registers in HVM domain destroyed
Date: Fri, 14 Feb 2014 10:40:56 +0000	[thread overview]
Message-ID: <52FE00C8020000780011C649@nat28.tlf.novell.com> (raw)
In-Reply-To: <52FDE2ED.4030008@ts.fujitsu.com>

>>> On 14.02.14 at 10:33, Juergen Gross <juergen.gross@ts.fujitsu.com> 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
- 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.

Hence I think that in general this ought to work. Question is
whether one of the more modern feature additions broke any of
this. Assuming that your guest isn't doing heavy accesses to the
debug registers, instrumenting the hypervisor side code to track
the saving/restoring shouldn't be causing too much log output (as
long as you suppress output from the context switch path when
no relevant state changed).

Jan

  reply	other threads:[~2014-02-14 10:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  9:33 Debug-Registers in HVM domain destroyed Juergen Gross
2014-02-14 10:40 ` Jan Beulich [this message]
2014-02-14 12:18   ` Juergen Gross
2014-02-14 13:02     ` Jan Beulich
2014-02-18 12:48       ` Juergen Gross
2014-02-18 12:56         ` Jan Beulich
2014-02-20  7:44           ` Juergen Gross
2014-02-20  8:07             ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FE00C8020000780011C649@nat28.tlf.novell.com \
    --to=jbeulich@suse.com \
    --cc=juergen.gross@ts.fujitsu.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.