SMP support for Raspberry Pi 2

Joel Sherrill joel.sherrill at oarcorp.com
Wed Jul 8 15:00:37 UTC 2015



On 7/8/2015 9:51 AM, Hesham ALMatary wrote:
> Hi Rohini,
>
> On Wed, Jul 8, 2015 at 1:54 PM, Rohini Kulkarni <krohini1593 at gmail.com> wrote:
>> Hi,
>>
>> I found this piece of code in confdefs.h
>>
>> #if defined(RTEMS_SMP)
>>
>>    /*
>>     *  If configured for SMP, then we need to know the maximum CPU cores.
>>     */
>>    #if !defined(CONFIGURE_SMP_APPLICATION)
>>      #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
>>        #define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1
>>      #endif
>>    #else
>>      #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
>>        #error "CONFIGURE_SMP_MAXIMUM_PROCESSORS not specified for SMP
>> Application"
>>      #endif
>>    #endif
>> #endif
>>
>> This piece of code gets the configured number of CPUs. I suppose this number
>> is not specified and will have to be specified by me somewhere in the
>> configurations. But I am unable to find out where.
>>
> Every BSP that supports SMP should define the number of
> cores/processors in its linkcmds file. For example have a look at
> Realview linkcmds file here [1]

The pc386 treats the configured value as the maximum to be supported.
It does not hard code the number on the hardware but probes at run-time.
See libbsp/i386/shared/smp.

The key is that the BSP can set a hard limit or determine the available
set at run-time.

There are two factors:

+ number RTEMS is configured for
+ number present in hardware
   - BSP can probe
   - can be hard-coded

An RTEMS SMP application configured for 2 CPUs on a quad-core system
will simply ignore the other two.

> [1] https://github.com/RTEMS/rtems/blob/master/c/src/lib/libbsp/arm/realview-pbx-a9/startup/linkcmds.realview_pbx_a9_qemu_smp#L1
>> Thanks!
>>
>>
>> On Sat, Jul 4, 2015 at 4:07 PM, Rohini Kulkarni <krohini1593 at gmail.com>
>> wrote:
>>>
>>>
>>>
>>> On Fri, Jul 3, 2015 at 10:43 PM, Joel Sherrill <joel.sherrill at oarcorp.com>
>>> wrote:
>>>>
>>>>
>>>>
>>>> On July 3, 2015 11:53:07 AM CDT, Rohini Kulkarni <krohini1593 at gmail.com>
>>>> wrote:
>>>>> Any help that I can with this?
>>>>>
>>>>> On 1 Jul 2015 16:59, "Rohini Kulkarni" <krohini1593 at gmail.com> wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I wish to know where the maximum number of processors for a variant are
>>>>> configured. I took a look at some configure scripts. I could see the
>>>>> processor count defined for xilinx-zynq in its configuration file as
>>>>> ZYNQ_CPUS=2.
>>>
>>>    This looks to be BSP specific and could originate in configure.ac or a
>>> .h file.
>>> I found this under ~/libbsp/arm/xilinx-zynq/configure
>>> # Check whether --enable-smp was given.
>>> if test "$rtems_cv_HAS_SMP" = "yes"; then :
>>>    ZYNQ_CPUS="2"
>>> fi
>>>>
>>>>
>>>> It is likely that each BSP has an underlying hardware limit.
>>>
>>> Yes
>>>>
>>>>
>>>>>
>>>>> rtems_configuration_get_maximum_processors() called in gets this
>>>>> configured number. But I don't know from where.
>>>>
>>>> This is set initially based on the confdefs.h parameter
>>>> CONFIGURE_SMP_MAXIMUM_PROCESSORS or something close to that (on phone).
>>>
>>> Ya, I found this piece of code in confdefs.h
>>> #if defined(RTEMS_SMP)
>>>    /*
>>>     *  If configured for SMP, then we need to know the maximum CPU cores.
>>>     */
>>>    #if !defined(CONFIGURE_SMP_APPLICATION)
>>>      #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
>>>        #define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1
>>>      #endif
>>>    #else
>>>      #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
>>>        #error "CONFIGURE_SMP_MAXIMUM_PROCESSORS not specified for SMP
>>> Application"
>>>      #endif
>>>    #endif
>>> #endif
>>>
>>> This piece of code gets the configured number of CPUs. I suppose this
>>> number is not specified and will have to be specified by me somewhere in the
>>> configurations. But I am unable to find out where.
>>>>
>>>> Ultimately the maximum CPUs for an application is the lower of those
>>>> available or RTEMS is configured for.
>>>
>>> Yes.
>>>>
>>>>
>>>>> Also where is RTEMS_SMP defined for a bsp?
>>>>
>>>> A side-effect of building with --enable-smp.
>>>
>>> Oh,alright.
>>>>
>>>>
>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Rohini Kulkarni
>>>>
>>>> --joel
>>>
>>>
>>>
>>>
>>> --
>>> Rohini Kulkarni
>>
>>
>>
>>
>> --
>> Rohini Kulkarni
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>
>
>

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the devel mailing list