Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1238889imm; Tue, 22 May 2018 00:25:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqx9zsWq0P4mSZ1/Ino+xL1vDxenS5m1L6MdSFBpU8eNSNwKp5tZWM+kNq+yhxsDAoRAuBw X-Received: by 2002:a17:902:5309:: with SMTP id b9-v6mr24026881pli.187.1526973919907; Tue, 22 May 2018 00:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526973919; cv=none; d=google.com; s=arc-20160816; b=x+InH9ORk0xNyFSxPWGQKUM3kyHciGDXjs0dbaLPYm8+iMR+eWGUq2dxonQ3BUvcqi qlX5/Vd5Uz7qyo1R9SbDg7MicCGlw5vp2P9aWgVf8fvOx7eJubnPWyyC7bwpVdSF5iJK oR9+J2Mn8L+vpV6cOLBdPLdg6Hz6rAZnYeuqaD3wA1sGMnw1NLb/CFMvkZ9sxL7c/Qzt xv09y8s8ujSbM/EfT8mW3UG1I0U51d4aYpECZh8lxvnYIzb3GE75LAHm4UouYmcP9bGF Uiba9uZ2t9AR8+4AlQ/Ykwe5JDW8crRhPcTyj71jjqW23qnzLPYoqjbUt8Sk1iAB+3vX ITMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:date:references :in-reply-to:subject:cc:to:from:arc-authentication-results; bh=fuVkBy0az/hUgLHRX94GB0UF7+Ivj9DTTvNG2hPqkdM=; b=s1/mQ3IDC2PiUV3YCz67cGQ7EUqniC6UuhusuCqabOPuouiyu+67uIyVNgSsySGh0p rHk6rnrEIFqCjg8w5HZu5RCwIOJ0MzFkpqFaqhikiDq4jl62hLbuAjvPpy5fdXlfP7kM /fuPzKLBMtwhyqTWhnszghOhEYz6Jbw7JSfdBSZKMobZXOGxpL5xkUM4lqWdg1gq18p7 teHBA2W2wltUTyMpu62tpvB2Hr/hlY0j4/g1dqSCadXml7yK9tbKohFSC2q/4FFx8UDM vY/gC+GfNmsfl8Wa2rxYPc4IUqX6kbdcyJOKeTNaaclt/GMUNYcjteQWasLZ8B5yoNNu UoQw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u17-v6si15885762plj.182.2018.05.22.00.25.05; Tue, 22 May 2018 00:25:19 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbeEVHYQ (ORCPT + 99 others); Tue, 22 May 2018 03:24:16 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51220 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751106AbeEVHYH (ORCPT ); Tue, 22 May 2018 03:24:07 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4M7IvrX130646 for ; Tue, 22 May 2018 03:24:06 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j4dft31t5-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 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 22 May 2018 08:24:01 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4M7O0Yh52559912; Tue, 22 May 2018 07:24:00 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7B1B4C04A; Tue, 22 May 2018 08:15:42 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DBEB4C040; Tue, 22 May 2018 08:15:37 +0100 (BST) Received: from vajain21.in.ibm.com (unknown [9.85.179.187]) by d06av22.portsmouth.uk.ibm.com (Postfix) with SMTP; Tue, 22 May 2018 08:15:37 +0100 (BST) Received: by vajain21.in.ibm.com (sSMTP sendmail emulation); Tue, 22 May 2018 12:53:53 +0530 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 X-TM-AS-GCONF: 00 x-cbid: 18052207-0044-0000-0000-000005550CC6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052207-0045-0000-0000-00002896986A Message-Id: <87bmd8xieu.fsf@vajain21.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-22_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805220088 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.