]> git.hungrycats.org Git - linux/commitdiff
staging: hv: use sync_bitops when interacting with the hypervisor
authorOlaf Hering <olaf@aepfle.de>
Mon, 21 Mar 2011 13:41:37 +0000 (14:41 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 20:02:02 +0000 (13:02 -0700)
commit 22356585712d1ff08fbfed152edd8b386873b238 upstream.

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: Olaf Hering <olaf@aepfle.de>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Acked-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/channel.c
drivers/staging/hv/connection.c
drivers/staging/hv/vmbus_drv.c
drivers/staging/hv/vmbus_private.h

index 45a627d77b41786cc520974fd0cc7258657a2d85..09e596a506b0e35c7857cbca0180493535db30da 100644 (file)
@@ -76,14 +76,14 @@ static void vmbus_setevent(struct vmbus_channel *channel)
 
        if (channel->offermsg.monitor_allocated) {
                /* Each u32 represents 32 channels */
-               set_bit(channel->offermsg.child_relid & 31,
+               sync_set_bit(channel->offermsg.child_relid & 31,
                        (unsigned long *) gVmbusConnection.SendInterruptPage +
                        (channel->offermsg.child_relid >> 5));
 
                monitorpage = gVmbusConnection.MonitorPages;
                monitorpage++; /* Get the child to parent monitor page */
 
-               set_bit(channel->monitor_bit,
+               sync_set_bit(channel->monitor_bit,
                        (unsigned long *)&monitorpage->trigger_group
                                        [channel->monitor_grp].pending);
 
@@ -99,7 +99,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
 
        if (Channel->offermsg.monitor_allocated) {
                /* Each u32 represents 32 channels */
-               clear_bit(Channel->offermsg.child_relid & 31,
+               sync_clear_bit(Channel->offermsg.child_relid & 31,
                          (unsigned long *)gVmbusConnection.SendInterruptPage +
                          (Channel->offermsg.child_relid >> 5));
 
@@ -107,7 +107,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
                        (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
                monitorPage++; /* Get the child to parent monitor page */
 
-               clear_bit(Channel->monitor_bit,
+               sync_clear_bit(Channel->monitor_bit,
                          (unsigned long *)&monitorPage->trigger_group
                                        [Channel->monitor_grp].Pending);
        }
index c2e298ff483440a920e44298de3aa64605b50533..0739eb7b6ee11316ea6242175c03d331a23d478b 100644 (file)
@@ -281,7 +281,7 @@ void VmbusOnEvents(void)
                for (dword = 0; dword < maxdword; dword++) {
                        if (recvInterruptPage[dword]) {
                                for (bit = 0; bit < 32; bit++) {
-                                       if (test_and_clear_bit(bit, (unsigned long *)&recvInterruptPage[dword])) {
+                                       if (sync_test_and_clear_bit(bit, (unsigned long *)&recvInterruptPage[dword])) {
                                                relid = (dword << 5) + bit;
                                                DPRINT_DBG(VMBUS, "event detected for relid - %d", relid);
 
@@ -320,7 +320,7 @@ int VmbusPostMessage(void *buffer, size_t bufferLen)
 int VmbusSetEvent(u32 childRelId)
 {
        /* Each u32 represents 32 channels */
-       set_bit(childRelId & 31,
+       sync_set_bit(childRelId & 31,
                (unsigned long *)gVmbusConnection.SendInterruptPage +
                (childRelId >> 5));
 
index 84fdb64d3ceb297a19c046a3b7b46a013d786877..87e6cf2086f083d79532ec1e9da192aabf93b4a4 100644 (file)
@@ -291,7 +291,7 @@ static int vmbus_on_isr(struct hv_driver *drv)
        event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
 
        /* 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]);
                ret |= 0x2;
        }
index 07f6d22eeabb5bb0239e5adb6a7b1d7ecbf3eb56..c75b2d7fb2f068d0b07915a9954613cb658dfbd4 100644 (file)
@@ -31,6 +31,7 @@
 #include "channel_mgmt.h"
 #include "ring_buffer.h"
 #include <linux/list.h>
+#include <asm/sync_bitops.h>
 
 
 /*