Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (sc_list updaters)

None of the readers/updaters of sc_list rely on channel->lock for
synchronization.

Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/20200617164642.37393-7-parri.andrea@gmail.com
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
Andrea Parri (Microsoft) 2020-06-17 18:46:40 +02:00 committed by Wei Liu
parent 3eb0ac869c
commit 8a99e50134

View File

@ -400,8 +400,6 @@ static void vmbus_release_relid(u32 relid)
void hv_process_channel_removal(struct vmbus_channel *channel) void hv_process_channel_removal(struct vmbus_channel *channel)
{ {
unsigned long flags;
lockdep_assert_held(&vmbus_connection.channel_mutex); lockdep_assert_held(&vmbus_connection.channel_mutex);
BUG_ON(!channel->rescind); BUG_ON(!channel->rescind);
@ -422,14 +420,10 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
if (channel->offermsg.child_relid != INVALID_RELID) if (channel->offermsg.child_relid != INVALID_RELID)
vmbus_channel_unmap_relid(channel); vmbus_channel_unmap_relid(channel);
if (channel->primary_channel == NULL) { if (channel->primary_channel == NULL)
list_del(&channel->listentry); list_del(&channel->listentry);
} else { else
struct vmbus_channel *primary_channel = channel->primary_channel;
spin_lock_irqsave(&primary_channel->lock, flags);
list_del(&channel->sc_list); list_del(&channel->sc_list);
spin_unlock_irqrestore(&primary_channel->lock, flags);
}
/* /*
* If this is a "perf" channel, updates the hv_numa_map[] masks so that * If this is a "perf" channel, updates the hv_numa_map[] masks so that
@ -470,7 +464,6 @@ static void vmbus_add_channel_work(struct work_struct *work)
struct vmbus_channel *newchannel = struct vmbus_channel *newchannel =
container_of(work, struct vmbus_channel, add_channel_work); container_of(work, struct vmbus_channel, add_channel_work);
struct vmbus_channel *primary_channel = newchannel->primary_channel; struct vmbus_channel *primary_channel = newchannel->primary_channel;
unsigned long flags;
int ret; int ret;
/* /*
@ -531,13 +524,10 @@ err_deq_chan:
*/ */
newchannel->probe_done = true; newchannel->probe_done = true;
if (primary_channel == NULL) { if (primary_channel == NULL)
list_del(&newchannel->listentry); list_del(&newchannel->listentry);
} else { else
spin_lock_irqsave(&primary_channel->lock, flags);
list_del(&newchannel->sc_list); list_del(&newchannel->sc_list);
spin_unlock_irqrestore(&primary_channel->lock, flags);
}
/* vmbus_process_offer() has mapped the channel. */ /* vmbus_process_offer() has mapped the channel. */
vmbus_channel_unmap_relid(newchannel); vmbus_channel_unmap_relid(newchannel);
@ -557,7 +547,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
{ {
struct vmbus_channel *channel; struct vmbus_channel *channel;
struct workqueue_struct *wq; struct workqueue_struct *wq;
unsigned long flags;
bool fnew = true; bool fnew = true;
/* /*
@ -609,10 +598,10 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
} }
} }
if (fnew) if (fnew) {
list_add_tail(&newchannel->listentry, list_add_tail(&newchannel->listentry,
&vmbus_connection.chn_list); &vmbus_connection.chn_list);
else { } else {
/* /*
* Check to see if this is a valid sub-channel. * Check to see if this is a valid sub-channel.
*/ */
@ -630,9 +619,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
* Process the sub-channel. * Process the sub-channel.
*/ */
newchannel->primary_channel = channel; newchannel->primary_channel = channel;
spin_lock_irqsave(&channel->lock, flags);
list_add_tail(&newchannel->sc_list, &channel->sc_list); list_add_tail(&newchannel->sc_list, &channel->sc_list);
spin_unlock_irqrestore(&channel->lock, flags);
} }
vmbus_channel_map_relid(newchannel); vmbus_channel_map_relid(newchannel);