From 8fcafdd553f3a564ecb5ab5093d01b29971418da Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 21 May 2014 10:33:43 +0200 Subject: score: Multiprocessor Resource Sharing Protocol Add basic support for the Multiprocessor Resource Sharing Protocol (MrsP). The Multiprocessor Resource Sharing Protocol (MrsP) is defined in A. Burns and A.J. Wellings, A Schedulability Compatible Multiprocessor Resource Sharing Protocol - MrsP, Proceedings of the 25th Euromicro Conference on Real-Time Systems (ECRTS 2013), July 2013. It is a generalization of the Priority Ceiling Protocol to SMP systems. Each MrsP semaphore uses a ceiling priority per scheduler instance. These ceiling priorities can be specified with rtems_semaphore_set_priority(). A task obtaining or owning a MrsP semaphore will execute with the ceiling priority for its scheduler instance as specified by the MrsP semaphore object. Tasks waiting to get ownership of a MrsP semaphore will not relinquish the processor voluntarily. In case the owner of a MrsP semaphore gets preempted it can ask all tasks waiting for this semaphore to help out and temporarily borrow the right to execute on one of their assigned processors. The help out feature is not implemented with this patch. --- cpukit/rtems/src/semrelease.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cpukit/rtems/src/semrelease.c') diff --git a/cpukit/rtems/src/semrelease.c b/cpukit/rtems/src/semrelease.c index ff4e792b92..2c4be04c78 100644 --- a/cpukit/rtems/src/semrelease.c +++ b/cpukit/rtems/src/semrelease.c @@ -73,12 +73,24 @@ rtems_status_code rtems_semaphore_release( Objects_Locations location; CORE_mutex_Status mutex_status; CORE_semaphore_Status semaphore_status; + rtems_attribute attribute_set; the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: - if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) { + attribute_set = the_semaphore->attribute_set; +#if defined(RTEMS_SMP) + if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) { + MRSP_Status mrsp_status = _MRSP_Release( + &the_semaphore->Core_control.mrsp, + _Thread_Get_executing() + ); + _Objects_Put( &the_semaphore->Object ); + return _Semaphore_Translate_MRSP_status_code( mrsp_status ); + } else +#endif + if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) { mutex_status = _CORE_mutex_Surrender( &the_semaphore->Core_control.mutex, id, -- cgit v1.2.3