svn commit: r296083 - in head/sys/dev/hyperv: include netvsc storvsc vmbus

Sepherosa Ziehau sephe at FreeBSD.org
Fri Feb 26 09:17:33 UTC 2016


Author: sephe
Date: Fri Feb 26 09:17:31 2016
New Revision: 296083
URL: https://svnweb.freebsd.org/changeset/base/296083

Log:
  hyperv: Remove useless channel inbound_lock
  
  It serves no purpose.
  
  Reviewed by:	Hongjiang Zhang <honzhan microsoft com>
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D5450

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h	Fri Feb 26 08:43:36 2016	(r296082)
+++ head/sys/dev/hyperv/include/hyperv.h	Fri Feb 26 09:17:31 2016	(r296083)
@@ -753,8 +753,6 @@ typedef struct hv_vmbus_channel {
 	 */
 	hv_vmbus_ring_buffer_info	inbound;
 
-	struct mtx			inbound_lock;
-
 	struct taskqueue *		rxq;
 	struct task			channel_task;
 	hv_vmbus_pfn_channel_callback	on_channel_callback;

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Fri Feb 26 08:43:36 2016	(r296082)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Fri Feb 26 09:17:31 2016	(r296083)
@@ -720,9 +720,7 @@ hv_nv_on_device_remove(struct hv_device 
 	netvsc_dev *net_dev = sc->net_dev;;
 	
 	/* Stop outbound traffic ie sends and receives completions */
-	mtx_lock(&device->channel->inbound_lock);
 	net_dev->destroy = TRUE;
-	mtx_unlock(&device->channel->inbound_lock);
 
 	/* Wait for all send completions */
 	while (net_dev->num_outstanding_sends) {

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Fri Feb 26 08:43:36 2016	(r296082)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Fri Feb 26 09:17:31 2016	(r296083)
@@ -1153,9 +1153,7 @@ storvsc_detach(device_t dev)
 	struct hv_sgl_node *sgl_node = NULL;
 	int j = 0;
 
-	mtx_lock(&hv_device->channel->inbound_lock);
 	sc->hs_destroy = TRUE;
-	mtx_unlock(&hv_device->channel->inbound_lock);
 
 	/*
 	 * At this point, all outbound traffic should be disabled. We

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel.c	Fri Feb 26 08:43:36 2016	(r296082)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c	Fri Feb 26 09:17:31 2016	(r296083)
@@ -537,13 +537,7 @@ hv_vmbus_channel_close_internal(hv_vmbus
 	 */
 	channel->rxq = NULL;
 	taskqueue_drain(rxq, &channel->channel_task);
-	/*
-	 * Grab the lock to prevent race condition when a packet received
-	 * and unloading driver is in the process.
-	 */
-	mtx_lock(&channel->inbound_lock);
 	channel->on_channel_callback = NULL;
-	mtx_unlock(&channel->inbound_lock);
 
 	/**
 	 * Send a closing message
@@ -920,12 +914,6 @@ VmbusProcessChannelEvent(void* context, 
 	 * callback to NULL. This closes the window.
 	 */
 
-	/*
-	 * Disable the lock due to newly added WITNESS check in r277723.
-	 * Will seek other way to avoid race condition.
-	 * -- whu
-	 */
-	// mtx_lock(&channel->inbound_lock);
 	if (channel->on_channel_callback != NULL) {
 		arg = channel->channel_callback_context;
 		is_batched_reading = channel->batched_reading;
@@ -952,5 +940,4 @@ VmbusProcessChannelEvent(void* context, 
 				bytes_to_read = 0;
 		} while (is_batched_reading && (bytes_to_read != 0));
 	}
-	// mtx_unlock(&channel->inbound_lock);
 }

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Fri Feb 26 08:43:36 2016	(r296082)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Fri Feb 26 09:17:31 2016	(r296083)
@@ -140,9 +140,7 @@ hv_vmbus_allocate_channel(void)
 					M_DEVBUF,
 					M_WAITOK | M_ZERO);
 
-	mtx_init(&channel->inbound_lock, "channel inbound", NULL, MTX_DEF);
 	mtx_init(&channel->sc_lock, "vmbus multi channel", NULL, MTX_DEF);
-
 	TAILQ_INIT(&channel->sc_list_anchor);
 
 	return (channel);
@@ -155,8 +153,6 @@ void
 hv_vmbus_free_vmbus_channel(hv_vmbus_channel* channel)
 {
 	mtx_destroy(&channel->sc_lock);
-	mtx_destroy(&channel->inbound_lock);
-
 	free(channel, M_DEVBUF);
 }
 


More information about the svn-src-head mailing list