util: Turn futex_wake parameter to int32_t for consistence across platforms

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28473>
This commit is contained in:
Yonggang Luo 2024-03-30 00:01:41 +08:00 committed by Marge Bot
parent ca9738cd7a
commit 3114917986
5 changed files with 14 additions and 14 deletions

View file

@ -292,7 +292,7 @@ anv_state_table_add(struct anv_state_table *table, uint32_t *idx,
old.u64 = __sync_lock_test_and_set(&table->state.u64, new.u64);
if (old.next != state.next)
futex_wake(&table->state.end, INT_MAX);
futex_wake(&table->state.end, INT32_MAX);
} else {
futex_wait(&table->state.end, state.end, NULL);
continue;
@ -614,14 +614,14 @@ anv_block_pool_alloc_new(struct anv_block_pool *pool,
do {
new.end = anv_block_pool_grow(pool, pool_state, block_size);
if (pool->size > 0 && new.end == 0) {
futex_wake(&pool_state->end, INT_MAX);
futex_wake(&pool_state->end, INT32_MAX);
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
} while (new.end < new.next);
old.u64 = __sync_lock_test_and_set(&pool_state->u64, new.u64);
if (old.next != state.next)
futex_wake(&pool_state->end, INT_MAX);
futex_wake(&pool_state->end, INT32_MAX);
*offset = state.next;
return VK_SUCCESS;
} else {
@ -721,7 +721,7 @@ anv_fixed_size_state_pool_alloc_new(struct anv_fixed_size_state_pool *pool,
new.end = *offset + block_size;
old.u64 = __sync_lock_test_and_set(&pool->block.u64, new.u64);
if (old.next != block.next)
futex_wake(&pool->block.end, INT_MAX);
futex_wake(&pool->block.end, INT32_MAX);
return result;
} else {
futex_wait(&pool->block.end, block.end, NULL);

View file

@ -308,7 +308,7 @@ anv_state_table_add(struct anv_state_table *table, uint32_t *idx,
old.u64 = __sync_lock_test_and_set(&table->state.u64, new.u64);
if (old.next != state.next)
futex_wake(&table->state.end, INT_MAX);
futex_wake(&table->state.end, INT32_MAX);
} else {
futex_wait(&table->state.end, state.end, NULL);
continue;
@ -779,7 +779,7 @@ anv_block_pool_alloc_new(struct anv_block_pool *pool,
old.u64 = __sync_lock_test_and_set(&pool_state->u64, new.u64);
if (old.next != state.next)
futex_wake(&pool_state->end, INT_MAX);
futex_wake(&pool_state->end, INT32_MAX);
return state.next;
} else {
futex_wait(&pool_state->end, state.end, NULL);
@ -906,7 +906,7 @@ anv_fixed_size_state_pool_alloc_new(struct anv_fixed_size_state_pool *pool,
new.end = offset + block_size;
old.u64 = __sync_lock_test_and_set(&pool->block.u64, new.u64);
if (old.next != block.next)
futex_wake(&pool->block.end, INT_MAX);
futex_wake(&pool->block.end, INT32_MAX);
return offset;
} else {
futex_wait(&pool->block.end, block.end, NULL);

View file

@ -43,7 +43,7 @@ static inline long sys_futex(void *addr1, int op, int val1, const struct timespe
return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
}
int futex_wake(uint32_t *addr, int count)
int futex_wake(uint32_t *addr, int32_t count)
{
return sys_futex(addr, FUTEX_WAKE, count, NULL, NULL, 0);
}
@ -64,9 +64,9 @@ int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout)
#include <sys/types.h>
#include <sys/umtx.h>
int futex_wake(uint32_t *addr, int count)
int futex_wake(uint32_t *addr, int32_t count)
{
assert(count == (int)(uint32_t)count); /* Check that bits weren't discarded */
assert(count == (int32_t)(uint32_t)count); /* Check that bits weren't discarded */
return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
}
@ -94,7 +94,7 @@ int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout)
#include <sys/futex.h>
#include <sys/time.h>
int futex_wake(uint32_t *addr, int count)
int futex_wake(uint32_t *addr, int32_t count)
{
return futex(addr, FUTEX_WAKE, count, NULL, NULL);
}
@ -122,7 +122,7 @@ int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout)
#include <assert.h>
#include <errno.h>
int futex_wake(uint32_t *addr, int count)
int futex_wake(uint32_t *addr, int32_t count)
{
/* All current callers fall into one of these buckets, and we'll get the semantics
* wrong if someone tries to be more clever.

View file

@ -46,7 +46,7 @@ extern "C" {
#endif
#if UTIL_FUTEX_SUPPORTED
int futex_wake(uint32_t *addr, int count);
int futex_wake(uint32_t *addr, int32_t count);
int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout);
#endif

View file

@ -91,7 +91,7 @@ util_queue_fence_signal(struct util_queue_fence *fence)
assert(val != 0);
if (val == 2)
futex_wake(&fence->val, INT_MAX);
futex_wake(&fence->val, INT32_MAX);
}
/**