From c42be504c92d76d2e06d0fc8ebd05fc913376d2d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 16 Nov 2016 14:50:09 +0100 Subject: posix: Add self-contained pthread spinlock Turn pthread_spinlock_t into a self-contained object. On uni-processor configurations, interrupts are disabled in the lock/trylock operations and the previous interrupt status is restored in the corresponding unlock operations. On SMP configurations, a ticket lock is a acquired and released in addition. The self-contained pthread_spinlock_t object is defined by Newlib in . typedef struct { struct _Ticket_lock_Control _lock; __uint32_t _interrupt_state; } pthread_spinlock_t; This implementation is simple and efficient. However, this test case of the Linux Test Project would fail due to call of printf() and sleep() during spin lock ownership: https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c There is only limited support for profiling on SMP configurations. Delete CORE spinlock implementation. Update #2674. --- cpukit/sapi/include/confdefs.h | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'cpukit/sapi/include/confdefs.h') diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index be817bbf1d..3a718ba452 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -2068,10 +2068,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS \ rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) #endif - #if !defined(CONFIGURE_MAXIMUM_POSIX_SPINLOCKS) - #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif #endif /* RTEMS_POSIX_API */ #endif /* CONFIGURE_UNLIMITED_OBJECTS */ @@ -2468,7 +2464,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #include #include #include - #include #include #include @@ -2614,23 +2609,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \ _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) ) - /** - * This configuration parameter specifies the maximum number of - * POSIX API spinlocks. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS - #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 0 - #endif - - /** - * This macro is calculated to specify the memory required for - * POSIX API spinlocks. - * - * This is an internal parameter. - */ - #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \ - _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) ) - /** * This configuration parameter specifies the maximum number of * POSIX API rwlocks. @@ -2871,8 +2849,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \ CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \ CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(CONFIGURE_MAXIMUM_POSIX_BARRIERS) + \ - CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( \ - CONFIGURE_MAXIMUM_POSIX_SPINLOCKS) + \ CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \ CONFIGURE_MAXIMUM_POSIX_RWLOCKS) + \ CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS)) @@ -3339,7 +3315,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; CONFIGURE_MAXIMUM_POSIX_SEMAPHORES, CONFIGURE_MAXIMUM_POSIX_BARRIERS, CONFIGURE_MAXIMUM_POSIX_RWLOCKS, - CONFIGURE_MAXIMUM_POSIX_SPINLOCKS, CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE, CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME }; @@ -3554,7 +3529,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; uint32_t POSIX_MESSAGE_QUEUES; uint32_t POSIX_SEMAPHORES; uint32_t POSIX_BARRIERS; - uint32_t POSIX_SPINLOCKS; uint32_t POSIX_RWLOCKS; #endif @@ -3608,7 +3582,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ), CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ), CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ), - CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ), CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ), CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ), #endif @@ -3680,7 +3653,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \ (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \ (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_SPINLOCKS != 0) || \ (CONFIGURE_MAXIMUM_POSIX_RWLOCKS != 0) || \ defined(CONFIGURE_POSIX_INIT_THREAD_TABLE)) #error "CONFIGURATION ERROR: POSIX API support not configured!!" -- cgit v1.2.3