[PATCH 1/8] score: Static scheduler configuration
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Apr 11 18:02:41 UTC 2014
On 04/11/2014 06:50 PM, Gedare Bloom wrote:
> On Fri, Apr 11, 2014 at 11:11 AM, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>> Do not allocate the scheduler control structures from the workspace.
>> This is a preparation step for configuration of clustered/partitioned
>> schedulers on SMP.
>> ---
>> cpukit/sapi/Makefile.am | 1 +
>> cpukit/sapi/include/confdefs.h | 129 +++++++++-------
>> cpukit/sapi/include/rtems/scheduler.h | 160 ++++++++++++++++++++
>> cpukit/sapi/preinstall.am | 4 +
>> cpukit/score/include/rtems/score/scheduler.h | 126 +++++++++------
>> cpukit/score/include/rtems/score/schedulercbs.h | 26 ++-
>> cpukit/score/include/rtems/score/scheduleredf.h | 55 ++++---
>> .../score/include/rtems/score/scheduleredfimpl.h | 18 +-
>> cpukit/score/include/rtems/score/schedulerimpl.h | 131 +++++++++--------
>> .../score/include/rtems/score/schedulerpriority.h | 51 ++++---
>> .../rtems/score/schedulerpriorityaffinitysmp.h | 20 ++--
>> .../include/rtems/score/schedulerpriorityimpl.h | 30 ++--
>> .../include/rtems/score/schedulerprioritysmp.h | 24 ++-
>> cpukit/score/include/rtems/score/schedulersimple.h | 47 +++---
>> .../include/rtems/score/schedulersimpleimpl.h | 22 ++--
>> .../score/include/rtems/score/schedulersimplesmp.h | 21 ++-
>> cpukit/score/include/rtems/score/schedulersmp.h | 18 +--
>> .../score/include/rtems/score/schedulersmpimpl.h | 28 ++--
>> cpukit/score/src/scheduler.c | 9 +-
>> cpukit/score/src/schedulercbs.c | 10 --
>> cpukit/score/src/schedulercbsallocate.c | 4 +-
>> cpukit/score/src/schedulercbsattachthread.c | 8 +-
>> cpukit/score/src/schedulercbscleanup.c | 3 +-
>> cpukit/score/src/schedulercbscreateserver.c | 11 +-
>> cpukit/score/src/schedulercbsdestroyserver.c | 7 +-
>> cpukit/score/src/schedulercbsdetachthread.c | 6 +-
>> cpukit/score/src/schedulercbsgetapprovedbudget.c | 4 +-
>> cpukit/score/src/schedulercbsgetexecutiontime.c | 10 +-
>> cpukit/score/src/schedulercbsgetparameters.c | 4 +-
>> cpukit/score/src/schedulercbsgetremainingbudget.c | 8 +-
>> cpukit/score/src/schedulercbsgetserverid.c | 4 +-
>> cpukit/score/src/schedulercbsreleasejob.c | 6 +-
>> cpukit/score/src/schedulercbssetparameters.c | 4 +-
>> cpukit/score/src/schedulercbsunblock.c | 4 +-
>> cpukit/score/src/schedulerdefaultallocatefree.c | 8 +-
>> cpukit/score/src/schedulerdefaultgetaffinity.c | 8 +-
>> cpukit/score/src/schedulerdefaultreleasejob.c | 6 +-
>> cpukit/score/src/schedulerdefaultsetaffinity.c | 8 +-
>> cpukit/score/src/schedulerdefaultstartidle.c | 6 +-
>> cpukit/score/src/schedulerdefaulttick.c | 6 +-
>> cpukit/score/src/schedulerdefaultupdate.c | 4 +-
>> cpukit/score/src/scheduleredf.c | 15 +--
>> cpukit/score/src/scheduleredfallocate.c | 4 +-
>> cpukit/score/src/scheduleredfblock.c | 4 +-
>> cpukit/score/src/scheduleredfenqueue.c | 10 +-
>> cpukit/score/src/scheduleredfenqueuefirst.c | 4 +-
>> cpukit/score/src/scheduleredfextract.c | 10 +-
>> cpukit/score/src/scheduleredffree.c | 4 +-
>> cpukit/score/src/scheduleredfreleasejob.c | 6 +-
>> cpukit/score/src/scheduleredfschedule.c | 4 +-
>> cpukit/score/src/scheduleredfunblock.c | 4 +-
>> cpukit/score/src/scheduleredfupdate.c | 4 +-
>> cpukit/score/src/scheduleredfyield.c | 14 +-
>> cpukit/score/src/schedulerpriority.c | 13 +-
>> cpukit/score/src/schedulerpriorityaffinitysmp.c | 20 ++--
>> cpukit/score/src/schedulerpriorityallocate.c | 4 +-
>> cpukit/score/src/schedulerpriorityblock.c | 4 +-
>> cpukit/score/src/schedulerpriorityenqueue.c | 10 +-
>> cpukit/score/src/schedulerpriorityenqueuefirst.c | 10 +-
>> cpukit/score/src/schedulerpriorityextract.c | 6 +-
>> cpukit/score/src/schedulerpriorityfree.c | 6 +-
>> cpukit/score/src/schedulerpriorityschedule.c | 6 +-
>> cpukit/score/src/schedulerprioritysmp.c | 97 ++++++------
>> cpukit/score/src/schedulerpriorityunblock.c | 10 +-
>> cpukit/score/src/schedulerpriorityupdate.c | 12 +-
>> cpukit/score/src/schedulerpriorityyield.c | 6 +-
>> cpukit/score/src/schedulersimple.c | 13 +-
>> cpukit/score/src/schedulersimpleblock.c | 4 +-
>> cpukit/score/src/schedulersimpleenqueue.c | 10 +-
>> cpukit/score/src/schedulersimpleenqueuefirst.c | 7 +-
>> cpukit/score/src/schedulersimpleextract.c | 8 +-
>> .../score/src/schedulersimplereadyqueueenqueue.c | 10 +-
>> .../src/schedulersimplereadyqueueenqueuefirst.c | 10 +-
>> cpukit/score/src/schedulersimpleschedule.c | 4 +-
>> cpukit/score/src/schedulersimplesmp.c | 86 +++++------
>> cpukit/score/src/schedulersimpleunblock.c | 8 +-
>> cpukit/score/src/schedulersimpleyield.c | 5 +-
>> cpukit/score/src/threadchangepriority.c | 6 +-
>> cpukit/score/src/threadrestart.c | 8 +-
>> doc/user/conf.t | 16 +-
>> testsuites/rhealstone/rhilatency/ilatency.c | 6 +-
>> testsuites/sptests/spinternalerror01/init.c | 6 +-
>> testsuites/sptests/spsize/size.c | 10 +-
>> testsuites/tmtests/tm26/task1.c | 31 ++--
>> testsuites/tmtests/tm27/task1.c | 20 ++-
>> 85 files changed, 911 insertions(+), 703 deletions(-)
>> create mode 100644 cpukit/sapi/include/rtems/scheduler.h
>>
>> diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am
>> index 37a2fa4..4a2b6ca 100644
>> --- a/cpukit/sapi/Makefile.am
>> +++ b/cpukit/sapi/Makefile.am
>> @@ -17,6 +17,7 @@ include_rtems_HEADERS += include/rtems/cbs.h
>> include_rtems_HEADERS += include/rtems/profiling.h
>> include_rtems_HEADERS += include/rtems/rbheap.h
>> include_rtems_HEADERS += include/rtems/rbtree.h
>> +include_rtems_HEADERS += include/rtems/scheduler.h
>> include_rtems_HEADERS += include/rtems/sptables.h
>> include_rtems_HEADERS += include/rtems/test.h
>> include_rtems_HEADERS += include/rtems/timespec.h
>> diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
>> index 53a8699..959514f 100644
>> --- a/cpukit/sapi/include/confdefs.h
>> +++ b/cpukit/sapi/include/confdefs.h
> [...]
>> @@ -807,11 +817,17 @@ const rtems_libio_helper rtems_fs_init_helper =
>> * this code to know which scheduler is configured by the user.
>> */
>> #ifdef CONFIGURE_INIT
>> - Scheduler_Control _Scheduler = {
>> - NULL, /* Scheduler Specific Data Pointer */
>> - CONFIGURE_SCHEDULER_ENTRY_POINTS /* Scheduler Operations */
>> + CONFIGURE_SCHEDULER_CONTEXT;
>> +
>> + const Scheduler_Control _Scheduler_Table[] = {
>> + CONFIGURE_SCHEDULER_CONTROLS
>> };
>>
>> + #if defined(RTEMS_SMP)
>> + const size_t _Scheduler_Count =
>> + RTEMS_ARRAY_SIZE( _Scheduler_Table );
>> + #endif
>> +
> Would this compute to 1 in non-SMP mode? If so it can be used.
It is very important that this is a compile time constant on
uni-processor configurations so that the compiler can optimize the loops
away.
I will add this to a comment in this source code.
>
> [...]
>> diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
>> index 1e4e91b..7706bf3 100644
>> --- a/cpukit/score/include/rtems/score/schedulerpriority.h
>> +++ b/cpukit/score/include/rtems/score/schedulerpriority.h
>> @@ -67,6 +67,11 @@ extern "C" {
>>
>> typedef struct {
>> /**
>> + * @brief Basic scheduler context.
>> + */
>> + Scheduler_Context Base;
>> +
>> + /**
>> * @brief Bit map to indicate non-empty ready queues.
>> */
>> Priority_bit_map_Control Bit_map;
>> @@ -74,8 +79,8 @@ typedef struct {
>> /**
>> * @brief One ready queue per priority level.
>> */
>> - Chain_Control Ready[ 1 ];
>> -} Scheduler_priority_Control;
>> + Chain_Control Ready[ 0 ];
>> +} Scheduler_priority_Context;
>>
> Use of zero-length array to tail-pad a struct is a gnu extension. If
> we are C90 then it must be an array with [1], if we assume C99 then
> the array length can be omitted []. Otherwise, we assume the GNU
> extension works but should make note of this somewhere. The same
> applies in other parts of this patch where structs get a zero-length
> array.
Yes, its a GNU extension, but even the Microsoft supports this. The []
is not allowed in strict C++. What about adding
#define RTEMS_ZERO_LENGTH_ARRAY 0
to basedefs.h so that the places are easily spotted?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list