RTEMS synchronization primitives support for SMP

yangwei weiyang wei.a.yang at gmail.com
Mon Aug 6 13:31:11 UTC 2012


Hi all,
As a GSOC project "atomic operations support for RTEMS" has completed
first milestone which includes atomic API design and its
implementation for i386 and PowerPC architecture (PowerPC atomic was
not tested under SMP mode). And then i want to do more developments
based on this project. The basic idear is to make existing kinds of
synchronization primitives on RTEMS support SMP and to add  some new
SMP-safe synchronization primitives based on atomic operations.
And in there i attach the FreeBSD synchronization primitives which are
based on atomic operations:
FreeBSD kernel:
1. Mutexs
    int atomic_cmpset_[acq_|rel_]<type>(volatile _type_ *dst,
_type_old, _type_ new);
    void atomic_store_rel_<type>(volatile _type_ *p, _type_ v);
    void atomic_set_[acq_|rel_]<type>(volatile _type_ *p, _type_ v);
    void atomic_clear_[acq_|rel_]<type>(volatile _type_ *p, _type_ v);

2. Condition variables
    Do not use atomic API directly instead of using mutexs API.

3. Shared/Exclusive locks
    int atomic_cmpset_[acq_|rel_]<type>(volatile _type_ *dst,
_type_old, _type_ new);
    void atomic_store_rel_<type>(volatile _type_ *p, _type_ v);
    void atomic_set_[acq_|rel_]<type>(volatile _type_ *p, _type_ v);
    void atomic_clear_[acq_|rel_]<type>(volatile _type_ *p, _type_ v);

4. Semaphores
     Do not use atomic API directly instead of using mutexs and
condition variables API in conjunction.

5. Reader-Writer locks
    int atomic_cmpset_[acq_|rel_]<type>(volatile _type_ *dst,
_type_old, _type_ new);
    void atomic_store_rel_<type>(volatile _type_ *p, _type_ v);

6. Read-Mostly locks
    Do not use atomic API directly

7. Refcounts
    void atomic_add_[acq_|rel_]<type>(volatile _type_ *p, _type_ v);
    _type_ atomic_fetchadd_<type>(volatile _type_ *p, _type_ v);

RTEMS existing synchronization primitives:
1. semaphore
2. message
3. event
4. mutexs
5. rwlock
6. spinlock
So i have two questions:
1. which primitives above should be modified to support SMP?
2. what kinds of new primitives should be added to support SMP more better?
If you have any comments please contact me freely.


-- 
Wei Yang
Best Regards

wei.a.yang at gmail.com



More information about the devel mailing list