Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Check if a queued work is tried to be enqueued agai...
details: https://anonhg.NetBSD.org/src/rev/839214e296da
branches: trunk
changeset: 359118:839214e296da
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Jan 30 11:03:06 2018 +0000
description:
Check if a queued work is tried to be enqueued again, which is not allowed
diffstat:
sys/kern/subr_workqueue.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diffs (48 lines):
diff -r 158e8738d74c -r 839214e296da sys/kern/subr_workqueue.c
--- a/sys/kern/subr_workqueue.c Tue Jan 30 11:01:04 2018 +0000
+++ b/sys/kern/subr_workqueue.c Tue Jan 30 11:03:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_workqueue.c,v 1.34 2017/12/28 07:00:52 ozaki-r Exp $ */
+/* $NetBSD: subr_workqueue.c,v 1.35 2018/01/30 11:03:06 ozaki-r Exp $ */
/*-
* Copyright (c)2002, 2005, 2006, 2007 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.34 2017/12/28 07:00:52 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.35 2018/01/30 11:03:06 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -354,6 +354,19 @@
kmem_free(wq->wq_ptr, workqueue_size(wq->wq_flags));
}
+#ifdef DEBUG
+static void
+workqueue_check_duplication(struct workqueue_queue *q, work_impl_t *wk)
+{
+ work_impl_t *_wk;
+
+ SIMPLEQ_FOREACH(_wk, &q->q_queue_pending, wk_entry) {
+ if (_wk == wk)
+ panic("%s: tried to enqueue a queued work", __func__);
+ }
+}
+#endif
+
void
workqueue_enqueue(struct workqueue *wq, struct work *wk0, struct cpu_info *ci)
{
@@ -365,6 +378,9 @@
mutex_enter(&q->q_mutex);
KASSERT(q->q_waiter == NULL);
+#ifdef DEBUG
+ workqueue_check_duplication(q, wk);
+#endif
SIMPLEQ_INSERT_TAIL(&q->q_queue_pending, wk, wk_entry);
cv_signal(&q->q_cv);
mutex_exit(&q->q_mutex);
Home |
Main Index |
Thread Index |
Old Index