public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "K.Prasad" <prasad@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Avi Kivity <avi@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jason Wessel <jason.wessel@windriver.com>
Subject: HW breakpoints vs. KVM context switches
Date: Mon, 07 Sep 2009 19:22:24 +0200	[thread overview]
Message-ID: <4AA54150.3000101@siemens.com> (raw)

Hi,

as we currently face some abstraction issue around hardware breakpoints
in kvm, I had a look again at the state of your work. I assume it's on a
good way towards mainline, right?

So far kvm (on x86) switches debug registers between host and guest
fairly conservatively: If the guest has some breakpoint in use, the host
registers are read from the hardware and restored to it on return. This
is not really optimal, specifically as dr6/dr7 are currently touched
unconditionally.

Now Avi's idea is to skip saving the registers as we could also restore
them from current->thread.debugregX whenever required. IIUC this will no
longer be true when hw-breakpoints hit mainline. It is already wrong for
kgdb as that breakpoint user touches the registers without asking anyone
(or at least informing others).

My question is now if we could extend the hw-breakpoint interface in a
way, either arch-specific or even generic, that kvm could easily use it
to restore the host's debug register state if required.

Moreover, I think we also need some interface extension for kgdb. I
guess it wants ultimate access to the registers on all CPUs, and it
likely don't want to debate about this with the kernel (==acquire
locks). Still the hw-breakpoint layer would likely want to know if kgdb
is claiming the hardware so that it can step back from touching them.
Also kvm would like to hear about this + access to their (cached)
content for proper restoration.

So far the theory. Before starting to craft any prototypes, I would like
to hear your opinion on this.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

             reply	other threads:[~2009-09-07 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-07 17:22 Jan Kiszka [this message]
2009-09-07 23:20 ` HW breakpoints vs. KVM context switches Frederic Weisbecker

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=4AA54150.3000101@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox