summaryrefslogtreecommitdiff
path: root/kern/sleepq.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-07-10 19:40:05 +0200
committerRichard Braun <rbraun@sceen.net>2018-07-10 19:40:05 +0200
commit9ea1595a9156f2818b216d883e25f63bd74459c0 (patch)
treeaacf50829edcdce7a356c6bc8d629be82238e5fd /kern/sleepq.h
parent7cab594590002ff3737629b76083a298616b665a (diff)
kern/sleepq: make disabling interrupts optional
Commit d2a89f7f6e976d022527c2a5a1c75268aab8cd49 changed sleep queues to allow semaphores to be signalled from interrupt handlers, but this implied disabling interrupts for all synchronization objects, and most of them do not require interrupts to be disabled. The sleep queue interface is augmented with interrupt-related versions.
Diffstat (limited to 'kern/sleepq.h')
-rw-r--r--kern/sleepq.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/kern/sleepq.h b/kern/sleepq.h
index 10b139fb..72f39843 100644
--- a/kern/sleepq.h
+++ b/kern/sleepq.h
@@ -47,8 +47,7 @@ void sleepq_destroy(struct sleepq *sleepq);
/*
* Acquire/release a sleep queue.
*
- * Acquiring a sleep queue serializes all access and disables both
- * preemption and interrupts.
+ * Acquiring a sleep queue serializes all access and disables preemption.
*
* The condition argument must be true if the synchronization object
* is a condition variable.
@@ -57,11 +56,22 @@ void sleepq_destroy(struct sleepq *sleepq);
* return NULL if internal state shared by unrelated synchronization
* objects is locked.
*/
-struct sleepq * sleepq_acquire(const void *sync_obj, bool condition,
- unsigned long *flags);
-struct sleepq * sleepq_tryacquire(const void *sync_obj, bool condition,
- unsigned long *flags);
-void sleepq_release(struct sleepq *sleepq, unsigned long flags);
+struct sleepq * sleepq_acquire(const void *sync_obj, bool condition);
+struct sleepq * sleepq_tryacquire(const void *sync_obj, bool condition);
+void sleepq_release(struct sleepq *sleepq);
+
+/*
+ * Versions of the sleep queue acquisition functions that also disable
+ * interrupts.
+ */
+struct sleepq * sleepq_acquire_intr_save(const void *sync_obj,
+ bool condition,
+ unsigned long *flags);
+struct sleepq * sleepq_tryacquire_intr_save(const void *sync_obj,
+ bool condition,
+ unsigned long *flags);
+void sleepq_release_intr_restore(struct sleepq *sleepq,
+ unsigned long flags);
/*
* Lend/return a sleep queue.
@@ -82,9 +92,16 @@ void sleepq_release(struct sleepq *sleepq, unsigned long flags);
* The condition argument must be true if the synchronization object
* is a condition variable.
*/
-struct sleepq * sleepq_lend(const void *sync_obj, bool condition,
- unsigned long *flags);
-void sleepq_return(struct sleepq *sleepq, unsigned long flags);
+struct sleepq * sleepq_lend(const void *sync_obj, bool condition);
+void sleepq_return(struct sleepq *sleepq);
+
+/*
+ * Versions of the sleep queue lending functions that also disable
+ * interrupts.
+ */
+struct sleepq * sleepq_lend_intr_save(const void *sync_obj, bool condition,
+ unsigned long *flags);
+void sleepq_return_intr_restore(struct sleepq *sleepq, unsigned long flags);
/*
* Return true if the given sleep queue has no waiters.