diff -ru a/lib/modules/source/vmci-only/include/pgtbl.h b/lib/modules/source/vmci-only/include/pgtbl.h
--- a/lib/modules/source/vmci-only/include/pgtbl.h 2009-10-22 06:54:15.000000000 -0400
+++ b/lib/modules/source/vmci-only/include/pgtbl.h       2010-01-17 22:52:44.127684350 -0500
@@ -24,6 +24,7 @@
 #include "compat_pgtable.h"
 #include "compat_spinlock.h"
 #include "compat_page.h"
+#include "compat_sched.h"

 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 11)
 # define compat_active_mm  mm
diff -ru a/lib/modules/source/vmnet-only/vnetUserListener.c b/lib/modules/source/vmnet-only/vnetUserListener.c
--- a/lib/modules/source/vmnet-only/vnetUserListener.c     2009-10-22 06:54:13.000000000 -0400
+++ b/lib/modules/source/vmnet-only/vnetUserListener.c   2010-01-17 22:52:39.708362200 -0500
@@ -34,6 +34,7 @@
 #include "compat_skbuff.h"
 #include "compat_wait.h"
 #include "vnetInt.h"
+#include "compat_sched.h"

 typedef struct VNetUserListener_EventNode VNetUserListener_EventNode;

diff -urN a/lib/modules/source/vmci-only/Makefile b/lib/modules/source/vmci-only/Makefile
--- a/lib/modules/source/vmci-only/Makefile	2009-10-20 22:31:34.000000000 -0200
+++ b/lib/modules/source/vmci-only/Makefile	2010-01-01 00:00:00.000000000 -0200
@@ -113,12 +113,12 @@
 
 vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
 	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
 	-DKBUILD_BASENAME=\"$(DRIVER)\" \
 	-Werror -S -o /dev/null -xc $(1) \
 	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
 
-CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_WARNINGS := -Wall -Wstrict-prototypes -Wno-unused -Wno-uninitialized -Wno-undef
 CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
 ifdef VMX86_DEVEL
 CC_OPTS += -DVMX86_DEVEL
diff -urN a/lib/modules/source/vmmon-only/common/vmx86.c b/lib/modules/source/vmmon-only/common/vmx86.c
--- a/lib/modules/source/vmmon-only/common/vmx86.c	2009-10-20 22:31:31.000000000 -0200
+++ b/lib/modules/source/vmmon-only/common/vmx86.c	2010-01-01 00:00:00.000000000 -0200
@@ -1144,7 +1144,7 @@
        * * freq fits into 64 bits and that tDiff fits into 32 bits.  This
        * is safe given the values used on Linux.
        */
-      Div643264(cDiff * freq, tDiff, &hz, &tmp);
+      Div643264(cDiff * freq, tDiff, (uint64 *)&hz, (uint32 *)&tmp);
       hz += 500;
       /*
        * If result in kHz cannot fit into 32 bits, we would get a divide
@@ -1153,7 +1153,7 @@
       if ((uint32)(hz >> 32) >= 1000) {
          goto failure;
       }
-      Div643232(hz, 1000, &tmpkHz, &tmp);
+      Div643232(hz, 1000, &tmpkHz, (uint32 *)&tmp);
       kHz = tmpkHz;
    }
 #endif
diff -urN a/lib/modules/source/vmmon-only/include/compat_cred.h b/lib/modules/source/vmmon-only/include/compat_cred.h
--- a/lib/modules/source/vmmon-only/include/compat_cred.h	1969-12-31 21:00:00.000000000 -0300
+++ b/lib/modules/source/vmmon-only/include/compat_cred.h	2010-01-01 00:00:00.000000000 -0200
@@ -0,0 +1,82 @@
+#ifndef __COMPAT_CRED_H__
+#define __COMPAT_CRED_H__
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+#define current_uid()   current->uid
+#define current_gid()   current->gid
+#define current_suid()  current->suid
+#define current_sgid()  current->sgid
+#define current_euid()  current->euid
+#define current_egid()  current->egid
+#define current_fsuid() current->fsuid
+#define current_fsgid() current->fsgid
+#define current_cap()   current->cap_effective
+#endif
+
+void
+compat_current_fsuid(int fsuid)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	current->fsuid = fsuid;
+#else
+	struct cred *new_cred = prepare_creds();
+
+	if (new_cred) {
+		new_cred->fsuid = fsuid;
+		commit_creds(new_cred);
+	}
+#endif
+}
+
+void
+compat_current_fsgid(int fsgid)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	current->fsgid = fsgid;
+#else
+	struct cred *new_cred = prepare_creds();
+
+	if (new_cred) {
+		new_cred->fsgid = fsgid;
+		commit_creds(new_cred);
+	}
+#endif
+}
+
+void
+compat_cap_raise(int flag)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	cap_raise(current->cap_effective, flag);
+#else
+	struct cred *new_cred = prepare_creds();
+
+	if (new_cred) {
+		cap_raise(new_cred->cap_effective, flag);
+		commit_creds(new_cred);
+	}
+#endif
+}
+
+void
+compat_cap_lower(int flag)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	cap_lower(current->cap_effective, flag);
+#else
+	struct cred *new_cred = prepare_creds();
+
+	if (new_cred) {
+		cap_lower(new_cred->cap_effective, flag);
+		commit_creds(new_cred);
+	}
+#endif
+}
+
+int
+compat_cap_raised(int flag)
+{
+	return cap_raised(current_cap(), flag);
+}
+
+#endif
diff -urN a/lib/modules/source/vmmon-only/include/x86svm.h b/lib/modules/source/vmmon-only/include/x86svm.h
--- a/lib/modules/source/vmmon-only/include/x86svm.h	2009-10-20 22:31:31.000000000 -0200
+++ b/lib/modules/source/vmmon-only/include/x86svm.h	2010-01-01 00:00:00.000000000 -0200
@@ -47,10 +47,14 @@
 #endif
 
 /* SVM related MSRs */
+#ifndef MSR_VM_CR
 #define MSR_VM_CR                  0xC0010114
+#endif
 #define MSR_IGNNE                  0xC0010115
 #define MSR_SMM_CTL                0xC0010116
+#ifndef MSR_VM_HSAVE_PA
 #define MSR_VM_HSAVE_PA            0xC0010117
+#endif
 
 #define MSR_VM_CR_SVM_LOCK         0x0000000000000008ULL
 #define MSR_VM_CR_SVME_DISABLE     0x0000000000000010ULL
diff -urN a/lib/modules/source/vmmon-only/linux/driver.c b/lib/modules/source/vmmon-only/linux/driver.c
--- a/lib/modules/source/vmmon-only/linux/driver.c	2009-10-20 22:31:31.000000000 -0200
+++ b/lib/modules/source/vmmon-only/linux/driver.c	2010-01-01 00:00:00.000000000 -0200
@@ -1,1 +1,1 @@
-/*********************************************************
+#define VMW_HAVE_UNLOCKED_IOCTL /*
@@ -1984,10 +1984,10 @@
    }
 
    case IOCTL_VMX86_ALLOW_CORE_DUMP:
-      if (current->euid == current->uid &&
-	  current->fsuid == current->uid &&
-          current->egid == current->gid &&
-	  current->fsgid == current->gid) {
+	if (current_euid() == current_uid() &&
+			current_fsuid() == current_uid() &&
+			current_egid()  == current_gid() &&
+			current_fsgid() == current_gid()) {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
          /* Dump core, readable by user. */
          set_bit(MMF_DUMPABLE, &current->mm->flags);
diff -urN a/lib/modules/source/vmmon-only/linux/hostif.c b/lib/modules/source/vmmon-only/linux/hostif.c
--- a/lib/modules/source/vmmon-only/linux/hostif.c	2009-10-20 22:31:31.000000000 -0200
+++ b/lib/modules/source/vmmon-only/linux/hostif.c	2010-01-01 00:00:00.000000000 -0200
@@ -33,6 +33,8 @@
 #include <linux/binfmts.h>
 #include "compat_fs.h"
 #include "compat_sched.h"
+#include "compat_cred.h"
+#define HAVE_UNLOCKED_IOCTL
 #include "compat_slab.h"
 #if defined(KERNEL_2_4_22)
    #include <linux/vmalloc.h>
@@ -2576,6 +2577,7 @@
                 Bool setVMPtr,  // IN:
                 Bool probe)     // IN:
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
 #if defined(CONFIG_SMP) || defined(CONFIG_X86_UP_IOAPIC) || \
     defined(CONFIG_X86_UP_APIC) || defined(CONFIG_X86_LOCAL_APIC)
    VA kAddr;
@@ -2601,6 +2603,7 @@
       vm->hostAPIC = NULL;
    }
 #endif
+#endif
    return TRUE;
 }

@@ -3411,20 +3411,9 @@
               u_int iocmd,
               unsigned long ioarg)
 {
-#ifdef HAVE_UNLOCKED_IOCTL
    if (filp->f_op->unlocked_ioctl) {
       return filp->f_op->unlocked_ioctl(filp, iocmd, ioarg);
    }
-#endif
-   if (filp->f_op->ioctl) {
-      long err;
-
-      lock_kernel();
-      err = filp->f_op->ioctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
-      unlock_kernel();
-      return err;
-   }
-   return -ENOIOCTLCMD;
 }


@@ -3456,7 +3459,7 @@
    oldFS = get_fs();
    set_fs(KERNEL_DS);
    compat_allow_signal(SIGKILL);
-   cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+   compat_cap_raise(CAP_SYS_RESOURCE);
    compat_set_user_nice(current, linuxState.fastClockPriority);
 
    while (linuxState.fastClockRate > HZ + HZ/16) {
@@ -3580,19 +3583,19 @@
          Bool cap;
          long pid;
 
-         fsuid = current->fsuid;
-         current->fsuid = 0;
+         fsuid = current_fsuid();
+         compat_current_fsuid(0);
          filp = filp_open("/dev/rtc", O_RDONLY, 0);
-         current->fsuid = fsuid;
+         compat_current_fsuid(fsuid);
          if (IS_ERR(filp)) {
             Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
             return -(int)(VA)filp;
          }
-         cap = cap_raised(current->cap_effective, CAP_SYS_RESOURCE);
-         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         cap = compat_cap_raised(CAP_SYS_RESOURCE);
+         compat_cap_raise(CAP_SYS_RESOURCE);
          res = HostIFDoIoctl(filp, RTC_PIE_ON, 0);
          if (!cap) {
-            cap_lower(current->cap_effective, CAP_SYS_RESOURCE);            
+            compat_cap_lower(CAP_SYS_RESOURCE);            
          }
          if (res < 0) {
             Warning("/dev/rtc enable interrupt failed: %d\n", res);
diff -urN a/lib/modules/source/vmmon-only/Makefile b/lib/modules/source/vmmon-only/Makefile
--- a/lib/modules/source/vmmon-only/Makefile	2009-10-20 22:31:31.000000000 -0200
+++ b/lib/modules/source/vmmon-only/Makefile	2010-01-01 00:00:00.000000000 -0200
@@ -113,12 +113,12 @@
 
 vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
 	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
 	-DKBUILD_BASENAME=\"$(DRIVER)\" \
 	-Werror -S -o /dev/null -xc $(1) \
 	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
 
-CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_WARNINGS := -Wall -Wstrict-prototypes -Wno-unused -Wno-uninitialized -Wno-undef
 CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
 ifdef VMX86_DEVEL
 CC_OPTS += -DVMX86_DEVEL
diff -urN a/lib/modules/source/vmnet-only/Makefile b/lib/modules/source/vmnet-only/Makefile
--- a/lib/modules/source/vmnet-only/Makefile	2009-10-20 22:31:33.000000000 -0200
+++ b/lib/modules/source/vmnet-only/Makefile	2010-01-01 00:00:00.000000000 -0200
@@ -113,12 +113,12 @@
 
 vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
 	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
 	-DKBUILD_BASENAME=\"$(DRIVER)\" \
 	-Werror -S -o /dev/null -xc $(1) \
 	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
 
-CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_WARNINGS := -Wall -Wstrict-prototypes -Wno-unused -Wno-uninitialized -Wno-undef
 CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
 ifdef VMX86_DEVEL
 CC_OPTS += -DVMX86_DEVEL
diff -urN a/lib/modules/source/vmnet-only/netif.c b/lib/modules/source/vmnet-only/netif.c
--- a/lib/modules/source/vmnet-only/netif.c	2009-10-20 22:31:32.000000000 -0200
+++ b/lib/modules/source/vmnet-only/netif.c	2010-01-01 00:00:00.000000000 -0200
@@ -194,9 +194,24 @@
  *----------------------------------------------------------------------
  */
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
+static const struct net_device_ops netdev_ops = {
+	.ndo_init = VNetNetifProbe,
+	.ndo_open = VNetNetifOpen,
+	.ndo_stop = VNetNetifClose,
+	.ndo_start_xmit = VNetNetifStartXmit,
+	.ndo_set_multicast_list = VNetNetifSetMulticast,
+	.ndo_set_mac_address = VNetNetifSetMAC,
+	.ndo_get_stats = VNetNetifGetStats,
+};
+#endif
+
 static void
 VNetNetIfSetup(struct net_device *dev)  // IN:
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
+	dev->netdev_ops = &netdev_ops;
+#else
    ether_setup(dev); // turns on IFF_BROADCAST, IFF_MULTICAST
    dev->init = VNetNetifProbe;
    dev->open = VNetNetifOpen;
@@ -205,6 +220,8 @@
    dev->get_stats = VNetNetifGetStats;
    dev->set_mac_address = VNetNetifSetMAC;
    dev->set_multicast_list = VNetNetifSetMulticast;
+#endif
+
 #ifdef KERNEL_2_3_43
    /*
     * We cannot stuck... If someone will report problems under
@@ -242,6 +259,7 @@
                  int hubNum)     // IN: 
 {
    VNetNetIF *netIf;
+	VNetNetIF **netIf_priv;
    struct net_device *dev;
    int retval = 0;
    static unsigned id = 0;
@@ -324,8 +342,9 @@
       goto out;
    }
 
-   dev->priv = netIf;
-   netIf->dev = dev;
+	netIf_priv = netdev_priv(dev);
+	*netIf_priv = netIf;
+	netIf->dev = dev;
    
    memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
    
@@ -566,7 +585,7 @@
 VNetNetifStartXmit(struct sk_buff    *skb, // IN:
                    struct net_device *dev) // IN:
 {
-   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+	VNetNetIF *netIf = netdev_priv(dev);
 
    if(skb == NULL) {
       return 0;
@@ -618,7 +637,7 @@
 VNetNetifSetMAC(struct net_device *dev, // IN:
                 void *p)                // IN:
 {
-   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+	VNetNetIF *netIf = netdev_priv(dev);
    struct sockaddr const *addr = p;
    if (!VMX86_IS_STATIC_MAC(addr->sa_data)) {
       return -EINVAL;
@@ -675,7 +694,7 @@
 struct net_device_stats *
 VNetNetifGetStats(struct net_device *dev) // IN:
 {
-   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+	VNetNetIF *netIf = netdev_priv(dev);
    return &(netIf->stats);
 }
 
diff -urN a/lib/modules/source/vsock-only/Makefile b/lib/modules/source/vsock-only/Makefile
--- a/lib/modules/source/vsock-only/Makefile	2009-10-20 22:31:35.000000000 -0200
+++ b/lib/modules/source/vsock-only/Makefile	2010-01-01 00:00:00.000000000 -0200
@@ -113,12 +113,12 @@
 
 vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
 	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
 	-DKBUILD_BASENAME=\"$(DRIVER)\" \
 	-Werror -S -o /dev/null -xc $(1) \
 	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
 
-CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_WARNINGS := -Wall -Wstrict-prototypes -Wno-unused -Wno-uninitialized -Wno-undef
 CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
 ifdef VMX86_DEVEL
 CC_OPTS += -DVMX86_DEVEL

diff -Naurx '*.o' -x '*.cmd' -x '*.ko' '-x*.tar' '-x*.mod.c' vmware-server-distrib//lib/modules/source/vmci-only/include/compat_semaphore.h vmware-working//lib/modules/source/vmci-only
--- vmware-server-distrib//lib/modules/source/vmci-only/include/compat_semaphore.h  2009-10-20 18:43:27.000000000 -0700
+++ vmware-working//lib/modules/source/vmci-only/include/compat_semaphore.h 2011-05-01 16:33:56.115417067 -0700
@@ -45,5 +45,23 @@
    #endif
 #endif

+#if (defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
+   /*
+    * The -rt patch series changes the name of semaphore/mutex initialization
+    * routines (across the entire kernel).  Probably to identify locations that
+    * need to be audited for spinlock vs. true semaphore.  We always assumed
+    * true semaphore, so just apply the rename.
+    *
+    * The -rt patchset added the rename between 2.6.29-rt and 2.6.31-rt.
+    */
+   #ifndef DECLARE_MUTEX
+      #define DECLARE_MUTEX(_m)  DEFINE_SEMAPHORE(_m)
+   #endif
+   #ifndef init_MUTEX
+      #define init_MUTEX(_m) sema_init(_m,1)
+   #endif
+#endif
+
+

 #endif /* __COMPAT_SEMAPHORE_H__ */
diff -Naurx '*.o' -x '*.cmd' -x '*.ko' '-x*.tar' '-x*.mod.c' vmware-server-distrib//lib/modules/source/vmmon-only/linux/driver.c vmware-working//lib/modules/source/vmmon-only/linux/dri
--- vmware-server-distrib//lib/modules/source/vmmon-only/linux/driver.c 2011-05-01 16:51:36.695416720 -0700
+++ vmware-working//lib/modules/source/vmmon-only/linux/driver.c    2011-05-01 16:41:28.225416919 -0700
@@ -153,6 +153,7 @@

 struct VMXLinuxState linuxState;

+#define kernel_locked_by_current() (current->lock_depth >= 0)

 /*
  *----------------------------------------------------------------------
@@ -1743,7 +1744,7 @@
       unlock_kernel();
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 #  if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
-      ASSERT(!kernel_locked());
+      ASSERT(!0);
 #  endif
 #endif
       retval = Vmx86_RunVM(vmLinux->vm, vcpuid);
diff -Naurx '*.o' -x '*.cmd' -x '*.ko' '-x*.tar' '-x*.mod.c' vmware-server-distrib//lib/modules/source/vmnet-only/driver.c vmware-working//lib/modules/source/vmnet-only/driver.c
--- vmware-server-distrib//lib/modules/source/vmnet-only/driver.c   2009-10-20 18:43:26.000000000 -0700
+++ vmware-working//lib/modules/source/vmnet-only/driver.c  2011-05-01 16:43:26.145416881 -0700
@@ -117,7 +117,8 @@
  * For change to peer field you must own both
  * vnetStructureSemaphore and vnetPeerLock for write.
  */
-DECLARE_MUTEX(vnetStructureSemaphore);
+
+DEFINE_SEMAPHORE(vnetStructureSemaphore);

 #if defined(VM_X86_64) && !defined(HAVE_COMPAT_IOCTL)
 /*
diff -Naurx '*.o' -x '*.cmd' -x '*.ko' '-x*.tar' '-x*.mod.c' vmware-server-distrib//lib/modules/source/vmnet-only/filter.c vmware-working//lib/modules/source/vmnet-only/filter.c
--- vmware-server-distrib//lib/modules/source/vmnet-only/filter.c   2009-10-20 18:43:25.000000000 -0700
+++ vmware-working//lib/modules/source/vmnet-only/filter.c  2011-05-01 16:44:33.485416859 -0700
@@ -76,7 +76,11 @@
 RuleSet *activeRule = NULL;   /* actual rule set for filter callback to use */

 /* locks to protect against concurrent accesses. */
-static DECLARE_MUTEX(filterIoctlSem);   /* serialize ioctl()s from user space. */
+//#if !defined(CONFIG_PREEMPT_RT)
+//static DECLARE_MUTEX(filterIoctlSem);   /* serialize ioctl()s from user space. */
+//#else
+static DEFINE_SEMAPHORE(filterIoctlSem);   /* serialize ioctl()s from user space. */
+//#endif
 /*
  * user/netfilter hook concurrency lock.
  * This spinlock doesn't scale well if/when in the future the netfilter
diff -Naurx '*.o' -x '*.cmd' -x '*.ko' '-x*.tar' '-x*.mod.c' vmware-server-distrib//lib/modules/source/vsock-only/linux/af_vsock.c vmware-working//lib/modules/source/vsock-only/linux/a
--- vmware-server-distrib//lib/modules/source/vsock-only/linux/af_vsock.c   2009-10-20 18:43:28.000000000 -0700
+++ vmware-working//lib/modules/source/vsock-only/linux/af_vsock.c  2011-05-01 16:50:59.375416731 -0700
@@ -421,7 +421,7 @@
    VSockPacket pkt;
 } VSockRecvPktInfo;

-static DECLARE_MUTEX(registrationMutex);
+static DEFINE_SEMAPHORE(registrationMutex);
 static int devOpenCount = 0;
 static int vsockVmciSocketCount = 0;
 #ifdef VMX86_TOOLS
@@ -3149,7 +3149,7 @@
     * a notification of an error.
     */
    timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

    while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
       if (timeout == 0) {
@@ -3172,7 +3172,7 @@
          goto outWaitError;
       }

-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }

    if (sk->compat_sk_err) {
@@ -3184,7 +3184,7 @@
    }

 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -3244,7 +3244,7 @@
     * upon connection establishment.
     */
    timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);

    while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
           listener->compat_sk_err == 0) {
@@ -3260,7 +3260,7 @@
          goto outWait;
       }

-      compat_cont_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
    }

    if (listener->compat_sk_err) {
@@ -3294,7 +3294,7 @@
    }

 outWait:
-   compat_finish_wait(listener->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(listener), &wait, TASK_RUNNING);
 out:
    release_sock(listener);
    return err;
@@ -3391,7 +3391,7 @@

    sk = sock->sk;

-   poll_wait(file, sk->compat_sk_sleep, wait);
+   poll_wait(file, compat_sk_sleep(sk), wait);
    mask = 0;

    if (sk->compat_sk_err) {
@@ -3992,7 +3992,7 @@
     * Wait for room in the produce queue to enqueue our user's data.
     */
    timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

    while (totalWritten < len) {
       Bool sentWrote;
@@ -4031,7 +4031,7 @@
             goto outWait;
          }

-         compat_cont_prepare_to_wait(sk->compat_sk_sleep,
+         compat_cont_prepare_to_wait(compat_sk_sleep(sk),
                                      &wait, TASK_INTERRUPTIBLE);
       }

@@ -4114,7 +4114,7 @@
    if (totalWritten > 0) {
       err = totalWritten;
    }
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -4337,7 +4337,7 @@
    timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
    copied = 0;

-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

    while ((ready = VMCIQueue_BufReady(vsk->consumeQ,
                                       vsk->produceQ,
@@ -4380,7 +4380,7 @@
          goto outWait;
       }

-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }

    if (sk->compat_sk_err) {
@@ -4472,7 +4472,7 @@
    err = copied;

 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;

