Index: sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c =================================================================== --- sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c +++ sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c @@ -69,13 +69,12 @@ static hv_setup_args setup_args; /* only CPU 0 supported at this time */ static char *vmbus_ids[] = { "VMBUS", NULL }; - /** * @brief Software interrupt thread routine to handle channel messages from * the hypervisor. */ static void -vmbus_msg_swintr(void *arg) +vmbus_msg_swintr(void *arg, int pending) { int cpu; void* page_addr; @@ -219,7 +218,7 @@ } if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { - swi_sched(hv_vmbus_g_context.msg_swintr[cpu], 0); + taskqueue_enqueue_fast(hv_vmbus_g_context.hv_msg_queue[cpu], &hv_vmbus_g_context.hv_msg_task[cpu]); } return (FILTER_HANDLED); @@ -508,9 +507,6 @@ setup_args.vector = hv_vmbus_g_context.hv_cb_vector; CPU_FOREACH(j) { - hv_vmbus_g_context.hv_msg_intr_event[j] = NULL; - hv_vmbus_g_context.msg_swintr[j] = NULL; - snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); intrcnt_add(buf, &hv_vmbus_intr_cpu[j]); @@ -537,30 +533,24 @@ "hvevent%d", j); /* - * Setup software interrupt thread and handler for msg handling. + * Setup taskqueue to handle msg */ - ret = swi_add(&hv_vmbus_g_context.hv_msg_intr_event[j], - "hv_msg", vmbus_msg_swintr, (void *)(long)j, SWI_CLOCK, 0, - &hv_vmbus_g_context.msg_swintr[j]); - if (ret) { + hv_vmbus_g_context.hv_msg_queue[j] = taskqueue_create_fast("hyperv msg", + M_WAITOK, taskqueue_thread_enqueue, &hv_vmbus_g_context.hv_msg_queue[j]); + if (hv_vmbus_g_context.hv_msg_queue[j] == NULL) { if(bootverbose) - printf("VMBUS: failed to setup msg swi for " - "cpu %d\n", j); + printf("VMBUS: failed to create message task queue for " + "cpu %d\n", j); goto cleanup1; } - - /* - * Bind the swi thread to the cpu. - */ - ret = intr_event_bind(hv_vmbus_g_context.hv_msg_intr_event[j], - j); - if (ret) { + if (taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_queue[j], 1, + PI_DISK, "hvmsg%d", j) != 0) { if(bootverbose) - printf("VMBUS: failed to bind msg swi thread " - "to cpu %d\n", j); + printf("VMBUS: fail to start message task queue for " + "cpu %d\n", j); goto cleanup1; } - + 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. */ @@ -604,11 +594,14 @@ * remove swi and vmbus callback vector; */ CPU_FOREACH(j) { - if (hv_vmbus_g_context.hv_event_queue[j] != NULL) + if (hv_vmbus_g_context.hv_event_queue[j] != NULL) { taskqueue_free(hv_vmbus_g_context.hv_event_queue[j]); - if (hv_vmbus_g_context.msg_swintr[j] != NULL) - swi_remove(hv_vmbus_g_context.msg_swintr[j]); - hv_vmbus_g_context.hv_msg_intr_event[j] = NULL; + hv_vmbus_g_context.hv_event_queue[j] = NULL; + } + if (hv_vmbus_g_context.hv_msg_queue[j] != NULL) { + taskqueue_free(hv_vmbus_g_context.hv_msg_queue[j]); + hv_vmbus_g_context.hv_msg_queue[j] = NULL; + } } vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); @@ -673,11 +666,14 @@ /* remove swi */ CPU_FOREACH(i) { - if (hv_vmbus_g_context.hv_event_queue[i] != NULL) + if (hv_vmbus_g_context.hv_event_queue[i] != NULL) { taskqueue_free(hv_vmbus_g_context.hv_event_queue[i]); - if (hv_vmbus_g_context.msg_swintr[i] != NULL) - swi_remove(hv_vmbus_g_context.msg_swintr[i]); - hv_vmbus_g_context.hv_msg_intr_event[i] = NULL; + hv_vmbus_g_context.hv_event_queue[i] = NULL; + } + if (hv_vmbus_g_context.hv_msg_queue[i] != NULL) { + taskqueue_free(hv_vmbus_g_context.hv_msg_queue[i]); + hv_vmbus_g_context.hv_msg_queue[i] = NULL; + } } vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); Index: sys/dev/hyperv/vmbus/hv_vmbus_priv.h =================================================================== --- sys/dev/hyperv/vmbus/hv_vmbus_priv.h +++ sys/dev/hyperv/vmbus/hv_vmbus_priv.h @@ -203,8 +203,8 @@ * event and msg handling. */ struct taskqueue *hv_event_queue[MAXCPU]; - struct intr_event *hv_msg_intr_event[MAXCPU]; - void *msg_swintr[MAXCPU]; + struct taskqueue *hv_msg_queue[MAXCPU]; + struct task hv_msg_task[MAXCPU]; /* * Host use this vector to intrrupt guest for vmbus channel * event and msg.