From patchwork Fri Sep 1 16:00:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 808766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cuMEg7ET"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xkP9X6K6Qz9s2G for ; Sat, 2 Sep 2017 02:01:04 +1000 (AEST) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=1hCX3NQplWPBpkdrJ6Q3xYyFAxsRx/5Xv5tURToIejI=; b=cuM Eg7ETXhTVZwebeZa1xtke/Uaz23FLi8txAZj1/Y/aJZXrswzKxmnjkLmuNSJNHfs5UIsmEhPlmUIp 14wffwNLaQBvRCGcJ33vLvt4l9VekzK4vunyDxd2/sdnzXcg2ugrVgoPlmODG9Zfz4ZwD/7DrXqSi m1Cta/XJQ3Oavk+SmTEpTnEIbjk3l+OgooqVDeOY8GaashRcVqnLSsOQXpIr4eZqRcwOY9/o+xxu6 yVFT8LqQGtotf8BX5DUE9uAhiqq4+oVGZelOaLNqr/fwr8RE19vuZUU11QLMK6VBzPx1eBzDi8Hd6 QEnhBB3mMCAhpkqPwdRKHdhH1B27h5w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dnoNT-0005q3-H2; Fri, 01 Sep 2017 16:01:03 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dnoNN-0005mW-BR for linux-snps-arc@lists.infradead.org; Fri, 01 Sep 2017 16:01:02 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 0250D24E15BB for ; Fri, 1 Sep 2017 09:00:32 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id DBC54BAA; Fri, 1 Sep 2017 09:00:31 -0700 (PDT) Received: from joabreu-VirtualBox.internal.synopsys.com (joabreu-e7440.internal.synopsys.com [10.107.19.75]) by mailhost.synopsys.com (Postfix) with ESMTP id BF4D9B7E; Fri, 1 Sep 2017 09:00:30 -0700 (PDT) From: Jose Abreu To: linux-snps-arc@lists.infradead.org Subject: [PATCH v2] arc: Re-enable MMU upon die() Date: Fri, 1 Sep 2017 17:00:23 +0100 Message-Id: <12fbfb3099623ae8044f48983bfa58321495cf79.1504281470.git.joabreu@synopsys.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170901_090057_448038_FAEFE614 X-CRM114-Status: UNSURE ( 7.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jose Abreu , Vineet Gupta , Alexey Brodkin MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org I recently came upon a scenario where I would get a double fault after a machine check error. It turns out that for Ksymbol lookup to work with modules we need to have MMU enabled because module address is mapped in the cached space. This patch re-enables the MMU before start printing the stacktrace making stacktracing of modules work upon a fatal exception. Signed-off-by: Jose Abreu Cc: Vineet Gupta Cc: Alexey Brodkin Changes from v1: - Moved MMU re-enable to machine check exception handler --- arch/arc/kernel/traps.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c index ff83e78..d92f161 100644 --- a/arch/arc/kernel/traps.c +++ b/arch/arc/kernel/traps.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include #include @@ -103,6 +105,9 @@ int do_misaligned_access(unsigned long address, struct pt_regs *regs, */ void do_machine_check_fault(unsigned long address, struct pt_regs *regs) { + /* MMU must be enabled for Ksymbol lookup in modules */ + write_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID)); + die("Machine Check Exception", regs, address); }