[Bug 262587] panic: lock (sleep mutex) umtxql not locked @ /usr/src/sys/sys/umtxvar.h:262 on 14-current master-n253798-8cdecdecb43
Date: Mon, 21 Mar 2022 19:08:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262587
--- Comment #18 from Alexander Motin <mav@FreeBSD.org> ---
OK. I still don't understand how can it be safe to change the lock when there
seems to be a window between umtxq_getchain() and mtx_lock() inside the
umtxq_lock(), but what would you say about this patch:
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -808,8 +808,10 @@ umtxq_sleep(struct umtx_q *uq, const char *wmesg,
if (error != 0)
break;
}
- error = msleep_sbt(uq, &uc->uc_lock, PCATCH, wmesg,
+ error = msleep_sbt(uq, &uc->uc_lock, PCATCH | PDROP, wmesg,
sbt, 0, flags);
+ uc = umtxq_getchain(&uq->uq_key);
+ mtx_lock(&uc->uc_lock);
if (error == EINTR || error == ERESTART)
break;
if (error == EWOULDBLOCK && (flags & C_ABSOLUTE) != 0) {
It seems even before my change code could try on the old lock due to uc never
being updated, so I did it this way instead of using umtxq_lock().
--
You are receiving this mail because:
You are the assignee for the bug.