From 24934e36e2513f972510d7c746103be1f766dc6a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 3 Apr 2014 15:03:35 +0200 Subject: score: Add scheduler control to scheduler ops Scheduler operations must be free of a global scheduler context to enable partitioned/clustered scheduling. --- cpukit/rtems/src/clocktick.c | 2 +- cpukit/rtems/src/ratemoncancel.c | 6 +++++- cpukit/rtems/src/ratemondelete.c | 6 +++++- cpukit/rtems/src/ratemonperiod.c | 12 ++++++++++-- cpukit/rtems/src/taskgetaffinity.c | 13 ++++++++----- cpukit/rtems/src/tasksetaffinity.c | 12 +++++++----- cpukit/rtems/src/taskwakeafter.c | 2 +- 7 files changed, 37 insertions(+), 16 deletions(-) (limited to 'cpukit/rtems/src') diff --git a/cpukit/rtems/src/clocktick.c b/cpukit/rtems/src/clocktick.c index a026b44494..1abaa7f20e 100644 --- a/cpukit/rtems/src/clocktick.c +++ b/cpukit/rtems/src/clocktick.c @@ -34,7 +34,7 @@ rtems_status_code rtems_clock_tick( void ) _Watchdog_Tickle_ticks(); - _Scheduler_Tick(); + _Scheduler_Tick( _Scheduler_Get( NULL ) ); #if defined( RTEMS_SMP ) _Thread_Enable_dispatch(); diff --git a/cpukit/rtems/src/ratemoncancel.c b/cpukit/rtems/src/ratemoncancel.c index d9b5dee6ea..9f993f2cdf 100644 --- a/cpukit/rtems/src/ratemoncancel.c +++ b/cpukit/rtems/src/ratemoncancel.c @@ -40,7 +40,11 @@ rtems_status_code rtems_rate_monotonic_cancel( } (void) _Watchdog_Remove( &the_period->Timer ); the_period->state = RATE_MONOTONIC_INACTIVE; - _Scheduler_Release_job(the_period->owner, 0); + _Scheduler_Release_job( + _Scheduler_Get( the_period->owner ), + the_period->owner, + 0 + ); _Objects_Put( &the_period->Object ); return RTEMS_SUCCESSFUL; diff --git a/cpukit/rtems/src/ratemondelete.c b/cpukit/rtems/src/ratemondelete.c index 36480beab1..ee0b23682f 100644 --- a/cpukit/rtems/src/ratemondelete.c +++ b/cpukit/rtems/src/ratemondelete.c @@ -35,7 +35,11 @@ rtems_status_code rtems_rate_monotonic_delete( switch ( location ) { case OBJECTS_LOCAL: - _Scheduler_Release_job(the_period->owner, 0); + _Scheduler_Release_job( + _Scheduler_Get( the_period->owner ), + the_period->owner, + 0 + ); _Objects_Close( &_Rate_monotonic_Information, &the_period->Object ); (void) _Watchdog_Remove( &the_period->Timer ); the_period->state = RATE_MONOTONIC_INACTIVE; diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c index 4c39fc56ff..9d31813353 100644 --- a/cpukit/rtems/src/ratemonperiod.c +++ b/cpukit/rtems/src/ratemonperiod.c @@ -144,7 +144,11 @@ void _Rate_monotonic_Initiate_statistics( } #endif - _Scheduler_Release_job(the_period->owner, the_period->next_length); + _Scheduler_Release_job( + _Scheduler_Get( the_period->owner ), + the_period->owner, + the_period->next_length + ); } static void _Rate_monotonic_Update_statistics( @@ -340,7 +344,11 @@ rtems_status_code rtems_rate_monotonic_period( the_period->next_length = length; _Watchdog_Insert_ticks( &the_period->Timer, length ); - _Scheduler_Release_job(the_period->owner, the_period->next_length); + _Scheduler_Release_job( + _Scheduler_Get( the_period->owner ), + the_period->owner, + the_period->next_length + ); _Objects_Put( &the_period->Object ); return RTEMS_TIMEOUT; } diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c index d9cc25e646..c389f1b991 100644 --- a/cpukit/rtems/src/taskgetaffinity.c +++ b/cpukit/rtems/src/taskgetaffinity.c @@ -34,7 +34,7 @@ rtems_status_code rtems_task_get_affinity( { Thread_Control *the_thread; Objects_Locations location; - rtems_status_code status = RTEMS_SUCCESSFUL; + bool ok; if ( !cpuset ) return RTEMS_INVALID_ADDRESS; @@ -44,11 +44,14 @@ rtems_status_code rtems_task_get_affinity( switch ( location ) { case OBJECTS_LOCAL: - if ( ! _Scheduler_Get_affinity( the_thread, cpusetsize, cpuset )) { - status = RTEMS_INVALID_NUMBER; - } + ok = _Scheduler_Get_affinity( + _Scheduler_Get( the_thread ), + the_thread, + cpusetsize, + cpuset + ); _Objects_Put( &the_thread->Object ); - return status; + return ok ? RTEMS_SUCCESSFUL : RTEMS_INVALID_NUMBER; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: diff --git a/cpukit/rtems/src/tasksetaffinity.c b/cpukit/rtems/src/tasksetaffinity.c index 4d767410a9..6d8def7aca 100644 --- a/cpukit/rtems/src/tasksetaffinity.c +++ b/cpukit/rtems/src/tasksetaffinity.c @@ -42,12 +42,14 @@ rtems_status_code rtems_task_set_affinity( switch ( location ) { case OBJECTS_LOCAL: - ok = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset ); + ok = _Scheduler_Set_affinity( + _Scheduler_Get( the_thread ), + the_thread, + cpusetsize, + cpuset + ); _Objects_Put( &the_thread->Object ); - if (! ok) { - return RTEMS_INVALID_NUMBER; - } - return RTEMS_SUCCESSFUL; + return ok ? RTEMS_SUCCESSFUL : RTEMS_INVALID_NUMBER; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c index aaa5bf39c7..367b43acc6 100644 --- a/cpukit/rtems/src/taskwakeafter.c +++ b/cpukit/rtems/src/taskwakeafter.c @@ -37,7 +37,7 @@ rtems_status_code rtems_task_wake_after( executing = _Thread_Executing; if ( ticks == 0 ) { - _Scheduler_Yield( executing ); + _Scheduler_Yield( _Scheduler_Get( executing ), executing ); } else { _Thread_Set_state( executing, STATES_DELAYING ); _Watchdog_Initialize( -- cgit v1.2.3