svn commit: r297221 - head/sys/dev/hyperv/vmbus

Sepherosa Ziehau sephe at FreeBSD.org
Thu Mar 24 02:15:25 UTC 2016


Author: sephe
Date: Thu Mar 24 02:15:23 2016
New Revision: 297221
URL: https://svnweb.freebsd.org/changeset/base/297221

Log:
  hyperv/vmbus: Create per-cpu fast taskqueue for msg handling
  
  Using one taskqueue does not work, since the EOM MSR must be written
  on the msg's owner CPU.
  
  Noticed by:	Jun Su <junsu microsoft com>
  Discussed with:	Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Thu Mar 24 01:12:28 2016	(r297220)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Thu Mar 24 02:15:23 2016	(r297221)
@@ -204,7 +204,8 @@ hv_vmbus_isr(struct trapframe *frame)
 
 	msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
 	if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
-		taskqueue_enqueue(taskqueue_fast, &hv_vmbus_g_context.hv_msg_task[cpu]);
+		taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu],
+		    &hv_vmbus_g_context.hv_msg_task[cpu]);
 	}
 
 	return (FILTER_HANDLED);
@@ -531,9 +532,17 @@ vmbus_bus_init(void)
 			"hvevent%d", j);
 
 		/*
-		 * Setup tasks to handle msg
+		 * Setup per-cpu tasks and taskqueues to handle msg.
 		 */
-		TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0, vmbus_msg_swintr, (void *)(long)j);
+		hv_vmbus_g_context.hv_msg_tq[j] = taskqueue_create_fast(
+		    "hyperv msg", M_WAITOK, taskqueue_thread_enqueue,
+		    &hv_vmbus_g_context.hv_msg_tq[j]);
+		CPU_SETOF(j, &cpu_mask);
+		taskqueue_start_threads_cpuset(&hv_vmbus_g_context.hv_msg_tq[j],
+		    1, PI_NET, &cpu_mask, "hvmsg%d", j);
+		TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0,
+		    vmbus_msg_swintr, (void *)(long)j);
+
 		/*
 		 * Prepare the per cpu msg and event pages to be called on each cpu.
 		 */

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h	Thu Mar 24 01:12:28 2016	(r297220)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h	Thu Mar 24 02:15:23 2016	(r297221)
@@ -205,6 +205,7 @@ typedef struct {
 	 * event and msg handling.
 	 */
 	struct taskqueue		*hv_event_queue[MAXCPU];
+	struct taskqueue		*hv_msg_tq[MAXCPU];
 	struct task			hv_msg_task[MAXCPU];
 	/*
 	 * Host use this vector to intrrupt guest for vmbus channel


More information about the svn-src-all mailing list