From patchwork Wed Aug 29 10:17:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 10579799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AB4F920 for ; Wed, 29 Aug 2018 10:18:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 199EB2A996 for ; Wed, 29 Aug 2018 10:18:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E0762A99A; Wed, 29 Aug 2018 10:18:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 018472A996 for ; Wed, 29 Aug 2018 10:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:To:Subject :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=HDP9aohHqXl78EZFvnkMbYb5grOSjzdzbhxkOVsImQQ=; b=ZLz4ssLgNlRvfV YMxa6r77RpAI6Fv1QFPhn9n6nwEORGh6pe7wr5MaubOrTMUfPG4XM/L1247x7d4bTGl2CRHcvUoj/ bIQYiwtC4UtNJLvAVJVG0K3039HvrDkaZKzTlwvrtvVJ5Otmw+7h9h+jTrvi7vRt0kGNewsbjCnm4 YLLEeSBR/uBMulVwjLYRugw0/3oeTehffM68fR37b6vcEBOIhmnKnHiJ5VMJ9KFBBw7agnCOp9sbM RdK7/uIK6wTqwgWDYA7+0KiJTitmgnpJhuvufpcaxtyN1b2Ngdqdky/V4OD04sPerdIlSzvjGPtFB bsp4ZXNJ4MQ5zLNI5Udg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuxYL-0002JF-PG; Wed, 29 Aug 2018 10:18:21 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuxYI-0002Ij-4B for linux-arm-kernel@lists.infradead.org; Wed, 29 Aug 2018 10:18:20 +0000 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5DBECAA613355; Wed, 29 Aug 2018 18:18:01 +0800 (CST) Received: from [127.0.0.1] (10.177.23.32) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.399.0; Wed, 29 Aug 2018 18:17:55 +0800 From: Ding Tianhong Subject: [PATCH RESEND] arm64: don't dump stack for usermode address in show_regs To: Catalin Marinas , , , Mark Rutland , "linux-arm-kernel@lists.infradead.org" , LinuxArm Message-ID: <0003f02c-fc35-b4e9-3d3d-82ee8d02acb7@huawei.com> Date: Wed, 29 Aug 2018 18:17:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-Originating-IP: [10.177.23.32] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180829_031818_374568_87F5760A X-CRM114-Status: GOOD ( 12.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP I met this problem when do some testcase on my arm64 board system: 160935.412546] BUG: soft lockup - CPU#0 stuck for 116s! [cce_hlt_no_shar:12141] [160935.413292] CPU: 0 PID: 12141 Comm: cce_hlt_no_shar Tainted: G [160935.413429] Hardware name: Hisilicon Phosphorxxxx ESL (DT) [160935.413571] task: ffff800024efe300 ti: ffff80001670c000 task.ti: ffff80001670c000 [160935.413711] PC is at 0xffffa0bf76b0 [160935.413818] LR is at 0xffffa0c003a8 [160935.413936] pc : [<0000ffffa0bf76b0>] lr : [<0000ffffa0c003a8>] pstate: 20000000 [160935.414060] sp : 0000ffff9ed56d00 [160935.414157] x29: 0000ffff9ed56d00 x28: 0000ffffa0eae6f0 [160935.414307] x27: 0000ffff9ed57c60 x26: 0000000000000000 [160935.414456] x25: 0000ffffa0a33250 x24: 0000000000001000 [160935.414605] x23: 0000ffffa0a37320 x22: 0000ffffa0eae000 [160935.414754] x21: 0000000000002d2a x20: 0000ffff9ed58840 [160935.414903] x19: 0000000000000005 x18: 0000ffffcda37490 [160935.415053] x17: 0000ffffa0c0033c x16: 0000ffffa0c4cc60 [160935.415206] x15: 00312d6898000000 x14: 0000ffffa0c2670e [160935.415354] x13: 000000000000016e x12: 0000000000000000 [160935.415502] x11: 0000ffff9ed56e00 x10: 0000000000000020 [160935.415652] x9 : 2079726f00000000 x8 : 0000000000000040 [160935.415796] x7 : 0000000000000000 x6 : 0000ffff9ed58290 [160935.415943] x5 : 0000000000000000 x4 : 0000000000000000 [160935.416089] x3 : 0000000000000000 x2 : 0000000000000000 [160935.416236] x1 : 00000000ffff0000 x0 : 0000000000000005 [160935.416371] Call trace: [160935.416477] Unable to handle kernel paging request at virtual address ffff9ed56d00 [160935.416604] pgd = ffff800011991000 [160935.416705] [ffff9ed56d00] *pgd=00000000193a0003, *pud=000000001e447003, .... [160935.416954] Internal error: Oops: 9600000f [#1] SMP [160935.417686] CPU: 0 PID: 12141 Comm: cce_hlt_no_shar Tainted: G [160935.417822] Hardware name: Hisilicon Phosphorxxxx ESL (DT) [160935.417964] task: ffff800024efe300 ti: ffff80001670c000 task.ti: ffff80001670c000 [160935.418138] PC is at unwind_frame+0x38/0x60 [160935.418287] LR is at dump_backtrace+0x58/0x148 160935.418413] pc : [] lr : [] pstate: 404001c5 [160935.418540] sp : ffff80001670fbe0 [160935.418635] x29: ffff80001670fbe0 x28: 00000000ee6b2800 [160935.418785] x27: ffff8000281aa3a0 x26: ffff800000941388 [160935.418937] x25: ffff80001670feb0 x24: 0000000000000074 [160935.419088] x23: ffff800000815598 x22: ffff800000081800 [160935.419240] x21: ffff800000081000 x20: ffff800000941388 [160935.419391] x19: 0000ffffa0bf76b0 x18: 0000000000000010 [160935.419540] x17: 0000ffffa0c0033c x16: 0000ffffa0c4cc60 [160935.419689] x15: 0000000000000000 x14: ffff800080a732b7 [160935.419841] x13: ffff800000a732c6 x12: 0000000000000002 [160935.419987] x11: 0000000000000000 x10: 0000000000027ea8 [160935.420134] x9 : 0000000000000000 x8 : 0000000000065a73 [160935.420284] x7 : ffff800000961568 x6 : ffff8000003e2e70 [160935.420431] x5 : 0000000000000001 x4 : 0000000000000000 [160935.420578] x3 : 0000ffff9ed56d10 x2 : 0000ffff9ed56d00 [160935.420725] x1 : 0000000000000000 x0 : ffff80001670fc20 [160935.420896] Process cce_hlt_no_shar (pid: 12141, stack limit = 0xffff80001670c020) ...... [160935.427658] Call trace: [160935.427804] [] unwind_frame+0x38/0x60 [160935.427961] [] show_regs+0x20/0x30 [160935.428123] [] watchdog_timer_fn+0x204/0x260 [160935.428292] [] __run_hrtimer+0x60/0x208 [160935.428464] [] hrtimer_interrupt+0xf8/0x288 [160935.428627] [] arch_timer_handler_phys+0x30/0x40 [160935.428792] [] handle_percpu_devid_irq+0x84/0x230 [160935.428971] [] generic_handle_irq+0x34/0x50 [160935.429148] [] __handle_domain_irq+0x5c/0xb0 [160935.429299] [] gic_handle_irq+0xac/0x1b4 --------------------------------- cut here -------------------------------------- Obviously the cce_hlt_no_shar was in loop issues, the soft watchdog catch this error and try to dump stack, then the bug hit. The reason is that the patch 1149aad10b ("arm64: Add dump_backtrace() in show_regs") would help to dump the stack when debug in the socklockups, but if the issues happened in the user space, it will be errors when dumping the usermode address in kernel, so fix this problem by avoid dumping stack for usermode address in show_regs. Fixes: 1149aad10b ("arm64: Add dump_backtrace() in show_regs") Signed-off-by: Ding Tianhong --- arch/arm64/kernel/process.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 7f1628e..454825a 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -249,7 +249,9 @@ void __show_regs(struct pt_regs *regs) void show_regs(struct pt_regs * regs) { __show_regs(regs); - dump_backtrace(regs, NULL); + + if (!user_mode(regs)) + dump_backtrace(regs, NULL); } static void tls_thread_flush(void)