From 4adaed7328e39eac4fe1879cba61919e74965cc8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 27 Jul 2021 11:08:54 +0200 Subject: score: Remove processor event broadcast/receive Remove _CPU_SMP_Processor_event_broadcast() and _CPU_SMP_Processor_event_receive(). These functions are hard to use since they are subject to the lost wake up problem. --- testsuites/smptests/smpfatal01/init.c | 6 +++--- testsuites/smptests/smpfatal02/init.c | 4 ++-- testsuites/smptests/smpmulticast01/init.c | 2 +- testsuites/smptests/smppsxsignal01/init.c | 5 ++--- testsuites/smptests/smpsignal01/init.c | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) (limited to 'testsuites/smptests') diff --git a/testsuites/smptests/smpfatal01/init.c b/testsuites/smptests/smpfatal01/init.c index 3f276a48fc..0fd5f3fc46 100644 --- a/testsuites/smptests/smpfatal01/init.c +++ b/testsuites/smptests/smpfatal01/init.c @@ -58,7 +58,7 @@ static void fatal_extension( for (cpu = 0; cpu < MAX_CPUS; ++cpu) { const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); - Per_CPU_State state = per_cpu->state; + Per_CPU_State state = _Per_CPU_Get_state(per_cpu); assert(state == PER_CPU_STATE_SHUTDOWN); } @@ -92,7 +92,7 @@ static rtems_status_code test_driver_init( for (cpu = 0; cpu < MAX_CPUS; ++cpu) { const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); - Per_CPU_State state = per_cpu->state; + Per_CPU_State state = _Per_CPU_Get_state(per_cpu); if (cpu == self) { assert(state == PER_CPU_STATE_INITIAL); @@ -110,7 +110,7 @@ static rtems_status_code test_driver_init( uint32_t other = (self + 1) % cpu_count; Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( other ); - per_cpu->state = PER_CPU_STATE_SHUTDOWN; + _Per_CPU_Set_state(per_cpu, PER_CPU_STATE_SHUTDOWN); } else { TEST_END(); exit(0); diff --git a/testsuites/smptests/smpfatal02/init.c b/testsuites/smptests/smpfatal02/init.c index 6aa48d6cc0..25321ca27b 100644 --- a/testsuites/smptests/smpfatal02/init.c +++ b/testsuites/smptests/smpfatal02/init.c @@ -60,7 +60,7 @@ static void fatal_extension( for (cpu = 0; cpu < MAX_CPUS; ++cpu) { const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); - Per_CPU_State state = per_cpu->state; + Per_CPU_State state = _Per_CPU_Get_state(per_cpu); assert(state == PER_CPU_STATE_SHUTDOWN); } @@ -96,7 +96,7 @@ static rtems_status_code test_driver_init( for (cpu = 0; cpu < MAX_CPUS; ++cpu) { const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); - Per_CPU_State state = per_cpu->state; + Per_CPU_State state = _Per_CPU_Get_state(per_cpu); if (cpu == self) { assert(state == PER_CPU_STATE_INITIAL); diff --git a/testsuites/smptests/smpmulticast01/init.c b/testsuites/smptests/smpmulticast01/init.c index 96462e32e3..fbe6fb6abf 100644 --- a/testsuites/smptests/smpmulticast01/init.c +++ b/testsuites/smptests/smpmulticast01/init.c @@ -390,7 +390,7 @@ static void set_wrong_cpu_state(void *arg) cpu_self = arg; T_step_eq_ptr(0, cpu_self, _Per_CPU_Get()); - cpu_self->state = 123; + _Per_CPU_Set_state(cpu_self, 123); while (true) { /* Do nothing */ diff --git a/testsuites/smptests/smppsxsignal01/init.c b/testsuites/smptests/smppsxsignal01/init.c index 1882715b3b..d23a664e9a 100644 --- a/testsuites/smptests/smppsxsignal01/init.c +++ b/testsuites/smptests/smppsxsignal01/init.c @@ -32,7 +32,7 @@ typedef enum { } test_state; typedef struct { - test_state state; + volatile test_state state; pthread_t consumer; pthread_t producer; uint32_t consumer_processor; @@ -42,13 +42,12 @@ typedef struct { static void change_state(test_context *ctx, test_state new_state) { ctx->state = new_state; - _CPU_SMP_Processor_event_broadcast(); } static void wait_for_state(const test_context *ctx, test_state desired_state) { while ( ctx->state != desired_state ) { - _CPU_SMP_Processor_event_receive(); + /* Wait */ } } diff --git a/testsuites/smptests/smpsignal01/init.c b/testsuites/smptests/smpsignal01/init.c index 025e84c6a2..471c058348 100644 --- a/testsuites/smptests/smpsignal01/init.c +++ b/testsuites/smptests/smpsignal01/init.c @@ -33,7 +33,7 @@ typedef enum { } test_state; typedef struct { - test_state state; + volatile test_state state; rtems_id consumer; rtems_id producer; uint32_t consumer_processor; @@ -45,13 +45,12 @@ typedef struct { static void change_state(test_context *ctx, test_state new_state) { ctx->state = new_state; - _CPU_SMP_Processor_event_broadcast(); } static void wait_for_state(const test_context *ctx, test_state desired_state) { while ( ctx->state != desired_state ) { - _CPU_SMP_Processor_event_receive(); + /* Wait */ } } -- cgit v1.2.3