Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1144346imm; Wed, 23 May 2018 10:59:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZostEfd1148D6qdN1MCZvhg6oNCGg/X0FxgS9ZK5nkAQf4Vrb4Jl0go0Sihe5mhNPctVJxW X-Received: by 2002:a62:2218:: with SMTP id i24-v6mr3829829pfi.53.1527098358043; Wed, 23 May 2018 10:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527098358; cv=none; d=google.com; s=arc-20160816; b=bxSvrVOa3aNYGLEkOjOz/1yrI3biN8mG8G5ZA0nPc86lPLpkWx2ub+ykr8IpzH47XU RPDl3L9JRdI1GCRLsjmpIA0yLV/bqzR5wBiiy+1NEn5EJ5X05ZST6ZQHCZpDupt0v22J 8g4lrDIsVN/BNmouiWNYeenztk9YsQHYc9Fx2RRrtYBq1l4bG4gyW5LK2A42SkOJqhfg RJ5Z5hRRyMz5CFjk/oa6LzKm0ryUnuw7h1HxhpqSJ7pYlcA406QyKqf30sEsRMI5qDJR Mipi3u00VgfGMfvS3FJH0NE5aceW9R1bihMOyvejOBEvhsWxorNnZ8y8zAM8Sqbb/6BI FB2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=3y6tkPtzyhz4AoauYQiGP0zyEzNaOZannMRgwsoqxos=; b=JQFi951xn4OLnCjQJpiGiXbasfkYH/M6C+fSIk50Y2buNp2NcZwWKwtrr5QpiYqVYn GQtREG7ZZA+NiHZ204GfxRtGAIVvUGcyYHhoWzMJPHgTmjMGd04+DcO643DCZnKstjQ2 r1fESpRldEE+3O2E+IU2rqYRuPdSFvNyCXzK4cso35OyXL2texYLM1tG921Ms2cw1/i0 YZBnLlEIsXZiw86Dhf2W1v3YEGMeQeGhRbHsceAsyGQPt7+9kG3G59VfkJTl4AMqvDdG jkUYgfjj74zVIQBo8x/OJxbePGCMio3OgRRAE98kX7X/zEqzPWvTIoTw3+U4/EGMszux yn4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2-v6si18283734pfh.346.2018.05.23.10.59.02; Wed, 23 May 2018 10:59:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933750AbeEWR6e (ORCPT + 99 others); Wed, 23 May 2018 13:58:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:50545 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754623AbeEWR6b (ORCPT ); Wed, 23 May 2018 13:58:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 502AAAF3C; Wed, 23 May 2018 17:58:30 +0000 (UTC) Date: Wed, 23 May 2018 19:58:28 +0200 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= To: Vaibhav Jain Cc: 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 Subject: Re: [PATCH] powerpc/xmon: really enable xmon when a breakpoint is set Message-ID: <20180523195828.764f4356@kitsune.suse.cz> In-Reply-To: <87bmd8xieu.fsf@vajain21.in.ibm.com> References: <20180521132108.7938-1-msuchanek@suse.de> <87bmd8xieu.fsf@vajain21.in.ibm.com> Organization: SUSE Linux X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 May 2018 12:53:53 +0530 Vaibhav Jain wrote: > 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. Indeed, setting xmon_on is sufficient. Will resend the patch. Thanks Michal > > > 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. > >