From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [59.145.155.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e28smtp03.in.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 0231BDE198 for ; Thu, 21 May 2009 17:15:16 +1000 (EST) Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by e28smtp03.in.ibm.com (8.13.1/8.13.1) with ESMTP id n4L7F7gA029986 for ; Thu, 21 May 2009 12:45:07 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4L7F7qi1900752 for ; Thu, 21 May 2009 12:45:07 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.13.1/8.13.3) with ESMTP id n4L7F6JN015815 for ; Thu, 21 May 2009 17:15:07 +1000 Date: Thu, 21 May 2009 12:45:05 +0530 From: "K.Prasad" To: Alan Stern Subject: Re: [RFC Patch 2/6] Introduce PPC64 specific Hardware Breakpointinterfaces Message-ID: <20090521071505.GB9344@in.ibm.com> References: <20090518161055.GA27641@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Cc: Michael Neuling , Benjamin Herrenschmidt , linuxppc-dev@ozlabs.org, paulus@samba.org, Roland McGrath Reply-To: prasad@linux.vnet.ibm.com List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, May 18, 2009 at 12:30:41PM -0400, Alan Stern wrote: > On Mon, 18 May 2009, K.Prasad wrote: > > > > > > > +int __kprobes hw_breakpoint_handler(struct die_args *args) > > > > > > +{ > > > > > > + int rc = NOTIFY_STOP; > > > > > > + struct hw_breakpoint *bp; > > > > > > + struct pt_regs *regs = args->regs; > > > > > > + unsigned long dar; > > > > > > + int cpu, stepped, is_kernel; > > > > > > + > > > > > > + /* Disable breakpoints during exception handling */ > > > > > > + set_dabr(0); > > > > > > + > > > > > > + dar = regs->dar & (~HW_BREAKPOINT_ALIGN); > > > > > > + is_kernel = (dar >= TASK_SIZE) ? 1 : 0; > > > > > > > > > > is_kernel_addr() ? > > > > > > > > > > > > > Ok. > > > > > > Shouldn't this test hbp_kernel_pos instead? > > > > > > > Testing hbp_kernel_pos should be sufficient for PPC64 with just one > > breakpoint register. However the above code is more extensible to other > > PowerPC implementations which have more than one breakpoint register. > > Then maybe you don't want to test this at all. Just compare the dar > value with each of the breakpoint addresses. That's more like what the > x86 code does. > > Alan Stern > Comparing the DAR register value with each breakpoint address is required to determine if the exception is the cause of a breakpoint hit and I've added the code to hw_breakpoint_handler(). With this check in place, I find that using hbp_kernel_pos to determine kernel/user space origin is much easier (as you suggested) and the code is modified accordingly. Please find the changes in the new patchset being sent. Thanks, K.Prasad