Skip to content

Instantly share code, notes, and snippets.

@ghing
Created March 8, 2011 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ghing/860635 to your computer and use it in GitHub Desktop.
Save ghing/860635 to your computer and use it in GitHub Desktop.
Patch to VMWare Server 2.0.2 Linux kernel module sources that allows the modules to be compiled for use with a realtime kernel.
diff -ru a/lib/modules/source/vmci-only/linux/driver.c b/lib/modules/source/vmci-only/linux/driver.c
--- a/lib/modules/source/vmci-only/linux/driver.c 2009-10-20 19:31:34.000000000 -0500
+++ b/lib/modules/source/vmci-only/linux/driver.c 2011-03-08 10:39:35.305432000 -0600
@@ -360,7 +360,11 @@
memset(vmciLinux, 0, sizeof *vmciLinux);
vmciLinux->ctType = VMCIOBJ_NOT_SET;
#if defined(HAVE_COMPAT_IOCTL) || defined(HAVE_UNLOCKED_IOCTL)
+#if !defined(CONFIG_PREEMPT_RT)
init_MUTEX(&vmciLinux->lock);
+#else
+ semaphore_init(&vmciLinux->lock);
+#endif
#endif
filp->private_data = vmciLinux;
diff -ru a/lib/modules/source/vmnet-only/filter.c b/lib/modules/source/vmnet-only/filter.c
--- a/lib/modules/source/vmnet-only/filter.c 2009-10-20 19:31:32.000000000 -0500
+++ b/lib/modules/source/vmnet-only/filter.c 2011-03-08 10:54:04.779432001 -0600
@@ -76,7 +76,12 @@
RuleSet *activeRule = NULL; /* actual rule set for filter callback to use */
/* locks to protect against concurrent accesses. */
+#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 -ru a/lib/modules/source/vmnet-only/driver.c b/lib/modules/source/vmnet-only/driver.c
--- a/lib/modules/source/vmnet-only/driver.c 2009-10-20 19:31:33.000000000 -0500
+++ b/lib/modules/source/vmnet-only/driver.c 2011-03-08 11:00:40.079432001 -0600
@@ -117,7 +117,11 @@
* For change to peer field you must own both
* vnetStructureSemaphore and vnetPeerLock for write.
*/
+#if !defined(CONFIG_PREEMPT_RT)
DECLARE_MUTEX(vnetStructureSemaphore);
+#else
+DEFINE_SEMAPHORE(vnetStructureSemaphore);
+#endif
#if defined(VM_X86_64) && !defined(HAVE_COMPAT_IOCTL)
/*
diff -ru a/lib/modules/source/vsock-only/linux/af_vsock.c b/lib/modules/source/vsock-only/linux/af_vsock.c
--- a/lib/modules/source/vsock-only/linux/af_vsock.c 2009-10-20 19:31:35.000000000 -0500
+++ b/lib/modules/source/vsock-only/linux/af_vsock.c 2011-03-08 11:04:54.559432001 -0600
@@ -421,7 +421,11 @@
VSockPacket pkt;
} VSockRecvPktInfo;
+#if !defined(CONFIG_PREEMPT_RT)
static DECLARE_MUTEX(registrationMutex);
+#else
+static DEFINE_SEMAPHORE(registrationMutex);
+#endif
static int devOpenCount = 0;
static int vsockVmciSocketCount = 0;
#ifdef VMX86_TOOLS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment