All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
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 4/4] kvmppc/booke: exit_nr fixup for guest debug single
Date: Wed, 03 Feb 2010 11:19:07 +0000	[thread overview]
Message-ID: <4B695BAB.2070000@suse.de> (raw)
In-Reply-To: <0A1FE637C2C7E148B9573BB60CC630E5762AFC-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>

Liu Yu-B13201 wrote:
>  
>
>   
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de] 
>> Sent: Wednesday, February 03, 2010 6:14 PM
>> To: Liu Yu-B13201
>> Cc: hollis@penguinppc.org; kvm-ppc@vger.kernel.org; 
>> kvm@vger.kernel.org
>> Subject: Re: [PATCH 4/4] kvmppc/booke: exit_nr fixup for 
>> guest debug single step
>>
>> Liu Yu-B13201 wrote:
>>     
>>>  
>>>
>>>   
>>>       
>>>> -----Original Message-----
>>>> From: kvm-ppc-owner@vger.kernel.org 
>>>> [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Alexander Graf
>>>> Sent: Wednesday, February 03, 2010 5:03 PM
>>>> To: Liu Yu-B13201
>>>> Cc: hollis@penguinppc.org; kvm-ppc@vger.kernel.org; 
>>>> kvm@vger.kernel.org; Liu Yu-B13201
>>>> Subject: Re: [PATCH 4/4] kvmppc/booke: exit_nr fixup for 
>>>> guest debug single step
>>>>
>>>>
>>>> Am 03.02.2010 um 08:53 schrieb Liu Yu <yu.liu@freescale.com>:
>>>>
>>>>     
>>>>         
>>>>> As BOOKE doesn't have hardware support for virtualization,
>>>>> hardware never know who's guest and host.
>>>>>
>>>>> When enable hardware single step in guest,
>>>>> we cannot disabled it at the point we switch back to host.
>>>>>       
>>>>>           
>>>> Why not? We directly arrive in our code. So we can just 
>>>> disable it, no?
>>>>
>>>> Or does that break when you'd try to debug the guest 
>>>> interrupt handlers?
>>>>     
>>>>         
>>> That's the hardware limitition.
>>> Assume received itlb miss interrupt, but it doesn't clear 
>>>       
>> MSR_DE in MSR,
>>     
>>> so on the exit path single step still work and then debug 
>>>       
>> interrupt is
>>     
>>> triggled.
>>>   
>>>       
>> MSRDE is set to 0 by critical class interrupts
>> unless Category E.ED is supported, by Debug                   
>> interrupts, and by Machine Check interrupts,                  
>> and is left unchanged by all other interrupts.                
>>
>> Great.
>>
>> So when single stepping is enabled, you jump into the guest, 
>> get an itlb
>> miss, get out, still have DE set, get in KVM's own DE handler and can
>> process things from there.
>>
>> Could you check if the debug instruction was on PR=0? If so, you can
>> just rfi and be good, right?
>>
>>     
>
> Hr?
> The moment we found this happen we've already saved the guest and loaded host on exit path
> Rfi will make exit path again which means save guest again.
>   

Well the guest saving code is in our hands. So we can just modify the
debug interrupt handler in booke_interrupts.S to check for PR=0 first
thing and then decide whether to save to guest state or return to the
host kernel.

I think that'd make it a lot cleaner.

Alex


WARNING: multiple messages have this Message-ID (diff)
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 4/4] kvmppc/booke: exit_nr fixup for guest debug single step
Date: Wed, 03 Feb 2010 12:19:07 +0100	[thread overview]
Message-ID: <4B695BAB.2070000@suse.de> (raw)
In-Reply-To: <0A1FE637C2C7E148B9573BB60CC630E5762AFC-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 6:14 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 4/4] kvmppc/booke: exit_nr fixup for 
>> guest debug single step
>>
>> 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 5:03 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 4/4] kvmppc/booke: exit_nr fixup for 
>>>> guest debug single step
>>>>
>>>>
>>>> Am 03.02.2010 um 08:53 schrieb Liu Yu <yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>:
>>>>
>>>>     
>>>>         
>>>>> As BOOKE doesn't have hardware support for virtualization,
>>>>> hardware never know who's guest and host.
>>>>>
>>>>> When enable hardware single step in guest,
>>>>> we cannot disabled it at the point we switch back to host.
>>>>>       
>>>>>           
>>>> Why not? We directly arrive in our code. So we can just 
>>>> disable it, no?
>>>>
>>>> Or does that break when you'd try to debug the guest 
>>>> interrupt handlers?
>>>>     
>>>>         
>>> That's the hardware limitition.
>>> Assume received itlb miss interrupt, but it doesn't clear 
>>>       
>> MSR_DE in MSR,
>>     
>>> so on the exit path single step still work and then debug 
>>>       
>> interrupt is
>>     
>>> triggled.
>>>   
>>>       
>> MSRDE is set to 0 by critical class interrupts
>> unless Category E.ED is supported, by Debug                   
>> interrupts, and by Machine Check interrupts,                  
>> and is left unchanged by all other interrupts.                
>>
>> Great.
>>
>> So when single stepping is enabled, you jump into the guest, 
>> get an itlb
>> miss, get out, still have DE set, get in KVM's own DE handler and can
>> process things from there.
>>
>> Could you check if the debug instruction was on PR=0? If so, you can
>> just rfi and be good, right?
>>
>>     
>
> Hr?
> The moment we found this happen we've already saved the guest and loaded host on exit path
> Rfi will make exit path again which means save guest again.
>   

Well the guest saving code is in our hands. So we can just modify the
debug interrupt handler in booke_interrupts.S to check for PR=0 first
thing and then decide whether to save to guest state or return to the
host kernel.

I think that'd make it a lot cleaner.

Alex

  parent reply	other threads:[~2010-02-03 11:19 UTC|newest]

Thread overview: 34+ 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
2010-02-03  7:53 ` 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
2010-02-03  7:53     ` 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
2010-02-03  7:53         ` 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
2010-02-03  7:53             ` 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
2010-02-03  7:53                 ` Liu Yu
     [not found]                 ` <1265183633-2230-5-git-send-email-yu.liu-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2010-02-03  9:03                   ` Alexander Graf
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
2010-02-03  9:24                         ` Liu Yu-B13201
     [not found]                         ` <0A1FE637C2C7E148B9573BB60CC630E5762ADE-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-02-03 10:14                           ` [PATCH 4/4] kvmppc/booke: exit_nr fixup for guest debug single Alexander Graf
2010-02-03 10:14                             ` [PATCH 4/4] kvmppc/booke: exit_nr fixup for guest debug single step Alexander Graf
     [not found]                             ` <4B694C6C.3020903-l3A5Bk7waGM@public.gmane.org>
2010-02-03 11:14                               ` Liu Yu-B13201
2010-02-03 11:14                                 ` Liu Yu-B13201
     [not found]                                 ` <0A1FE637C2C7E148B9573BB60CC630E5762AFC-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-02-03 11:19                                   ` Alexander Graf [this message]
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 10:25               ` Jan Kiszka
2010-02-03  8:57     ` [PATCH 1/4] kvmppc: guest debug definitions Alexander Graf
2010-02-03  8:57       ` Alexander Graf
2010-02-03  9:17       ` Liu Yu-B13201
2010-02-03  9:17         ` Liu Yu-B13201
2010-02-03  9:51         ` Alexander Graf
2010-02-03  9:51           ` Alexander Graf
2010-02-03 10:35           ` Liu Yu-B13201
2010-02-03 10:35             ` Liu Yu-B13201
     [not found]             ` <0A1FE637C2C7E148B9573BB60CC630E5762AF7-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-02-03 10:37               ` Alexander Graf
2010-02-03 10:37                 ` Alexander Graf
2010-02-03  8:52   ` [PATCH RESEND 0/4] kvmppc/booke: add guest debug support Alexander Graf
2010-02-03  8:52     ` 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=4B695BAB.2070000@suse.de \
    --to=agraf@suse.de \
    --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 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.