Skip to content

Commit e55198a

Browse files
fix(freertos-smp): Remove scheduler suspension from event_groups.c
This commit removes the need for suspending the scheduler when calling some event_groups.c APIs as the non-deterministic operations are happening with the event group being locked and the preemption being disabled from the current task.
1 parent e579350 commit e55198a

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

event_groups.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,6 @@
621621
{
622622
traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet );
623623

624-
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
625-
626-
/* We are about to access the kernel data group non-deterministically,
627-
* thus we suspend the kernel data group.*/
628-
vTaskSuspendAll();
629-
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
630-
631624
pxListItem = listGET_HEAD_ENTRY( pxList );
632625

633626
/* Set the bits. */
@@ -698,10 +691,6 @@
698691

699692
/* Snapshot resulting bits. */
700693
uxReturnBits = pxEventBits->uxEventBits;
701-
702-
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
703-
( void ) xTaskResumeAll();
704-
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
705694
}
706695
( void ) event_groupsUNLOCK( pxEventBits );
707696

@@ -726,24 +715,13 @@
726715
{
727716
traceEVENT_GROUP_DELETE( xEventGroup );
728717

729-
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
730-
731-
/* We are about to access the kernel data group non-deterministically,
732-
* thus we suspend the kernel data group.*/
733-
vTaskSuspendAll();
734-
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
735-
736718
while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( UBaseType_t ) 0 )
737719
{
738720
/* Unblock the task, returning 0 as the event list is being deleted
739721
* and cannot therefore have any bits set. */
740722
configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( const ListItem_t * ) &( pxTasksWaitingForBits->xListEnd ) );
741723
vTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );
742724
}
743-
744-
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
745-
( void ) xTaskResumeAll();
746-
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
747725
}
748726
( void ) event_groupsUNLOCK( pxEventBits );
749727

tasks.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5977,9 +5977,12 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
59775977

59785978
traceENTER_vTaskRemoveFromUnorderedEventList( pxEventListItem, xItemValue );
59795979

5980-
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
5981-
* the event flags implementation. */
5982-
configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U );
5980+
#if ( !( portUSING_GRANULAR_LOCKS == 1 ) )
5981+
5982+
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
5983+
* the event flags implementation. */
5984+
configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U );
5985+
#endif /* #if ( ! ( portUSING_GRANULAR_LOCKS == 1 ) ) */
59835986

59845987
/* Store the new item value in the event list. */
59855988
listSET_LIST_ITEM_VALUE( pxEventListItem, xItemValue | taskEVENT_LIST_ITEM_VALUE_IN_USE );

0 commit comments

Comments
 (0)