From owner-svn-src-all@freebsd.org Mon Jul 11 07:45:33 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 047ABB90454; Mon, 11 Jul 2016 07:45:33 +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 BB0371C13; Mon, 11 Jul 2016 07:45:32 +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 u6B7jV8o073812; Mon, 11 Jul 2016 07:45:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B7jVhY073811; Mon, 11 Jul 2016 07:45:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110745.u6B7jVhY073811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 07:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302556 - 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: Mon, 11 Jul 2016 07:45:33 -0000 Author: sephe Date: Mon Jul 11 07:45:31 2016 New Revision: 302556 URL: https://svnweb.freebsd.org/changeset/base/302556 Log: hyperv/vmbus: Create channel synchronously. The device probe/attach has been move to a different thread, so the reasons to create the channel asynchronously are no longer valid. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6862 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:35:58 2016 (r302555) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:45:31 2016 (r302556) @@ -39,7 +39,8 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_offer_internal(void *context); +static void vmbus_channel_on_offer_internal( + const hv_vmbus_channel_offer_channel *offer); static void vmbus_channel_on_offer_rescind_internal(void *context); static void vmbus_channel_on_offer(struct vmbus_softc *, @@ -365,44 +366,27 @@ vmbus_channel_select_defcpu(struct hv_vm /** * @brief Handler for channel offers from Hyper-V/Azure * - * Handler for channel offers from vmbus in parent partition. We ignore - * all offers except network and storage offers. For each network and storage - * offers, we create a channel object and queue a work item to the channel - * object to process the offer synchronously + * Handler for channel offers from vmbus in parent partition. */ static void vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - const hv_vmbus_channel_offer_channel *offer; - hv_vmbus_channel_offer_channel *copied; - - offer = (const hv_vmbus_channel_offer_channel *)hdr; - - // copy offer data - copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT); - if (copied == NULL) { - printf("fail to allocate memory\n"); - return; - } - - memcpy(copied, hdr, sizeof(*copied)); - hv_queue_work_item(vmbus_channel_on_offer_internal, copied); mtx_lock(&vmbus_chwait_lock); if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) vmbus_chancnt++; mtx_unlock(&vmbus_chwait_lock); + + offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; + vmbus_channel_on_offer_internal(offer); } static void -vmbus_channel_on_offer_internal(void* context) +vmbus_channel_on_offer_internal(const hv_vmbus_channel_offer_channel *offer) { hv_vmbus_channel* new_channel; - hv_vmbus_channel_offer_channel* offer = (hv_vmbus_channel_offer_channel*)context; /* Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(); @@ -441,8 +425,6 @@ vmbus_channel_on_offer_internal(void* co vmbus_channel_select_defcpu(new_channel); vmbus_channel_process_offer(new_channel); - - free(offer, M_DEVBUF); } /**