diff mbox

Disable bust_locks for general calls of abort()

Message ID 1434093500-11201-1-git-send-email-alistair@popple.id.au
State Accepted
Headers show

Commit Message

Alistair Popple June 12, 2015, 7:18 a.m. UTC
Currently bust_locks is set to true whenever abort() is called. This
was done for the lock debugging code which calls abort() as its last
step. If there is a locking error there is a good chance parts of the
console code will be deadlocked (for example if it has a lock on the
scom bus).

However busting locks can cause problems, especially now that flash
data is being read in parallel as this uses the LPC bus. Instead of
getting a nice error message showing where the code aborted it is
likely the message will go missing, or it will be garbled by the flash
data. So instead of always busting locks make it so they're only
busted if they're suspected of being broken.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 core/lock.c  | 2 ++
 core/utils.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/core/lock.c b/core/lock.c
index fbf2d87..53cc337 100644
--- a/core/lock.c
+++ b/core/lock.c
@@ -31,6 +31,8 @@  bool bust_locks = true;
 
 static void lock_error(struct lock *l, const char *reason, uint16_t err)
 {
+	bust_locks = true;
+
 	fprintf(stderr, "LOCK ERROR: %s @%p (state: 0x%016lx)\n",
 		reason, l, l->lock_val);
 	op_display(OP_FATAL, OP_MOD_LOCK, err);
diff --git a/core/utils.c b/core/utils.c
index 9c94ecc..f340b4f 100644
--- a/core/utils.c
+++ b/core/utils.c
@@ -38,8 +38,6 @@  void __noreturn _abort(void)
 		for (;;) ;
 	in_abort = true;
 
-	bust_locks = true;
-
 	op_display(OP_FATAL, OP_MOD_CORE, 0x6666);
 	
 	prlog(PR_EMERG, "Aborting!\n");