From d8b6cc614acde625494abf1ad24f374fdcb0eb2a Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 9 Dec 2003 21:14:31 +0000 Subject: [PATCH] Adjust an assertion for the TDF_TSNOBLOCK race handling in turnstile_unpend(). A racing thread that does not have TDI_LOCK set may either be running on another CPU or it may be sitting on a run queue if it was preempted during the very small window in turnstile_wait() between unlocking the turnstile chain lock and locking sched_lock. --- sys/kern/subr_turnstile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index 54458ef3610..1f877f48576 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -672,7 +672,8 @@ turnstile_unpend(struct turnstile *ts) /* * Wake up all the pending threads. If a thread is not blocked * on a lock, then it is currently executing on another CPU in - * turnstile_wait(). Set a flag to force it to try to acquire + * turnstile_wait() or sitting on a run queue waiting to resume + * in turnstile_wait(). Set a flag to force it to try to acquire * the lock again instead of blocking. */ while (!TAILQ_EMPTY(&pending_threads)) { @@ -687,7 +688,7 @@ turnstile_unpend(struct turnstile *ts) setrunqueue(td); } else { td->td_flags |= TDF_TSNOBLOCK; - MPASS(TD_IS_RUNNING(td)); + MPASS(TD_IS_RUNNING(td) || TD_ON_RUNQ(td)); } } mtx_unlock_spin(&sched_lock); -- 2.45.2