public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: kvm-devel@lists.sourceforge.net,
	kvm-ppc-devel@lists.sourceforge.net, jyoung5@us.ibm.com
Subject: Re: [RFC] Reworking KVM_DEBUG_GUEST
Date: Wed, 14 May 2008 16:06:00 -0500	[thread overview]
Message-ID: <200805141606.00915.hollisb@us.ibm.com> (raw)
In-Reply-To: <482B422E.3000007@web.de>

On Wednesday 14 May 2008 14:49:02 Jan Kiszka wrote:
> > In Qemu, when exit_reason == KVM_EXIT_DEBUG, it would 
> > just need to see if that address is for a breakpoint Qemu set or not. If 
so, 
> > it's happy. If not, (commence handwaving) tell KVM to forward the debug 
> > interrupt to the guest. This way, the list of breakpoints is maintained in 
> > userspace (in the qemu gdb stub), which is nice because it could be 
> > arbitrarily large.
> 
> Yes, but I would rather pass the debug registers (more general: some
> arch dependent state set) back in this slot. Those contain everything
> the gdbstub needs to know to catch relevant hardware-BP/watchpoint
> events (and report them to the gdb frontend).

But what would the stub *do* with the contents of the debug registers? The 
only reason they were set is on behalf of the stub in the first place. In 
fact, in the case of soft breakpoints, KVM doesn't even know where all the 
set breakpoints are. The only thing KVM needs to report is the address of the 
breakpoint that was just hit.

Sorry if this gets formatted badly:

gdb					qemu stub				KVM
break *0xf00
sends Z0 packet 0xf00
					0xf00 -> BP list
					ioctl(KVM_DEBUG, 0xf00)
continue
					ioctl(KVM_RUN)
											running...
											breakpoint hit
											exit_reason = KVM_EXIT_DEBUG
											kvm_run.debug.address = current PC value
					search BP list for address
bp hit			<---	present        not present --->	send debug interrupt to guest

Notes:
- KVM_DEBUG in this case will set a hardware breakpoint. The alternative is to 
write an int3 into guest memory.
- The stub doesn't care how the hardware registers were configured. All it 
needs to know is a) that a breakpoint was hit, and b) at what address.

Does this make sense?

-- 
Hollis Blanchard
IBM Linux Technology Center

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  reply	other threads:[~2008-05-14 21:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-12 11:34 [RFC] Reworking KVM_DEBUG_GUEST Jan Kiszka
2008-05-14 15:12 ` Jerone Young
2008-05-14 15:28   ` Jan Kiszka
2008-05-14 15:55     ` Jerone Young
2008-05-14 18:25     ` Hollis Blanchard
2008-05-14 19:10       ` Jan Kiszka
2008-05-14 19:33         ` Hollis Blanchard
2008-05-14 19:49           ` Jan Kiszka
2008-05-14 21:06             ` Hollis Blanchard [this message]
2008-05-14 21:11               ` [kvm-ppc-devel] " Hollis Blanchard
2008-05-14 21:13                 ` Hollis Blanchard
2008-05-15  7:47 ` Avi Kivity

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=200805141606.00915.hollisb@us.ibm.com \
    --to=hollisb@us.ibm.com \
    --cc=jan.kiszka@web.de \
    --cc=jyoung5@us.ibm.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=kvm-ppc-devel@lists.sourceforge.net \
    /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