linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Roland McGrath <roland@redhat.com>,
	akpm@linux-foundation.org, mingo@elte.hu,
	jason.wessel@windriver.com, richardj_moore@uk.ibm.com
Subject: Re: [RFC Patch 0/9] Hardware Breakpoint interfaces
Date: Tue, 7 Oct 2008 22:15:35 +0530	[thread overview]
Message-ID: <20081007164535.GA4130@in.ibm.com> (raw)
In-Reply-To: <48EB7406.1010509@redhat.com>

On Tue, Oct 07, 2008 at 04:36:54PM +0200, Avi Kivity wrote:
> K.Prasad wrote:
>> On Tue, Oct 07, 2008 at 02:29:05PM +0200, Avi Kivity wrote:
>>   
>>> K.Prasad wrote:
>>>     
>>>> - Enable KGDB and KVM to use the register_kernel_hw_breakpoint()
>>>>   interface for their HW Breakpoint usage, in the absence of which
>>>>   they will be broken during simultaneous use.
>>>>         
>>> KVM conceptually isn't a kernel use of the debug registers.  KVM   
>>> modifies the debug registers while the guest is running, and restores 
>>>  them after the guest returns.
>>>
>>> Right now, as an optimization, KVM defers restoring the debug 
>>> registers  until after the next context switch out of the kvm task, 
>>> or until the  next exit to userspace (whichever comes earlier); we 
>>> should change this  to avoid the deferral if kernel breakpoints are 
>>> in effect.  This will  allow simultaneous use of KVM breakpoints and 
>>> kernel breakpoints.
>>>
>>>     
>> The patch posted provides interface for using HW breakpoints on both
>> user- and kernel-space breakpoints. KVM's user-space address breakpoint
>> requirements, after code-modification, should be made to use
>> register_user_hw_breakpoint() interface (presently un-exported but will
>> be changed subsequently) to help maintain a system-wide consistent view on the
>> availability of HW Breakpoint registers.
>>
>>   
>
> Correcting myself, actually kvm breakpoints are in a third namespace.   
> You could have kernel breakpoints, user breakpoints, and guest  
> breakpoints coexisting.
>
>> Presently I find plenty of set_debugreg() calls from kvm/ which will
>> modify the registers directly and break the breakpoint register
>> management brought-in through the patch.
>>   
>
> If kvm restores the registers, should there be any problem?
>
No, it should be fine although I don't understand how the exception
handler is invoked in KVM without the use of notifier or a hook in
die_debug (or have they replaced code at a layer much below that?).

Apart from the doubt I've stated above, if they operate by replacing
the breakpoint register contents before a context switch from KVM to
other processes, they might in fact help maximise its utilisation.

Thanks for the clarification!

Thanks,
K.Prasad


  reply	other threads:[~2008-10-07 16:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07 11:38 [RFC Patch 0/9] Hardware Breakpoint interfaces K.Prasad
2008-10-07 11:40 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
2008-10-07 15:21   ` Alan Stern
2008-10-07 16:49     ` K.Prasad
2008-10-07 11:41 ` [RFC Patch 2/9] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2008-10-07 15:36   ` Alan Stern
2008-10-07 17:23     ` K.Prasad
2008-10-07 17:38       ` Alan Stern
2008-10-07 17:28     ` K.Prasad
2008-10-07 11:42 ` [RFC Patch 3/9] Modifying generic debug exception to use virtual debug registers K.Prasad
2008-10-07 11:43 ` [RFC Patch 4/9] Modify kprobe exception handler to recognise single-stepping by HW Breakpoint handler K.Prasad
2008-10-07 11:44 ` [RFC Patch 5/9] Use wrapper routines around debug registers in processor related functions K.Prasad
2008-10-07 11:44 ` [RFC Patch 6/9] Use virtual debug registers in process/thread handling code K.Prasad
2008-10-07 15:40   ` Alan Stern
2008-10-07 17:48     ` K.Prasad
2008-10-07 11:45 ` [RFC Patch 7/9] Modify signal handling code to refrain from re-enabling HW Breakpoints K.Prasad
2008-10-07 11:46 ` [RFC Patch 8/9] Modify Ptrace to use wrapper routines to access breakpoint registers K.Prasad
2008-10-07 11:46 ` [RFC Patch 9/9] Cleanup HW Breakpoint registers before kexec K.Prasad
2008-10-07 12:29 ` [RFC Patch 0/9] Hardware Breakpoint interfaces Avi Kivity
2008-10-07 14:32   ` K.Prasad
2008-10-07 14:36     ` Avi Kivity
2008-10-07 16:45       ` K.Prasad [this message]
2008-10-07 16:52         ` Avi Kivity

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=20081007164535.GA4130@in.ibm.com \
    --to=prasad@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=richardj_moore@uk.ibm.com \
    --cc=roland@redhat.com \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).