mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 18:30:09 +01:00
v3dv/bo: use mtx_lock/unlock on cache_init too
To handle coverity warning: 4. thread2_modifies_field: Thread2 sets cache_size to a new value. Note that this write can be reordered at runtime to occur before instructions that do not access this field within this locked region. After Thread2 leaves the critical section, control is switched back to Thread1. CID 1559509 (#1 of 1): Check of thread-shared field evades lock acquisition (LOCK_EVASION)6. thread1_overwrites_value_in_field: Thread1 sets cache_size to a new value. Now the two threads have an inconsistent view of cache_size and updates to fields correlated with cache_size may be lost. 521 cache->cache_size += bo->size; Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26951>
This commit is contained in:
parent
ffd0e3a7fe
commit
0a3784ae33
1 changed files with 2 additions and 0 deletions
|
|
@ -419,9 +419,11 @@ v3dv_bo_cache_init(struct v3dv_device *device)
|
|||
fprintf(stderr, "MAX BO CACHE SIZE: %iMB\n", device->bo_cache.max_cache_size);
|
||||
}
|
||||
|
||||
mtx_lock(&device->bo_cache.lock);
|
||||
device->bo_cache.max_cache_size *= 1024 * 1024;
|
||||
device->bo_cache.cache_count = 0;
|
||||
device->bo_cache.cache_size = 0;
|
||||
mtx_unlock(&device->bo_cache.lock);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue