[PATCH] score: Allways check if a prio ceiling is defined

Gedare Bloom gedare at rtems.org
Fri Apr 16 19:32:19 UTC 2021


On Fri, Apr 16, 2021 at 10:01 AM Joel Sherrill <joel at rtems.org> wrote:
>
> Allways -> Always
>
or All ways

> :)
>
;)

> On Fri, Apr 16, 2021 at 9:04 AM Gedare Bloom <gedare at rtems.org> wrote:
>>
>> ok. also good if you want to open a ticket and backport to 5.
>>
>> On Fri, Apr 16, 2021 at 1:30 AM Sebastian Huber
>> <sebastian.huber at embedded-brains.de> wrote:
>> >
>> > Priority ceiling semaphores (in contrast to MrsP semaphores) have only
>> > one priority ceiling which is defined for the home scheduler of the task
>> > which created the semaphore.  Always check during a semaphore seize that
>> > the home scheduler of the calling task is equal to this scheduler.
>> >
>> > This avoids a scheduler mismatch if the semphore is acquired after the
>> > calling thread blocked on the semaphore.
>> > ---
>> >  cpukit/include/rtems/score/coremuteximpl.h | 20 ++++++++++----------
>> >  1 file changed, 10 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/cpukit/include/rtems/score/coremuteximpl.h b/cpukit/include/rtems/score/coremuteximpl.h
>> > index cbc1e720fb..6b5c240105 100644
>> > --- a/cpukit/include/rtems/score/coremuteximpl.h
>> > +++ b/cpukit/include/rtems/score/coremuteximpl.h
>> > @@ -475,19 +475,19 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Seize(
>> >
>> >    _CORE_mutex_Acquire_critical( &the_mutex->Recursive.Mutex, queue_context );
>> >
>> > -  owner = _CORE_mutex_Get_owner( &the_mutex->Recursive.Mutex );
>> > -
>> > -  if ( owner == NULL ) {
>> >  #if defined(RTEMS_SMP)
>> > -    if (
>> > -      _Thread_Scheduler_get_home( executing )
>> > -        != _CORE_ceiling_mutex_Get_scheduler( the_mutex )
>> > -    ) {
>> > -      _CORE_mutex_Release( &the_mutex->Recursive.Mutex, queue_context );
>> > -      return STATUS_NOT_DEFINED;
>> > -    }
>> > +  if (
>> > +    _Thread_Scheduler_get_home( executing )
>> > +      != _CORE_ceiling_mutex_Get_scheduler( the_mutex )
>> > +  ) {
>> > +    _CORE_mutex_Release( &the_mutex->Recursive.Mutex, queue_context );
>> > +    return STATUS_NOT_DEFINED;
>> > +  }
>> >  #endif
>> >
>> > +  owner = _CORE_mutex_Get_owner( &the_mutex->Recursive.Mutex );
>> > +
>> > +  if ( owner == NULL ) {
>> >      _Thread_queue_Context_clear_priority_updates( queue_context );
>> >      return _CORE_ceiling_mutex_Set_owner(
>> >        the_mutex,
>> > --
>> > 2.26.2
>> >
>> > _______________________________________________
>> > devel mailing list
>> > devel at rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list