Commit 22356585 authored by Olaf Hering's avatar Olaf Hering Committed by Greg Kroah-Hartman

staging: hv: use sync_bitops when interacting with the hypervisor

Locking is required when tweaking bits located in a shared page, use the
sync_ version of bitops. Without this change vmbus_on_event() will miss
events and as a result, vmbus_isr() will not schedule the receive tasklet.
Signed-off-by: default avatarOlaf Hering <olaf@aepfle.de>
Cc: stable <stable@kernel.org>
Acked-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Acked-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 75e4fb22
...@@ -81,14 +81,14 @@ static void vmbus_setevent(struct vmbus_channel *channel) ...@@ -81,14 +81,14 @@ static void vmbus_setevent(struct vmbus_channel *channel)
if (channel->offermsg.monitor_allocated) { if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
set_bit(channel->offermsg.child_relid & 31, sync_set_bit(channel->offermsg.child_relid & 31,
(unsigned long *) vmbus_connection.send_int_page + (unsigned long *) vmbus_connection.send_int_page +
(channel->offermsg.child_relid >> 5)); (channel->offermsg.child_relid >> 5));
monitorpage = vmbus_connection.monitor_pages; monitorpage = vmbus_connection.monitor_pages;
monitorpage++; /* Get the child to parent monitor page */ monitorpage++; /* Get the child to parent monitor page */
set_bit(channel->monitor_bit, sync_set_bit(channel->monitor_bit,
(unsigned long *)&monitorpage->trigger_group (unsigned long *)&monitorpage->trigger_group
[channel->monitor_grp].pending); [channel->monitor_grp].pending);
...@@ -104,7 +104,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) ...@@ -104,7 +104,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
if (Channel->offermsg.monitor_allocated) { if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
clear_bit(Channel->offermsg.child_relid & 31, sync_clear_bit(Channel->offermsg.child_relid & 31,
(unsigned long *)vmbus_connection.send_int_page + (unsigned long *)vmbus_connection.send_int_page +
(Channel->offermsg.child_relid >> 5)); (Channel->offermsg.child_relid >> 5));
...@@ -112,7 +112,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) ...@@ -112,7 +112,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
vmbus_connection.monitor_pages; vmbus_connection.monitor_pages;
monitorPage++; /* Get the child to parent monitor page */ monitorPage++; /* Get the child to parent monitor page */
clear_bit(Channel->monitor_bit, sync_clear_bit(Channel->monitor_bit,
(unsigned long *)&monitorPage->trigger_group (unsigned long *)&monitorPage->trigger_group
[Channel->monitor_grp].Pending); [Channel->monitor_grp].Pending);
} }
......
...@@ -296,7 +296,7 @@ void vmbus_on_event(unsigned long data) ...@@ -296,7 +296,7 @@ void vmbus_on_event(unsigned long data)
for (dword = 0; dword < maxdword; dword++) { for (dword = 0; dword < maxdword; dword++) {
if (recv_int_page[dword]) { if (recv_int_page[dword]) {
for (bit = 0; bit < 32; bit++) { for (bit = 0; bit < 32; bit++) {
if (test_and_clear_bit(bit, if (sync_test_and_clear_bit(bit,
(unsigned long *) (unsigned long *)
&recv_int_page[dword])) { &recv_int_page[dword])) {
relid = (dword << 5) + bit; relid = (dword << 5) + bit;
...@@ -338,7 +338,7 @@ int vmbus_post_msg(void *buffer, size_t buflen) ...@@ -338,7 +338,7 @@ int vmbus_post_msg(void *buffer, size_t buflen)
int vmbus_set_event(u32 child_relid) int vmbus_set_event(u32 child_relid)
{ {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
set_bit(child_relid & 31, sync_set_bit(child_relid & 31,
(unsigned long *)vmbus_connection.send_int_page + (unsigned long *)vmbus_connection.send_int_page +
(child_relid >> 5)); (child_relid >> 5));
......
...@@ -254,7 +254,7 @@ static int vmbus_on_isr(void) ...@@ -254,7 +254,7 @@ static int vmbus_on_isr(void)
event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
/* Since we are a child, we only need to check bit 0 */ /* Since we are a child, we only need to check bit 0 */
if (test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) { if (sync_test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) {
DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]); DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]);
ret |= 0x2; ret |= 0x2;
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "channel_mgmt.h" #include "channel_mgmt.h"
#include "ring_buffer.h" #include "ring_buffer.h"
#include <linux/list.h> #include <linux/list.h>
#include <asm/sync_bitops.h>
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment