From 850634cc709b658d17965fb8e57d1002ecbe20fc Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Wed, 25 Aug 2010 10:09:03 +0100 Subject: [PATCH] crit_exit - Correct panic conditions * Now that critical sections have been moved out of the td_pri and use their own td_critcount, we also need to adjust the panic conditions accordingly. --- sys/kern/lwkt_thread.c | 6 +++--- sys/sys/thread2.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index 85f488db1d..8deb893819 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -1618,10 +1618,10 @@ void crit_panic(void) { thread_t td = curthread; - int lpri = td->td_pri; + int lcrit = td->td_critcount; - td->td_pri = 0; - panic("td_pri is/would-go negative! %p %d", td, lpri); + td->td_critcount = 0; + panic("td_critcount is/would-go negative! %p %d", td, lcrit); } #ifdef SMP diff --git a/sys/sys/thread2.h b/sys/sys/thread2.h index 442c50058f..710162fe75 100644 --- a/sys/sys/thread2.h +++ b/sys/sys/thread2.h @@ -149,7 +149,7 @@ _crit_exit_noyield(struct thread *curtd __DEBUG_CRIT_ADD_ARG__) __DEBUG_CRIT_EXIT(curtd); --curtd->td_critcount; #ifdef INVARIANTS - if (curtd->td_pri < 0) + if (curtd->td_critcount < 0) crit_panic(); #endif cpu_ccfence(); /* prevent compiler reordering */ @@ -163,7 +163,7 @@ _crit_exit(__DEBUG_CRIT_ARG__) __DEBUG_CRIT_EXIT(td); --td->td_critcount; #ifdef INVARIANTS - if (td->td_pri < 0) + if (td->td_critcount < 0) crit_panic(); #endif cpu_ccfence(); /* prevent compiler reordering */ -- 2.41.0