From patchwork Fri Feb 7 18:20:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 3607201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1A4EABF418 for ; Fri, 7 Feb 2014 18:26:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4071320114 for ; Fri, 7 Feb 2014 18:26:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 046D3200D4 for ; Fri, 7 Feb 2014 18:26:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBq7g-0001dE-9D; Fri, 07 Feb 2014 18:25:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBq2o-0003ia-Aw; Fri, 07 Feb 2014 18:20:54 +0000 Received: from 82-68-191-81.dsl.posilan.com ([82.68.191.81] helo=rainbowdash.ducie.codethink.co.uk) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBq2a-0003gf-V4 for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 18:20:42 +0000 Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1WBq2B-0004TB-RG; Fri, 07 Feb 2014 18:20:15 +0000 From: Ben Dooks To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: mm: add imprecise abort non-deadly handler Date: Fri, 7 Feb 2014 18:20:14 +0000 Message-Id: <1391797214-17142-2-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1391797214-17142-1-git-send-email-ben.dooks@codethink.co.uk> References: <1391797214-17142-1-git-send-email-ben.dooks@codethink.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140207_132041_136283_EF8B4DD8 X-CRM114-Status: GOOD ( 17.89 ) X-Spam-Score: -0.3 (/) Cc: linux-kernel@lists.codethink.co.uk, Ben Dooks X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Given that imprecise aborts may be delivered after the action that caused them (or even for non-cpu related activities such as bridge faults from a bus-master) it is possible that the wrong process is terminated as a result. It is not know at this time in an SMP system which cores get notified of an imprecise external abort, we have yet to find the right details in the architecture reference manuals. This also means that killing the process is probably the wrong thing to do on reception of these aborts. Add a handler to take and print imprecise aborts and allow the process to continue. This should ensure that the abort is shown but not kill the process that was running on the cpu core at the time. Signed-off-by: Ben Dooks --- arch/arm/mm/fault.c | 15 +++++++++++++++ arch/arm/mm/fsr-2level.c | 32 ++++++++++++++++---------------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index eb8830a..c1fd5ba 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -512,6 +512,21 @@ do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs) return 1; } +/* + * On an imprecise external abort it is possible that the currently running + * process did not cause it (it could be from an external bus bridge or + * another device causing a fault on the bus). + * + * Always return handled as we do not know how to do it and killing the + * current process may not prevent future faults. + */ +static int +do_bad_imprecise(unsigned long addr, unsigned int fsr, struct pt_regs *regs) +{ + printk(KERN_INFO "Caught imprecise abort (0x%03x) %08lx", fsr, addr); + return 0; +} + struct fsr_info { int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); int sig; diff --git a/arch/arm/mm/fsr-2level.c b/arch/arm/mm/fsr-2level.c index 18ca74c..8f5ef60 100644 --- a/arch/arm/mm/fsr-2level.c +++ b/arch/arm/mm/fsr-2level.c @@ -24,22 +24,22 @@ static struct fsr_info fsr_info[] = { * 10 of the FSR, and may not be recoverable. These are only * supported if the CPU abort handler supports bit 10. */ - { do_bad, SIGBUS, 0, "unknown 16" }, - { do_bad, SIGBUS, 0, "unknown 17" }, - { do_bad, SIGBUS, 0, "unknown 18" }, - { do_bad, SIGBUS, 0, "unknown 19" }, - { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */ - { do_bad, SIGBUS, 0, "unknown 21" }, - { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ - { do_bad, SIGBUS, 0, "unknown 23" }, - { do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */ - { do_bad, SIGBUS, 0, "unknown 25" }, - { do_bad, SIGBUS, 0, "unknown 26" }, - { do_bad, SIGBUS, 0, "unknown 27" }, - { do_bad, SIGBUS, 0, "unknown 28" }, - { do_bad, SIGBUS, 0, "unknown 29" }, - { do_bad, SIGBUS, 0, "unknown 30" }, - { do_bad, SIGBUS, 0, "unknown 31" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 16" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 17" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 18" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 19" }, + { do_bad_imprecise, SIGBUS, 0, "lock abort" }, /* xscale */ + { do_bad_imprecise, SIGBUS, 0, "unknown 21" }, + { do_bad_imprecise, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ + { do_bad_imprecise, SIGBUS, 0, "unknown 23" }, + { do_bad_imprecise, SIGBUS, 0, "dcache parity error" }, /* xscale */ + { do_bad_imprecise, SIGBUS, 0, "unknown 25" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 26" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 27" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 28" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 29" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 30" }, + { do_bad_imprecise, SIGBUS, 0, "unknown 31" }, }; static struct fsr_info ifsr_info[] = {