Skip to content

Commit

Permalink
Drivers: hv: vmbus: Remove the lock field from the vmbus_channel struct
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrea Parri (Microsoft) authored and Wei Liu committed Jun 20, 2020
1 parent 21d2052 commit 775f43f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
6 changes: 1 addition & 5 deletions drivers/hv/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,8 @@ static int __vmbus_open(struct vmbus_channel *newchannel,
send_pages = newchannel->ringbuffer_send_offset;
recv_pages = newchannel->ringbuffer_pagecount - send_pages;

spin_lock_irqsave(&newchannel->lock, flags);
if (newchannel->state != CHANNEL_OPEN_STATE) {
spin_unlock_irqrestore(&newchannel->lock, flags);
if (newchannel->state != CHANNEL_OPEN_STATE)
return -EINVAL;
}
spin_unlock_irqrestore(&newchannel->lock, flags);

newchannel->state = CHANNEL_OPENING_STATE;
newchannel->onchannel_callback = onchannelcallback;
Expand Down
1 change: 0 additions & 1 deletion drivers/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ static struct vmbus_channel *alloc_channel(void)
return NULL;

spin_lock_init(&channel->sched_lock);
spin_lock_init(&channel->lock);
init_completion(&channel->rescind_event);

INIT_LIST_HEAD(&channel->sc_list);
Expand Down
6 changes: 0 additions & 6 deletions include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -840,12 +840,6 @@ struct vmbus_channel {
*/
void (*chn_rescind_callback)(struct vmbus_channel *channel);

/*
* The spinlock to protect the structure. It is being used to protect
* test-and-set access to various attributes of the structure as well
* as all sc_list operations.
*/
spinlock_t lock;
/*
* All Sub-channels of a primary channel are linked here.
*/
Expand Down

0 comments on commit 775f43f

Please sign in to comment.