mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
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.
This commit is contained in:
parent
4117c1db9e
commit
3cf3b9f097
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248470
@ -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)
|
||||
|
@ -108,7 +108,7 @@ SDT_PROBE_ARGTYPE(proc, kernel, , signal_discard, 2, "int");
|
||||
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 proc *p)
|
||||
* 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, sigset_t waitset, ksiginfo_t *ksi,
|
||||
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, sigset_t mask)
|
||||
/* 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, struct proc *p, int sending)
|
||||
}
|
||||
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;
|
||||
|
@ -205,8 +205,6 @@ _sleep(void *ident, struct lock_object *lock, int priority,
|
||||
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)",
|
||||
|
@ -405,7 +405,7 @@ sleepq_catch_signals(void *wchan, int pri)
|
||||
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 pri)
|
||||
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 pri)
|
||||
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);
|
||||
|
@ -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);
|
||||
|
@ -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" */
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user