svn commit: r275794 - in stable/10/sys: kern powerpc/aim powerpc/booke sys
Konstantin Belousov
kib at FreeBSD.org
Mon Dec 15 10:46:09 UTC 2014
Author: kib
Date: Mon Dec 15 10:46:07 2014
New Revision: 275794
URL: https://svnweb.freebsd.org/changeset/base/275794
Log:
MFC r275616:
Thread waiting for the vfork(2)-ed child to exec or exit, must allow
for the suspension.
MFC r275683 (by andreast):
Fix build for powerpc(32|64) kernels.
MFC r275686 (by andreast):
Fix kernel build for booke.
r275639 (by andrew) is not merged, since arm/arm/syscall.c is not
present on the stable/10 branch, and arm/arm/trap.c already includes
sys/kernel.h.
Modified:
stable/10/sys/kern/kern_thread.c
stable/10/sys/kern/subr_syscall.c
stable/10/sys/powerpc/aim/trap.c
stable/10/sys/powerpc/booke/trap.c
stable/10/sys/sys/proc.h
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/kern/kern_thread.c
==============================================================================
--- stable/10/sys/kern/kern_thread.c Mon Dec 15 10:29:02 2014 (r275793)
+++ stable/10/sys/kern/kern_thread.c Mon Dec 15 10:46:07 2014 (r275794)
@@ -724,6 +724,19 @@ stopme:
return (0);
}
+bool
+thread_suspend_check_needed(void)
+{
+ struct proc *p;
+ struct thread *td;
+
+ td = curthread;
+ p = td->td_proc;
+ PROC_LOCK_ASSERT(p, MA_OWNED);
+ return (P_SHOULDSTOP(p) || ((p->p_flag & P_TRACED) != 0 &&
+ (td->td_dbgflags & TDB_SUSPEND) != 0));
+}
+
/*
* Called in from locations that can safely check to see
* whether we have to suspend or at least throttle for a
@@ -768,8 +781,7 @@ thread_suspend_check(int return_instead)
p = td->td_proc;
mtx_assert(&Giant, MA_NOTOWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
- while (P_SHOULDSTOP(p) ||
- ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
+ while (thread_suspend_check_needed()) {
if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) {
KASSERT(p->p_singlethread != NULL,
("singlethread not set"));
Modified: stable/10/sys/kern/subr_syscall.c
==============================================================================
--- stable/10/sys/kern/subr_syscall.c Mon Dec 15 10:29:02 2014 (r275793)
+++ stable/10/sys/kern/subr_syscall.c Mon Dec 15 10:46:07 2014 (r275794)
@@ -227,9 +227,20 @@ syscallret(struct thread *td, int error,
*/
td->td_pflags &= ~TDP_RFPPWAIT;
p2 = td->td_rfppwait_p;
+again:
PROC_LOCK(p2);
- while (p2->p_flag & P_PPWAIT)
- cv_wait(&p2->p_pwait, &p2->p_mtx);
+ while (p2->p_flag & P_PPWAIT) {
+ PROC_LOCK(p);
+ if (thread_suspend_check_needed()) {
+ PROC_UNLOCK(p2);
+ thread_suspend_check(0);
+ PROC_UNLOCK(p);
+ goto again;
+ } else {
+ PROC_UNLOCK(p);
+ }
+ cv_timedwait(&p2->p_pwait, &p2->p_mtx, hz);
+ }
PROC_UNLOCK(p2);
}
}
Modified: stable/10/sys/powerpc/aim/trap.c
==============================================================================
--- stable/10/sys/powerpc/aim/trap.c Mon Dec 15 10:29:02 2014 (r275793)
+++ stable/10/sys/powerpc/aim/trap.c Mon Dec 15 10:46:07 2014 (r275794)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syscall.h>
#include <sys/sysent.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
#include <sys/uio.h>
#include <sys/signalvar.h>
#include <sys/vmmeter.h>
Modified: stable/10/sys/powerpc/booke/trap.c
==============================================================================
--- stable/10/sys/powerpc/booke/trap.c Mon Dec 15 10:29:02 2014 (r275793)
+++ stable/10/sys/powerpc/booke/trap.c Mon Dec 15 10:46:07 2014 (r275794)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syscall.h>
#include <sys/sysent.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
#include <sys/uio.h>
#include <sys/signalvar.h>
#include <sys/vmmeter.h>
Modified: stable/10/sys/sys/proc.h
==============================================================================
--- stable/10/sys/sys/proc.h Mon Dec 15 10:29:02 2014 (r275793)
+++ stable/10/sys/sys/proc.h Mon Dec 15 10:46:07 2014 (r275794)
@@ -947,6 +947,7 @@ void childproc_stopped(struct proc *chil
void childproc_continued(struct proc *child);
void childproc_exited(struct proc *child);
int thread_suspend_check(int how);
+bool thread_suspend_check_needed(void);
void thread_suspend_switch(struct thread *);
void thread_suspend_one(struct thread *td);
void thread_unlink(struct thread *td);
More information about the svn-src-stable
mailing list