[PATCH] config: Improve EDF SMP scheduler configuration
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Dec 19 10:42:01 UTC 2019
Use CONFIGURE_MAXIMUM_PROCESSORS to configure the EDF SMP scheduler
context. This avoids hard to debug configuration errors resulting in
memory corruptions.
Close #3815.
---
cpukit/include/rtems/confdefs.h | 3 +--
cpukit/include/rtems/scheduler.h | 10 +++++++---
testsuites/smptests/smpschededf01/init.c | 2 +-
testsuites/smptests/smpschededf04/init.c | 4 ++--
testsuites/smptests/smpscheduler02/init.c | 2 +-
testsuites/smptests/smpscheduler07/init.c | 2 +-
testsuites/smptests/smpthreadpin01/init.c | 4 ++--
7 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index b98dffb4c8..76e2167e01 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -916,8 +916,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
/** Configure the context needed by the scheduler instance */
- #define CONFIGURE_SCHEDULER \
- RTEMS_SCHEDULER_EDF_SMP(dflt, _CONFIGURE_MAXIMUM_PROCESSORS)
+ #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF_SMP(dflt)
/** Configure the controls for this scheduler instance */
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
diff --git a/cpukit/include/rtems/scheduler.h b/cpukit/include/rtems/scheduler.h
index 336ca71fe6..dbc161a69d 100644
--- a/cpukit/include/rtems/scheduler.h
+++ b/cpukit/include/rtems/scheduler.h
@@ -112,13 +112,17 @@
#ifdef CONFIGURE_SCHEDULER_EDF_SMP
#include <rtems/score/scheduleredfsmp.h>
+ #ifndef CONFIGURE_MAXIMUM_PROCESSORS
+ #error "CONFIGURE_MAXIMUM_PROCESSORS must be defined to configure the EDF SMP scheduler"
+ #endif
+
#define SCHEDULER_EDF_SMP_CONTEXT_NAME( name ) \
SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name )
- #define RTEMS_SCHEDULER_EDF_SMP( name, max_cpu_count ) \
+ #define RTEMS_SCHEDULER_EDF_SMP( name ) \
static struct { \
Scheduler_EDF_SMP_Context Base; \
- Scheduler_EDF_SMP_Ready_queue Ready[ ( max_cpu_count ) + 1 ]; \
+ Scheduler_EDF_SMP_Ready_queue Ready[ CONFIGURE_MAXIMUM_PROCESSORS + 1 ]; \
} SCHEDULER_EDF_SMP_CONTEXT_NAME( name )
#define RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name ) \
@@ -132,7 +136,7 @@
/* Provided for backward compatibility */
#define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \
- RTEMS_SCHEDULER_EDF_SMP( name, max_cpu_count )
+ RTEMS_SCHEDULER_EDF_SMP( name )
#define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \
RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name )
diff --git a/testsuites/smptests/smpschededf01/init.c b/testsuites/smptests/smpschededf01/init.c
index c049c63a3b..c87d31dea1 100644
--- a/testsuites/smptests/smpschededf01/init.c
+++ b/testsuites/smptests/smpschededf01/init.c
@@ -137,7 +137,7 @@ static void Init(rtems_task_argument arg)
#include <rtems/scheduler.h>
-RTEMS_SCHEDULER_EDF_SMP(a, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(a);
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
RTEMS_SCHEDULER_TABLE_EDF_SMP(a, rtems_build_name('E', 'D', 'F', ' '))
diff --git a/testsuites/smptests/smpschededf04/init.c b/testsuites/smptests/smpschededf04/init.c
index 851c1f6211..c72d7b6563 100644
--- a/testsuites/smptests/smpschededf04/init.c
+++ b/testsuites/smptests/smpschededf04/init.c
@@ -112,9 +112,9 @@ static void Init(rtems_task_argument arg)
#include <rtems/scheduler.h>
-RTEMS_SCHEDULER_EDF_SMP(a, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(a);
-RTEMS_SCHEDULER_EDF_SMP(b, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(b);
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
RTEMS_SCHEDULER_TABLE_EDF_SMP(a, MAIN), \
diff --git a/testsuites/smptests/smpscheduler02/init.c b/testsuites/smptests/smpscheduler02/init.c
index 9fdd5b9076..6cfa5915d2 100644
--- a/testsuites/smptests/smpscheduler02/init.c
+++ b/testsuites/smptests/smpscheduler02/init.c
@@ -439,7 +439,7 @@ static void Init(rtems_task_argument arg)
RTEMS_SCHEDULER_PRIORITY_SMP(a, 256);
-RTEMS_SCHEDULER_EDF_SMP(b, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(b);
RTEMS_SCHEDULER_SIMPLE_SMP(c);
diff --git a/testsuites/smptests/smpscheduler07/init.c b/testsuites/smptests/smpscheduler07/init.c
index 9fb77c6a42..4583a5eb2a 100644
--- a/testsuites/smptests/smpscheduler07/init.c
+++ b/testsuites/smptests/smpscheduler07/init.c
@@ -32,7 +32,7 @@ const char rtems_test_name[] = "SMPSCHEDULER 7";
#include <rtems/scheduler.h>
-RTEMS_SCHEDULER_EDF_SMP(a, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(a);
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
RTEMS_SCHEDULER_TABLE_EDF_SMP( a, rtems_build_name('T', 'E', 'S', 'T'))
diff --git a/testsuites/smptests/smpthreadpin01/init.c b/testsuites/smptests/smpthreadpin01/init.c
index 9bcf9149a9..7c3c9b2309 100644
--- a/testsuites/smptests/smpthreadpin01/init.c
+++ b/testsuites/smptests/smpthreadpin01/init.c
@@ -597,9 +597,9 @@ static void Init(rtems_task_argument arg)
#include <rtems/scheduler.h>
-RTEMS_SCHEDULER_EDF_SMP(a, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(a);
-RTEMS_SCHEDULER_EDF_SMP(b, CONFIGURE_MAXIMUM_PROCESSORS);
+RTEMS_SCHEDULER_EDF_SMP(b);
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
RTEMS_SCHEDULER_TABLE_EDF_SMP(a, SCHED_A), \
--
2.16.4
More information about the devel
mailing list