From: Andrea Parri (Microsoft) Date: Wed, 17 Jun 2020 16:46:38 +0000 (+0200) Subject: Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (sc_list readers) X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=12d0dd8e728e785e6fb81f5232280678bc69d8dc;p=linux.git Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (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) Link: https://lore.kernel.org/r/20200617164642.37393-5-parri.andrea@gmail.com Reviewed-by: Michael Kelley Signed-off-by: Wei Liu --- diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 857290dcfd954..da69338f92f58 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -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 @@ -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; } diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 5b07c5bcb2605..48446422b108c 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2344,7 +2344,6 @@ acpi_walk_err: 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) { /* @@ -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); }