[PATCH 4/8] score: Add _SMP_Online_processors

Joel Sherrill joel at rtems.org
Thu Mar 3 15:11:26 UTC 2016


Looks OK. I assume this is infrastructure for something that is coming.

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> ---
>  cpukit/score/include/rtems/score/smpimpl.h | 11 +++++++++++
>  cpukit/score/src/smp.c                     |  5 ++++-
>  testsuites/smptests/smpipi01/init.c        | 10 ++++++++++
>  3 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/score/include/rtems/score/smpimpl.h
> b/cpukit/score/include/rtems/score/smpimpl.h
> index 09c47ec..386216f 100644
> --- a/cpukit/score/include/rtems/score/smpimpl.h
> +++ b/cpukit/score/include/rtems/score/smpimpl.h
> @@ -20,6 +20,7 @@
>
>  #include <rtems/score/smp.h>
>  #include <rtems/score/percpu.h>
> +#include <rtems/score/processormask.h>
>  #include <rtems/fatal.h>
>  #include <rtems/rtems/cache.h>
>
> @@ -91,6 +92,16 @@ static inline void _SMP_Fatal( SMP_Fatal_code code )
>  #if defined( RTEMS_SMP )
>
>  /**
> + * @brief Set of online processors.
> + *
> + * A processor is online if was started during system initialization.  In
> this
> + * case its corresponding bit in the mask is set.
> + *
> + * @see _SMP_Handler_initialize().
> + */
> +extern Processor_mask _SMP_Online_processors;
> +
> +/**
>   * @brief Performs high-level initialization of a secondary processor and
> runs
>   * the application threads.
>   *
> diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
> index b2713f1..68a55ff 100644
> --- a/cpukit/score/src/smp.c
> +++ b/cpukit/score/src/smp.c
> @@ -29,6 +29,8 @@
>    #error "deferred FP switch not implemented for SMP"
>  #endif
>
> +Processor_mask _SMP_Online_processors;
> +
>  uint32_t _SMP_Processor_count;
>
>  static void _SMP_Start_processors( uint32_t cpu_count )
> @@ -36,7 +38,6 @@ static void _SMP_Start_processors( uint32_t cpu_count )
>    uint32_t cpu_index_self = _SMP_Get_current_processor();
>    uint32_t cpu_index;
>
> -
>    for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) {
>      const Scheduler_Assignment *assignment =
>        _Scheduler_Get_assignment( cpu_index );
> @@ -69,6 +70,8 @@ static void _SMP_Start_processors( uint32_t cpu_count )
>
>        ++context->processor_count;
>        cpu->scheduler_context = context;
> +
> +      _Processor_mask_Set( _SMP_Online_processors, cpu_index );
>      }
>    }
>  }
> diff --git a/testsuites/smptests/smpipi01/init.c
> b/testsuites/smptests/smpipi01/init.c
> index db0688c..8c39d18 100644
> --- a/testsuites/smptests/smpipi01/init.c
> +++ b/testsuites/smptests/smpipi01/init.c
> @@ -161,6 +161,10 @@ static void test_send_message_flood(
>    }
>
>    for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
> +    rtems_test_assert(
> +      _Processor_mask_Is_set(_SMP_Online_processors, cpu_index)
> +    );
> +
>      printf(
>        "inter-processor interrupts for processor %"
>          PRIu32 "%s: %" PRIu32 "\n",
> @@ -169,6 +173,12 @@ static void test_send_message_flood(
>        ctx->counters[cpu_index].value
>      );
>    }
> +
> +  for (; cpu_index < CPU_COUNT; ++cpu_index) {
> +    rtems_test_assert(
> +      !_Processor_mask_Is_set(_SMP_Online_processors, cpu_index)
> +    );
> +  }
>  }
>
>  static void test(void)
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160303/bb4eaf18/attachment-0002.html>


More information about the devel mailing list