From: Alexander Graf <agraf@suse.de>
To: Christoffer Dall <christoffer.dall@linaro.org>
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>,
"Paolo Bonzini" <pbonzini@redhat.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: Mon, 24 Nov 2014 15:07:35 +0100 [thread overview]
Message-ID: <54733BA7.9000400@suse.de> (raw)
In-Reply-To: <CAMJs5B97kdspypKr2gMz+9J12X7bO7aJjo0dQHhYaA86Fw_CyQ@mail.gmail.com>
On 24.11.14 14:10, Christoffer Dall wrote:
> On Mon, Nov 24, 2014 at 1:56 PM, Alexander Graf <agraf@suse.de> wrote:
>>
>>
>> On 24.11.14 13:53, Christoffer Dall wrote:
>>> On Mon, Nov 24, 2014 at 1:51 PM, Alexander Graf <agraf@suse.de> wrote:
>>>>
>>>>
>>>> On 24.11.14 13:44, Peter Maydell wrote:
>>>>> On 24 November 2014 at 12:41, Alexander Graf <agraf@suse.de> wrote:
>>>>>>> Am 24.11.2014 um 13:32 schrieb Peter Maydell <peter.maydell@linaro.org>:
>>>>>>> Yes, but we don't want to know about properties of the guest
>>>>>>> vCPU. In an ideal world QEMU could reserve say half the debug
>>>>>>> registers for debugging the VM on startup and have KVM expose
>>>>>>> ID registers indicating to the guest that it only had the
>>>>>>> other half...
>>>>>>
>>>>>> Yup, so create another (read-only) ONE_REG that exposes the number
>>>>>> of actual guest debug registers.
>>>>>
>>>>> I'm confused. ONE_REG is for guest state, and the ID register
>>>>> by definition is how we tell the guest how many debug registers
>>>>> it has. What we want to know (and perhaps even control) for
>>>>> debugging the VM is how many debug registers the host has.
>>>>
>>>> No, we don't want to know how many debug registers the host has. We want
>>>> to know how many debug registers the guest has.
>>>>
>>>> Imagine you're running on A57 today with 8 debug registers (no idea if
>>>> that's true, but assume it is). Tomorrow there will be a new core -
>>>> let's call it A67 - with 16 debug registers.
>>>>
>>>> To make sure your legacy, badly written guest behaves exactly the same -
>>>> especially after live migration - you want to spawn a VM with -cpu A57.
>>>> That implies you want to expose 8 debug registers into the guest. So
>>>> debug register synchronization should only be aware of those 8 registers.
>>>>
>>>> So what we really care about is the number of debug registers available
>>>> to a guest vcpu. That in turn means it's guest state and as such can
>>>> easily go into ONE_REG.
>>>>
>>> We already export this for the guest via ONE_REG.
>>>
>>> What we want to do is support gdbstubs in QEMU to debug the guest, and
>>> to do this, QEMU needs to know how many hardware registers on the host
>>> there is; the guest will never see this information.
>>>
>>> So this is really about the host, the guest side is trivially handled
>>> through ONE_REG.
>>
>> That's the cp15 register that happens to get exposed to the guest. You
>> can just add another ONE_REG that does not have a cp15 equivalent to
>> expose the number of the vcpu's actually available debug registers.
>>
>>
> The fact that we currently map the guest vcpu registers to that of the
> host doesn't mean that will always be the case (which you argued for
> above).
>
> If you migrate a VM from a CPU with 16 debug registers (or emulate a
> CPU with 16 debug registers) on a physical CPU with only 8 debug
> registers, you cannot tell QEMU that it has 16 debug registers on the
> hardware to configure to debug the guest, which is what ONE_REG would
> give you.
>
> You could add another set of registers to ONE_REG which says "these
> are the host versions", or you could say that you don't ever support a
> setup where the guest number of debug registers is not the same as the
> host number, but both would be wrong.
Why would QEMU ever want to access debug registers that it didn't ask
for in the first place? If we simply limit ourselves to the register set
the vcpu has we don't have any problems and the complexity matrix
shrinks noticably, no?
Alex
next prev parent reply other threads:[~2014-11-24 14:07 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 [this message]
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
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=54733BA7.9000400@suse.de \
--to=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=pbonzini@redhat.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.