From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40qnFj5TGczDqDv for ; Tue, 22 May 2018 17:24:09 +1000 (AEST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4M7JHhd115607 for ; Tue, 22 May 2018 03:24:07 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j4crncqj5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 22 May 2018 03:24:06 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 May 2018 08:24:04 +0100 From: Vaibhav Jain To: Michal Suchanek , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Balbir Singh , Nicholas Piggin , Breno Leitao , "Naveen N. Rao" , "Guilherme G. Piccoli" , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Michal Suchanek Subject: Re: [PATCH] powerpc/xmon: really enable xmon when a breakpoint is set In-Reply-To: <20180521132108.7938-1-msuchanek@suse.de> References: <20180521132108.7938-1-msuchanek@suse.de> Date: Tue, 22 May 2018 12:53:53 +0530 MIME-Version: 1.0 Content-Type: text/plain Message-Id: <87bmd8xieu.fsf@vajain21.in.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Thanks for the patch Michal, Michal Suchanek writes: > When single-stepping kernel code from xmon without a debug hook enabled > the kernel crashes. This can happen when kernel starts with xmon on > crash disabled but xmon is entered using sysrq. > > Commit e1368d0c9edb ("powerpc/xmon: Setup debugger hooks when first > break-point is set") adds force_enable_xmon function that prints > "xmon: Enabling debugger hooks" but does not enable them. Debugger hooks are enabled just befores debugger() is entered from sysrq_handle_xmon(). Thats why force_enable_xmon() simply sets sets 'xmon_on=1' and exits. The problem you are seeing is probably due to sysrq_handle_xmon() clearing the debugger hooks on return from debugger() as xmon_on was never set for the 's' xmon command. > Add the call to xmon_init to install the debugger hooks in > force_enable_xmon and also call force_enable_xmon when single-stepping > in xmon. Only calling force_enable_xmon() from do_step() should be suffice as on exit from the debugger() the value of xmon_on is checked and if required the debugger hooks are kept instead of getting cleared. > arch/powerpc/xmon/xmon.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c > index a0842f1ff72c..504bd1c3d8b0 100644 > --- a/arch/powerpc/xmon/xmon.c > +++ b/arch/powerpc/xmon/xmon.c > @@ -1275,6 +1279,7 @@ static inline void force_enable_xmon(void) > if (!xmon_on) { > printf("xmon: Enabling debugger hooks\n"); > xmon_on = 1; > + xmon_init(1); > } > } As mentioned above call to force_enable_xmon() is usually done in context of sysrq_handle_xmon() which sets the debugger hooks as soon as its entered. So I think that this hunk is not really needed. -- Vaibhav Jain Linux Technology Center, IBM India Pvt. Ltd.