From f8f43523e08235d31c2b474ab4300a3fd7a1785d Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Tue, 18 Mar 2025 09:37:53 -0700 Subject: [PATCH] venus: fix unexpected ring alive status expire upon owner thread switch If the last owner thread has just unset the alive status and released the watchdog, the new owner thread could have acquired to abort unexpectedly if the ownership transfer occurs right before the next owner's warn order. So we must set watchdog alive for new owner so that it can properly check ring alive status in the next warn order. Cc: mesa-stable Acked-by: Dmitry Osipenko Part-of: (cherry picked from commit 8b2703fe0838419f081b5fc0c9dc66ab91c4efff) --- .pick_status.json | 2 +- src/virtio/vulkan/vn_common.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 6de85e3e1b0..c5685bd4007 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4354,7 +4354,7 @@ "description": "venus: fix unexpected ring alive status expire upon owner thread switch", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c index 7b7a1f16f35..038cd130211 100644 --- a/src/virtio/vulkan/vn_common.c +++ b/src/virtio/vulkan/vn_common.c @@ -144,6 +144,10 @@ vn_watchdog_acquire(struct vn_watchdog *watchdog, bool alive) mtx_trylock(&watchdog->mutex) == thrd_success) { /* register as the only waiting thread that monitors the ring. */ watchdog->tid = tid; + /* Always set alive to true for new watchdog owner because the + * last owner might have just unset the alive bit before release. + */ + alive = true; } if (tid != watchdog->tid)