mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 07:30:22 +01:00
freedreno/drm: Fix race in zombie import
The check for the zombie case (racing with final unref of the bo vs removal from table) must be atomic. Fixes spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread Fixes:a192923f99("freedreno/drm: Restart import on zombie race") Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25995> (cherry picked from commit6ac133c646)
This commit is contained in:
parent
28e36118af
commit
7afb7e9a42
2 changed files with 3 additions and 6 deletions
|
|
@ -834,7 +834,7 @@
|
|||
"description": "freedreno/drm: Fix race in zombie import",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "a192923f99e1f0c929b385fefd235453b44a3924",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -61,15 +61,12 @@ lookup_bo(struct hash_table *tbl, uint32_t key)
|
|||
* remove an object it is about to free. Fortunately since table
|
||||
* lookup and removal are protected by the same lock (and table
|
||||
* removal happens before obj free) we can easily detect this by
|
||||
* checking for refcnt==0.
|
||||
* checking for refcnt==0 (ie. 1 after p_atomic_inc_return).
|
||||
*/
|
||||
if (bo->refcnt == 0) {
|
||||
if (p_atomic_inc_return(&bo->refcnt) == 1) {
|
||||
return &zombie;
|
||||
}
|
||||
|
||||
/* found, incr refcnt and return: */
|
||||
fd_bo_ref(bo);
|
||||
|
||||
if (!list_is_empty(&bo->node)) {
|
||||
mesa_logw("bo was in cache, size=%u, alloc_flags=0x%x\n",
|
||||
bo->size, bo->alloc_flags);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue