[PATCH 01/15] score: Add per scheduler instance maximum priority
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri May 20 13:33:38 UTC 2016
The priority values are only valid within a scheduler instance. Thus,
the maximum priority value must be defined per scheduler instance. The
first scheduler instance defines PRIORITY_MAXIMUM. This implies that
RTEMS_MAXIMUM_PRIORITY and POSIX_SCHEDULER_MAXIMUM_PRIORITY are only
valid for threads of the first scheduler instance. Further
API/implementation changes are necessary to fix this.
Update #2556.
---
cpukit/posix/include/rtems/posix/priorityimpl.h | 2 +-
cpukit/rtems/include/rtems/rtems/tasks.h | 1 +
cpukit/sapi/include/confdefs.h | 13 +------------
cpukit/sapi/include/rtems/scheduler.h | 18 +++++++++++++++++-
cpukit/score/include/rtems/score/priority.h | 8 --------
cpukit/score/include/rtems/score/scheduler.h | 14 ++++++++++++++
cpukit/score/include/rtems/score/schedulercbs.h | 2 ++
cpukit/score/include/rtems/score/scheduleredf.h | 2 ++
cpukit/score/include/rtems/score/schedulersimple.h | 2 ++
cpukit/score/include/rtems/score/schedulersimplesmp.h | 2 ++
10 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/cpukit/posix/include/rtems/posix/priorityimpl.h b/cpukit/posix/include/rtems/posix/priorityimpl.h
index 169254d..3835ee9 100644
--- a/cpukit/posix/include/rtems/posix/priorityimpl.h
+++ b/cpukit/posix/include/rtems/posix/priorityimpl.h
@@ -19,7 +19,7 @@
#ifndef _RTEMS_POSIX_PRIORITYIMPL_H
#define _RTEMS_POSIX_PRIORITYIMPL_H
-#include <rtems/score/priority.h>
+#include <rtems/score/scheduler.h>
#ifdef __cplusplus
extern "C" {
diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 5f33e0b..84ea806 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -38,6 +38,7 @@
#define _RTEMS_RTEMS_TASKS_H
#include <rtems/score/object.h>
+#include <rtems/score/scheduler.h>
#include <rtems/score/thread.h>
#include <rtems/rtems/types.h>
#include <rtems/rtems/event.h>
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index b7c2f44..95f29fd 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -883,6 +883,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
CONFIGURE_MAXIMUM_PRIORITY + 1 \
)
+ /** Configure the controls for this scheduler instance */
#define CONFIGURE_SCHEDULER_CONTROLS \
RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( \
dflt, \
@@ -3350,18 +3351,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
CONFIGURE_MINIMUM_TASK_STACK_SIZE;
/**
- * This variable specifies the maximum priority value that
- * a task may have. This must be a power of 2 between 4
- * and 256 and is specified in terms of Classic API
- * priority values.
- *
- * NOTE: This is left as a simple uint8_t so it can be externed as
- * needed without requring being high enough logical to
- * include the full configuration table.
- */
- uint8_t rtems_maximum_priority = CONFIGURE_MAXIMUM_PRIORITY;
-
- /**
* This is the primary Configuration Table for this application.
*/
const rtems_configuration_table Configuration = {
diff --git a/cpukit/sapi/include/rtems/scheduler.h b/cpukit/sapi/include/rtems/scheduler.h
index 39dff90..0b20aab 100644
--- a/cpukit/sapi/include/rtems/scheduler.h
+++ b/cpukit/sapi/include/rtems/scheduler.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -70,6 +70,7 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ).Base, \
SCHEDULER_CBS_ENTRY_POINTS, \
+ SCHEDULER_CBS_MAXIMUM_PRIORITY, \
( obj_name ) \
}
#endif
@@ -87,6 +88,7 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ).Base, \
SCHEDULER_EDF_ENTRY_POINTS, \
+ SCHEDULER_EDF_MAXIMUM_PRIORITY, \
( obj_name ) \
}
#endif
@@ -107,6 +109,9 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \
SCHEDULER_PRIORITY_ENTRY_POINTS, \
+ RTEMS_ARRAY_SIZE( \
+ RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Ready \
+ ) - 1, \
( obj_name ) \
}
#endif
@@ -127,6 +132,9 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base.Base, \
SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \
+ RTEMS_ARRAY_SIZE( \
+ RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Ready \
+ ) - 1, \
( obj_name ) \
}
#endif
@@ -147,6 +155,9 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base.Base, \
SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \
+ RTEMS_ARRAY_SIZE( \
+ RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Ready \
+ ) - 1, \
( obj_name ) \
}
#endif
@@ -167,6 +178,9 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Base.Base.Base, \
SCHEDULER_STRONG_APA_ENTRY_POINTS, \
+ RTEMS_ARRAY_SIZE( \
+ RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Ready \
+ ) - 1, \
( obj_name ) \
}
#endif
@@ -185,6 +199,7 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \
SCHEDULER_SIMPLE_ENTRY_POINTS, \
+ SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
( obj_name ) \
}
#endif
@@ -203,6 +218,7 @@
{ \
&RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base.Base, \
SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \
+ SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \
( obj_name ) \
}
#endif
diff --git a/cpukit/score/include/rtems/score/priority.h b/cpukit/score/include/rtems/score/priority.h
index 0a772f6..38f3995 100644
--- a/cpukit/score/include/rtems/score/priority.h
+++ b/cpukit/score/include/rtems/score/priority.h
@@ -72,14 +72,6 @@ typedef uint32_t Priority_Control;
#define PRIORITY_DEFAULT_MAXIMUM 255
#endif
-/** This defines the lowest (least important) thread priority. */
-#define PRIORITY_MAXIMUM rtems_maximum_priority
-
-/**
- * This variable contains the configured number of priorities
- */
-extern uint8_t rtems_maximum_priority;
-
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 5296644..1e6236f 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -201,6 +201,14 @@ struct Scheduler_Control {
Scheduler_Operations Operations;
/**
+ * @brief The maximum priority value of this scheduler.
+ *
+ * It defines the lowest (least important) thread priority for this
+ * scheduler. For example the idle threads have this priority.
+ */
+ Priority_Control maximum_priority;
+
+ /**
* @brief The scheduler name.
*/
uint32_t name;
@@ -555,6 +563,12 @@ void _Scheduler_default_Start_idle(
#define SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY
#endif
+/**
+ * @brief This defines the lowest (least important) thread priority of the
+ * first scheduler instance.
+ */
+#define PRIORITY_MAXIMUM ( _Scheduler_Table[ 0 ].maximum_priority )
+
/**@}*/
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index 5558d6e..e390532 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -39,6 +39,8 @@ extern "C" {
*/
/**@{*/
+#define SCHEDULER_CBS_MAXIMUM_PRIORITY SCHEDULER_EDF_MAXIMUM_PRIORITY
+
/**
* Entry points for the Constant Bandwidth Server Scheduler.
*
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 9b0d1b4..137ea3a 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -35,6 +35,8 @@ extern "C" {
*/
/**@{*/
+#define SCHEDULER_EDF_MAXIMUM_PRIORITY 255
+
/**
* Entry points for the Earliest Deadline First Scheduler.
*/
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 201c1b6..a546ed6 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -32,6 +32,8 @@ extern "C" {
*/
/**@{*/
+#define SCHEDULER_SIMPLE_MAXIMUM_PRIORITY 255
+
/**
* Entry points for Scheduler Simple
*/
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 11310c6..342a574 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -54,6 +54,8 @@ typedef struct {
Chain_Control Ready;
} Scheduler_simple_SMP_Context;
+#define SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY 255
+
/**
* @brief Entry points for the Simple SMP Scheduler.
*/
--
1.8.4.5
More information about the devel
mailing list