From owner-svn-src-all@FreeBSD.ORG Wed Oct 16 05:02:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 43C6E40F; Wed, 16 Oct 2013 05:02:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 16A6F2052; Wed, 16 Oct 2013 05:02:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9G521jd066227; Wed, 16 Oct 2013 05:02:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9G521cA066218; Wed, 16 Oct 2013 05:02:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310160502.r9G521cA066218@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 16 Oct 2013 05:02:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256587 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2013 05:02:02 -0000 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 #include #include +#include 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 #include #include +#ifdef VIMAGE +#include +#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,