summaryrefslogtreecommitdiff
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-02-09 03:15:42 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-02-09 03:15:42 +0000
commit24ad848078fcf32ba92421894c27fa8abb452209 (patch)
tree310b78e8bbf34ba1ceab66cfc2bd1afacecde97b /sys/kern/kern_synch.c
parentb0353336ff6ce726e4e5366de313c7cbf62de3c1 (diff)
we want to defer work traditionally (in openbsd) handled in an
interrupt context to a taskq running in a thread. however, there is a concern that if we do that then we allow accidental use of sleeping APIs in this work, which will make it harder to move the work back to interrupts in the future. guenther and kettenis came up with the idea of marking a proc with CANTSLEEP which the sleep paths can check and panic on. this builds on that so you create taskqs that run with CANTSLEEP set except when they need to sleep for more tasks to run. the taskq_create api is changed to take a flags argument so users can specify CANTSLEEP. MPSAFE is also passed via this flags field now. this means archs that defined IPL_MPSAFE to 0 can now create mpsafe taskqs too. lots of discussion at s2k15 ok guenther@ miod@ mpi@ tedu@ pelikan@
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index fbf768457d5..9f8eff7e5f8 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.116 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.117 2015/02/09 03:15:41 dlg Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -191,6 +191,8 @@ sleep_setup(struct sleep_state *sls, const volatile void *ident, int prio,
struct proc *p = curproc;
#ifdef DIAGNOSTIC
+ if (p->p_flag & P_CANTSLEEP)
+ panic("sleep: %s failed insomnia", p->p_comm);
if (ident == NULL)
panic("tsleep: no ident");
if (p->p_stat != SONPROC)