From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755649Ab0G1RI6 (ORCPT ); Wed, 28 Jul 2010 13:08:58 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:33120 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751894Ab0G1RIy (ORCPT ); Wed, 28 Jul 2010 13:08:54 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=i5tJKDo2tzov/8K52HLO3UGGBiN9UxZC2oJkBQXWd0smfNk6P00I3ToYC+F2T5RFz0 jg4d5ioUiN8CKAQN4DQwsNvZdPP59aixELqrmAsezdSZ0ri9VM6BT+T/+olGeZvtOQ/n kT8M6g/R7vCMWpBsMxf2pFNRC0QWAOjXjZtqY= Date: Wed, 28 Jul 2010 19:08:57 +0200 From: Frederic Weisbecker To: DDD Cc: Jason Wessel , will.deacon@arm.com, lethal@linux-sh.org, mahesh@linux.vnet.ibm.com, prasad@linux.vnet.ibm.com, benh@kernel.crashing.org, paulus@samba.org, mingo@elte.hu, kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] hw-breakpoints, kgdb, x86: add a flag topassDIE_DEBUG notification Message-ID: <20100728170854.GC5394@nowhere> References: <1279851361-32604-1-git-send-email-dongdong.deng@windriver.com> <20100723130430.GA5255@nowhere> <4C4996FA.2010301@windriver.com> <20100723140745.GB5255@nowhere> <4C49BA00.5030200@windriver.com> <20100723161746.GD5255@nowhere> <4C4D6DD3.80909@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C4D6DD3.80909@windriver.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 26, 2010 at 07:13:23PM +0800, DDD wrote: > Frederic Weisbecker wrote: >> Why? It seems to me a kernel debugger should have the highest priority >> over anything. > > In my option, the reason of kgdb set the lowest-prio for > notifier is: > > For letting kgdb to keep simple, there is no codes to check the > breakpoint event was generated by kgdb or not, thus it have to set kgdb > as lowest priority to notifier. > > If the breakpoint event is not generated by kgdb, the source of the > breakpoint event will consume that event before passing to kgdb's > routine, so that the breakpoint event of kgdb getting must be generated > by kgdb itself. Ok, but that makes it hard to differentiate from a spurious breakpoint event. >> >> >> >>>> - Always returning NOTIFY_DONE from the breakpoint path. >>>> >>>> >>> Without some further investigation, I am not sure what this will do. >> >> >> >> Nothing, this NOTIFY_STOP is only an optimization. But now I think that >> won't solve the problem. We still clear a dr6 trap bit for a debug >> exception due to lazy dr7 switches we have to handle. >> >> This is why kgdb should have the highest priority, or use the overflow >> callback. > > > OK, I will try to use the overflow callback to let kgdb works with > hw_breakpoints. :-) > > Thanks, > Dongdong Thanks. kgdb sets breakpoints through arch_install_hw_breakpoint() So when it triggers, it will be handled by perf through perf_bp_event(), so it's quite natural it is considered as handled and then it's bit removed from dr6. The only way for kgdb to handle it properly is to set an overflow_handler. Tell me if you encounter any problem.