Changeset 785c02f in rtems-docs


Ignore:
Timestamp:
02/02/17 13:07:53 (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
87b4d03
Parents:
3e005fe
Message:

c-user: Add SMP low-level synchronization

Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • c-user/glossary.rst

    r3e005fe r785c02f  
    1414      A task which must execute only at irregular intervals and has only a soft
    1515      deadline.
     16
     17   API
     18      An acronym for Application Programming Interface.
    1619
    1720   application
     
    315318      over resources.
    316319
     320   MCS
     321      An acronym for Mellor-Crummey Scott.
     322
    317323   memory pool
    318324      Used interchangeably with heap.
     
    379385   non-existent
    380386      The state occupied by an uncreated or deleted task.
     387
     388   NUMA
     389      An acronym for Non-Uniform Memory Access.
    381390
    382391   numeric coprocessor
     
    614623   SMCB
    615624      An acronym for Semaphore Control Block.
     625
     626   SMP
     627      An acronym for Symmetric Multiprocessing.
    616628
    617629   SMP locks
  • c-user/symmetric_multiprocessing_services.rst

    r3e005fe r785c02f  
    525525Therefore, self-contained synchronization objects are now available for RTEMS.
    526526
     527Directives
     528==========
     529
     530This section details the symmetric multiprocessing services.  A subsection is
     531dedicated to each of these services and describes the calling sequence, related
     532constants, usage, and status codes.
     533
     534.. raw:: latex
     535
     536   \clearpage
     537
     538.. _rtems_get_processor_count:
     539
     540GET_PROCESSOR_COUNT - Get processor count
     541-----------------------------------------
     542
     543CALLING SEQUENCE:
     544    .. code-block:: c
     545
     546        uint32_t rtems_get_processor_count(void);
     547
     548DIRECTIVE STATUS CODES:
     549    The count of processors in the system.
     550
     551DESCRIPTION:
     552    In uni-processor configurations, a value of one will be returned.
     553
     554    In SMP configurations, this returns the value of a global variable set
     555    during system initialization to indicate the count of utilized processors.
     556    The processor count depends on the physically or virtually available
     557    processors and application configuration.  The value will always be less
     558    than or equal to the maximum count of application configured processors.
     559
     560NOTES:
     561    None.
     562
     563.. raw:: latex
     564
     565   \clearpage
     566
     567.. _rtems_get_current_processor:
     568
     569GET_CURRENT_PROCESSOR - Get current processor index
     570---------------------------------------------------
     571
     572CALLING SEQUENCE:
     573    .. code-block:: c
     574
     575        uint32_t rtems_get_current_processor(void);
     576
     577DIRECTIVE STATUS CODES:
     578    The index of the current processor.
     579
     580DESCRIPTION:
     581    In uni-processor configurations, a value of zero will be returned.
     582
     583    In SMP configurations, an architecture specific method is used to obtain the
     584    index of the current processor in the system.  The set of processor indices
     585    is the range of integers starting with zero up to the processor count minus
     586    one.
     587
     588    Outside of sections with disabled thread dispatching the current processor
     589    index may change after every instruction since the thread may migrate from
     590    one processor to another.  Sections with disabled interrupts are sections
     591    with thread dispatching disabled.
     592
     593NOTES:
     594    None.
     595
    527596Implementation Details
    528597======================
     598
     599This section covers some implementation details of the RTEMS SMP support.
     600
     601Low-Level Synchronization
     602-------------------------
     603
     604All low-level synchronization primitives are implemented using :term:`C11`
     605atomic operations, so no target-specific hand-written assembler code is
     606necessary.  Four synchronization primitives are currently available
     607
     608* ticket locks (mutual exclusion),
     609
     610* :term:`MCS` locks (mutual exclusion),
     611
     612* barriers, implemented as a sense barrier, and
     613
     614* sequence locks :cite:`Boehm:2012:Seqlock`.
     615
     616A vital requirement for low-level mutual exclusion is :term:`FIFO` fairness
     617since we are interested in a predictable system and not maximum throughput.
     618With this requirement, there are only few options to resolve this problem.  For
     619reasons of simplicity, the ticket lock algorithm was chosen to implement the
     620SMP locks.  However, the API is capable to support MCS locks, which may be
     621interesting in the future for systems with a processor count in the range of 32
     622or more, e.g.  :term:`NUMA`, many-core systems.
     623
     624The test program `SMPLOCK 1
     625<https://git.rtems.org/rtems/tree/testsuites/smptests/smplock01>`_ can be used
     626to gather performance and fairness data for several scenarios.  The SMP lock
     627performance and fairness measured on the QorIQ T4240 follows as an example.
     628This chip contains three L2 caches.  Each L2 cache is shared by eight
     629processors.
     630
     631.. image:: ../images/c_user/smplock01perf-t4240.*
     632   :width: 400
     633   :align: center
     634
     635.. image:: ../images/c_user/smplock01fair-t4240.*
     636   :width: 400
     637   :align: center
    529638
    530639Thread Dispatch Details
     
    565674temporary per-processor stack is set up which may be used by the interrupt
    566675prologue before the stack is switched to the interrupt stack.
    567 
    568 Directives
    569 ==========
    570 
    571 This section details the symmetric multiprocessing services.  A subsection is
    572 dedicated to each of these services and describes the calling sequence, related
    573 constants, usage, and status codes.
    574 
    575 .. raw:: latex
    576 
    577    \clearpage
    578 
    579 .. _rtems_get_processor_count:
    580 
    581 GET_PROCESSOR_COUNT - Get processor count
    582 -----------------------------------------
    583 
    584 CALLING SEQUENCE:
    585     .. code-block:: c
    586 
    587         uint32_t rtems_get_processor_count(void);
    588 
    589 DIRECTIVE STATUS CODES:
    590     The count of processors in the system.
    591 
    592 DESCRIPTION:
    593     In uni-processor configurations, a value of one will be returned.
    594 
    595     In SMP configurations, this returns the value of a global variable set
    596     during system initialization to indicate the count of utilized processors.
    597     The processor count depends on the physically or virtually available
    598     processors and application configuration.  The value will always be less
    599     than or equal to the maximum count of application configured processors.
    600 
    601 NOTES:
    602     None.
    603 
    604 .. raw:: latex
    605 
    606    \clearpage
    607 
    608 .. _rtems_get_current_processor:
    609 
    610 GET_CURRENT_PROCESSOR - Get current processor index
    611 ---------------------------------------------------
    612 
    613 CALLING SEQUENCE:
    614     .. code-block:: c
    615 
    616         uint32_t rtems_get_current_processor(void);
    617 
    618 DIRECTIVE STATUS CODES:
    619     The index of the current processor.
    620 
    621 DESCRIPTION:
    622     In uni-processor configurations, a value of zero will be returned.
    623 
    624     In SMP configurations, an architecture specific method is used to obtain the
    625     index of the current processor in the system.  The set of processor indices
    626     is the range of integers starting with zero up to the processor count minus
    627     one.
    628 
    629     Outside of sections with disabled thread dispatching the current processor
    630     index may change after every instruction since the thread may migrate from
    631     one processor to another.  Sections with disabled interrupts are sections
    632     with thread dispatching disabled.
    633 
    634 NOTES:
    635     None.
Note: See TracChangeset for help on using the changeset viewer.