svn commit: r248470 - in head/sys: cddl/compat/opensolaris/sys kern sys

John Baldwin jhb at FreeBSD.org
Mon Mar 18 17:24:01 UTC 2013


Author: jhb
Date: Mon Mar 18 17:23:58 2013
New Revision: 248470
URL: http://svnweb.freebsd.org/changeset/base/248470

Log:
  Partially revert r195702.  Deferring stops is now implemented via a set of
  calls to toggle TDF_SBDRY rather than passing PBDRY to individual sleep
  calls.
  - Remove the stop_allowed parameters from cursig() and issignal().
    issignal() checks TDF_SBDRY directly.
  - Remove the PBDRY and SLEEPQ_STOP_ON_BDRY flags.

Modified:
  head/sys/cddl/compat/opensolaris/sys/sig.h
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_synch.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/subr_trap.c
  head/sys/sys/param.h
  head/sys/sys/signalvar.h
  head/sys/sys/sleepqueue.h

Modified: head/sys/cddl/compat/opensolaris/sys/sig.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/sig.h	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/cddl/compat/opensolaris/sys/sig.h	Mon Mar 18 17:23:58 2013	(r248470)
@@ -55,7 +55,7 @@ issig(int why)
 		p = td->td_proc;
 		PROC_LOCK(p);
 		mtx_lock(&p->p_sigacts->ps_mtx);
-		sig = cursig(td, SIG_STOP_ALLOWED);
+		sig = cursig(td);
 		mtx_unlock(&p->p_sigacts->ps_mtx);
 		PROC_UNLOCK(p);
 		if (sig != 0)

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/kern/kern_sig.c	Mon Mar 18 17:23:58 2013	(r248470)
@@ -108,7 +108,7 @@ SDT_PROBE_ARGTYPE(proc, kernel, , signal
 static int	coredump(struct thread *);
 static int	killpg1(struct thread *td, int sig, int pgid, int all,
 		    ksiginfo_t *ksi);
-static int	issignal(struct thread *td, int stop_allowed);
+static int	issignal(struct thread *td);
 static int	sigprop(int sig);
 static void	tdsigwakeup(struct thread *, int, sig_t, int);
 static void	sig_suspend_threads(struct thread *, struct proc *, int);
@@ -565,14 +565,12 @@ sigqueue_delete_stopmask_proc(struct pro
  * action, the process stops in issignal().
  */
 int
-cursig(struct thread *td, int stop_allowed)
+cursig(struct thread *td)
 {
 	PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
-	KASSERT(stop_allowed == SIG_STOP_ALLOWED ||
-	    stop_allowed == SIG_STOP_NOT_ALLOWED, ("cursig: stop_allowed"));
 	mtx_assert(&td->td_proc->p_sigacts->ps_mtx, MA_OWNED);
 	THREAD_LOCK_ASSERT(td, MA_NOTOWNED);
-	return (SIGPENDING(td) ? issignal(td, stop_allowed) : 0);
+	return (SIGPENDING(td) ? issignal(td) : 0);
 }
 
 /*
@@ -1202,7 +1200,7 @@ kern_sigtimedwait(struct thread *td, sig
 	SIGSETNAND(td->td_sigmask, waitset);
 	for (;;) {
 		mtx_lock(&ps->ps_mtx);
-		sig = cursig(td, SIG_STOP_ALLOWED);
+		sig = cursig(td);
 		mtx_unlock(&ps->ps_mtx);
 		if (sig != 0 && SIGISMEMBER(waitset, sig)) {
 			if (sigqueue_get(&td->td_sigqueue, sig, ksi) != 0 ||
@@ -1465,7 +1463,7 @@ kern_sigsuspend(struct thread *td, sigse
 			/* void */;
 		thread_suspend_check(0);
 		mtx_lock(&p->p_sigacts->ps_mtx);
-		while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0)
+		while ((sig = cursig(td)) != 0)
 			has_sig += postsig(sig);
 		mtx_unlock(&p->p_sigacts->ps_mtx);
 	}
@@ -2399,12 +2397,10 @@ static void
 sig_suspend_threads(struct thread *td, struct proc *p, int sending)
 {
 	struct thread *td2;
-	int wakeup_swapper;
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	PROC_SLOCK_ASSERT(p, MA_OWNED);
 
-	wakeup_swapper = 0;
 	FOREACH_THREAD_IN_PROC(p, td2) {
 		thread_lock(td2);
 		td2->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK;
@@ -2431,8 +2427,6 @@ sig_suspend_threads(struct thread *td, s
 		}
 		thread_unlock(td2);
 	}
-	if (wakeup_swapper)
-		kick_proc0();
 }
 
 int
@@ -2584,7 +2578,7 @@ sigallowstop()
  *		postsig(sig);
  */
 static int
-issignal(struct thread *td, int stop_allowed)
+issignal(struct thread *td)
 {
 	struct proc *p;
 	struct sigacts *ps;

Modified: head/sys/kern/kern_synch.c
==============================================================================
--- head/sys/kern/kern_synch.c	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/kern/kern_synch.c	Mon Mar 18 17:23:58 2013	(r248470)
@@ -205,8 +205,6 @@ _sleep(void *ident, struct lock_object *
 		sleepq_flags = SLEEPQ_SLEEP;
 	if (catch)
 		sleepq_flags |= SLEEPQ_INTERRUPTIBLE;
-	if (priority & PBDRY)
-		sleepq_flags |= SLEEPQ_STOP_ON_BDRY;
 
 	sleepq_lock(ident);
 	CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)",

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/kern/subr_sleepqueue.c	Mon Mar 18 17:23:58 2013	(r248470)
@@ -405,7 +405,7 @@ sleepq_catch_signals(void *wchan, int pr
 	struct thread *td;
 	struct proc *p;
 	struct sigacts *ps;
-	int sig, ret, stop_allowed;
+	int sig, ret;
 
 	td = curthread;
 	p = curproc;
@@ -429,8 +429,6 @@ sleepq_catch_signals(void *wchan, int pr
 		sleepq_switch(wchan, pri);
 		return (0);
 	}
-	stop_allowed = (td->td_flags & TDF_SBDRY) ? SIG_STOP_NOT_ALLOWED :
-	    SIG_STOP_ALLOWED;
 	thread_unlock(td);
 	mtx_unlock_spin(&sc->sc_lock);
 	CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)",
@@ -438,7 +436,7 @@ sleepq_catch_signals(void *wchan, int pr
 	PROC_LOCK(p);
 	ps = p->p_sigacts;
 	mtx_lock(&ps->ps_mtx);
-	sig = cursig(td, stop_allowed);
+	sig = cursig(td);
 	if (sig == 0) {
 		mtx_unlock(&ps->ps_mtx);
 		ret = thread_suspend_check(1);

Modified: head/sys/kern/subr_trap.c
==============================================================================
--- head/sys/kern/subr_trap.c	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/kern/subr_trap.c	Mon Mar 18 17:23:58 2013	(r248470)
@@ -267,7 +267,7 @@ ast(struct trapframe *framep)
 	    !SIGISEMPTY(p->p_siglist)) {
 		PROC_LOCK(p);
 		mtx_lock(&p->p_sigacts->ps_mtx);
-		while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0)
+		while ((sig = cursig(td)) != 0)
 			postsig(sig);
 		mtx_unlock(&p->p_sigacts->ps_mtx);
 		PROC_UNLOCK(p);

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/sys/param.h	Mon Mar 18 17:23:58 2013	(r248470)
@@ -211,7 +211,6 @@
 #define	PRIMASK	0x0ff
 #define	PCATCH	0x100		/* OR'd with pri for tsleep to check signals */
 #define	PDROP	0x200	/* OR'd with pri to stop re-entry of interlock mutex */
-#define	PBDRY	0x400	/* for PCATCH stop is done on the user boundary */
 
 #define	NZERO	0		/* default "nice" */
 

Modified: head/sys/sys/signalvar.h
==============================================================================
--- head/sys/sys/signalvar.h	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/sys/signalvar.h	Mon Mar 18 17:23:58 2013	(r248470)
@@ -318,16 +318,12 @@ struct thread;
 
 extern struct mtx	sigio_lock;
 
-/* Values for stop_allowed parameter for cursig(). */
-#define	SIG_STOP_ALLOWED	100
-#define	SIG_STOP_NOT_ALLOWED	101
-
 /* Flags for kern_sigprocmask(). */
 #define	SIGPROCMASK_OLD		0x0001
 #define	SIGPROCMASK_PROC_LOCKED	0x0002
 #define	SIGPROCMASK_PS_LOCKED	0x0004
 
-int	cursig(struct thread *td, int stop_allowed);
+int	cursig(struct thread *td);
 int	sigdeferstop(void);
 void	sigallowstop(void);
 void	execsigs(struct proc *p);

Modified: head/sys/sys/sleepqueue.h
==============================================================================
--- head/sys/sys/sleepqueue.h	Mon Mar 18 15:38:15 2013	(r248469)
+++ head/sys/sys/sleepqueue.h	Mon Mar 18 17:23:58 2013	(r248470)
@@ -93,8 +93,6 @@ struct thread;
 #define	SLEEPQ_SX		0x03		/* Used by an sx lock. */
 #define	SLEEPQ_LK		0x04		/* Used by a lockmgr. */
 #define	SLEEPQ_INTERRUPTIBLE	0x100		/* Sleep is interruptible. */
-#define	SLEEPQ_STOP_ON_BDRY	0x200		/* Stop sleeping thread on
-						   user mode boundary */
 
 void	init_sleepqueues(void);
 int	sleepq_abort(struct thread *td, int intrval);


More information about the svn-src-all mailing list