Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by kami...
details: https://anonhg.NetBSD.org/src/rev/27e962aaae7c
branches: netbsd-9
changeset: 458500:27e962aaae7c
user: martin <martin%NetBSD.org@localhost>
date: Tue Oct 15 19:25:11 2019 +0000
description:
Pull up following revision(s) (requested by kamil in ticket #327):
sys/kern/kern_sig.c: revision 1.370
Add sigswitch_unlock_and_switch_away(), extracted from sigswitch()
Use sigswitch_unlock_and_switch_away() whenever there is no need for
sigswitch().
diffstat:
sys/kern/kern_sig.c | 44 +++++++++++++++++++++++++++++++-------------
1 files changed, 31 insertions(+), 13 deletions(-)
diffs (113 lines):
diff -r 275aaeffac78 -r 27e962aaae7c sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c Tue Oct 15 19:23:09 2019 +0000
+++ b/sys/kern/kern_sig.c Tue Oct 15 19:25:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sig.c,v 1.364.2.4 2019/10/15 19:23:09 martin Exp $ */
+/* $NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.4 2019/10/15 19:23:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $");
#include "opt_ptrace.h"
#include "opt_dtrace.h"
@@ -126,6 +126,7 @@
static int sigput(sigpend_t *, struct proc *, ksiginfo_t *);
static int sigunwait(struct proc *, const ksiginfo_t *);
static void sigswitch(int, int, bool);
+static void sigswitch_unlock_and_switch_away(struct lwp *);
static void sigacts_poolpage_free(struct pool *, void *);
static void *sigacts_poolpage_alloc(struct pool *, int);
@@ -932,10 +933,11 @@
* The process is already stopping.
*/
if ((p->p_sflag & PS_STOPPING) != 0) {
- sigswitch(0, p->p_xsig, true);
+ mutex_exit(proc_lock);
+ sigswitch_unlock_and_switch_away(l);
mutex_enter(proc_lock);
mutex_enter(p->p_lock);
- goto repeat; /* XXX */
+ goto repeat;
}
mask = &l->l_sigmask;
@@ -1640,10 +1642,11 @@
* The process is already stopping.
*/
if ((p->p_sflag & PS_STOPPING) != 0) {
- sigswitch(0, p->p_xsig, true);
+ mutex_exit(proc_lock);
+ sigswitch_unlock_and_switch_away(l);
mutex_enter(proc_lock);
mutex_enter(p->p_lock);
- goto repeat; /* XXX */
+ goto repeat;
}
KSI_INIT_TRAP(&ksi);
@@ -1690,7 +1693,6 @@
{
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
- int biglocks;
KASSERT(mutex_owned(p->p_lock));
KASSERT(l->l_stat == LSONPROC);
@@ -1750,10 +1752,26 @@
mutex_exit(proc_lock);
}
- /*
- * Unlock and switch away.
- */
+ sigswitch_unlock_and_switch_away(l);
+}
+
+/*
+ * Unlock and switch away.
+ */
+static void
+sigswitch_unlock_and_switch_away(struct lwp *l)
+{
+ struct proc *p;
+ int biglocks;
+
+ p = l->l_proc;
+
+ KASSERT(mutex_owned(p->p_lock));
KASSERT(!mutex_owned(proc_lock));
+
+ KASSERT(l->l_stat == LSONPROC);
+ KASSERT(p->p_nrlwps > 0);
+
KERNEL_UNLOCK_ALL(l, &biglocks);
if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) {
p->p_nrlwps--;
@@ -1843,7 +1861,7 @@
* we awaken, check for a signal from the debugger.
*/
if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) {
- sigswitch(PS_NOCLDSTOP, 0, false);
+ sigswitch_unlock_and_switch_away(l);
mutex_enter(p->p_lock);
signo = sigchecktrace();
} else if (p->p_stat == SACTIVE)
@@ -2525,9 +2543,9 @@
* The process is already stopping.
*/
if ((p->p_sflag & PS_STOPPING) != 0) {
- sigswitch(0, p->p_xsig, false);
+ sigswitch_unlock_and_switch_away(l);
mutex_enter(p->p_lock);
- goto repeat; /* XXX */
+ goto repeat;
}
/* Needed for ktrace */
Home |
Main Index |
Thread Index |
Old Index