Drivers: hv: vmbus: Remove the useless API vmbus_get_outgoing_channel()
Commit d86adf482b
("scsi: storvsc: Enable multi-queue support") removed
the usage of the API in Jan 2017, and the API is not used since then.
netvsc and storvsc have their own algorithms to determine the outgoing
channel, so this API is useless.
And the API is potentially unsafe, because it reads primary->num_sc without
any lock held. This can be risky considering the RESCIND-OFFER message.
Let's remove the API.
Cc: Long Li <longli@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6b50d882d3
commit
4d3c5c6919
|
@ -703,7 +703,6 @@ int vmbus_disconnect_ring(struct vmbus_channel *channel)
|
||||||
/* Snapshot the list of subchannels */
|
/* Snapshot the list of subchannels */
|
||||||
spin_lock_irqsave(&channel->lock, flags);
|
spin_lock_irqsave(&channel->lock, flags);
|
||||||
list_splice_init(&channel->sc_list, &list);
|
list_splice_init(&channel->sc_list, &list);
|
||||||
channel->num_sc = 0;
|
|
||||||
spin_unlock_irqrestore(&channel->lock, flags);
|
spin_unlock_irqrestore(&channel->lock, flags);
|
||||||
|
|
||||||
list_for_each_entry_safe(cur_channel, tmp, &list, sc_list) {
|
list_for_each_entry_safe(cur_channel, tmp, &list, sc_list) {
|
||||||
|
|
|
@ -405,7 +405,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
|
||||||
primary_channel = channel->primary_channel;
|
primary_channel = channel->primary_channel;
|
||||||
spin_lock_irqsave(&primary_channel->lock, flags);
|
spin_lock_irqsave(&primary_channel->lock, flags);
|
||||||
list_del(&channel->sc_list);
|
list_del(&channel->sc_list);
|
||||||
primary_channel->num_sc--;
|
|
||||||
spin_unlock_irqrestore(&primary_channel->lock, flags);
|
spin_unlock_irqrestore(&primary_channel->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +482,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
|
||||||
newchannel->primary_channel = channel;
|
newchannel->primary_channel = channel;
|
||||||
spin_lock_irqsave(&channel->lock, flags);
|
spin_lock_irqsave(&channel->lock, flags);
|
||||||
list_add_tail(&newchannel->sc_list, &channel->sc_list);
|
list_add_tail(&newchannel->sc_list, &channel->sc_list);
|
||||||
channel->num_sc++;
|
|
||||||
spin_unlock_irqrestore(&channel->lock, flags);
|
spin_unlock_irqrestore(&channel->lock, flags);
|
||||||
} else {
|
} else {
|
||||||
goto err_free_chan;
|
goto err_free_chan;
|
||||||
|
@ -1239,49 +1237,6 @@ int vmbus_request_offers(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the (sub) channel on which to send an outgoing request.
|
|
||||||
* When a primary channel has multiple sub-channels, we try to
|
|
||||||
* distribute the load equally amongst all available channels.
|
|
||||||
*/
|
|
||||||
struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary)
|
|
||||||
{
|
|
||||||
struct list_head *cur, *tmp;
|
|
||||||
int cur_cpu;
|
|
||||||
struct vmbus_channel *cur_channel;
|
|
||||||
struct vmbus_channel *outgoing_channel = primary;
|
|
||||||
int next_channel;
|
|
||||||
int i = 1;
|
|
||||||
|
|
||||||
if (list_empty(&primary->sc_list))
|
|
||||||
return outgoing_channel;
|
|
||||||
|
|
||||||
next_channel = primary->next_oc++;
|
|
||||||
|
|
||||||
if (next_channel > (primary->num_sc)) {
|
|
||||||
primary->next_oc = 0;
|
|
||||||
return outgoing_channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_cpu = hv_cpu_number_to_vp_number(smp_processor_id());
|
|
||||||
list_for_each_safe(cur, tmp, &primary->sc_list) {
|
|
||||||
cur_channel = list_entry(cur, struct vmbus_channel, sc_list);
|
|
||||||
if (cur_channel->state != CHANNEL_OPENED_STATE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (cur_channel->target_vp == cur_cpu)
|
|
||||||
return cur_channel;
|
|
||||||
|
|
||||||
if (i == next_channel)
|
|
||||||
return cur_channel;
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return outgoing_channel;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(vmbus_get_outgoing_channel);
|
|
||||||
|
|
||||||
static void invoke_sc_cb(struct vmbus_channel *primary_channel)
|
static void invoke_sc_cb(struct vmbus_channel *primary_channel)
|
||||||
{
|
{
|
||||||
struct list_head *cur, *tmp;
|
struct list_head *cur, *tmp;
|
||||||
|
|
|
@ -830,15 +830,6 @@ struct vmbus_channel {
|
||||||
* All Sub-channels of a primary channel are linked here.
|
* All Sub-channels of a primary channel are linked here.
|
||||||
*/
|
*/
|
||||||
struct list_head sc_list;
|
struct list_head sc_list;
|
||||||
/*
|
|
||||||
* Current number of sub-channels.
|
|
||||||
*/
|
|
||||||
int num_sc;
|
|
||||||
/*
|
|
||||||
* Number of a sub-channel (position within sc_list) which is supposed
|
|
||||||
* to be used as the next outgoing channel.
|
|
||||||
*/
|
|
||||||
int next_oc;
|
|
||||||
/*
|
/*
|
||||||
* The primary channel this sub-channel belongs to.
|
* The primary channel this sub-channel belongs to.
|
||||||
* This will be NULL for the primary channel.
|
* This will be NULL for the primary channel.
|
||||||
|
@ -965,14 +956,6 @@ void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
|
||||||
void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
|
void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
|
||||||
void (*chn_rescind_cb)(struct vmbus_channel *));
|
void (*chn_rescind_cb)(struct vmbus_channel *));
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the (sub) channel on which to send an outgoing request.
|
|
||||||
* When a primary channel has multiple sub-channels, we choose a
|
|
||||||
* channel whose VCPU binding is closest to the VCPU on which
|
|
||||||
* this call is being made.
|
|
||||||
*/
|
|
||||||
struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if sub-channels have already been offerred. This API will be useful
|
* Check if sub-channels have already been offerred. This API will be useful
|
||||||
* when the driver is unloaded after establishing sub-channels. In this case,
|
* when the driver is unloaded after establishing sub-channels. In this case,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user