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 <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
This commit is contained in:
Yiwei Zhang 2025-03-18 09:37:53 -07:00 committed by Marge Bot
parent 3fb07c5412
commit 8b2703fe08

View file

@ -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)