Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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) <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>

authored by

Andrea Parri (Microsoft) and committed by
Wei Liu
12d0dd8e 0a968209

-6
-3
drivers/hv/hv.c
··· 241 241 { 242 242 struct vmbus_channel *channel, *sc; 243 243 bool channel_found = false; 244 - unsigned long flags; 245 244 246 245 /* 247 246 * Hyper-V does not provide a way to change the connect CPU once ··· 262 263 channel_found = true; 263 264 break; 264 265 } 265 - spin_lock_irqsave(&channel->lock, flags); 266 266 list_for_each_entry(sc, &channel->sc_list, sc_list) { 267 267 if (sc->target_cpu == cpu) { 268 268 channel_found = true; 269 269 break; 270 270 } 271 271 } 272 - spin_unlock_irqrestore(&channel->lock, flags); 273 272 if (channel_found) 274 273 break; 275 274 }
-3
drivers/hv/vmbus_drv.c
··· 2344 2344 static int vmbus_bus_suspend(struct device *dev) 2345 2345 { 2346 2346 struct vmbus_channel *channel, *sc; 2347 - unsigned long flags; 2348 2347 2349 2348 while (atomic_read(&vmbus_connection.offer_in_progress) != 0) { 2350 2349 /* ··· 2401 2402 continue; 2402 2403 } 2403 2404 2404 - spin_lock_irqsave(&channel->lock, flags); 2405 2405 list_for_each_entry(sc, &channel->sc_list, sc_list) { 2406 2406 pr_err("Sub-channel not deleted!\n"); 2407 2407 WARN_ON_ONCE(1); 2408 2408 } 2409 - spin_unlock_irqrestore(&channel->lock, flags); 2410 2409 2411 2410 atomic_inc(&vmbus_connection.nr_chan_fixup_on_resume); 2412 2411 }