From: ben.dooks@codethink.co.uk (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 [thread overview]
Message-ID: <1391797214-17142-2-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1391797214-17142-1-git-send-email-ben.dooks@codethink.co.uk>
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 <ben.dooks@codethink.co.uk>
---
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[] = {
--
1.8.5.3
next prev parent reply other threads:[~2014-02-07 18:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 18:20 imprecise abort behaviour Ben Dooks
2014-02-07 18:20 ` Ben Dooks [this message]
2014-02-10 14:37 ` [PATCH] ARM: mm: add imprecise abort non-deadly handler Dave Martin
2014-02-10 17:25 ` Ben Dooks
2014-02-11 15:43 ` Dave Martin
-- strict thread matches above, loose matches on Subject: below --
2015-04-18 0:14 Ben Hutchings
2015-04-18 9:08 ` Russell King - ARM Linux
2015-04-20 8:57 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391797214-17142-2-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).