summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-18 11:53:48 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-22 16:46:01 +0200
commit05e82bd76b057bf60f8590c5226561538ba9057e (patch)
treefd84479c03e705bb5ab414b2364e0b131f6d2eef /cpukit
parentrtems: Error for task variables on SMP (diff)
downloadrtems-05e82bd76b057bf60f8590c5226561538ba9057e.tar.bz2
score: Error for non-preemptible tasks on SMP
A common use case for disabled preemption was to ensure mutual exclusion on single-processor configurations. On SMP this does not work. To abandon non-preemptible tasks simplifies the scheduler.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/rtems/src/taskcreate.c1
-rw-r--r--cpukit/rtems/src/taskmode.c13
-rw-r--r--cpukit/sapi/include/confdefs.h6
-rw-r--r--cpukit/score/src/threadinitialize.c7
4 files changed, 25 insertions, 2 deletions
diff --git a/cpukit/rtems/src/taskcreate.c b/cpukit/rtems/src/taskcreate.c
index 64ad1ebd76..471990da0a 100644
--- a/cpukit/rtems/src/taskcreate.c
+++ b/cpukit/rtems/src/taskcreate.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/support.h>
#include <rtems/rtems/modes.h>
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c
index d9c7fce0ec..eb3636d172 100644
--- a/cpukit/rtems/src/taskmode.c
+++ b/cpukit/rtems/src/taskmode.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/support.h>
#include <rtems/rtems/modes.h>
@@ -67,8 +68,18 @@ rtems_status_code rtems_task_mode(
/*
* These are generic thread scheduling characteristics.
*/
- if ( mask & RTEMS_PREEMPT_MASK )
+ if ( mask & RTEMS_PREEMPT_MASK ) {
+#if defined( RTEMS_SMP )
+ if (
+ rtems_configuration_is_smp_enabled()
+ && !_Modes_Is_preempt( mode_set )
+ ) {
+ return RTEMS_NOT_IMPLEMENTED;
+ }
+#endif
+
executing->is_preemptible = _Modes_Is_preempt( mode_set );
+ }
if ( mask & RTEMS_TIMESLICE_MASK ) {
if ( _Modes_Is_timeslice(mode_set) ) {
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index b7cbfaa676..c969fa78de 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1021,7 +1021,11 @@ const rtems_libio_helper rtems_fs_init_helper =
#endif
#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
- #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
+ #if defined(RTEMS_SMP) && defined(CONFIGURE_SMP_APPLICATION)
+ #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
+ #else
+ #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
+ #endif
#endif
#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 4c40ae87b8..cc74573def 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -18,6 +18,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/score/apiext.h>
#include <rtems/score/context.h>
#include <rtems/score/interr.h>
@@ -57,6 +58,12 @@ bool _Thread_Initialize(
bool extension_status;
int i;
+#if defined( RTEMS_SMP )
+ if ( rtems_configuration_is_smp_enabled() && !is_preemptible ) {
+ return false;
+ }
+#endif
+
/*
* Initialize the Ada self pointer
*/