diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-17 15:43:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 07:49:41 +0200 |
commit | dab902d5b2688fe958118299f7d44d1adbf13878 (patch) | |
tree | fa54fcf607d93dd03017f9d0eb1f82ca0f55aca4 /testsuites/smptests | |
parent | score: Avoid Giant _Objects_Extend_information() (diff) | |
download | rtems-dab902d5b2688fe958118299f7d44d1adbf13878.tar.bz2 |
testsuites: Avoid Giant lock
Replace _Thread_Disable_dispatch() with _Thread_Dispatch_disable().
Replace _Thread_Enable_dispatch() with _Thread_Dispatch_enable().
This is a preparation to remove the Giant lock.
Update #2555.
Diffstat (limited to 'testsuites/smptests')
-rw-r--r-- | testsuites/smptests/smpcache01/init.c | 17 | ||||
-rw-r--r-- | testsuites/smptests/smpfatal03/init.c | 4 | ||||
-rw-r--r-- | testsuites/smptests/smpmigration02/init.c | 6 | ||||
-rw-r--r-- | testsuites/smptests/smpscheduler01/init.c | 10 | ||||
-rw-r--r-- | testsuites/smptests/smpthreadlife01/init.c | 4 |
5 files changed, 22 insertions, 19 deletions
diff --git a/testsuites/smptests/smpcache01/init.c b/testsuites/smptests/smpcache01/init.c index d8995e8be2..52ee997fa5 100644 --- a/testsuites/smptests/smpcache01/init.c +++ b/testsuites/smptests/smpcache01/init.c @@ -166,19 +166,19 @@ static void call_tests_isr_disabled( size_t set_size, } } -static void call_tests_with_giant_acquired( size_t set_size, +static void call_tests_with_thread_dispatch_disabled( size_t set_size, const cpu_set_t *cpu_set, SMP_barrier_State *bs ) { size_t i; for (i = 0; i < RTEMS_ARRAY_SIZE( test_cases ); ++i) { - if ( rtems_get_current_processor() == 0) - _Thread_Disable_dispatch(); + Per_CPU_Control *cpu_self; + + cpu_self = _Thread_Dispatch_disable(); call_test( set_size, cpu_set, bs, i ); - if ( rtems_get_current_processor() == 0) - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable( cpu_self ); } } @@ -208,10 +208,9 @@ static void all_tests( void ) call_tests_isr_disabled( set_size, cpu_set, &bs ); cmlog( "Done!\n" ); - /* Call test cases with core 0 holding the giant lock */ - cmlog( "Calling test cases with CPU0 holding " - "the giant lock. " ); - call_tests_with_giant_acquired( set_size, cpu_set, &bs ); + /* Call test cases with thread dispatch disabled */ + cmlog( "Calling test cases with thread_dispatch_disabled. "); + call_tests_with_thread_dispatch_disabled( set_size, cpu_set, &bs ); cmlog( "Done!\n"); /* Done. Free up memory. */ diff --git a/testsuites/smptests/smpfatal03/init.c b/testsuites/smptests/smpfatal03/init.c index 788b07167c..2f3980bfe5 100644 --- a/testsuites/smptests/smpfatal03/init.c +++ b/testsuites/smptests/smpfatal03/init.c @@ -42,7 +42,7 @@ static void acquire_giant_and_fatal_task(rtems_task_argument arg) int i; for (i = 0; i < 13; ++i) { - _Thread_Disable_dispatch(); + _Giant_Acquire(); } _SMP_barrier_Wait(&giant_barrier, &state, CPU_COUNT); @@ -62,7 +62,7 @@ static void wait_for_giant(void) _SMP_barrier_Wait(&giant_barrier, &state, CPU_COUNT); - _Thread_Disable_dispatch(); + _Giant_Release(); } static void Init(rtems_task_argument arg) diff --git a/testsuites/smptests/smpmigration02/init.c b/testsuites/smptests/smpmigration02/init.c index 40ac8ffa38..ed10c2bc35 100644 --- a/testsuites/smptests/smpmigration02/init.c +++ b/testsuites/smptests/smpmigration02/init.c @@ -140,6 +140,7 @@ static void test_double_migration(test_context *ctx) uint32_t cpu_other_index = 1; Per_CPU_Control *cpu_self = _Per_CPU_Get_by_index(cpu_self_index); Per_CPU_Control *cpu_other = _Per_CPU_Get_by_index(cpu_other_index); + Per_CPU_Control *cpu_self_dispatch_disabled; Thread_Control *self; Thread_Control *other; @@ -173,7 +174,8 @@ static void test_double_migration(test_context *ctx) /* Wait */ } - _Thread_Disable_dispatch(); + cpu_self_dispatch_disabled = _Thread_Dispatch_disable(); + rtems_test_assert(cpu_self == cpu_self_dispatch_disabled); self = _Thread_Executing; @@ -215,7 +217,7 @@ static void test_double_migration(test_context *ctx) rtems_test_assert(cpu_other->heir == other); - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable(cpu_self_dispatch_disabled); while (!_Thread_Is_executing_on_a_processor(other)) { /* Wait */ diff --git a/testsuites/smptests/smpscheduler01/init.c b/testsuites/smptests/smpscheduler01/init.c index db61933f7e..9518a4d5fe 100644 --- a/testsuites/smptests/smpscheduler01/init.c +++ b/testsuites/smptests/smpscheduler01/init.c @@ -103,8 +103,9 @@ static bool is_per_cpu_state_ok(void) static void test_scheduler_cross(void) { bool per_cpu_state_ok; + Per_CPU_Control *cpu_self; - _Thread_Disable_dispatch(); + cpu_self = _Thread_Dispatch_disable(); suspend(0); suspend(1); @@ -113,7 +114,7 @@ static void test_scheduler_cross(void) per_cpu_state_ok = is_per_cpu_state_ok(); - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable( cpu_self ); rtems_test_assert(per_cpu_state_ok); } @@ -121,8 +122,9 @@ static void test_scheduler_cross(void) static void test_scheduler_move_heir(void) { bool per_cpu_state_ok; + Per_CPU_Control *cpu_self; - _Thread_Disable_dispatch(); + cpu_self = _Thread_Dispatch_disable(); suspend(2); suspend(3); @@ -136,7 +138,7 @@ static void test_scheduler_move_heir(void) resume(1); - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable( cpu_self ); rtems_test_assert(per_cpu_state_ok); } diff --git a/testsuites/smptests/smpthreadlife01/init.c b/testsuites/smptests/smpthreadlife01/init.c index bd4c88dd65..5bfa3bceb4 100644 --- a/testsuites/smptests/smpthreadlife01/init.c +++ b/testsuites/smptests/smpthreadlife01/init.c @@ -212,7 +212,7 @@ static void delay_ipi_task(rtems_task_argument variant) rtems_counter_delay_nanoseconds(100000000); if (variant != 0) { - _Thread_Disable_dispatch(); + _Thread_Dispatch_disable(); } _ISR_Enable_without_giant(level); @@ -224,7 +224,7 @@ static void delay_ipi_task(rtems_task_argument variant) _Thread_Set_life_protection( THREAD_LIFE_PROTECTED ); if (variant != 0) { - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable( _Per_CPU_Get() ); } rtems_test_assert(0); |