From: Alexander Graf <agraf-l3A5Bk7waGM@public.gmane.org>
To: Liu Yu-B13201 <B13201-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: hollis-yUx37fBWTUITNcAmw9vGhQ@public.gmane.org,
kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/4] kvmppc: guest debug definitions
Date: Wed, 03 Feb 2010 11:37:20 +0100 [thread overview]
Message-ID: <4B6951E0.6080608@suse.de> (raw)
In-Reply-To: <0A1FE637C2C7E148B9573BB60CC630E5762AF7-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
Liu Yu-B13201 wrote:
>
>
>
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf-l3A5Bk7waGM@public.gmane.org]
>> Sent: Wednesday, February 03, 2010 5:51 PM
>> To: Liu Yu-B13201
>> Cc: hollis-yUx37fBWTUITNcAmw9vGhQ@public.gmane.org; kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
>> kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Subject: Re: [PATCH 1/4] kvmppc: guest debug definitions
>>
>> Liu Yu-B13201 wrote:
>>
>>>
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>>> [mailto:kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Alexander Graf
>>>> Sent: Wednesday, February 03, 2010 4:57 PM
>>>> To: Liu Yu-B13201
>>>> Cc: hollis-yUx37fBWTUITNcAmw9vGhQ@public.gmane.org; kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
>>>> kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Liu Yu-B13201
>>>> Subject: Re: [PATCH 1/4] kvmppc: guest debug definitions
>>>>
>>>>
>>>> Am 03.02.2010 um 08:53 schrieb Liu Yu <yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>:
>>>>
>>>>
>>>>
>>>>> Signed-off-by: Liu Yu <yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>>>>> ---
>>>>> arch/powerpc/include/asm/kvm.h | 20 ++++++++++++++++++++
>>>>> arch/powerpc/include/asm/kvm_host.h | 16 ++++++++++++++++
>>>>> 2 files changed, 36 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/arch/powerpc/include/asm/kvm.h
>>>>>
>> b/arch/powerpc/include/
>>
>>>>> asm/kvm.h
>>>>> index 81f3b0b..b7f7861 100644
>>>>> --- a/arch/powerpc/include/asm/kvm.h
>>>>> +++ b/arch/powerpc/include/asm/kvm.h
>>>>> @@ -22,6 +22,9 @@
>>>>>
>>>>> #include <linux/types.h>
>>>>>
>>>>> +/* Select powerpc specific features in <linux/kvm.h> */
>>>>> +#define __KVM_HAVE_GUEST_DEBUG
>>>>> +
>>>>> struct kvm_regs {
>>>>> __u64 pc;
>>>>> __u64 cr;
>>>>> @@ -71,10 +74,27 @@ struct kvm_fpu {
>>>>> };
>>>>>
>>>>> struct kvm_debug_exit_arch {
>>>>> + __u32 exception;
>>>>> + __u32 pc;
>>>>> + __u32 status;
>>>>> };
>>>>>
>>>>> +#define KVM_INST_GUESTGDB 0x44000022
>>>>>
>>>>>
>>>> What instruction is this again? :) Is it something reserved for
>>>> purposes like this?
>>>>
>>>>
>>>>
>>> Just an invalid instruction which can generate program interrupt...
>>> I'm open to it's value btw.
>>>
>>>
>> Well this definitely doesn't generate a program interrupt. Or at least
>> it shouldn't :-).
>> I just remembered where I've seen an opcode like this before.
>> This is a
>> part of a dump of arch/powerpc/boot/ps3-hvcall.o
>>
>> 00000000 <lv1_get_logical_ppe_id>:
>> 0: 7c 08 02 a6 mflr r0
>> 4: 90 01 00 04 stw r0,4(r1)
>> 8: 94 21 ff f0 stwu r1,-16(r1)
>> c: 90 61 00 08 stw r3,8(r1)
>> 10: 39 60 00 45 li r11,69
>> 14: 44 00 00 22 sc 1
>>
>> So as you can see, this is the hypercall instruction for lv1.
>> IIRC beat
>> uses the same. I don't think we want to reuse that opcode for
>> ourselves.
>> Maybe one day someone figures it's a good idea to implement a
>> beat-style
>> ABI in KVM.
>>
>> But IIRC sc can take a lot of values, so we can just take sc 0x1234 or
>> so :-).
>>
>>
>>>>> +
>>>>> +#define KVM_GUESTDBG_USE_SW_BP 0x00010000
>>>>> +#define KVM_GUESTDBG_USE_HW_BP 0x00020000
>>>>> +
>>>>> +#define KVMPPC_DEBUG_NOTYPE 0x0
>>>>> +#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1)
>>>>> +#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2)
>>>>> +#define KVMPPC_DEBUG_WATCH_READ (1UL << 3)
>>>>> +
>>>>> /* for KVM_SET_GUEST_DEBUG */
>>>>> struct kvm_guest_debug_arch {
>>>>> + struct {
>>>>> + __u32 addr;
>>>>> + __u32 type;
>>>>> + } bp[6];
>>>>>
>>>>>
>>>> I can't look up the sources right now. Is this a struct that
>>>> 1:1 maps
>>>> to an ioctl struct? If so, we should add padding for a
>>>> possible future
>>>> extension of debug registers.
>>>>
>>>>
>>> Yes it's used by ioctl.
>>> What's the usually pad size?
>>>
>>>
>> I don't think there's a default. I just tend to pad it to something
>> reasonable. I guess in this case we can even just extend bp to 128
>> entries, add a reasonable amount of churn to the debug info
>> and be good:
>>
>> struct kvm_guest_debug_arch {
>> struct {
>> __u64 addr;
>> __u32 type;
>> __u32 pad1;
>> __u64 pad2;
>> } bp[128];
>> }
>>
>>
>
> Software breakpoint is maintained by qemu.
> Here it's only used by hardware breakpoint/watchpoint
> Is 128 much too large?
>
Well, it's only 3kb. And that way we're _really_ future-proof ;-).
Remember, this is only the interface to userspace. The data we keep
around in the kernel can be much smaller.
Alex
next prev parent reply other threads:[~2010-02-03 10:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 7:53 [PATCH RESEND 0/4] kvmppc/booke: add guest debug support Liu Yu
[not found] ` <1265183633-2230-1-git-send-email-yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2010-02-03 7:53 ` [PATCH 1/4] kvmppc: guest debug definitions Liu Yu
[not found] ` <1265183633-2230-2-git-send-email-yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2010-02-03 7:53 ` [PATCH 2/4] kvmppc/booke: switch shadow/host debug registers on guest enter/exit path Liu Yu
[not found] ` <1265183633-2230-3-git-send-email-yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2010-02-03 7:53 ` [PATCH 3/4] kvmppc/booke: guest debug support Liu Yu
[not found] ` <1265183633-2230-4-git-send-email-yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2010-02-03 7:53 ` [PATCH 4/4] kvmppc/booke: exit_nr fixup for guest debug single step Liu Yu
[not found] ` <1265183633-2230-5-git-send-email-yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2010-02-03 9:03 ` Alexander Graf
[not found] ` <DEFF369D-B8B0-4871-9786-BB39B122CAFD-l3A5Bk7waGM@public.gmane.org>
2010-02-03 9:24 ` Liu Yu-B13201
[not found] ` <0A1FE637C2C7E148B9573BB60CC630E5762ADE-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-02-03 10:14 ` Alexander Graf
[not found] ` <4B694C6C.3020903-l3A5Bk7waGM@public.gmane.org>
2010-02-03 11:14 ` Liu Yu-B13201
[not found] ` <0A1FE637C2C7E148B9573BB60CC630E5762AFC-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-02-03 11:19 ` Alexander Graf
2010-02-03 10:25 ` [PATCH 3/4] kvmppc/booke: guest debug support Jan Kiszka
2010-02-03 8:57 ` [PATCH 1/4] kvmppc: guest debug definitions Alexander Graf
2010-02-03 9:17 ` Liu Yu-B13201
2010-02-03 9:51 ` Alexander Graf
2010-02-03 10:35 ` Liu Yu-B13201
[not found] ` <0A1FE637C2C7E148B9573BB60CC630E5762AF7-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-02-03 10:37 ` Alexander Graf [this message]
2010-02-03 8:52 ` [PATCH RESEND 0/4] kvmppc/booke: add guest debug support Alexander Graf
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=4B6951E0.6080608@suse.de \
--to=agraf-l3a5bk7wagm@public.gmane.org \
--cc=B13201-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=hollis-yUx37fBWTUITNcAmw9vGhQ@public.gmane.org \
--cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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