From owner-svn-src-stable-10@freebsd.org Thu Jun 23 02:53:25 2016 Return-Path: Delivered-To: svn-src-stable-10@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 48010B7379B; Thu, 23 Jun 2016 02:53:25 +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 246E721A4; Thu, 23 Jun 2016 02:53:25 +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 u5N2rOX2021687; Thu, 23 Jun 2016 02:53:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N2rO6b021686; Thu, 23 Jun 2016 02:53:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230253.u5N2rO6b021686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 02:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r302111 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 02:53:25 -0000 Author: sephe Date: Thu Jun 23 02:53:24 2016 New Revision: 302111 URL: https://svnweb.freebsd.org/changeset/base/302111 Log: MFC 300108,300111,300112,300120,300121 300108 hyperv/vmbus: Minor white space and style cleanup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6407 300111 hyperv/vmbus: Utilize curcpu MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6408 300112 hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task It is not an SWI handler for a long time. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6409 300120 hyperv/vmbus: Remove useless modevent handler MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6410 300121 hyperv/vmbus: Nuke unnecessary function indirection MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6411 Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:00 2016 (r302110) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:24 2016 (r302111) @@ -74,28 +74,18 @@ static hv_setup_args setup_args; /* only 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, int pending __unused) +vmbus_msg_task(void *arg __unused, int pending __unused) { - int cpu; - void* page_addr; - hv_vmbus_channel_msg_header *hdr; - hv_vmbus_channel_msg_table_entry *entry; - hv_vmbus_channel_msg_type msg_type; - hv_vmbus_message* msg; - - cpu = (int)(long)arg; - KASSERT(cpu <= mp_maxid, ("VMBUS: vmbus_msg_swintr: " - "cpu out of range!")); - - page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; - msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT; + hv_vmbus_message *msg; + msg = ((hv_vmbus_message *)hv_vmbus_g_context.syn_ic_msg_page[curcpu]) + + HV_VMBUS_MESSAGE_SINT; for (;;) { + const hv_vmbus_channel_msg_table_entry *entry; + hv_vmbus_channel_msg_header *hdr; + hv_vmbus_channel_msg_type msg_type; + if (msg->header.message_type == HV_MESSAGE_TYPE_NONE) break; /* no message */ @@ -108,32 +98,29 @@ vmbus_msg_swintr(void *arg, int pending } entry = &g_channel_message_table[msg_type]; - if (entry->messageHandler) entry->messageHandler(hdr); handled: - msg->header.message_type = HV_MESSAGE_TYPE_NONE; - - /* - * Make sure the write to message_type (ie set to - * HV_MESSAGE_TYPE_NONE) happens before we read the - * message_pending and EOMing. Otherwise, the EOMing will - * not deliver any more messages - * since there is no empty slot - * - * NOTE: - * mb() is used here, since atomic_thread_fence_seq_cst() - * will become compiler fence on UP kernel. - */ - mb(); - - if (msg->header.message_flags.u.message_pending) { + msg->header.message_type = HV_MESSAGE_TYPE_NONE; + /* + * Make sure the write to message_type (ie set to + * HV_MESSAGE_TYPE_NONE) happens before we read the + * message_pending and EOMing. Otherwise, the EOMing will + * not deliver any more messages + * since there is no empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compiler fence on UP kernel. + */ + mb(); + if (msg->header.message_flags.u.message_pending) { /* * This will cause message queue rescan to possibly * deliver another msg from the hypervisor */ wrmsr(HV_X64_MSR_EOM, 0); - } + } } } @@ -147,11 +134,9 @@ static inline int hv_vmbus_isr(struct trapframe *frame) { struct vmbus_softc *sc = vmbus_get_softc(); - int cpu; - hv_vmbus_message* msg; - void* page_addr; - - cpu = PCPU_GET(cpuid); + int cpu = curcpu; + hv_vmbus_message *msg; + void *page_addr; /* * The Windows team has advised that we check for events @@ -162,7 +147,7 @@ hv_vmbus_isr(struct trapframe *frame) /* Check if there are actual msgs to be process */ page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; - msg = (hv_vmbus_message*) page_addr + HV_VMBUS_TIMER_SINT; + msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) { @@ -193,7 +178,7 @@ hv_vmbus_isr(struct trapframe *frame) } } - msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT; + msg = ((hv_vmbus_message *)page_addr) + 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]); @@ -534,7 +519,7 @@ vmbus_bus_init(void) taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[j], 1, PI_NET, "hvmsg%d", j); TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0, - vmbus_msg_swintr, (void *)(long)j); + vmbus_msg_task, NULL); CPU_SETOF(j, &cpu_mask); TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask); @@ -654,8 +639,8 @@ vmbus_init(void) vmbus_bus_init(); } -static void -vmbus_bus_exit(void) +static int +vmbus_detach(device_t dev) { int i; @@ -681,49 +666,6 @@ vmbus_bus_exit(void) vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); - return; -} - -static void -vmbus_exit(void) -{ - vmbus_bus_exit(); -} - -static int -vmbus_detach(device_t dev) -{ - vmbus_exit(); - return (0); -} - -static void -vmbus_mod_load(void) -{ - if(bootverbose) - printf("VMBUS: load\n"); -} - -static void -vmbus_mod_unload(void) -{ - if(bootverbose) - printf("VMBUS: unload\n"); -} - -static int -vmbus_modevent(module_t mod, int what, void *arg) -{ - switch (what) { - - case MOD_LOAD: - vmbus_mod_load(); - break; - case MOD_UNLOAD: - vmbus_mod_unload(); - break; - } - return (0); } @@ -753,7 +695,7 @@ static driver_t vmbus_driver = { devclass_t vmbus_devclass; -DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, vmbus_modevent, 0); +DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); MODULE_DEPEND(vmbus, acpi, 1, 1, 1); MODULE_VERSION(vmbus, 1);