| /kernel/liteos_a/kernel/include/ |
| D | los_mux.h | 33 * @defgroup los_mux Mutex 70 * Mutex object. 74 LosMuxAttr attr; /**< Mutex attribute */ 76 LOS_DL_LIST muxList; /**< Mutex linked list */ 77 VOID *owner; /**< The current thread that is locking a mutex */ 78 UINT16 muxCount; /**< Times of locking a mutex */ 89 extern UINT32 LOS_MuxSetPrioceiling(LosMux *mutex, INT32 prioceiling, INT32 *oldPrioceiling); 90 extern UINT32 LOS_MuxGetPrioceiling(const LosMux *mutex, INT32 *prioceiling); 91 extern BOOL LOS_MuxIsValid(const LosMux *mutex); 95 * @brief Init a mutex. [all …]
|
| /kernel/liteos_a/kernel/base/ipc/ |
| D | los_mux.c | 147 LITE_OS_SEC_TEXT UINT32 LOS_MuxSetPrioceiling(LosMux *mutex, INT32 prioceiling, INT32 *oldPrioceili… in LOS_MuxSetPrioceiling() argument 151 if ((mutex == NULL) || in LOS_MuxSetPrioceiling() 157 retLock = LOS_MuxLock(mutex, LOS_WAIT_FOREVER); in LOS_MuxSetPrioceiling() 163 *oldPrioceiling = mutex->attr.prioceiling; in LOS_MuxSetPrioceiling() 166 ret = LOS_MuxAttrSetPrioceiling(&mutex->attr, prioceiling); in LOS_MuxSetPrioceiling() 168 retLock = LOS_MuxUnlock(mutex); in LOS_MuxSetPrioceiling() 176 LITE_OS_SEC_TEXT UINT32 LOS_MuxGetPrioceiling(const LosMux *mutex, INT32 *prioceiling) in LOS_MuxGetPrioceiling() argument 178 if ((mutex != NULL) && (prioceiling != NULL) && (mutex->magic == OS_MUX_MAGIC)) { in LOS_MuxGetPrioceiling() 179 *prioceiling = mutex->attr.prioceiling; in LOS_MuxGetPrioceiling() 186 LITE_OS_SEC_TEXT BOOL LOS_MuxIsValid(const LosMux *mutex) in LOS_MuxIsValid() argument [all …]
|
| /kernel/liteos_m/testsuites/sample/posix/ |
| D | BUILD.gn | 86 "mutex/It_posix_mutex.c", 87 "mutex/It_posix_mutex_001.c", 88 "mutex/It_posix_mutex_002.c", 89 "mutex/It_posix_mutex_003.c", 90 "mutex/It_posix_mutex_004.c", 91 "mutex/It_posix_mutex_005.c", 92 "mutex/It_posix_mutex_006.c", 93 "mutex/It_posix_mutex_007.c", 94 "mutex/It_posix_mutex_008.c", 95 "mutex/It_posix_mutex_009.c", [all …]
|
| /kernel/linux/linux-5.10/drivers/gpu/drm/mediatek/ |
| D | mtk_drm_ddp.c | 105 struct mtk_disp_mutex mutex[10]; member 193 if (ddp->mutex[id].claimed) in mtk_disp_mutex_get() 196 ddp->mutex[id].claimed = true; in mtk_disp_mutex_get() 198 return &ddp->mutex[id]; in mtk_disp_mutex_get() 201 void mtk_disp_mutex_put(struct mtk_disp_mutex *mutex) in mtk_disp_mutex_put() argument 203 struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp, in mtk_disp_mutex_put() 204 mutex[mutex->id]); in mtk_disp_mutex_put() 206 WARN_ON(&ddp->mutex[mutex->id] != mutex); in mtk_disp_mutex_put() 208 mutex->claimed = false; in mtk_disp_mutex_put() 211 int mtk_disp_mutex_prepare(struct mtk_disp_mutex *mutex) in mtk_disp_mutex_prepare() argument [all …]
|
| /kernel/linux/linux-6.6/include/linux/ |
| D | mutex.h | 41 * - only one task can hold the mutex at a time 42 * - only the owner can unlock the mutex 45 * - a mutex object must be initialized via the API 46 * - a mutex object must not be initialized via memset or copying 47 * - task may not exit with mutex held 54 * enabled. Furthermore, besides enforcing the above rules, the mutex 66 struct mutex { struct 86 extern void mutex_destroy(struct mutex *lock); argument 92 static inline void mutex_destroy(struct mutex *lock) {} in mutex_destroy() 97 * mutex_init - initialize the mutex [all …]
|
| D | ww_mutex.h | 5 * Original mutex implementation started by Ingo Molnar: 20 #include <linux/mutex.h> 29 #define WW_MUTEX_BASE mutex 88 * ww_mutex_init - initialize the w/w mutex 89 * @lock: the mutex to be initialized 90 * @ww_class: the w/w class the mutex should belong to 92 * Initialize the w/w mutex to unlocked state and associate it with the given 93 * class. Static define macro for w/w mutex is not provided and this function 94 * is the only way to properly initialize the w/w mutex. 96 * It is not allowed to initialize an already locked mutex. [all …]
|
| /kernel/liteos_m/kernel/include/ |
| D | los_mux.h | 33 * @defgroup los_mux Mutex 50 * Mutex error code: The memory request fails. 60 * Mutex error code: The mutex is not usable. 64 …* Solution: Check whether the mutex ID and the mutex state are applicable for the current operatio… 70 * Mutex error code: Null pointer. 80 * Mutex error code: No mutex is available and the mutex request fails. 90 * Mutex error code: The mutex fails to be locked in non-blocking mode because it is locked by anoth… 94 * Solution: Lock the mutex after it is unlocked by the thread that owns it, or set a waiting time. 100 * Mutex error code: The mutex is being locked during an interrupt. 104 * Solution: Check whether the mutex is being locked during an interrupt. [all …]
|
| /kernel/linux/linux-5.10/drivers/net/ethernet/netronome/nfp/nfpcore/ |
| D | nfp_mutex.c | 69 * nfp_cpp_mutex_init() - Initialize a mutex location 73 * @key: Unique 32-bit value for this mutex 78 * This creates the initial mutex state, as locked by this 109 * nfp_cpp_mutex_alloc() - Create a mutex handle 128 struct nfp_cpp_mutex *mutex; in nfp_cpp_mutex_alloc() local 143 mutex = kzalloc(sizeof(*mutex), GFP_KERNEL); in nfp_cpp_mutex_alloc() 144 if (!mutex) in nfp_cpp_mutex_alloc() 147 mutex->cpp = cpp; in nfp_cpp_mutex_alloc() 148 mutex->target = target; in nfp_cpp_mutex_alloc() 149 mutex->address = address; in nfp_cpp_mutex_alloc() [all …]
|
| /kernel/linux/linux-6.6/drivers/net/ethernet/netronome/nfp/nfpcore/ |
| D | nfp_mutex.c | 69 * nfp_cpp_mutex_init() - Initialize a mutex location 73 * @key: Unique 32-bit value for this mutex 78 * This creates the initial mutex state, as locked by this 109 * nfp_cpp_mutex_alloc() - Create a mutex handle 128 struct nfp_cpp_mutex *mutex; in nfp_cpp_mutex_alloc() local 143 mutex = kzalloc(sizeof(*mutex), GFP_KERNEL); in nfp_cpp_mutex_alloc() 144 if (!mutex) in nfp_cpp_mutex_alloc() 147 mutex->cpp = cpp; in nfp_cpp_mutex_alloc() 148 mutex->target = target; in nfp_cpp_mutex_alloc() 149 mutex->address = address; in nfp_cpp_mutex_alloc() [all …]
|
| /kernel/linux/linux-6.6/drivers/acpi/acpica/ |
| D | exmutex.c | 4 * Module Name: exmutex - ASL Mutex Acquire/Release functions 27 * PARAMETERS: obj_desc - The mutex to be unlinked 31 * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list 37 struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; in acpi_ex_unlink_mutex() 45 if (obj_desc->mutex.next) { in acpi_ex_unlink_mutex() 46 (obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev; in acpi_ex_unlink_mutex() 49 if (obj_desc->mutex.prev) { in acpi_ex_unlink_mutex() 50 (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; in acpi_ex_unlink_mutex() 53 * Migrate the previous sync level associated with this mutex to in acpi_ex_unlink_mutex() 54 * the previous mutex on the list so that it may be preserved. in acpi_ex_unlink_mutex() [all …]
|
| /kernel/linux/linux-5.10/drivers/acpi/acpica/ |
| D | exmutex.c | 4 * Module Name: exmutex - ASL Mutex Acquire/Release functions 27 * PARAMETERS: obj_desc - The mutex to be unlinked 31 * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list 37 struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; in acpi_ex_unlink_mutex() 45 if (obj_desc->mutex.next) { in acpi_ex_unlink_mutex() 46 (obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev; in acpi_ex_unlink_mutex() 49 if (obj_desc->mutex.prev) { in acpi_ex_unlink_mutex() 50 (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; in acpi_ex_unlink_mutex() 53 * Migrate the previous sync level associated with this mutex to in acpi_ex_unlink_mutex() 54 * the previous mutex on the list so that it may be preserved. in acpi_ex_unlink_mutex() [all …]
|
| /kernel/uniproton/src/osal/posix/ |
| D | prt_posix_mutex.c | 78 int PRT_PthreadMutexInit(prt_pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) in PRT_PthreadMutexInit() argument 83 if (mutex == NULL) { in PRT_PthreadMutexInit() 88 mutex->type = PTHREAD_MUTEX_DEFAULT; in PRT_PthreadMutexInit() 94 mutex->type = (U8)attr->type; in PRT_PthreadMutexInit() 98 switch (mutex->type) { in PRT_PthreadMutexInit() 102 …OS_SEM_FULL, SEM_TYPE_BIN | (protocol << 8), SEM_MODE_PRIOR, &mutex->mutex_sem, (U32)&mutex->mutex… in PRT_PthreadMutexInit() 107 &mutex->mutex_sem, (U32)&mutex->mutex_sem); in PRT_PthreadMutexInit() 118 mutex->magic = MUTEX_MAGIC; in PRT_PthreadMutexInit() 123 int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) in pthread_mutex_init() argument 125 return PRT_PthreadMutexInit((prt_pthread_mutex_t *)mutex, attr); in pthread_mutex_init() [all …]
|
| /kernel/linux/linux-5.10/include/linux/ |
| D | mutex.h | 28 * - only one task can hold the mutex at a time 29 * - only the owner can unlock the mutex 32 * - a mutex object must be initialized via the API 33 * - a mutex object must not be initialized via memset or copying 34 * - task may not exit with mutex held 41 * enabled. Furthermore, besides enforcing the above rules, the mutex 53 struct mutex { struct 72 struct mutex base; argument 80 * This is the control structure for tasks blocked on mutex, 97 extern void mutex_destroy(struct mutex *lock); [all …]
|
| D | ww_mutex.h | 5 * Original mutex implementation started by Ingo Molnar: 20 #include <linux/mutex.h> 78 * ww_mutex_init - initialize the w/w mutex 79 * @lock: the mutex to be initialized 80 * @ww_class: the w/w class the mutex should belong to 82 * Initialize the w/w mutex to unlocked state and associate it with the given 85 * It is not allowed to initialize an already locked mutex. 104 * Context-based w/w mutex acquiring can be done in any order whatsoever within 108 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can 150 * Marks the end of the acquire phase, any further w/w mutex lock calls using [all …]
|
| /kernel/linux/linux-6.6/Documentation/devicetree/bindings/soc/mediatek/ |
| D | mediatek,mutex.yaml | 4 $id: http://devicetree.org/schemas/soc/mediatek/mediatek,mutex.yaml# 7 title: Mediatek mutex 14 Mediatek mutex, namely MUTEX, is used to send the triggers signals called 17 In some SoC, such as mt2701, MUTEX could be a hardware mutex which protects 19 MUTEX device node must be siblings to the central MMSYS_CONFIG node. 27 - mediatek,mt2701-disp-mutex 28 - mediatek,mt2712-disp-mutex 29 - mediatek,mt6795-disp-mutex 30 - mediatek,mt8167-disp-mutex 31 - mediatek,mt8173-disp-mutex [all …]
|
| /kernel/linux/linux-6.6/drivers/gpu/drm/amd/pm/ |
| D | amdgpu_dpm.c | 49 mutex_lock(&adev->pm.mutex); in amdgpu_dpm_get_sclk() 52 mutex_unlock(&adev->pm.mutex); in amdgpu_dpm_get_sclk() 65 mutex_lock(&adev->pm.mutex); in amdgpu_dpm_get_mclk() 68 mutex_unlock(&adev->pm.mutex); in amdgpu_dpm_get_mclk() 85 mutex_lock(&adev->pm.mutex); in amdgpu_dpm_set_powergating_by_smu() 107 mutex_unlock(&adev->pm.mutex); in amdgpu_dpm_set_powergating_by_smu() 117 mutex_lock(&adev->pm.mutex); in amdgpu_dpm_set_gfx_power_up_by_imu() 119 mutex_unlock(&adev->pm.mutex); in amdgpu_dpm_set_gfx_power_up_by_imu() 135 mutex_lock(&adev->pm.mutex); in amdgpu_dpm_baco_enter() 140 mutex_unlock(&adev->pm.mutex); in amdgpu_dpm_baco_enter() [all …]
|
| /kernel/linux/linux-6.6/drivers/soc/mediatek/ |
| D | mtk-mutex.c | 13 #include <linux/soc/mediatek/mtk-mutex.h> 316 struct mtk_mutex mutex[MTK_MUTEX_MAX_HANDLES]; member 598 * So that MUTEX can not only send a STREAM_DONE event to GCE 722 if (!mtx->mutex[i].claimed) { in mtk_mutex_get() 723 mtx->mutex[i].claimed = true; in mtk_mutex_get() 724 return &mtx->mutex[i]; in mtk_mutex_get() 731 void mtk_mutex_put(struct mtk_mutex *mutex) in mtk_mutex_put() argument 733 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_put() 734 mutex[mutex->id]); in mtk_mutex_put() 736 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_put() [all …]
|
| /kernel/liteos_a/testsuites/unittest/process/lock/mutex/ |
| D | config.gni | 32 process_lock_mutex_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/mutex" ] 35 [ "$TEST_UNITTEST_DIR/process/lock/mutex/process_mutex_test.cpp" ] 38 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_001.cpp", 39 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_002.cpp", 40 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_003.cpp", 41 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_004.cpp", 42 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_005.cpp", 43 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_006.cpp", 44 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_007.cpp", 45 "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_008.cpp", [all …]
|
| /kernel/liteos_m/kal/posix/src/ |
| D | pthread_mutex.c | 129 /* Initialize mutex. If mutexAttr is NULL, use default attributes. */ 130 int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexAttr) in pthread_mutex_init() argument 140 if (mutex == NULL) { in pthread_mutex_init() 155 mutex->stAttr = useAttr; in pthread_mutex_init() 156 mutex->magic = _MUX_MAGIC; in pthread_mutex_init() 157 mutex->handle = muxHandle; in pthread_mutex_init() 159 OsSetMutexCreateInfo(GET_MUX(mutex->handle), regLR); in pthread_mutex_init() 165 int pthread_mutex_destroy(pthread_mutex_t *mutex) in pthread_mutex_destroy() argument 168 if ((mutex == NULL) || (mutex->magic != _MUX_MAGIC)) { in pthread_mutex_destroy() 171 ret = LOS_MuxDelete(mutex->handle); in pthread_mutex_destroy() [all …]
|
| /kernel/linux/linux-6.6/Documentation/locking/ |
| D | mutex-design.rst | 2 Generic Mutex Subsystem 26 Mutexes are represented by 'struct mutex', defined in include/linux/mutex.h 27 and implemented in kernel/locking/mutex.c. These locks use an atomic variable 37 When acquiring a mutex, there are three possible paths that can be 49 soon. The mutex spinners are queued up using MCS lock so that only 50 one spinner can compete for the mutex. 61 waiting to spin on mutex owner, only to go directly to slowpath upon 78 The mutex subsystem checks and enforces the following rules: 80 - Only one task can hold the mutex at a time. 81 - Only the owner can unlock the mutex. [all …]
|
| D | rt-mutex-design.rst | 2 RT-mutex implementation design 12 Documentation/locking/rt-mutex.rst. Although this document does explain problems 27 to use a resource that a lower priority process has (a mutex for example), 85 mutex 88 the PI locks will be called a mutex. 103 a process being blocked on the mutex, it is fine to allocate 105 structure holds a pointer to the task, as well as the mutex that 107 place the task in the waiters rbtree of a mutex as well as the 108 pi_waiters rbtree of a mutex owner task (described below). 111 on a mutex. This is the same as waiter->task. [all …]
|
| /kernel/linux/linux-5.10/Documentation/locking/ |
| D | mutex-design.rst | 2 Generic Mutex Subsystem 26 Mutexes are represented by 'struct mutex', defined in include/linux/mutex.h 27 and implemented in kernel/locking/mutex.c. These locks use an atomic variable 37 When acquiring a mutex, there are three possible paths that can be 49 soon. The mutex spinners are queued up using MCS lock so that only 50 one spinner can compete for the mutex. 61 waiting to spin on mutex owner, only to go directly to slowpath upon 78 The mutex subsystem checks and enforces the following rules: 80 - Only one task can hold the mutex at a time. 81 - Only the owner can unlock the mutex. [all …]
|
| D | rt-mutex-design.rst | 2 RT-mutex implementation design 12 Documentation/locking/rt-mutex.rst. Although this document does explain problems 27 to use a resource that a lower priority process has (a mutex for example), 85 mutex 88 the PI locks will be called a mutex. 103 a process being blocked on the mutex, it is fine to allocate 105 structure holds a pointer to the task, as well as the mutex that 107 place the task in the waiters rbtree of a mutex as well as the 108 pi_waiters rbtree of a mutex owner task (described below). 111 on a mutex. This is the same as waiter->task. [all …]
|
| /kernel/linux/linux-6.6/kernel/locking/ |
| D | mutex.c | 3 * kernel/locking/mutex.c 19 * Also see Documentation/locking/mutex-design.rst. 21 #include <linux/mutex.h> 37 #include "mutex.h" 46 __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) in __mutex_init() 77 * DO NOT USE (outside of mutex code). 79 static inline struct task_struct *__mutex_owner(struct mutex *lock) in __mutex_owner() 89 bool mutex_is_locked(struct mutex *lock) in mutex_is_locked() 103 static inline struct task_struct *__mutex_trylock_common(struct mutex *lock, bool handoff) in __mutex_trylock_common() 142 static inline bool __mutex_trylock_or_handoff(struct mutex *lock, bool handoff) in __mutex_trylock_or_handoff() [all …]
|
| /kernel/liteos_a/compat/posix/src/ |
| D | pthread_mutex.c | 78 int pthread_mutex_setprioceiling(pthread_mutex_t *mutex, int prioceiling, int *oldPrioceiling) in pthread_mutex_setprioceiling() argument 80 return LOS_MuxSetPrioceiling(mutex, prioceiling, oldPrioceiling); in pthread_mutex_setprioceiling() 83 int pthread_mutex_getprioceiling(const pthread_mutex_t *mutex, int *prioceiling) in pthread_mutex_getprioceiling() argument 85 return LOS_MuxGetPrioceiling(mutex, prioceiling); in pthread_mutex_getprioceiling() 98 /* Initialize mutex. If mutexAttr is NULL, use default attributes. */ 99 int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexAttr) in pthread_mutex_init() argument 101 unsigned int ret = LOS_MuxInit(mutex, mutexAttr); in pthread_mutex_init() 104 mutex->attr.protocol = PTHREAD_PRIO_INHERIT; in pthread_mutex_init() 106 mutex->attr.protocol = PTHREAD_PRIO_PROTECT; in pthread_mutex_init() 108 mutex->attr.protocol = PTHREAD_PRIO_NONE; in pthread_mutex_init() [all …]
|