svn commit: r256587 - in head/sys: kern sys
Gleb Smirnoff
glebius at FreeBSD.org
Wed Oct 16 05:02:02 UTC 2013
Author: glebius
Date: Wed Oct 16 05:02:01 2013
New Revision: 256587
URL: http://svnweb.freebsd.org/changeset/base/256587
Log:
For VIMAGE kernels store vnet in the struct task, and set vnet context
during task processing.
Reported & tested by: mm
Modified:
head/sys/kern/subr_taskqueue.c
head/sys/sys/_task.h
head/sys/sys/taskqueue.h
Modified: head/sys/kern/subr_taskqueue.c
==============================================================================
--- head/sys/kern/subr_taskqueue.c Wed Oct 16 04:59:59 2013 (r256586)
+++ head/sys/kern/subr_taskqueue.c Wed Oct 16 05:02:01 2013 (r256587)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/taskqueue.h>
#include <sys/unistd.h>
#include <machine/stdarg.h>
+#include <net/vnet.h>
static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
static void *taskqueue_giant_ih;
@@ -330,7 +331,9 @@ taskqueue_run_locked(struct taskqueue *q
tb.tb_running = task;
TQ_UNLOCK(queue);
+ CURVNET_SET(task->ta_vnet);
task->ta_func(task->ta_context, pending);
+ CURVNET_RESTORE();
TQ_LOCK(queue);
tb.tb_running = NULL;
Modified: head/sys/sys/_task.h
==============================================================================
--- head/sys/sys/_task.h Wed Oct 16 04:59:59 2013 (r256586)
+++ head/sys/sys/_task.h Wed Oct 16 05:02:01 2013 (r256587)
@@ -49,6 +49,9 @@ struct task {
u_short ta_priority; /* (c) Priority */
task_fn_t *ta_func; /* (c) task handler */
void *ta_context; /* (c) argument for handler */
+#ifdef VIMAGE
+ struct vnet *ta_vnet; /* (c) vnet context */
+#endif
};
#endif /* !_SYS__TASK_H_ */
Modified: head/sys/sys/taskqueue.h
==============================================================================
--- head/sys/sys/taskqueue.h Wed Oct 16 04:59:59 2013 (r256586)
+++ head/sys/sys/taskqueue.h Wed Oct 16 05:02:01 2013 (r256587)
@@ -36,6 +36,9 @@
#include <sys/queue.h>
#include <sys/_task.h>
#include <sys/_callout.h>
+#ifdef VIMAGE
+#include <net/vnet.h>
+#endif
struct taskqueue;
struct thread;
@@ -105,12 +108,22 @@ void taskqueue_thread_enqueue(void *cont
/*
* Initialise a task structure.
*/
+#ifdef VIMAGE
#define TASK_INIT(task, priority, func, context) do { \
(task)->ta_pending = 0; \
(task)->ta_priority = (priority); \
(task)->ta_func = (func); \
(task)->ta_context = (context); \
+ (task)->ta_vnet = curvnet; \
} while (0)
+#else /* !VIMAGE */
+#define TASK_INIT(task, priority, func, context) do { \
+ (task)->ta_pending = 0; \
+ (task)->ta_priority = (priority); \
+ (task)->ta_func = (func); \
+ (task)->ta_context = (context); \
+} while (0)
+#endif /* !VIMAGE */
void _timeout_task_init(struct taskqueue *queue,
struct timeout_task *timeout_task, int priority, task_fn_t func,
More information about the svn-src-head
mailing list