[rtems commit] score: PR2174: Add workaround

Sebastian Huber sebh at rtems.org
Tue Mar 25 12:34:10 UTC 2014


Module:    rtems
Branch:    master
Commit:    1fac361fb9d4ec7f5b4ad2801ee6ff5858c82942
Changeset: http://git.rtems.org/rtems/commit/?id=1fac361fb9d4ec7f5b4ad2801ee6ff5858c82942

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar 24 08:51:37 2014 +0100

score: PR2174: Add workaround

Add _Scheduler_FIXME_thread_priority_queues_are_broken to prevent thread
priority queues in case an EDF scheduler is used.

---

 cpukit/sapi/include/confdefs.h               |    6 ++++++
 cpukit/score/include/rtems/score/scheduler.h |    6 ++++++
 cpukit/score/src/threadq.c                   |    5 +++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index aca99f0..b731743 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -781,6 +781,12 @@ const rtems_libio_helper rtems_fs_init_helper =
     NULL,                             /* Scheduler Specific Data Pointer */
     CONFIGURE_SCHEDULER_ENTRY_POINTS  /* Scheduler Operations */
   };
+
+  #if defined(CONFIGURE_SCHEDULER_EDF)
+    const bool _Scheduler_FIXME_thread_priority_queues_are_broken = true;
+  #else
+    const bool _Scheduler_FIXME_thread_priority_queues_are_broken = false;
+  #endif
 #endif
 
 /*
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index ced3c00..01d0c3a 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -184,6 +184,12 @@ void _Scheduler_default_Start_idle(
   Per_CPU_Control *processor
 );
 
+/*
+ * See also PR2174: Memory corruption with EDF scheduler and thread priority
+ * queues.
+ */
+extern const bool _Scheduler_FIXME_thread_priority_queues_are_broken;
+
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c
index 463330a..69b687f 100644
--- a/cpukit/score/src/threadq.c
+++ b/cpukit/score/src/threadq.c
@@ -20,6 +20,7 @@
 
 #include <rtems/score/threadqimpl.h>
 #include <rtems/score/chainimpl.h>
+#include <rtems/score/scheduler.h>
 
 void _Thread_queue_Initialize(
   Thread_queue_Control         *the_thread_queue,
@@ -28,6 +29,10 @@ void _Thread_queue_Initialize(
   uint32_t                      timeout_status
 )
 {
+  if ( _Scheduler_FIXME_thread_priority_queues_are_broken ) {
+    the_discipline = THREAD_QUEUE_DISCIPLINE_FIFO;
+  }
+
   the_thread_queue->state          = state;
   the_thread_queue->discipline     = the_discipline;
   the_thread_queue->timeout_status = timeout_status;




More information about the vc mailing list