Skip to content

Commit 8a99e50

Browse files
andrea-parriliuw
authored andcommitted
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) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Wei Liu <[email protected]>
1 parent 3eb0ac8 commit 8a99e50

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

drivers/hv/channel_mgmt.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,6 @@ static void vmbus_release_relid(u32 relid)
400400

401401
void hv_process_channel_removal(struct vmbus_channel *channel)
402402
{
403-
unsigned long flags;
404-
405403
lockdep_assert_held(&vmbus_connection.channel_mutex);
406404
BUG_ON(!channel->rescind);
407405

@@ -422,14 +420,10 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
422420
if (channel->offermsg.child_relid != INVALID_RELID)
423421
vmbus_channel_unmap_relid(channel);
424422

425-
if (channel->primary_channel == NULL) {
423+
if (channel->primary_channel == NULL)
426424
list_del(&channel->listentry);
427-
} else {
428-
struct vmbus_channel *primary_channel = channel->primary_channel;
429-
spin_lock_irqsave(&primary_channel->lock, flags);
425+
else
430426
list_del(&channel->sc_list);
431-
spin_unlock_irqrestore(&primary_channel->lock, flags);
432-
}
433427

434428
/*
435429
* 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)
470464
struct vmbus_channel *newchannel =
471465
container_of(work, struct vmbus_channel, add_channel_work);
472466
struct vmbus_channel *primary_channel = newchannel->primary_channel;
473-
unsigned long flags;
474467
int ret;
475468

476469
/*
@@ -531,13 +524,10 @@ static void vmbus_add_channel_work(struct work_struct *work)
531524
*/
532525
newchannel->probe_done = true;
533526

534-
if (primary_channel == NULL) {
527+
if (primary_channel == NULL)
535528
list_del(&newchannel->listentry);
536-
} else {
537-
spin_lock_irqsave(&primary_channel->lock, flags);
529+
else
538530
list_del(&newchannel->sc_list);
539-
spin_unlock_irqrestore(&primary_channel->lock, flags);
540-
}
541531

542532
/* vmbus_process_offer() has mapped the channel. */
543533
vmbus_channel_unmap_relid(newchannel);
@@ -557,7 +547,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
557547
{
558548
struct vmbus_channel *channel;
559549
struct workqueue_struct *wq;
560-
unsigned long flags;
561550
bool fnew = true;
562551

563552
/*
@@ -609,10 +598,10 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
609598
}
610599
}
611600

612-
if (fnew)
601+
if (fnew) {
613602
list_add_tail(&newchannel->listentry,
614603
&vmbus_connection.chn_list);
615-
else {
604+
} else {
616605
/*
617606
* Check to see if this is a valid sub-channel.
618607
*/
@@ -630,9 +619,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
630619
* Process the sub-channel.
631620
*/
632621
newchannel->primary_channel = channel;
633-
spin_lock_irqsave(&channel->lock, flags);
634622
list_add_tail(&newchannel->sc_list, &channel->sc_list);
635-
spin_unlock_irqrestore(&channel->lock, flags);
636623
}
637624

638625
vmbus_channel_map_relid(newchannel);

0 commit comments

Comments
 (0)