[PATCH 1/2] cpukit: Enable debug for SMP AArch64

Gedare Bloom gedare at rtems.org
Sat Nov 20 17:11:44 UTC 2021


This looks ok, along with the copyright clean-up. In the future please
separate non-functional (style, copyright, etc) changes from
functional patches to simplify review/approval/revision process.

One question I do have from this: the minimum APPROX size is 180
(+CPU_PER_CPU_CONTROL_SIZE + CPU_INTERRUPT_FRAME_SIZE)

So it seems there is some dead macro code following this.

  #elif PER_CPU_CONTROL_SIZE_APPROX > 128
is trivially true if it is reached, therefore
 #else
    #define PER_CPU_CONTROL_SIZE_LOG2 7
  #endif
should never happen?


On Wed, Nov 17, 2021 at 11:03 AM Kinsey Moore <kinsey.moore at oarcorp.com> wrote:
>
> Ensure when both RTEMS_DEBUG is specified and pointers are large that
> enough space is allocated to accomodate the Per_CPU_Control structure.
> This changes the calculation to be more compositional instead of trying
> to list out every permutation of options possible.
> ---
>  cpukit/include/rtems/score/percpu.h | 31 ++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/cpukit/include/rtems/score/percpu.h b/cpukit/include/rtems/score/percpu.h
> index 6081653a86..0794f15f69 100644
> --- a/cpukit/include/rtems/score/percpu.h
> +++ b/cpukit/include/rtems/score/percpu.h
> @@ -38,18 +38,31 @@
>  extern "C" {
>  #endif
>
> -#if defined(RTEMS_SMP)
> -  #if defined(RTEMS_PROFILING)
> -    #define PER_CPU_CONTROL_SIZE_APPROX \
> -      ( 512 + CPU_PER_CPU_CONTROL_SIZE + CPU_INTERRUPT_FRAME_SIZE )
> -  #elif defined(RTEMS_DEBUG) || CPU_SIZEOF_POINTER > 4
> -    #define PER_CPU_CONTROL_SIZE_APPROX \
> -      ( 256 + CPU_PER_CPU_CONTROL_SIZE + CPU_INTERRUPT_FRAME_SIZE )
> +#if defined( RTEMS_SMP )
> +  #if defined( RTEMS_PROFILING )
> +    #define PER_CPU_CONTROL_SIZE_PROFILING 332
> +  #else
> +    #define PER_CPU_CONTROL_SIZE_PROFILING 0
> +  #endif
> +
> +  #if defined( RTEMS_DEBUG )
> +    #define PER_CPU_CONTROL_SIZE_DEBUG 76
>    #else
> -    #define PER_CPU_CONTROL_SIZE_APPROX \
> -      ( 180 + CPU_PER_CPU_CONTROL_SIZE + CPU_INTERRUPT_FRAME_SIZE )
> +    #define PER_CPU_CONTROL_SIZE_DEBUG 0
>    #endif
>
> +  #if CPU_SIZEOF_POINTER > 4
> +    #define PER_CPU_CONTROL_SIZE_BIG_POINTER 76
> +  #else
> +    #define PER_CPU_CONTROL_SIZE_BIG_POINTER 0
> +  #endif
> +
> +  #define PER_CPU_CONTROL_SIZE_BASE 180
> +  #define PER_CPU_CONTROL_SIZE_APPROX \
> +    ( PER_CPU_CONTROL_SIZE_BASE + CPU_PER_CPU_CONTROL_SIZE + \
> +    CPU_INTERRUPT_FRAME_SIZE + PER_CPU_CONTROL_SIZE_PROFILING + \
> +    PER_CPU_CONTROL_SIZE_DEBUG + PER_CPU_CONTROL_SIZE_BIG_POINTER )
> +
>    /*
>     * This ensures that on SMP configurations the individual per-CPU controls
>     * are on different cache lines to prevent false sharing.  This define can be
> --
> 2.30.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list