mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 14:48:57 +00:00
MFC 300646
hyperv/vmbus: Move event/message taskqueue/task to vmbus softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6520
This commit is contained in:
parent
ad4fd71dcd
commit
c3f99f50f8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=302126
@ -202,7 +202,8 @@ hv_vmbus_channel_open(
|
||||
|
||||
vmbus_on_channel_open(new_channel);
|
||||
|
||||
new_channel->rxq = hv_vmbus_g_context.hv_event_queue[new_channel->target_cpu];
|
||||
new_channel->rxq = VMBUS_PCPU_GET(vmbus_get_softc(), event_tq,
|
||||
new_channel->target_cpu);
|
||||
TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel);
|
||||
|
||||
/* Allocate the ring buffer */
|
||||
|
@ -177,8 +177,8 @@ hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu)
|
||||
|
||||
msg = msg_base + HV_VMBUS_MESSAGE_SINT;
|
||||
if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
|
||||
taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu],
|
||||
&hv_vmbus_g_context.hv_msg_task[cpu]);
|
||||
taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu),
|
||||
VMBUS_PCPU_PTR(sc, message_task, cpu));
|
||||
}
|
||||
|
||||
return (FILTER_HANDLED);
|
||||
@ -460,38 +460,37 @@ vmbus_intr_setup(struct vmbus_softc *sc)
|
||||
* Setup taskqueue to handle events. Task will be per-
|
||||
* channel.
|
||||
*/
|
||||
hv_vmbus_g_context.hv_event_queue[cpu] =
|
||||
taskqueue_create_fast("hyperv event", M_WAITOK,
|
||||
taskqueue_thread_enqueue,
|
||||
&hv_vmbus_g_context.hv_event_queue[cpu]);
|
||||
taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[cpu],
|
||||
VMBUS_PCPU_GET(sc, event_tq, cpu) = taskqueue_create_fast(
|
||||
"hyperv event", M_WAITOK, taskqueue_thread_enqueue,
|
||||
VMBUS_PCPU_PTR(sc, event_tq, cpu));
|
||||
taskqueue_start_threads(VMBUS_PCPU_PTR(sc, event_tq, cpu),
|
||||
1, PI_NET, "hvevent%d", cpu);
|
||||
|
||||
CPU_SETOF(cpu, &cpu_mask);
|
||||
TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task,
|
||||
&cpu_mask);
|
||||
taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[cpu],
|
||||
taskqueue_enqueue(VMBUS_PCPU_GET(sc, event_tq, cpu),
|
||||
&cpuset_task);
|
||||
taskqueue_drain(hv_vmbus_g_context.hv_event_queue[cpu],
|
||||
taskqueue_drain(VMBUS_PCPU_GET(sc, event_tq, cpu),
|
||||
&cpuset_task);
|
||||
|
||||
/*
|
||||
* Setup tasks and taskqueues to handle messages.
|
||||
*/
|
||||
hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast(
|
||||
VMBUS_PCPU_GET(sc, message_tq, cpu) = taskqueue_create_fast(
|
||||
"hyperv msg", M_WAITOK, taskqueue_thread_enqueue,
|
||||
&hv_vmbus_g_context.hv_msg_tq[cpu]);
|
||||
taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[cpu], 1,
|
||||
VMBUS_PCPU_PTR(sc, message_tq, cpu));
|
||||
taskqueue_start_threads(VMBUS_PCPU_PTR(sc, message_tq, cpu), 1,
|
||||
PI_NET, "hvmsg%d", cpu);
|
||||
TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0,
|
||||
TASK_INIT(VMBUS_PCPU_PTR(sc, message_task, cpu), 0,
|
||||
vmbus_msg_task, sc);
|
||||
|
||||
CPU_SETOF(cpu, &cpu_mask);
|
||||
TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task,
|
||||
&cpu_mask);
|
||||
taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu],
|
||||
taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu),
|
||||
&cpuset_task);
|
||||
taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu],
|
||||
taskqueue_drain(VMBUS_PCPU_GET(sc, message_tq, cpu),
|
||||
&cpuset_task);
|
||||
}
|
||||
|
||||
@ -519,15 +518,15 @@ vmbus_intr_teardown(struct vmbus_softc *sc)
|
||||
vmbus_vector_free(sc->vmbus_idtvec);
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) {
|
||||
taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]);
|
||||
hv_vmbus_g_context.hv_event_queue[cpu] = NULL;
|
||||
if (VMBUS_PCPU_GET(sc, event_tq, cpu) != NULL) {
|
||||
taskqueue_free(VMBUS_PCPU_GET(sc, event_tq, cpu));
|
||||
VMBUS_PCPU_GET(sc, event_tq, cpu) = NULL;
|
||||
}
|
||||
if (hv_vmbus_g_context.hv_msg_tq[cpu] != NULL) {
|
||||
taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu],
|
||||
&hv_vmbus_g_context.hv_msg_task[cpu]);
|
||||
taskqueue_free(hv_vmbus_g_context.hv_msg_tq[cpu]);
|
||||
hv_vmbus_g_context.hv_msg_tq[cpu] = NULL;
|
||||
if (VMBUS_PCPU_GET(sc, message_tq, cpu) != NULL) {
|
||||
taskqueue_drain(VMBUS_PCPU_GET(sc, message_tq, cpu),
|
||||
VMBUS_PCPU_PTR(sc, message_task, cpu));
|
||||
taskqueue_free(VMBUS_PCPU_GET(sc, message_tq, cpu));
|
||||
VMBUS_PCPU_GET(sc, message_tq, cpu) = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,13 +207,6 @@ typedef struct {
|
||||
* For FreeBSD cpuid to Hyper-V vcpuid mapping.
|
||||
*/
|
||||
uint32_t hv_vcpu_index[MAXCPU];
|
||||
/*
|
||||
* Each cpu has its own software interrupt handler for channel
|
||||
* event and msg handling.
|
||||
*/
|
||||
struct taskqueue *hv_event_queue[MAXCPU];
|
||||
struct taskqueue *hv_msg_tq[MAXCPU];
|
||||
struct task hv_msg_task[MAXCPU];
|
||||
} hv_vmbus_context;
|
||||
|
||||
/*
|
||||
|
@ -42,11 +42,16 @@ struct vmbus_pcpu_data {
|
||||
/* Rarely used fields */
|
||||
struct hyperv_dma message_dma; /* busdma glue */
|
||||
struct hyperv_dma event_flag_dma; /* busdma glue */
|
||||
struct taskqueue *event_tq; /* event taskq */
|
||||
struct taskqueue *message_tq; /* message taskq */
|
||||
struct task message_task; /* message task */
|
||||
} __aligned(CACHE_LINE_SIZE);
|
||||
|
||||
struct vmbus_softc {
|
||||
void (*vmbus_event_proc)(struct vmbus_softc *, int);
|
||||
struct vmbus_pcpu_data vmbus_pcpu[MAXCPU];
|
||||
|
||||
/* Rarely used fields */
|
||||
device_t vmbus_dev;
|
||||
int vmbus_idtvec;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user