From owner-svn-src-all@freebsd.org Wed May 25 04:59:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E5B0B48958; Wed, 25 May 2016 04:59:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E7031FCD; Wed, 25 May 2016 04:59:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P4xKsI078861; Wed, 25 May 2016 04:59:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P4xK1L078857; Wed, 25 May 2016 04:59:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250459.u4P4xK1L078857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 25 May 2016 04:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300646 - head/sys/dev/hyperv/vmbus 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.22 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, 25 May 2016 04:59:21 -0000 Author: sephe Date: Wed May 25 04:59:20 2016 New Revision: 300646 URL: https://svnweb.freebsd.org/changeset/base/300646 Log: 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 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed May 25 04:59:20 2016 (r300646) @@ -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 */ Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 04:59:20 2016 (r300646) @@ -177,8 +177,8 @@ hv_vmbus_isr(struct vmbus_softc *sc, str 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); @@ -389,26 +389,25 @@ 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]); + VMBUS_PCPU_GET(sc, event_tq, cpu) = taskqueue_create_fast( + "hyperv event", M_WAITOK, taskqueue_thread_enqueue, + VMBUS_PCPU_PTR(sc, event_tq, cpu)); CPU_SETOF(cpu, &cpu_mask); taskqueue_start_threads_cpuset( - &hv_vmbus_g_context.hv_event_queue[cpu], 1, PI_NET, - &cpu_mask, "hvevent%d", cpu); + VMBUS_PCPU_PTR(sc, event_tq, cpu), 1, PI_NET, &cpu_mask, + "hvevent%d", cpu); /* * 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]); + VMBUS_PCPU_PTR(sc, message_tq, cpu)); CPU_SETOF(cpu, &cpu_mask); taskqueue_start_threads_cpuset( - &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET, - &cpu_mask, "hvmsg%d", cpu); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, + VMBUS_PCPU_PTR(sc, message_tq, cpu), 1, PI_NET, &cpu_mask, + "hvmsg%d", cpu); + TASK_INIT(VMBUS_PCPU_PTR(sc, message_task, cpu), 0, vmbus_msg_task, sc); } @@ -439,15 +438,15 @@ vmbus_intr_teardown(struct vmbus_softc * } 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; } } } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 04:59:20 2016 (r300646) @@ -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; /* Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 04:59:20 2016 (r300646) @@ -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; };