wait_queue_head_t tq_wait_waitq; /* wait waitq */
} taskq_t;
+/* Global system-wide dynamic task queue available for all consumers */
+extern taskq_t *system_taskq;
+
extern taskqid_t __taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
extern taskq_t *__taskq_create(const char *, int, pri_t, int, int, uint_t);
extern void __taskq_destroy(taskq_t *);
extern void __taskq_wait(taskq_t *);
extern int __taskq_member(taskq_t *, void *);
+int spl_taskq_init(void);
+void spl_taskq_fini(void);
+
#define taskq_member(tq, t) __taskq_member(tq, t)
#define taskq_wait_id(tq, id) __taskq_wait_id(tq, id)
#define taskq_wait(tq) __taskq_wait(tq)
#define SPLAT_TASKQ_TEST2_NAME "multiple"
#define SPLAT_TASKQ_TEST2_DESC "Multiple task queues, multiple tasks"
+#define SPLAT_TASKQ_TEST3_ID 0x0203
+#define SPLAT_TASKQ_TEST3_NAME "system"
+#define SPLAT_TASKQ_TEST3_DESC "System task queue, multiple tasks"
+
typedef struct splat_taskq_arg {
int flag;
int id;
* task completes, ensure task ran properly, cleanup taskq,
*/
static void
-splat_taskq_test1_func(void *arg)
+splat_taskq_test13_func(void *arg)
{
splat_taskq_arg_t *tq_arg = (splat_taskq_arg_t *)arg;
ASSERT(tq_arg);
splat_vprint(tq_arg->file, SPLAT_TASKQ_TEST1_NAME,
"Taskq '%s' function '%s' setting flag\n",
- tq_arg->name, sym2str(splat_taskq_test1_func));
+ tq_arg->name, sym2str(splat_taskq_test13_func));
tq_arg->flag = 1;
}
splat_vprint(file, SPLAT_TASKQ_TEST1_NAME,
"Taskq '%s' function '%s' dispatching\n",
- tq_arg.name, sym2str(splat_taskq_test1_func));
- if ((id = taskq_dispatch(tq, splat_taskq_test1_func,
+ tq_arg.name, sym2str(splat_taskq_test13_func));
+ if ((id = taskq_dispatch(tq, splat_taskq_test13_func,
&tq_arg, TQ_SLEEP)) == 0) {
splat_vprint(file, SPLAT_TASKQ_TEST1_NAME,
"Taskq '%s' function '%s' dispatch failed\n",
- tq_arg.name, sym2str(splat_taskq_test1_func));
+ tq_arg.name, sym2str(splat_taskq_test13_func));
taskq_destroy(tq);
return -EINVAL;
}
return rc;
}
+/* Validation Test 3 - Use the global system task queue with a single
+ * task, * wait until task completes, ensure task ran properly.
+ */
+static int
+splat_taskq_test3(struct file *file, void *arg)
+{
+ taskqid_t id;
+ splat_taskq_arg_t tq_arg;
+
+ tq_arg.flag = 0;
+ tq_arg.id = 0;
+ tq_arg.file = file;
+ tq_arg.name = SPLAT_TASKQ_TEST3_NAME;
+
+ splat_vprint(file, SPLAT_TASKQ_TEST3_NAME,
+ "Taskq '%s' function '%s' dispatching\n",
+ tq_arg.name, sym2str(splat_taskq_test13_func));
+ if ((id = taskq_dispatch(system_taskq, splat_taskq_test13_func,
+ &tq_arg, TQ_SLEEP)) == 0) {
+ splat_vprint(file, SPLAT_TASKQ_TEST3_NAME,
+ "Taskq '%s' function '%s' dispatch failed\n",
+ tq_arg.name, sym2str(splat_taskq_test13_func));
+ return -EINVAL;
+ }
+
+ splat_vprint(file, SPLAT_TASKQ_TEST3_NAME, "Taskq '%s' waiting\n",
+ tq_arg.name);
+ taskq_wait(system_taskq);
+
+ return (tq_arg.flag) ? 0 : -EINVAL;
+}
+
splat_subsystem_t *
splat_taskq_init(void)
{
SPLAT_TASKQ_TEST1_ID, splat_taskq_test1);
SPLAT_TEST_INIT(sub, SPLAT_TASKQ_TEST2_NAME, SPLAT_TASKQ_TEST2_DESC,
SPLAT_TASKQ_TEST2_ID, splat_taskq_test2);
+ SPLAT_TEST_INIT(sub, SPLAT_TASKQ_TEST3_NAME, SPLAT_TASKQ_TEST3_DESC,
+ SPLAT_TASKQ_TEST3_ID, splat_taskq_test3);
return sub;
}
splat_taskq_fini(splat_subsystem_t *sub)
{
ASSERT(sub);
+ SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST3_ID);
SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST2_ID);
SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST1_ID);