vmbus: pass channel to hv_process_channel_removal
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Sep 2018 16:10:15 +0000 (09:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Sep 2018 18:33:24 +0000 (20:33 +0200)
Rather than passing relid and then looking up the channel.
Pass the channel directly, since caller already knows it.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/channel.c
drivers/hv/channel_mgmt.c
drivers/hv/vmbus_drv.c
include/linux/hyperv.h

index 741857d80da11d9a09444a2ad6c4eda32920854a..33e6db02dbab918237b9a2cf508c91a31342619e 100644 (file)
@@ -690,8 +690,7 @@ void vmbus_close(struct vmbus_channel *channel)
                        wait_for_completion(&cur_channel->rescind_event);
                        mutex_lock(&vmbus_connection.channel_mutex);
                        vmbus_close_internal(cur_channel);
-                       hv_process_channel_removal(
-                                          cur_channel->offermsg.child_relid);
+                       hv_process_channel_removal(cur_channel);
                } else {
                        mutex_lock(&vmbus_connection.channel_mutex);
                        vmbus_close_internal(cur_channel);
index 0f0e091c117c6b4a1991573e607f9f2dec5e6196..b7c48ebdf6a1dcf82aa68bc0868cb8dc75804aee 100644 (file)
@@ -385,21 +385,14 @@ static void vmbus_release_relid(u32 relid)
        trace_vmbus_release_relid(&msg, ret);
 }
 
-void hv_process_channel_removal(u32 relid)
+void hv_process_channel_removal(struct vmbus_channel *channel)
 {
+       struct vmbus_channel *primary_channel;
        unsigned long flags;
-       struct vmbus_channel *primary_channel, *channel;
 
        BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
-
-       /*
-        * Make sure channel is valid as we may have raced.
-        */
-       channel = relid2channel(relid);
-       if (!channel)
-               return;
-
        BUG_ON(!channel->rescind);
+
        if (channel->target_cpu != get_cpu()) {
                put_cpu();
                smp_call_function_single(channel->target_cpu,
@@ -429,7 +422,7 @@ void hv_process_channel_removal(u32 relid)
                cpumask_clear_cpu(channel->target_cpu,
                                  &primary_channel->alloced_cpus_in_node);
 
-       vmbus_release_relid(relid);
+       vmbus_release_relid(channel->offermsg.child_relid);
 
        free_channel(channel);
 }
@@ -943,7 +936,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
                         * The channel is currently not open;
                         * it is safe for us to cleanup the channel.
                         */
-                       hv_process_channel_removal(rescind->child_relid);
+                       hv_process_channel_removal(channel);
                } else {
                        complete(&channel->rescind_event);
                }
index 4bbc420d12130e2a6240010256d7013e7be3e4a0..283d184280aff10470d30c1314f4b349f3bcba68 100644 (file)
@@ -864,10 +864,9 @@ static void vmbus_device_release(struct device *device)
        struct vmbus_channel *channel = hv_dev->channel;
 
        mutex_lock(&vmbus_connection.channel_mutex);
-       hv_process_channel_removal(channel->offermsg.child_relid);
+       hv_process_channel_removal(channel);
        mutex_unlock(&vmbus_connection.channel_mutex);
        kfree(hv_dev);
-
 }
 
 /* The one and only one */
index 2c3798bcb01c9f1c327362853d5dcc98e613493b..6c4575c7f46b61e6cc68868264941f7c37ec75ab 100644 (file)
@@ -1443,7 +1443,7 @@ 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_process_channel_removal(u32 relid);
+void hv_process_channel_removal(struct vmbus_channel *channel);
 
 void vmbus_setevent(struct vmbus_channel *channel);
 /*