diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-29 17:28:25 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-29 17:28:25 +0000 |
commit | 5757b59f3eea577c6b3b9e4e22003c5f78807d94 (patch) | |
tree | ffa770650db53de6a61f2f1e195f06dec102b96b /sys/kern/subr_trap.c | |
parent | 46e64474701fed52dc20a2366e204dd6aa26c3f6 (diff) | |
download | src-5757b59f3eea577c6b3b9e4e22003c5f78807d94.tar.gz src-5757b59f3eea577c6b3b9e4e22003c5f78807d94.zip |
Merge td_epochnest with td_no_sleeping.
Epoch itself doesn't rely on the counter and it is provided
merely for sleeping subsystems to check it.
- In functions that sleep use THREAD_CAN_SLEEP() to assert
correctness. With EPOCH_TRACE compiled print epoch info.
- _sleep() was a wrong place to put the assertion for epoch,
right place is sleepq_add(), as there ways to call the
latter bypassing _sleep().
- Do not increase td_no_sleeping in non-preemptible epochs.
The critical section would trigger all possible safeguards,
no sleeping counter is extraneous.
Reviewed by: kib
Notes
Notes:
svn path=/head/; revision=354148
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r-- | sys/kern/subr_trap.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 88abc78085c4..6a73f700e12e 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -166,12 +166,6 @@ userret(struct thread *td, struct trapframe *frame) WITNESS_WARN(WARN_PANIC, NULL, "userret: returning"); KASSERT(td->td_critnest == 0, ("userret: Returning in a critical section")); -#ifdef EPOCH_TRACE - if (__predict_false(curthread->td_epochnest > 0)) - epoch_trace_list(curthread); -#endif - KASSERT(td->td_epochnest == 0, - ("userret: Returning in an epoch section")); KASSERT(td->td_locks == 0, ("userret: Returning with %d locks held", td->td_locks)); KASSERT(td->td_rw_rlocks == 0, @@ -185,8 +179,12 @@ userret(struct thread *td, struct trapframe *frame) td->td_lk_slocks)); KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, ("userret: Returning with pagefaults disabled")); - KASSERT(THREAD_CAN_SLEEP(), - ("userret: Returning with sleep disabled")); + if (__predict_false(!THREAD_CAN_SLEEP())) { +#ifdef EPOCH_TRACE + epoch_trace_list(curthread); +#endif + KASSERT(1, ("userret: Returning with sleep disabled")); + } KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0, ("userret: Returning with with pinned thread")); KASSERT(td->td_vp_reserv == 0, |