[PATCH 24/26] score: Restrict task interrupt level to 0 on SMP

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 15 13:51:56 UTC 2016


Update #2811.
---
 cpukit/score/src/threadinitialize.c         | 10 ++++++++--
 testsuites/smptests/smpunsupported01/init.c | 18 +++++++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 2cbe138..9ae2acb 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -60,8 +60,14 @@ bool _Thread_Initialize(
   Per_CPU_Control         *cpu = _Per_CPU_Get_by_index( 0 );
 
 #if defined( RTEMS_SMP )
-  if ( rtems_configuration_is_smp_enabled() && !is_preemptible ) {
-    return false;
+  if ( rtems_configuration_is_smp_enabled() ) {
+    if ( !is_preemptible ) {
+      return false;
+    }
+
+    if ( isr_level != 0 ) {
+      return false;
+    }
   }
 #endif
 
diff --git a/testsuites/smptests/smpunsupported01/init.c b/testsuites/smptests/smpunsupported01/init.c
index 9d69b6b..52c3181 100644
--- a/testsuites/smptests/smpunsupported01/init.c
+++ b/testsuites/smptests/smpunsupported01/init.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014 On-Line Applications Research Corporation (OAR).
- * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -41,6 +41,22 @@ static void test(void)
     &id
   );
   rtems_test_assert(sc == RTEMS_UNSATISFIED);
+
+  mode = RTEMS_INTERRUPT_LEVEL(1);
+
+  if (mode != 0) {
+    sc = rtems_task_create(
+      rtems_build_name('T', 'A', 'S', 'K'),
+      RTEMS_MINIMUM_PRIORITY,
+      RTEMS_MINIMUM_STACK_SIZE,
+      mode,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    rtems_test_assert(sc == RTEMS_UNSATISFIED);
+  } else {
+    puts("RTEMS_INTERRUPT_LEVEL(1) not supported on this platform");
+  }
 }
 
 static void Init(rtems_task_argument arg)
-- 
1.8.4.5




More information about the devel mailing list