From 8b2703fe0838419f081b5fc0c9dc66ab91c4efff 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: --- src/virtio/vulkan/vn_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c index b71b174706f..2d389a8dc19 100644 --- a/src/virtio/vulkan/vn_common.c +++ b/src/virtio/vulkan/vn_common.c @@ -147,6 +147,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)