diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-10-13 08:57:29 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-02 10:05:43 +0100 |
commit | 913864c0b85c9e94140515a44e79d13e999ff9a2 (patch) | |
tree | 2bca1b18a07972948290afee551bda967c452185 | |
parent | score: Yield support for new SMP helping protocol (diff) | |
download | rtems-913864c0b85c9e94140515a44e79d13e999ff9a2.tar.bz2 |
score: Use scheduler instance specific locks
Update #2556.
-rw-r--r-- | cpukit/score/include/rtems/score/mrspimpl.h | 4 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/scheduler.h | 5 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/schedulerimpl.h | 20 | ||||
-rw-r--r-- | cpukit/score/src/scheduler.c | 16 |
4 files changed, 35 insertions, 10 deletions
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h index deaacf20a0..92cc56614c 100644 --- a/cpukit/score/include/rtems/score/mrspimpl.h +++ b/cpukit/score/include/rtems/score/mrspimpl.h @@ -53,12 +53,12 @@ extern "C" { RTEMS_INLINE_ROUTINE void _MRSP_Giant_acquire( ISR_lock_Context *lock_context ) { - _ISR_lock_Acquire( &_Scheduler_Lock, lock_context ); + /* FIXME: MrsP protocol implementation will be reworked soon */ } RTEMS_INLINE_ROUTINE void _MRSP_Giant_release( ISR_lock_Context *lock_context ) { - _ISR_lock_Release( &_Scheduler_Lock, lock_context ); + /* FIXME: MrsP protocol implementation will be reworked soon */ } RTEMS_INLINE_ROUTINE void _MRSP_Acquire_critical( diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h index d13277ab53..07e415a57e 100644 --- a/cpukit/score/include/rtems/score/scheduler.h +++ b/cpukit/score/include/rtems/score/scheduler.h @@ -237,6 +237,11 @@ typedef struct { * this structure at the begin of its context structure. */ typedef struct Scheduler_Context { + /** + * @brief Lock to protect this scheduler instance. + */ + ISR_LOCK_MEMBER( Lock ) + #if defined(RTEMS_SMP) /** * @brief Count of processors owned by this scheduler instance. diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index ea32e00a65..25b961fcd6 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -101,8 +101,6 @@ RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get_by_CPU( return _Scheduler_Get_by_CPU_index( cpu_index ); } -ISR_LOCK_DECLARE( extern, _Scheduler_Lock ) - /** * @brief Acquires the scheduler instance inside a critical section (interrupts * disabled). @@ -116,8 +114,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Acquire_critical( ISR_lock_Context *lock_context ) { +#if defined(RTEMS_SMP) + Scheduler_Context *context; + + context = _Scheduler_Get_context( scheduler ); + _ISR_lock_Acquire( &context->Lock, lock_context ); +#else (void) scheduler; - _ISR_lock_Acquire( &_Scheduler_Lock, lock_context ); + (void) lock_context; +#endif } /** @@ -133,8 +138,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_critical( ISR_lock_Context *lock_context ) { +#if defined(RTEMS_SMP) + Scheduler_Context *context; + + context = _Scheduler_Get_context( scheduler ); + _ISR_lock_Release( &context->Lock, lock_context ); +#else (void) scheduler; - _ISR_lock_Release( &_Scheduler_Lock, lock_context ); + (void) lock_context; +#endif } RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_node( diff --git a/cpukit/score/src/scheduler.c b/cpukit/score/src/scheduler.c index e7854e1361..e5b9688faf 100644 --- a/cpukit/score/src/scheduler.c +++ b/cpukit/score/src/scheduler.c @@ -20,16 +20,24 @@ #include <rtems/score/schedulerimpl.h> -ISR_LOCK_DEFINE( , _Scheduler_Lock, "Scheduler" ) - void _Scheduler_Handler_initialization(void) { - size_t n = _Scheduler_Count; + size_t n; size_t i; + n = _Scheduler_Count; + for ( i = 0 ; i < n ; ++i ) { - const Scheduler_Control *scheduler = &_Scheduler_Table[ i ]; + const Scheduler_Control *scheduler; +#if defined(RTEMS_SMP) + Scheduler_Context *context; +#endif + scheduler = &_Scheduler_Table[ i ]; +#if defined(RTEMS_SMP) + context = _Scheduler_Get_context( scheduler ); +#endif + _ISR_lock_Initialize( &context->Lock, "Scheduler" ); ( *scheduler->Operations.initialize )( scheduler ); } } |