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>
(cherry picked from commit 8b2703fe08)
This commit is contained in:
Yiwei Zhang 2025-03-18 09:37:53 -07:00 committed by Eric Engestrom
parent 59c3485022
commit f8f43523e0
2 changed files with 5 additions and 1 deletions

View file

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

View file

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