[{"id":1761780,"web_url":"http://patchwork.ozlabs.org/comment/1761780/","msgid":"<076df89b-1fb1-bf15-3f81-2ac7a4169b18@synopsys.com>","list_archive_url":null,"date":"2017-09-01T16:01:54","subject":"Re: [PATCH v2] arc: Re-enable MMU upon die()","submitter":{"id":68387,"url":"http://patchwork.ozlabs.org/api/people/68387/","name":"Jose Abreu","email":"Jose.Abreu@synopsys.com"},"content":"Oops, the commit title is now a little bit odd. Let me rephrase\nand send a new version.\n\nOn 01-09-2017 17:00, Jose Abreu wrote:\n> I recently came upon a scenario where I would get a double fault\n> after a machine check error. It turns out that for Ksymbol lookup\n> to work with modules we need to have MMU enabled because module\n> address is mapped in the cached space.\n>\n> This patch re-enables the MMU before start printing the stacktrace\n> making stacktracing of modules work upon a fatal exception.\n>\n> Signed-off-by: Jose Abreu <joabreu@synopsys.com>\n> Cc: Vineet Gupta <vgupta@synopsys.com>\n> Cc: Alexey Brodkin <abrodkin@synopsys.com>\n>\n> Changes from v1:\n> \t- Moved MMU re-enable to machine check exception handler\n> ---\n>  arch/arc/kernel/traps.c | 5 +++++\n>  1 file changed, 5 insertions(+)\n>\n> diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c\n> index ff83e78..d92f161 100644\n> --- a/arch/arc/kernel/traps.c\n> +++ b/arch/arc/kernel/traps.c\n> @@ -19,6 +19,8 @@\n>  #include <linux/ptrace.h>\n>  #include <linux/kprobes.h>\n>  #include <linux/kgdb.h>\n> +#include <asm/arcregs.h>\n> +#include <asm/mmu.h>\n>  #include <asm/setup.h>\n>  #include <asm/unaligned.h>\n>  #include <asm/kprobes.h>\n> @@ -103,6 +105,9 @@ int do_misaligned_access(unsigned long address, struct pt_regs *regs,\n>   */\n>  void do_machine_check_fault(unsigned long address, struct pt_regs *regs)\n>  {\n> +\t/* MMU must be enabled for Ksymbol lookup in modules */\n> +\twrite_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID));\n> +\n>  \tdie(\"Machine Check Exception\", regs, address);\n>  }\n>","headers":{"Return-Path":"<linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"V1qtd5IF\"; \n\tdkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkPC50KWMz9s2G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 02:02:25 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnoOl-0006ud-MC; Fri, 01 Sep 2017 16:02:23 +0000","from us01smtprelay-2.synopsys.com ([198.182.47.9]\n\thelo=smtprelay.synopsys.com)\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnoOi-0006sX-6w for linux-snps-arc@lists.infradead.org;\n\tFri, 01 Sep 2017 16:02:22 +0000","from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239])\n\tby smtprelay.synopsys.com (Postfix) with ESMTP id 1B31A24E1EDB\n\tfor <linux-snps-arc@lists.infradead.org>;\n\tFri,  1 Sep 2017 09:02:00 -0700 (PDT)","from mailhost.synopsys.com (localhost [127.0.0.1])\n\tby mailhost.synopsys.com (Postfix) with ESMTP id 01A98A07\n\tfor <linux-snps-arc@lists.infradead.org>;\n\tFri,  1 Sep 2017 09:02:00 -0700 (PDT)","from us01wehtc1.internal.synopsys.com\n\t(us01wehtc1-vip.internal.synopsys.com [10.12.239.236])\n\tby mailhost.synopsys.com (Postfix) with ESMTP id EB3D4A04\n\tfor <linux-snps-arc@lists.infradead.org>;\n\tFri,  1 Sep 2017 09:01:59 -0700 (PDT)","from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by\n\tus01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP\n\tServer (TLS) id 14.3.266.1; Fri, 1 Sep 2017 09:01:59 -0700","from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by\n\tDE02WEHTCA.internal.synopsys.com (10.225.19.92) with Microsoft SMTP\n\tServer (TLS) id 14.3.266.1; Fri, 1 Sep 2017 18:01:57 +0200","from [10.0.2.15] (10.107.19.75) by DE02WEHTCB.internal.synopsys.com\n\t(10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.266.1;\n\tFri, 1 Sep 2017 18:01:57 +0200"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:\n\tMessage-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description\n\t:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=/HT9CUmbzlkK+1vB+yn+qzgffYaVPLlOLUZMi0eT5f4=;\n\tb=V1qtd5IFmeX2RA\n\tUt9inEI5O4DxQBxXRvW1XQ2MIbMEqAoj/M2GxMyGa858G1nk9c3RucFOZZNnal+xrmh6tt2g/7hZ5\n\trjfqT8lP8vZ0YBHnBvICqRQaVh32dMXvLXPJzDfcuinOrKgtd1CW0ffJOf2/xaRyCORqQvHzaXklW\n\tovKwZkdQ+G4aYFjVcQ+047MEyMLywApxaj0KDCPPIYz6xV2DC9jb6dND4jLZvrCYHwm52qL7OOmNs\n\tKRbRgu8wn4rXZktdoLOfndgLZphF3bbi0OIDenp+X7/XwFA9emBx2wIJks2Rnirv4bRcRn10so/wz\n\t8vC668zDKbNa5VDrwgLQ==;","Subject":"Re: [PATCH v2] arc: Re-enable MMU upon die()","To":"<linux-snps-arc@lists.infradead.org>","References":"<12fbfb3099623ae8044f48983bfa58321495cf79.1504281470.git.joabreu@synopsys.com>","From":"Jose Abreu <Jose.Abreu@synopsys.com>","Message-ID":"<076df89b-1fb1-bf15-3f81-2ac7a4169b18@synopsys.com>","Date":"Fri, 1 Sep 2017 17:01:54 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101\n\tThunderbird/45.4.0","MIME-Version":"1.0","In-Reply-To":"<12fbfb3099623ae8044f48983bfa58321495cf79.1504281470.git.joabreu@synopsys.com>","X-Originating-IP":"[10.107.19.75]","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170901_090220_263503_AD29AD9A ","X-CRM114-Status":"GOOD (  10.52  )","X-Spam-Score":"-1.9 (-)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-1.9 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno trust [198.182.47.9 listed in list.dnswl.org]\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[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\n\t<linux-snps-arc.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-snps-arc>, \n\t<mailto:linux-snps-arc-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-snps-arc/>","List-Post":"<mailto:linux-snps-arc@lists.infradead.org>","List-Help":"<mailto:linux-snps-arc-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-snps-arc>, \n\t<mailto:linux-snps-arc-request@lists.infradead.org?subject=subscribe>","Cc":"Vineet Gupta <Vineet.Gupta1@synopsys.com>,\n\tAlexey Brodkin <Alexey.Brodkin@synopsys.com>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-snps-arc\" <linux-snps-arc-bounces@lists.infradead.org>","Errors-To":"linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1761784,"web_url":"http://patchwork.ozlabs.org/comment/1761784/","msgid":"<9dc23712-b8ea-9f4e-d2c1-a8149157af16@synopsys.com>","list_archive_url":null,"date":"2017-09-01T16:05:51","subject":"Re: [PATCH v2] arc: Re-enable MMU upon die()","submitter":{"id":26707,"url":"http://patchwork.ozlabs.org/api/people/26707/","name":"Vineet Gupta","email":"Vineet.Gupta1@synopsys.com"},"content":"On 09/01/2017 09:01 AM, Jose Abreu wrote:\n> Oops, the commit title is now a little bit odd. Let me rephrase\n> and send a new version.\n\nDon't worry - I'll fix it up here !\n\nThx,\n-Vineet\n\n>\n> On 01-09-2017 17:00, Jose Abreu wrote:\n>> I recently came upon a scenario where I would get a double fault\n>> after a machine check error. It turns out that for Ksymbol lookup\n>> to work with modules we need to have MMU enabled because module\n>> address is mapped in the cached space.\n>>\n>> This patch re-enables the MMU before start printing the stacktrace\n>> making stacktracing of modules work upon a fatal exception.\n>>\n>> Signed-off-by: Jose Abreu <joabreu@synopsys.com>\n>> Cc: Vineet Gupta <vgupta@synopsys.com>\n>> Cc: Alexey Brodkin <abrodkin@synopsys.com>\n>>\n>> Changes from v1:\n>> \t- Moved MMU re-enable to machine check exception handler\n>> ---\n>>   arch/arc/kernel/traps.c | 5 +++++\n>>   1 file changed, 5 insertions(+)\n>>\n>> diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c\n>> index ff83e78..d92f161 100644\n>> --- a/arch/arc/kernel/traps.c\n>> +++ b/arch/arc/kernel/traps.c\n>> @@ -19,6 +19,8 @@\n>>   #include <linux/ptrace.h>\n>>   #include <linux/kprobes.h>\n>>   #include <linux/kgdb.h>\n>> +#include <asm/arcregs.h>\n>> +#include <asm/mmu.h>\n>>   #include <asm/setup.h>\n>>   #include <asm/unaligned.h>\n>>   #include <asm/kprobes.h>\n>> @@ -103,6 +105,9 @@ int do_misaligned_access(unsigned long address, struct pt_regs *regs,\n>>    */\n>>   void do_machine_check_fault(unsigned long address, struct pt_regs *regs)\n>>   {\n>> +\t/* MMU must be enabled for Ksymbol lookup in modules */\n>> +\twrite_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID));\n>> +\n>>   \tdie(\"Machine Check Exception\", regs, address);\n>>   }\n>>   \n>","headers":{"Return-Path":"<linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"FlQHpyPB\"; \n\tdkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkPHn0d5cz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 02:06:29 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnoSh-00017A-MW; Fri, 01 Sep 2017 16:06:27 +0000","from us01smtprelay-2.synopsys.com ([198.182.47.9]\n\thelo=smtprelay.synopsys.com)\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnoSe-00011q-Bw for linux-snps-arc@lists.infradead.org;\n\tFri, 01 Sep 2017 16:06:25 +0000","from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239])\n\tby smtprelay.synopsys.com (Postfix) with ESMTP id 41CB724E171D\n\tfor <linux-snps-arc@lists.infradead.org>;\n\tFri,  1 Sep 2017 09:06:04 -0700 (PDT)","from mailhost.synopsys.com (localhost [127.0.0.1])\n\tby mailhost.synopsys.com (Postfix) with ESMTP id 30447432\n\tfor <linux-snps-arc@lists.infradead.org>;\n\tFri,  1 Sep 2017 09:06:04 -0700 (PDT)","from US01WXQAHTC1.internal.synopsys.com\n\t(us01wxqahtc1.internal.synopsys.com [10.12.238.230])\n\tby mailhost.synopsys.com (Postfix) with ESMTP id 253A042E\n\tfor <linux-snps-arc@lists.infradead.org>;\n\tFri,  1 Sep 2017 09:06:04 -0700 (PDT)","from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by\n\tUS01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft\n\tSMTP Server (TLS) id 14.3.266.1; Fri, 1 Sep 2017 09:06:04 -0700","from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by\n\tIN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP\n\tServer (TLS) id 14.3.266.1; Fri, 1 Sep 2017 21:36:01 +0530","from [10.12.196.101] (10.12.196.101) by\n\tIN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP\n\tServer (TLS) id 14.3.266.1; Fri, 1 Sep 2017 21:36:00 +0530"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:\n\tContent-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive:\n\tList-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From:\n\tReferences:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=4zySpGtRZamZfa2LmlM5J2gb3rTefZDXoEOJU0tjr9k=;\n\tb=FlQHpyPBuMXu4KoZtJm+vMGMH\n\tiR8lRz9W8J9K2CEtSfW8XF6vGC2OoAuwRfnghwCMjoJQZmooSeLQZKU9CjksK3nG0YOs9TYQdf2gl\n\tKYnp/duYHkm1Z9Rmg6ZgLuoP3Ni+M4/RE7qHODOGZX56lzTwHzDQPzRdjfRO/iheIV/U8PtyBCvk/\n\tsbXIMctlcMiQhta73OMH2knqsn0PaYU+oMM19vfweGRsw5mQRHCewZ1bbv6Tb4r6PjwqmeaUIyN9s\n\tCRoEG3KI8hy9RI/V7mH6lkMgLmogoEOMRlYJLTpCy6Gz6tKSSQrOWoLvFNXprAYf3eJj4cYPGwm0D\n\tmOqt00/4g==;","Subject":"Re: [PATCH v2] arc: Re-enable MMU upon die()","To":"Jose Abreu <Jose.Abreu@synopsys.com>,\n\t\"linux-snps-arc@lists.infradead.org\" <linux-snps-arc@lists.infradead.org>","References":"<12fbfb3099623ae8044f48983bfa58321495cf79.1504281470.git.joabreu@synopsys.com>\n\t<076df89b-1fb1-bf15-3f81-2ac7a4169b18@synopsys.com>","From":"Vineet Gupta <Vineet.Gupta1@synopsys.com>","Message-ID":"<9dc23712-b8ea-9f4e-d2c1-a8149157af16@synopsys.com>","Date":"Fri, 1 Sep 2017 09:05:51 -0700","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<076df89b-1fb1-bf15-3f81-2ac7a4169b18@synopsys.com>","Content-Language":"en-US","X-Originating-IP":"[10.12.196.101]","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170901_090624_427268_B602B4AC ","X-CRM114-Status":"UNSURE (   8.44  )","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:\n\tContent analysis details:   (-1.9 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno trust [198.182.47.9 listed in list.dnswl.org]\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[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\n\t<linux-snps-arc.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-snps-arc>, \n\t<mailto:linux-snps-arc-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-snps-arc/>","List-Post":"<mailto:linux-snps-arc@lists.infradead.org>","List-Help":"<mailto:linux-snps-arc-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-snps-arc>, \n\t<mailto:linux-snps-arc-request@lists.infradead.org?subject=subscribe>","Cc":"Alexey Brodkin <Alexey.Brodkin@synopsys.com>","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=\"us-ascii\"; Format=\"flowed\"","Sender":"\"linux-snps-arc\" <linux-snps-arc-bounces@lists.infradead.org>","Errors-To":"linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}}]