diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-21 15:01:57 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-22 07:05:05 +0100 |
commit | 90960bd11a91259d9aace3870692dbe2e227de0f (patch) | |
tree | 3d88f8bc3d1fe17252e8290cadae2afb4a38ce4b /testsuites | |
parent | rtems: Avoid __RTEMS_USE_TICKS_FOR_STATISTICS__ (diff) | |
download | rtems-90960bd11a91259d9aace3870692dbe2e227de0f.tar.bz2 |
rtems: Rework rate-monotonic scheduler
Use the default thread lock to protect rate-monotonic state changes.
This avoids use of the Giant lock. Split rtems_rate_monotonic_period()
body into several static functions. Introduce a new thread wait class
THREAD_WAIT_CLASS_PERIOD for period objects to synchronize the blocking
operation.
Close #2631.
Diffstat (limited to '')
-rw-r--r-- | testsuites/sptests/spintrcritical08/init.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/testsuites/sptests/spintrcritical08/init.c b/testsuites/sptests/spintrcritical08/init.c index 3610e65b96..8d17feb365 100644 --- a/testsuites/sptests/spintrcritical08/init.c +++ b/testsuites/sptests/spintrcritical08/init.c @@ -25,20 +25,18 @@ static rtems_id Period; static volatile bool case_hit = false; +static Thread_Control *thread; + static rtems_rate_monotonic_period_states getState(void) { - Objects_Locations location; - Rate_monotonic_Control *period; - - period = (Rate_monotonic_Control *)_Objects_Get( - &_Rate_monotonic_Information, Period, &location ); - if ( location != OBJECTS_LOCAL ) { - puts( "Bad object lookup" ); - rtems_test_exit(0); - } - _Thread_Unnest_dispatch(); + Rate_monotonic_Control *the_period; + ISR_lock_Context lock_context; + + the_period = _Rate_monotonic_Get( Period, &lock_context ); + rtems_test_assert( the_period != NULL ); + _ISR_lock_ISR_enable( &lock_context ); - return period->state; + return the_period->state; } static rtems_timer_service_routine test_release_from_isr( @@ -55,11 +53,19 @@ static rtems_timer_service_routine test_release_from_isr( && watchdog->expire == cpu->Watchdog.ticks && watchdog->routine == _Rate_monotonic_Timeout ) { + Thread_Wait_flags flags = _Thread_Wait_flags_get( thread ); + _Watchdog_Per_CPU_remove_relative( watchdog ); + rtems_test_assert( getState() == RATE_MONOTONIC_ACTIVE ); + (*watchdog->routine)( watchdog ); - if ( getState() == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING ) { + if ( flags == RATE_MONOTONIC_INTEND_TO_BLOCK ) { + rtems_test_assert( + _Thread_Wait_flags_get( thread ) == RATE_MONOTONIC_READY_AGAIN + ); + rtems_test_assert( getState() == RATE_MONOTONIC_ACTIVE ); case_hit = true; } } @@ -93,6 +99,8 @@ rtems_task Init( puts( "Init - Trying to generate period ending while blocking" ); + thread = _Thread_Get_executing(); + puts( "Init - rtems_rate_monotonic_create - OK" ); sc = rtems_rate_monotonic_create( rtems_build_name( 'P', 'E', 'R', '1' ), |