[PATCH 11 minor addeum] arm/raspberrypi: GPIO - using RTEMS interrupt lock during BSP

Pavel Pisa pisa at cmp.felk.cvut.cz
Wed Sep 7 06:52:33 UTC 2016


Hello Sebastian,

On Wednesday 07 of September 2016 07:33:36 Sebastian Huber wrote:
> Hello Pavel,
>
> On 06/09/16 21:48, Pavel Pisa wrote:
> > Hello Sebastian,
> >
> > On Tuesday 06 of September 2016 20:33:08 Sebastian Huber wrote:
> >> The interrupt locks are simple interrupt disable/enable or spin locks.
> >> So, they always work.
> >
> > Allmost, on UP they are simple local IRQ disable.
> > But on SMP they are spinlock combined with IRQ disable.
> > But spinlock requires that corresponding memory location is initialized.
> > It is initialized to 0,0 as ticked lock or combination with some
> > debug/non-zero information depending on RTEMS_DEBUG, RTEMS_PROFILING etc.
> > The locks ends in BSS for zero case and I expect that it is source of
> > my problems.
>
> if you want to use something before the BSS initialization, then you can
> move it to the BSP_START_DATA_SECTION section or explicitly initialize
> it, e.g. in your case via rtems_interrupt_lock_initialize().

I skip this patch. I have found one other corner case for it usefullens
and it is changing value of output pins to safe state during BSP fatal
handling. If other CPU hard-faults when holding spinlock then fatal
handler can block. But again artificially constructed case.

> The rest of the patch series looks good.

Thanks

> The smpfatal08 test is quite a hack since it re-defines some global SMP
> support functions locally. In order to support this, the ARM BSPs must
> place the _CPU_SMP_Start_processor() function as the only global
> function into the bspsmp.c file.

I expected that

CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections

in BSP and linker -Wl,--gc-section could/sould resolve that.

So should I divide bspsmp.c into two files?

For example, bspsmp-startcpu.c, bspsmp-init.c.

What about 

uint32_t _CPU_SMP_Initialize(void)
{
  uint32_t cpu_count = (uint32_t)bsp_processor_count;

  if ( cpu_count > 4 )
    cpu_count = 4;

  return cpu_count;
}

void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
{
  /* Do nothing */
}

void _CPU_SMP_Prepare_start_multitasking( void )
{
  /* Do nothing */
}

void _CPU_SMP_Send_interrupt( uint32_t target_cpu_index )
{
  /* Generates IPI */
  BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE +
      0x10 * target_cpu_index) = 0x1;
}

should they go to the same compilation unit as _CPU_SMP_Start_processor
or bspsmp-init.c separate one.

Or I should not care about smpfatal08 or add required symbol to it.

Best wishes,

                Pavel



More information about the devel mailing list