Skip to content

Commit 775f43f

Browse files
andrea-parriliuw
authored andcommitted
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) <[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 21d2052 commit 775f43f

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

drivers/hv/channel.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,8 @@ static int __vmbus_open(struct vmbus_channel *newchannel,
129129
send_pages = newchannel->ringbuffer_send_offset;
130130
recv_pages = newchannel->ringbuffer_pagecount - send_pages;
131131

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)
135133
return -EINVAL;
136-
}
137-
spin_unlock_irqrestore(&newchannel->lock, flags);
138134

139135
newchannel->state = CHANNEL_OPENING_STATE;
140136
newchannel->onchannel_callback = onchannelcallback;

drivers/hv/channel_mgmt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ static struct vmbus_channel *alloc_channel(void)
317317
return NULL;
318318

319319
spin_lock_init(&channel->sched_lock);
320-
spin_lock_init(&channel->lock);
321320
init_completion(&channel->rescind_event);
322321

323322
INIT_LIST_HEAD(&channel->sc_list);

include/linux/hyperv.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,6 @@ struct vmbus_channel {
840840
*/
841841
void (*chn_rescind_callback)(struct vmbus_channel *channel);
842842

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;
849843
/*
850844
* All Sub-channels of a primary channel are linked here.
851845
*/

0 commit comments

Comments
 (0)