Code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
Gaurav Aggarwal 2024-12-30 06:45:18 +00:00
parent f59c1da4ef
commit 730310e227
4 changed files with 17 additions and 12 deletions

View file

@ -149,10 +149,10 @@
extern void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr ); extern void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr );
extern void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr ); extern void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr );
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLockAcquire( xCoreID, pdTRUE ) #define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdTRUE )
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLockRelease( xCoreID, pdTRUE ) #define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdTRUE )
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLockAcquire( xCoreID, pdFALSE ) #define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdFALSE )
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLockRelease( xCoreID, pdFALSE ) #define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdFALSE )
#endif /* if ( configNUMBER_OF_CORES == 1 ) */ #endif /* if ( configNUMBER_OF_CORES == 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -255,10 +255,10 @@ static inline void vPortRecursiveLock( BaseType_t xCoreID,
#define portGET_TASK_LOCK( xCoreID ) #define portGET_TASK_LOCK( xCoreID )
#define portRELEASE_TASK_LOCK( xCoreID ) #define portRELEASE_TASK_LOCK( xCoreID )
#else #else
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdTRUE ) #define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdTRUE )
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdFALSE ) #define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdFALSE )
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdTRUE ) #define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdTRUE )
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdFALSE ) #define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdFALSE )
#endif #endif
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -152,10 +152,10 @@
#define portASSERT_IF_IN_ISR() configASSERT( portCHECK_IF_IN_ISR() == 0 ) #define portASSERT_IF_IN_ISR() configASSERT( portCHECK_IF_IN_ISR() == 0 )
#define portGET_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 0 ) ); } while( 0 ) #define portGET_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 0 ); } while( 0 )
#define portRELEASE_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 0 ) ); } while( 0 ) #define portRELEASE_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 0 ); } while( 0 )
#define portGET_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 1 ) ); } while( 0 ) #define portGET_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 1 ); } while( 0 )
#define portRELEASE_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 1 ) ); } while( 0 ) #define portRELEASE_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 1 ); } while( 0 )
void vTaskEnterCritical( void ); void vTaskEnterCritical( void );

View file

@ -3892,6 +3892,11 @@ void vTaskSuspendAll( void )
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
/* Query the coreID again as prvCheckForRunStateChange may have
* caused the task to get scheduled on a different core. The correct
* task lock for the core is acquired in prvCheckForRunStateChange. */
xCoreID = ( BaseType_t ) portGET_CORE_ID();
portGET_ISR_LOCK( xCoreID ); portGET_ISR_LOCK( xCoreID );
/* The scheduler is suspended if uxSchedulerSuspended is non-zero. An increment /* The scheduler is suspended if uxSchedulerSuspended is non-zero. An increment