RTEMS SMP implementation questions

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Dec 9 07:18:43 UTC 2014


Hello,

On 08/12/14 11:40, Hesham Moustafa wrote:
> Hi all,
>
> I have been implementing SMP for a new architecture (Epiphany) and I
> have some questions.
>
> When the secondary processor should be waiting (or going to idle
> state)? At Thread_Start_multitasking?

before you start a secondary processor the BSS segment must be 
initialized to zero and the global data must be initialized.

The startup handshake is done in _Per_CPU_State_change(), but this 
should be not relevant for the BSP SMP support code.

>
> When a secondary processor is interrupted by another one? When it's
> allocated a thread (lazy allocate)? And in that case, what's the
> interprocess interrupt handler should do?
>
> The current SMP interrupt handler checks for the type of the message
> (shutdown, test, cache, etc). Should the interrupt handler assembly
> code check for dispatch necessary (which is set by another processor
> that allocated a thread for it), and then executes this thread? Please
> correct me if I am wrong. And if this is correct, where the secondary
> processor should be waiting (which function)?

The interrupt processing should be identical to the uni-processor case, 
except that you have to access the _Per_CPU_Information with the index 
of the current processor.  The thread dispatching is part of the normal 
interrupt epilogue.

>
> One major question, what's exactly the must-be-added code to both
> Context Switch, and ISR Handler, that differs from uni-processor
> systems.

You have to access the _Per_CPU_Information with the index of the 
current processor.  In the context switch code you have to add a 
synchronization procedure.  See for example

http://git.rtems.org/rtems/tree/cpukit/score/cpu/arm/cpu_asm.S#n56

and also the no_cpu cpu.h file.

>
> When I tried to run smp01 with my current implementation, I noticed
> that the boot processor goes to IDLE thread after initialization, and
> a secondary processor is the one who executes Init, is that the
> correct behaviour? I think it's not, although the boot processor does
> all its necessary functions before restart itself and jump to idle
> task, and it's allocating Init to processor 1.

This is fine.

>
> [1] https://github.com/heshamelmatary/rtems-epiphany
>
> Regards,
> Hesham
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list