[rtems-libbsd commit] rtems-bsd-mutex: Add SMP lock debug support

Sebastian Huber sebh at rtems.org
Wed Jan 11 13:02:09 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    f11bfc2a5f22672129d9eb9f347a7567a895f5d3
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=f11bfc2a5f22672129d9eb9f347a7567a895f5d3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jan 11 14:01:17 2017 +0100

rtems-bsd-mutex: Add SMP lock debug support

---

 rtemsbsd/include/machine/rtems-bsd-muteximpl.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/rtemsbsd/include/machine/rtems-bsd-muteximpl.h b/rtemsbsd/include/machine/rtems-bsd-muteximpl.h
index 586a103..fdad3f1 100644
--- a/rtemsbsd/include/machine/rtems-bsd-muteximpl.h
+++ b/rtemsbsd/include/machine/rtems-bsd-muteximpl.h
@@ -8,7 +8,7 @@
  */
 
 /*
- * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2014, 2017 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -85,6 +85,9 @@ rtems_bsd_mutex_acquire_critical(rtems_bsd_mutex *m,
 
 	_Thread_queue_Queue_acquire_critical(&m->queue.Queue,
 	    &m->queue.Lock_stats, &queue_context->Lock_context.Lock_context);
+#if defined(RTEMS_SMP) && defined(RTEMS_DEBUG)
+	m->queue.owner = _SMP_lock_Who_am_I();
+#endif
 }
 
 static inline void
@@ -92,6 +95,10 @@ rtems_bsd_mutex_release(rtems_bsd_mutex *m, ISR_Level isr_level,
     Thread_queue_Context *queue_context)
 {
 
+#if defined(RTEMS_SMP) && defined(RTEMS_DEBUG)
+	_Assert( _Thread_queue_Is_lock_owner( &m->queue ) );
+	m->queue.owner = SMP_LOCK_NO_OWNER;
+#endif
 	_Thread_queue_Queue_release_critical(&m->queue.Queue,
 	    &queue_context->Lock_context.Lock_context);
 	_ISR_Local_enable(isr_level);




More information about the vc mailing list