Skip to content

Commit

Permalink
Drivers: hv: vmbus: Remove unnecessary channel->lock critical section…
Browse files Browse the repository at this point in the history
…s (sc_list readers)

Additions/deletions to/from sc_list (as well as modifications of
target_cpu(s)) are protected by channel_mutex, which hv_synic_cleanup()
and vmbus_bus_suspend() own for the duration of the channel->lock
critical section in question.

Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/20200617164642.37393-5-parri.andrea@gmail.com
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
  • Loading branch information
Andrea Parri (Microsoft) authored and Wei Liu committed Jun 19, 2020
1 parent 0a96820 commit 12d0dd8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
3 changes: 0 additions & 3 deletions drivers/hv/hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ int hv_synic_cleanup(unsigned int cpu)
{
struct vmbus_channel *channel, *sc;
bool channel_found = false;
unsigned long flags;

/*
* Hyper-V does not provide a way to change the connect CPU once
Expand All @@ -263,14 +262,12 @@ int hv_synic_cleanup(unsigned int cpu)
channel_found = true;
break;
}
spin_lock_irqsave(&channel->lock, flags);
list_for_each_entry(sc, &channel->sc_list, sc_list) {
if (sc->target_cpu == cpu) {
channel_found = true;
break;
}
}
spin_unlock_irqrestore(&channel->lock, flags);
if (channel_found)
break;
}
Expand Down
3 changes: 0 additions & 3 deletions drivers/hv/vmbus_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,6 @@ static int vmbus_acpi_add(struct acpi_device *device)
static int vmbus_bus_suspend(struct device *dev)
{
struct vmbus_channel *channel, *sc;
unsigned long flags;

while (atomic_read(&vmbus_connection.offer_in_progress) != 0) {
/*
Expand Down Expand Up @@ -2402,12 +2401,10 @@ static int vmbus_bus_suspend(struct device *dev)
continue;
}

spin_lock_irqsave(&channel->lock, flags);
list_for_each_entry(sc, &channel->sc_list, sc_list) {
pr_err("Sub-channel not deleted!\n");
WARN_ON_ONCE(1);
}
spin_unlock_irqrestore(&channel->lock, flags);

atomic_inc(&vmbus_connection.nr_chan_fixup_on_resume);
}
Expand Down

0 comments on commit 12d0dd8

Please sign in to comment.