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

Drivers: hv: vmbus: Remove the lock field from the vmbus_channel struct

The spinlock is (now) *not used to protect test-and-set accesses
to attributes of the structure or sc_list operations.

There is, AFAICT, a distinct lack of {WRITE,READ}_ONCE()s in the
handling of channel->state, but the changes below do not seem to
make things "worse". ;-)

Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/20200617164642.37393-9-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
775f43fa 21d2052c

+1 -12
+1 -5
drivers/hv/channel.c
··· 129 129 send_pages = newchannel->ringbuffer_send_offset; 130 130 recv_pages = newchannel->ringbuffer_pagecount - send_pages; 131 131 132 - spin_lock_irqsave(&newchannel->lock, flags); 133 - if (newchannel->state != CHANNEL_OPEN_STATE) { 134 - spin_unlock_irqrestore(&newchannel->lock, flags); 132 + if (newchannel->state != CHANNEL_OPEN_STATE) 135 133 return -EINVAL; 136 - } 137 - spin_unlock_irqrestore(&newchannel->lock, flags); 138 134 139 135 newchannel->state = CHANNEL_OPENING_STATE; 140 136 newchannel->onchannel_callback = onchannelcallback;
-1
drivers/hv/channel_mgmt.c
··· 317 317 return NULL; 318 318 319 319 spin_lock_init(&channel->sched_lock); 320 - spin_lock_init(&channel->lock); 321 320 init_completion(&channel->rescind_event); 322 321 323 322 INIT_LIST_HEAD(&channel->sc_list);
-6
include/linux/hyperv.h
··· 841 841 void (*chn_rescind_callback)(struct vmbus_channel *channel); 842 842 843 843 /* 844 - * The spinlock to protect the structure. It is being used to protect 845 - * test-and-set access to various attributes of the structure as well 846 - * as all sc_list operations. 847 - */ 848 - spinlock_t lock; 849 - /* 850 844 * All Sub-channels of a primary channel are linked here. 851 845 */ 852 846 struct list_head sc_list;