From patchwork Fri Feb 17 00:17:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 728957 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vPYZP5lNTz9s8B for ; Fri, 17 Feb 2017 11:20:13 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vPYZP4wdYzDqNd for ; Fri, 17 Feb 2017 11:20:13 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org 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 3vPYXV5NzVzDqHB for ; Fri, 17 Feb 2017 11:18:34 +1100 (AEDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1H0EM3w082426 for ; Thu, 16 Feb 2017 19:18:32 -0500 Received: from e24smtp03.br.ibm.com (e24smtp03.br.ibm.com [32.104.18.24]) by mx0a-001b2d01.pphosted.com with ESMTP id 28nnyah7n2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 16 Feb 2017 19:18:32 -0500 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Feb 2017 22:18:29 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 16 Feb 2017 22:18:27 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id C7D4E3520070 for ; Thu, 16 Feb 2017 19:17:53 -0500 (EST) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1H0IRpT34275382 for ; Thu, 16 Feb 2017 22:18:27 -0200 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1H0IQSN023511 for ; Thu, 16 Feb 2017 22:18:27 -0200 Received: from localhost ([9.85.166.85]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1H0IPN9023489; Thu, 16 Feb 2017 22:18:26 -0200 From: "Guilherme G. Piccoli" To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/3] powerpc/xmon: drop the nobt option from xmon plus minor fixes Date: Thu, 16 Feb 2017 22:17:56 -0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487290677-7200-1-git-send-email-gpiccoli@linux.vnet.ibm.com> References: <1487290677-7200-1-git-send-email-gpiccoli@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021700-0024-0000-0000-000001549F42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021700-0025-0000-0000-00001619A1D0 Message-Id: <1487290677-7200-3-git-send-email-gpiccoli@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-16_15:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702170002 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gpiccoli@linux.vnet.ibm.com, xinhui.pan@linux.vnet.ibm.com, npiggin@gmail.com, paulus@samba.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The xmon parameter nobt was added long time ago, by commit 26c8af5f01df ("[POWERPC] print backtrace when entering xmon"). The problem that time was that during a crash in a machine with USB keyboard, xmon wouldn't respond to commands from the keyboard, so printing the backtrace wouldn't be possible. Idea then was to show automatically the backtrace on xmon crash for the first time it's invoked (if it recovers, next time xmon won't show backtrace automatically). The nobt parameter was added _only_ to prevent this automatic trace show. Seems long time ago USB keyboards didn't work that well! We don't need it anymore, but the feature of auto showing the backtrace on first crash seems interesting (imagine a case of auto-reboot script), so this patch keeps the functionality, yet removes the nobt parameter. Also, this patch fixes __initdata placement on xmon_early and replaces __initcall() with modern device_initcall() on sysrq handler. Signed-off-by: Guilherme G. Piccoli --- arch/powerpc/xmon/xmon.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index f6e5c3d..03f5d65 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -185,7 +185,7 @@ static void dump_tlb_44x(void); static void dump_tlb_book3e(void); #endif -static int xmon_no_auto_backtrace; +static bool xmon_no_auto_backtrace; #ifdef CONFIG_PPC64 #define REG "%.16lx" @@ -882,7 +882,7 @@ cmds(struct pt_regs *excp) xmon_regs = excp; if (!xmon_no_auto_backtrace) { - xmon_no_auto_backtrace = 1; + xmon_no_auto_backtrace = true; xmon_show_stack(excp->gpr[1], excp->link, excp->nip); } @@ -3248,11 +3248,17 @@ static void xmon_init(int enable) #ifdef CONFIG_MAGIC_SYSRQ static void sysrq_handle_xmon(int key) { + bool autobt_state = xmon_no_auto_backtrace; + + xmon_no_auto_backtrace = true; /* ensure xmon is enabled */ xmon_init(1); + debugger(get_irq_regs()); if (xmon_off) xmon_init(0); + + xmon_no_auto_backtrace = autobt_state; } static struct sysrq_key_op sysrq_xmon_op = { @@ -3266,10 +3272,10 @@ static int __init setup_xmon_sysrq(void) register_sysrq_key('x', &sysrq_xmon_op); return 0; } -__initcall(setup_xmon_sysrq); +device_initcall(setup_xmon_sysrq); #endif /* CONFIG_MAGIC_SYSRQ */ -static int __initdata xmon_early; +static int xmon_early __initdata; static int __init early_parse_xmon(char *p) { @@ -3281,8 +3287,6 @@ static int __init early_parse_xmon(char *p) xmon_off = 0; else if (strncmp(p, "off", 3) == 0) xmon_off = 1; - else if (strncmp(p, "nobt", 4) == 0) - xmon_no_auto_backtrace = 1; else return 1;