MFC kern/sys_process.c revision 1.132

kern/kern_kse.c    revision 1.215

     > Fix a LOR between sched_lock and sleep queue lock.

Approved by: re(scottl)
This commit is contained in:
davidxu 2005-09-27 12:17:38 +00:00
parent 03359b164a
commit 54f46820e2
2 changed files with 7 additions and 6 deletions

View File

@ -1443,7 +1443,7 @@ thread_continued(struct proc *p)
struct thread *td;
PROC_LOCK_ASSERT(p, MA_OWNED);
mtx_assert(&sched_lock, MA_OWNED);
KASSERT(P_SHOULDSTOP(p), ("process not stopped"));
if (!(p->p_flag & P_SA))
return;
@ -1457,11 +1457,10 @@ thread_continued(struct proc *p)
if (!(td->td_pflags & TDP_SA))
continue;
FOREACH_UPCALL_IN_GROUP(kg, ku) {
mtx_lock_spin(&sched_lock);
ku->ku_flags |= KUF_DOUPCALL;
mtx_unlock_spin(&sched_lock);
wakeup(&kg->kg_completed);
if (TD_IS_SUSPENDED(ku->ku_owner)) {
thread_unsuspend_one(ku->ku_owner);
}
}
}
}

View File

@ -788,7 +788,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
/* deliver or queue signal */
if (P_SHOULDSTOP(p)) {
p->p_xstat = data;
p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG);
mtx_lock_spin(&sched_lock);
if (saved_pid <= PID_MAX) {
p->p_xthread->td_flags &= ~TDF_XSIG;
@ -808,8 +807,11 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
* you should use PT_SUSPEND to suspend it before
* continuing process.
*/
thread_unsuspend(p);
mtx_unlock_spin(&sched_lock);
thread_continued(p);
p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG);
mtx_lock_spin(&sched_lock);
thread_unsuspend(p);
mtx_unlock_spin(&sched_lock);
} else if (data) {
psignal(p, data);