[azure 4.13][PATCH 13/19] Revert "UBUNTU: SAUCE: vmbus: fix hv_percpu_channel_deq/enq race"
Marcelo Henrique Cerri
marcelo.cerri at canonical.com
Tue Dec 12 15:42:02 UTC 2017
From: Dexuan Cui <decui at microsoft.com>
BugLink: http://bugs.launchpad.net/bugs/1736283
This reverts commit e7afe094c401dbb64a9060debce6e20a97faf6b7.
Signed-off-by: Dexuan Cui <decui at microsoft.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
drivers/hv/channel_mgmt.c | 17 --------------
drivers/hv/connection.c | 11 ---------
drivers/hv/hyperv_vmbus.h | 1 -
drivers/hv/vmbus_drv.c | 59 +++--------------------------------------------
4 files changed, 3 insertions(+), 85 deletions(-)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 509019dc7df9..19f374ce3658 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -564,7 +564,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
return;
err_deq_chan:
- atomic_dec(&vmbus_connection.offer_in_progress);
mutex_lock(&vmbus_connection.channel_mutex);
list_del(&newchannel->listentry);
mutex_unlock(&vmbus_connection.channel_mutex);
@@ -945,28 +944,12 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
}
}
-static void vmbus_stop_rescind_handling_work(struct work_struct *work)
-{
- atomic_inc(&vmbus_connection.offer_in_progress);
-}
-
void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
{
- struct work_struct work;
-
BUG_ON(!is_hvsock_channel(channel));
- /* Prevent chn_rescind_callback from running in the rescind path */
- INIT_WORK(&work, vmbus_stop_rescind_handling_work);
- queue_work_on(vmbus_connection.connect_cpu,
- vmbus_connection.work_queue_rescind, &work);
- flush_work(&work);
-
channel->rescind = true;
vmbus_device_unregister(channel->device_obj);
-
- /* Unblock the rescind handling */
- atomic_dec(&vmbus_connection.offer_in_progress);
}
EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 71aad106d4fd..45e22bb53646 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -159,12 +159,6 @@ int vmbus_connect(void)
goto cleanup;
}
- vmbus_connection.work_queue_rescind = create_workqueue("hv_vmbus_rsd");
- if (!vmbus_connection.work_queue_rescind) {
- ret = -ENOMEM;
- goto cleanup;
- }
-
INIT_LIST_HEAD(&vmbus_connection.chn_msg_list);
spin_lock_init(&vmbus_connection.channelmsg_lock);
@@ -255,11 +249,6 @@ void vmbus_disconnect(void)
*/
vmbus_initiate_unload(false);
- if (vmbus_connection.work_queue_rescind) {
- drain_workqueue(vmbus_connection.work_queue_rescind);
- destroy_workqueue(vmbus_connection.work_queue_rescind);
- }
-
if (vmbus_connection.work_queue) {
drain_workqueue(vmbus_connection.work_queue);
destroy_workqueue(vmbus_connection.work_queue);
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 0256a3e19552..de6f01df9592 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -328,7 +328,6 @@ struct vmbus_connection {
struct mutex channel_mutex;
struct workqueue_struct *work_queue;
- struct workqueue_struct *work_queue_rescind;
};
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index eb5dbeb31b17..47b666dcfbb6 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -807,52 +807,6 @@ static void vmbus_onmessage_work(struct work_struct *work)
kfree(ctx);
}
-static void vmbus_dispatch_msg_work(struct work_struct *work)
-{
- struct vmbus_channel_message_header *hdr;
- struct onmessage_work_context *ctx, *context;
-
- ctx = container_of(work, struct onmessage_work_context, work);
- hdr = (struct vmbus_channel_message_header *)ctx->msg.u.payload;
-
- context = kmalloc(sizeof(*context), GFP_KERNEL | __GFP_NOFAIL);
- INIT_WORK(&context->work, vmbus_onmessage_work);
- memcpy(&context->msg, &ctx->msg, sizeof(struct hv_message));
-
- /*
- * The host can generate a rescind message while we
- * may still be handling the original offer. We deal with
- * this condition by ensuring the processing is done on the
- * same CPU.
- */
- switch (hdr->msgtype) {
- case CHANNELMSG_RESCIND_CHANNELOFFER:
- /*
- * If we are handling the rescind message;
- * schedule the work on the global work queue.
- */
- queue_work_on(vmbus_connection.connect_cpu,
- vmbus_connection.work_queue_rescind,
- &context->work);
- break;
-
- case CHANNELMSG_OFFERCHANNEL:
- /* XXX */
- flush_workqueue(vmbus_connection.work_queue_rescind);
-
- atomic_inc(&vmbus_connection.offer_in_progress);
- queue_work_on(vmbus_connection.connect_cpu,
- vmbus_connection.work_queue,
- &context->work);
- break;
-
- default:
- queue_work(vmbus_connection.work_queue, &context->work);
- }
-
- kfree(ctx);
-}
-
static void hv_process_timer_expiration(struct hv_message *msg,
struct hv_per_cpu_context *hv_cpu)
{
@@ -892,10 +846,9 @@ void vmbus_on_msg_dpc(unsigned long data)
if (ctx == NULL)
return;
- INIT_WORK(&ctx->work, vmbus_dispatch_msg_work);
+ INIT_WORK(&ctx->work, vmbus_onmessage_work);
memcpy(&ctx->msg, msg, sizeof(*msg));
-#if 0
/*
* The host can generate a rescind message while we
* may still be handling the original offer. We deal with
@@ -908,9 +861,8 @@ void vmbus_on_msg_dpc(unsigned long data)
* If we are handling the rescind message;
* schedule the work on the global work queue.
*/
- queue_work_on(vmbus_connection.connect_cpu,
- vmbus_connection.work_queue_rescind,
- &ctx->work);
+ schedule_work_on(vmbus_connection.connect_cpu,
+ &ctx->work);
break;
case CHANNELMSG_OFFERCHANNEL:
@@ -923,9 +875,6 @@ void vmbus_on_msg_dpc(unsigned long data)
default:
queue_work(vmbus_connection.work_queue, &ctx->work);
}
-#else
- schedule_work(&ctx->work);
-#endif
} else
entry->message_handler(hdr);
@@ -1389,8 +1338,6 @@ int vmbus_device_register(struct hv_device *child_device_obj)
child_device_obj->device.parent = &hv_acpi_dev->dev;
child_device_obj->device.release = vmbus_device_release;
- if (is_hvsock_channel(child_device_obj->channel))
- dev_set_uevent_suppress(&child_device_obj->device, 1);
/*
* Register with the LDM. This will kick off the driver/device
* binding...which will eventually call vmbus_match() and vmbus_probe()
--
2.7.4
More information about the kernel-team
mailing list