Skip to content

Commit 1b91c54

Browse files
fix(freertos-smp): Always take ISR locks in vTaskEnter/ExitCriticalFromISR
1 parent 5098b1a commit 1b91c54

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

tasks.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7582,10 +7582,18 @@ static void prvResetNextTaskUnblockTime( void )
75827582
{
75837583
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
75847584

7585-
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
7585+
#if ( portUSING_GRANULAR_LOCKS == 1 )
75867586
{
75877587
kernelGET_ISR_LOCK( xCoreID );
75887588
}
7589+
#else /* portUSING_GRANULAR_LOCKS */
7590+
{
7591+
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
7592+
{
7593+
kernelGET_ISR_LOCK( xCoreID );
7594+
}
7595+
}
7596+
#endif /* portUSING_GRANULAR_LOCKS */
75897597

75907598
portINCREMENT_CRITICAL_NESTING_COUNT( xCoreID );
75917599
}
@@ -7775,17 +7783,28 @@ static void prvResetNextTaskUnblockTime( void )
77757783

77767784
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U )
77777785
{
7778-
portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID );
7779-
7780-
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
7786+
#if ( portUSING_GRANULAR_LOCKS == 1 )
77817787
{
77827788
kernelRELEASE_ISR_LOCK( xCoreID );
7783-
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
7789+
7790+
portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID );
7791+
7792+
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
7793+
{
7794+
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
7795+
}
77847796
}
7785-
else
7797+
#else /* portUSING_GRANULAR_LOCKS */
77867798
{
7787-
mtCOVERAGE_TEST_MARKER();
7799+
portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID );
7800+
7801+
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
7802+
{
7803+
kernelRELEASE_ISR_LOCK( xCoreID );
7804+
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
7805+
}
77887806
}
7807+
#endif /* portUSING_GRANULAR_LOCKS */
77897808
}
77907809
else
77917810
{

0 commit comments

Comments
 (0)