All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Christoffer Dall <christoffer.dall@linaro.org>,
	Alexander Graf <agraf@suse.de>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Will Deacon" <will.deacon@arm.com>,
	"Marc Zyngier" <marc.zyngier@arm.com>,
	"kvmarm@lists.cs.columbia.edu" <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:44:37 +0100	[thread overview]
Message-ID: <5474B1F5.6050801@redhat.com> (raw)
In-Reply-To: <20141124145208.GQ3401@cbox>



On 24/11/2014 15:52, Christoffer Dall wrote:
> 
> We had a lenghty IRC discussion on this, for the curious, go read it
> here:
> http://irclogs.linaro.org/2014/11/24/%23kvm-arm.html

Some notes...

> chazy	but saying that you want to design an ABI that potentially exposes fewer debug registers to gdbstubs than your hardware supports and breaks gdbstub support if you happen to support emulation of a cpu with more debug registers in the future, because you want to re-use ONE_REG is not a great approach either
> 
> agraf	chazy: but you wouldn't even remotely think of doing it, no?
> 
> agraf	chazy: I'm saying that QEMU shouldn't have access to the excess registers
> 
> chazy	agraf: I wouldn’t even remotely think of doing nested virtualization, but people have
> 
> agraf	chazy: QEMU spawns an A57, it gets 8 debug registers
> 
> chazy	agraf: I understand, but I don’t agree with your rationale
> 
> agraf	chazy: not "QEMU spawns an A57 on an A67, so it gets 8 real and 8 hidden debug registers that it also needs to be aware of mappings of"

I disagree with Alex.  QEMU can use the 16 debug registers as it wishes,
since it sets them with KVM_SET_GUEST_DEBUG.  The guest's eight can be
mapped to the last 8 if those are the required semantics for the
architecture.  Just exit to QEMU if you do a debug register write while
gdbstub debugging is active; QEMU gets the contents of the 8
VCPU-visible registers with ONE_REG (equivalent of x86 GET_DEBUGREGS);
calls KVM_SET_GUEST_DEBUG to reflect them in the 16-register state; and
restarts.

It works as long as you can trap both reads and writes.

> chazy ajb-linaro: don’t migrate a guest that is getting debugged is
> the answer to that one I believe
> 
> ajb-linaro	chazy: at least with the overlay approach that happens automatically
> 
> ajb-linaro	the overlay isn't migrated and the new host isn't calling SET_GUEST_DEBUG so whatever the debug registers where before are restorerd

Right.  The destination will lose the hardware breakpoints/watchpoints
because it starts the guest with KVM_SET_GUEST_DEBUG.  Apart from losing
them, everything should work fine.  The dest sets the 8 VCPU-visible
registers with ONE_REG, the hypervisor reflects them in a subset of the
16 physical registers, and "that's it".

Paolo

  reply	other threads:[~2014-11-25 16:44 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 [this message]
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
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=5474B1F5.6050801@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.