All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Will Deacon" <will.deacon@arm.com>,
	"Marc Zyngier" <marc.zyngier@arm.com>,
	"Christoffer Dall" <christoffer.dall@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Alexander Graf" <agraf@suse.de>
Cc: kvmarm@lists.cs.columbia.edu,
	KVM devel mailing list <kvm@vger.kernel.org>
Subject: Re: Exposing host debug capabilities to userspace
Date: Tue, 25 Nov 2014 17:21:53 +0100	[thread overview]
Message-ID: <5474ACA1.20908@redhat.com> (raw)
In-Reply-To: <87a93gn1go.fsf@linaro.org>



On 24/11/2014 14:59, Alex Bennée wrote:
> Alexander Graf pointed out that KVM_CHECK_EXTENSION can return any
> positive number for success. How about using:
> 
> max_hw_bps = kvm_check_extension(kvm_state, KVM_CAP_GUEST_DEBUG_HW_BPS);
> max_hw_wps = kvm_check_extension(kvm_state, KVM_CAP_GUEST_DEBUG_HW_WPS);
> 
> Seems pretty sane, doesn't change the semantics of an API and is
> architecture agnostic if others need the number?

Yes, this was going to be my suggestion as well.  Just I would use a
bitmask in case some register can act as both breakpoint and watchpoint.

On x86, each of the four bp/wp registers (each register can act as both)
can be used for either guest or gdbstub debugging.  If the
KVM_GUESTDBG_USE_HW_BP feature is enabled, the guest is entered with
"made up" debug register contents, that we pass via
KVM_SET_GUEST_DEBUG's struct kvm_guest_debug_arch.  Otherwise, the guest
is entered with real debug register contents passed via
KVM_SET_DEBUGREGS.  Reads/writes of the debug registers trap to KVM
(which helps the guest see the expected values of the debug registers in
the former case).  There is no KVM_GET_GUEST_DEBUG because the
corresponding info is passed via struct kvm_debug_exit_arch.

If gdbstub hardware breakpoints are enabled, all hardware breakpoints
exit to userspace.  QEMU then decides whether the breakpoint came from
guest debugging (and then injects an exception), or from gdbstub
debugging (and then suspends execution).  Same for software breakpoints.
 If the total request is >4 hardware breakpoints, someone will have to
lose and some gdbstub breakpoints will be missed.

Paolo

  reply	other threads:[~2014-11-25 16:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 16:55 Exposing host debug capabilities to userspace Alex Bennée
2014-11-21 10:08 ` Christoffer Dall
2014-11-21 10:29   ` Alex Bennée
2014-11-21 11:23   ` Alex Bennée
     [not found] ` <87egssn91o.fsf@zen.linaro.local.i-did-not-set--mail-host-address--so-tickle-me>
2014-11-24 11:21   ` Peter Maydell
2014-11-24 12:20     ` Christoffer Dall
2014-11-24 11:35   ` Alex Bennée
2014-11-24 12:26     ` Alexander Graf
2014-11-24 12:32       ` Peter Maydell
2014-11-24 12:41         ` Alexander Graf
2014-11-24 12:44           ` Peter Maydell
2014-11-24 12:51             ` Alexander Graf
2014-11-24 12:53               ` Christoffer Dall
2014-11-24 12:56                 ` Alexander Graf
2014-11-24 13:10                   ` Christoffer Dall
2014-11-24 14:07                     ` Alexander Graf
2014-11-24 14:52                       ` Christoffer Dall
2014-11-25 16:44                         ` Paolo Bonzini
2014-11-24 12:53           ` Alex Bennée
2014-11-24 12:54             ` Christoffer Dall
2014-11-24 13:59     ` Alex Bennée
2014-11-25 16:21       ` Paolo Bonzini [this message]
2014-11-25 16:35         ` Alexander Graf
2014-11-25 16:50           ` Paolo Bonzini
2014-11-26 12:11             ` Alex Bennée
2014-11-26 12:23             ` Peter Maydell

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=5474ACA1.20908@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=marc.zyngier@arm.com \
    --cc=peter.maydell@linaro.org \
    --cc=will.deacon@arm.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 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.