[PATCH] score: Add local context to SMP lock API

Chris Johns chrisj at rtems.org
Wed Mar 12 23:46:02 UTC 2014


On 7/03/2014 9:20 pm, Sebastian Huber wrote:
> Add a local context structure to the SMP lock API for acquire and
> release pairs.  This context can be used to store the ISR level and
> profiling information.  It may be later used to enable more
> sophisticated lock algorithms, e.g. MCS locks.

Nice.

> --- a/cpukit/rtems/include/rtems/rtems/intr.h
> +++ b/cpukit/rtems/include/rtems/rtems/intr.h

Unrelated patch question. With SMP is it safe at this API level for a 
user to disable interrupts with out a lock ? I am struggling to see a 
use case in the application world where it is.

> --- a/cpukit/score/include/rtems/score/smplock.h
> +++ b/cpukit/score/include/rtems/score/smplock.h
> @@ -42,54 +42,50 @@ extern "C" {
>    * The SMP lock is implemented as a ticket lock.  This provides fairness in
>    * case of concurrent lock attempts.
>    *
> - * This SMP lock API has a flaw.  It does not provide the ability to use a
> - * local context for acquire and release pairs.  Such a context is necessary to
> - * implement for example the Mellor-Crummey and Scott (MCS) locks.  The SMP
> - * lock is currently used in _Thread_Disable_dispatch() and
> - * _Thread_Enable_dispatch() and makes them to a giant lock acquire and
> - * release.  Since these functions do not pass state information via a local
> - * context there is currently no use case for such a feature.
> + * This SMP lock API uses a local context for acquire and release pairs.  Such
> + * a context may be used to implement for example the Mellor-Crummey and Scott
> + * (MCS) locks in the future.

Should there be a '@todo' tag ?

Chris



More information about the devel mailing list