]> git.karo-electronics.de Git - karo-tx-linux.git/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)
committerAndi Kleen <ak@linux.intel.com>
Thu, 28 Apr 2011 15:20:50 +0000 (08:20 -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.

[Backported to 2.6.32 stable kernel by Haiyang Zhang <haiyangz@microsoft.com>]

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>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/staging/hv/channel.c
drivers/staging/hv/connection.c
drivers/staging/hv/vmbus.c
drivers/staging/hv/vmbus_private.h

index f047c5a7f64c1c35e7eed64b9818906e6f95885d..8955d6a4fb2247d824bdb6a17ee7590825f6acbb 100644 (file)
@@ -78,14 +78,14 @@ static void VmbusChannelSetEvent(struct vmbus_channel *Channel)
 
        if (Channel->OfferMsg.MonitorAllocated) {
                /* Each u32 represents 32 channels */
-               set_bit(Channel->OfferMsg.ChildRelId & 31,
+               sync_set_bit(Channel->OfferMsg.ChildRelId & 31,
                        (unsigned long *) gVmbusConnection.SendInterruptPage +
                        (Channel->OfferMsg.ChildRelId >> 5));
 
                monitorPage = gVmbusConnection.MonitorPages;
                monitorPage++; /* Get the child to parent monitor page */
 
-               set_bit(Channel->MonitorBit,
+               sync_set_bit(Channel->MonitorBit,
                        (unsigned long *)&monitorPage->TriggerGroup
                                        [Channel->MonitorGroup].Pending);
 
@@ -105,7 +105,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
 
        if (Channel->OfferMsg.MonitorAllocated) {
                /* Each u32 represents 32 channels */
-               clear_bit(Channel->OfferMsg.ChildRelId & 31,
+               sync_clear_bit(Channel->OfferMsg.ChildRelId & 31,
                          (unsigned long *)gVmbusConnection.SendInterruptPage +
                          (Channel->OfferMsg.ChildRelId >> 5));
 
@@ -113,7 +113,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->MonitorBit,
+               sync_clear_bit(Channel->MonitorBit,
                          (unsigned long *)&monitorPage->TriggerGroup
                                        [Channel->MonitorGroup].Pending);
        }
index e8824dadffc31786f32ac5494ad1b32f46c911b4..d80a9f319d148903a6f94381d1d77b5eaf844776 100644 (file)
@@ -292,7 +292,9 @@ 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);
 
@@ -337,7 +339,7 @@ int VmbusSetEvent(u32 childRelId)
        DPRINT_ENTER(VMBUS);
 
        /* Each u32 represents 32 channels */
-       set_bit(childRelId & 31,
+       sync_set_bit(childRelId & 31,
                (unsigned long *)gVmbusConnection.SendInterruptPage +
                (childRelId >> 5));
 
index 007543bdb4100b31d8dba170217a5f46939ef491..08a0c594de27f24e5c4dfd12acbc00f6a0397b33 100644 (file)
@@ -254,7 +254,7 @@ static int VmbusOnISR(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 588c667a7f6b1350bcad2021c133adf9a20871d3..90d58dd7166e86c70b07d15ae965d441169bb2bc 100644 (file)
@@ -32,6 +32,7 @@
 #include "channel_interface.h"
 #include "ring_buffer.h"
 #include <linux/list.h>
+#include <asm/sync_bitops.h>
 
 
 /*