[azure 4.13][PATCH 06/19] Revert "UBUNTU: SAUCE: vmbus: dynamically enqueue/dequeue a channel on vmbus_open/close"
Marcelo Henrique Cerri
marcelo.cerri at canonical.com
Tue Dec 12 15:41:55 UTC 2017
From: Dexuan Cui <decui at microsoft.com>
BugLink: http://bugs.launchpad.net/bugs/1736283
This reverts commit 733807e8a430347ecb71d94eeb2e4050cefe0dd3.
Signed-off-by: Dexuan Cui <decui at microsoft.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
drivers/hv/channel.c | 12 +++-------
drivers/hv/channel_mgmt.c | 60 +++++++++++++++++++++--------------------------
include/linux/hyperv.h | 3 ---
3 files changed, 30 insertions(+), 45 deletions(-)
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index dfeca41f8413..a76180bcb9f7 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -197,8 +197,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
goto error_free_gpadl;
}
- hv_percpu_channel_enq(newchannel);
-
ret = vmbus_post_msg(open_msg,
sizeof(struct vmbus_channel_open_channel), true);
@@ -211,25 +209,23 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (ret != 0) {
err = ret;
- goto error_deq_channel;
+ goto error_free_gpadl;
}
if (newchannel->rescind) {
err = -ENODEV;
- goto error_deq_channel;
+ goto error_free_gpadl;
}
if (open_info->response.open_result.status) {
err = -EAGAIN;
- goto error_deq_channel;
+ goto error_free_gpadl;
}
newchannel->state = CHANNEL_OPENED_STATE;
kfree(open_info);
return 0;
-error_deq_channel:
- hv_percpu_channel_deq(newchannel);
error_free_gpadl:
vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
kfree(open_info);
@@ -584,8 +580,6 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
goto out;
}
- hv_percpu_channel_deq(channel);
-
channel->state = CHANNEL_OPEN_STATE;
channel->sc_creation_callback = NULL;
/* Stop callback and cancel the timer asap */
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 92c9cd9b6c26..4f64561eac7a 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -362,22 +362,6 @@ static void percpu_channel_enq(void *arg)
list_add_tail_rcu(&channel->percpu_list, &hv_cpu->chan_list);
}
-void hv_percpu_channel_enq(struct vmbus_channel *channel)
-{
- unsigned long flags;
-
- if (channel->target_cpu != get_cpu())
- smp_call_function_single(channel->target_cpu,
- percpu_channel_enq, channel, true);
- else {
- local_irq_save(flags);
- percpu_channel_enq(channel);
- local_irq_restore(flags);
- }
-
- put_cpu();
-}
-
static void percpu_channel_deq(void *arg)
{
struct vmbus_channel *channel = arg;
@@ -385,23 +369,6 @@ static void percpu_channel_deq(void *arg)
list_del_rcu(&channel->percpu_list);
}
-void hv_percpu_channel_deq(struct vmbus_channel *channel)
-{
- unsigned long flags;
-
- if (channel->target_cpu != get_cpu())
- smp_call_function_single(channel->target_cpu,
- percpu_channel_deq, channel, true);
- else {
- local_irq_save(flags);
- percpu_channel_deq(channel);
- local_irq_restore(flags);
- }
-
- put_cpu();
-}
-
-
static void vmbus_release_relid(u32 relid)
{
struct vmbus_channel_relid_released msg;
@@ -428,6 +395,14 @@ void hv_process_channel_removal(u32 relid)
return;
BUG_ON(!channel->rescind);
+ if (channel->target_cpu != get_cpu()) {
+ put_cpu();
+ smp_call_function_single(channel->target_cpu,
+ percpu_channel_deq, channel, true);
+ } else {
+ percpu_channel_deq(channel);
+ put_cpu();
+ }
if (channel->primary_channel == NULL) {
list_del(&channel->listentry);
@@ -527,6 +502,16 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
init_vp_index(newchannel, dev_type);
+ if (newchannel->target_cpu != get_cpu()) {
+ put_cpu();
+ smp_call_function_single(newchannel->target_cpu,
+ percpu_channel_enq,
+ newchannel, true);
+ } else {
+ percpu_channel_enq(newchannel);
+ put_cpu();
+ }
+
/*
* This state is used to indicate a successful open
* so that when we do close the channel normally, we
@@ -590,6 +575,15 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
list_del(&newchannel->listentry);
mutex_unlock(&vmbus_connection.channel_mutex);
+ if (newchannel->target_cpu != get_cpu()) {
+ put_cpu();
+ smp_call_function_single(newchannel->target_cpu,
+ percpu_channel_deq, newchannel, true);
+ } else {
+ percpu_channel_deq(newchannel);
+ put_cpu();
+ }
+
vmbus_release_relid(newchannel->offermsg.child_relid);
err_free_chan:
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 2d8b937bbd90..f9088f52273d 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1434,9 +1434,6 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf,
const int *srv_version, int srv_vercnt,
int *nego_fw_version, int *nego_srv_version);
-void hv_percpu_channel_enq(struct vmbus_channel *channel);
-void hv_percpu_channel_deq(struct vmbus_channel *channel);
-
void hv_process_channel_removal(u32 relid);
void vmbus_setevent(struct vmbus_channel *channel);
--
2.7.4
More information about the kernel-team
mailing list