svn commit: r302556 - head/sys/dev/hyperv/vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Mon Jul 11 07:45:33 UTC 2016
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);
}
/**
More information about the svn-src-head
mailing list