Mesa (staging/20.0): anv: Fix deadlock in anv_timelines_wait

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 14 17:29:15 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 3705ec33a57be044341d84926714ba48377c5c29
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3705ec33a57be044341d84926714ba48377c5c29

Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date:   Tue May 12 12:27:58 2020 +0300

anv: Fix deadlock in anv_timelines_wait

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2945
Fixes: 34f32a6d6648073e2fda3fb78377124fb32bb288
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5005>
(cherry picked from commit 06b6c687e2aba075e9fc3812d80c128bd873bbce)

---

 .pick_status.json            | 2 +-
 src/intel/vulkan/anv_queue.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 78b0aa0e85f..5b33e923300 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -229,7 +229,7 @@
         "description": "anv: Fix deadlock in anv_timelines_wait",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "34f32a6d6648073e2fda3fb78377124fb32bb288"
     },
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index da52d02804f..5c1a1442df1 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -2229,9 +2229,10 @@ anv_timelines_wait(struct anv_device *device,
                    uint64_t abs_timeout_ns)
 {
    if (!wait_all && n_timelines > 1) {
+      pthread_mutex_lock(&device->mutex);
+
       while (1) {
          VkResult result;
-         pthread_mutex_lock(&device->mutex);
          for (uint32_t i = 0; i < n_timelines; i++) {
             result =
                anv_timeline_wait_locked(device, timelines[i], serials[i], 0);



More information about the mesa-commit mailing list