x86_64 patch for OpenSSI - 2 of 6 - Modified base files for OpenSSI

John Hughes <[email protected]> Fri, 12 Feb 2010 16:02:53 +0100
Newsgroups gmane.linux.cluster.ssic.devel
Message-ID <[email protected]>
This patch modifies the base kernel x86_64 architecture files for 
OpenSSI.  (kernel/include/asm-x86_64 and kernel/arch/x86_64).

To apply:

   1. get the current (12/2/2010) OpenSSI cvs to ./openssi

   2. extract the base 2.6.11 kernel to ./linux

   3. save the patch as ./base-openssi-x86_64.patch

   4. cd ./openssi/kernel

   5. copy the files from the base kernel:

      perl -MFile::Basename -MFile::Copy -ane 'next unless $F[0] eq "Index:"; \
      	system "mkdir -p " .dirname $F[1]; \
      	copy ("../../linux/" .$F[1], $F[1])' ../../base-openssi-x86_64.patch

   6. Apply the patch:

      patch -p0 <../../base-openssi-x86_64.patch

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

_______________________________________________
ssic-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ssic-linux-devel
base-openssi-x86_64.patch (text/x-patch, 19.5 KB)
Index: arch/x86_64/kernel/ldt.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/arch/x86_64/kernel/ldt.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.16.1
diff -u -p -r1.1.1.1 -r1.1.1.1.16.1
--- arch/x86_64/kernel/ldt.c	2 Mar 2005 07:38:38 -0000	1.1.1.1
+++ arch/x86_64/kernel/ldt.c	22 Jan 2010 12:12:25 -0000	1.1.1.1.16.1
@@ -81,7 +81,10 @@ static int alloc_ldt(mm_context_t *pc, u
 	return 0;
 }
 
-static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
+#ifndef CONFIG_SSI
+static
+#endif
+inline int copy_ldt(mm_context_t *new, mm_context_t *old)
 {
 	int err = alloc_ldt(new, old->size, 0);
 	if (err < 0)
Index: arch/x86_64/kernel/process.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/arch/x86_64/kernel/process.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.4.1
diff -u -p -r1.1.1.2 -r1.1.1.2.4.1
--- arch/x86_64/kernel/process.c	17 Jun 2005 19:48:29 -0000	1.1.1.2
+++ arch/x86_64/kernel/process.c	22 Jan 2010 12:12:25 -0000	1.1.1.2.4.1
@@ -51,7 +51,11 @@
 
 asmlinkage extern void ret_from_fork(void);
 
+#ifdef CONFIG_SSI
+unsigned long kernel_thread_flags = IS_KTHREAD | CLONE_VM | CLONE_UNTRACED;
+#else
 unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
+#endif
 
 static atomic_t hlt_counter = ATOMIC_INIT(0);
 
Index: arch/x86_64/kernel/ptrace.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/arch/x86_64/kernel/ptrace.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.4.1
diff -u -p -r1.1.1.2 -r1.1.1.2.4.1
--- arch/x86_64/kernel/ptrace.c	17 Jun 2005 19:48:29 -0000	1.1.1.2
+++ arch/x86_64/kernel/ptrace.c	22 Jan 2010 12:12:25 -0000	1.1.1.2.4.1
@@ -20,6 +20,10 @@
 #include <linux/seccomp.h>
 #include <linux/signal.h>
 
+#ifdef CONFIG_SSI
+#include <linux/vproc.h>
+#endif
+
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -326,9 +330,15 @@ asmlinkage long sys_ptrace(long request,
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
+#ifndef CONFIG_SSI
+		/*
+		 * SSI_XXX  ssi doesn't support CONFIG_SECURITY NOW and we
+		 * don't have the parent.
+		 */
 		ret = security_ptrace(current->parent, current);
 		if (ret)
 			goto out;
+#endif
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
 		ret = 0;
@@ -341,8 +351,24 @@ asmlinkage long sys_ptrace(long request,
 		get_task_struct(child);
 	read_unlock(&tasklist_lock);
 	if (!child)
+#ifdef CONFIG_SSI
+	{
+		struct vproc *vp = LOCATE_VPROC_PID(pid, "sys_ptrace");
+		int dummy;
+		long tmpret;
+
+		if (!vp)
+			goto out;
+		(void)VPOP_PTRACE(vp, request, addr, data, &dummy, &tmpret);
+		ret = tmpret;
+		VPROC_RELE(vp, "sys_ptrace");
 		goto out;
 
+	}
+#else
+		goto out;
+#endif
+
 	ret = -EPERM;
 	if (pid == 1)		/* you may not mess with init */
 		goto out_tsk;
@@ -484,6 +510,9 @@ asmlinkage long sys_ptrace(long request,
 		/* make sure the single step bit is not set. */
 		clear_singlestep(child);
 		wake_up_process(child);
+#ifdef CONFIG_VPROC
+		VPOP_NOTIFY_PARENT(child->p_vproc, 0, 0);
+#endif
 		ret = 0;
 		break;
 
@@ -531,6 +560,9 @@ asmlinkage long sys_ptrace(long request,
 		/* make sure the single step bit is not set. */
 		clear_singlestep(child);
 		wake_up_process(child);
+#ifdef CONFIG_VPROC
+		VPOP_NOTIFY_PARENT(child->p_vproc, 0, 0);
+#endif
 		break;
 
 	case PTRACE_SINGLESTEP:    /* set the trap flag. */
@@ -542,6 +574,9 @@ asmlinkage long sys_ptrace(long request,
 		child->exit_code = data;
 		/* give it a chance to run. */
 		wake_up_process(child);
+#ifdef CONFIG_VPROC
+		VPOP_NOTIFY_PARENT(child->p_vproc, 0, 0);
+#endif
 		ret = 0;
 		break;
 
Index: arch/x86_64/kernel/x8664_ksyms.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/arch/x86_64/kernel/x8664_ksyms.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.6.2
diff -u -p -r1.1.1.2 -r1.1.1.2.6.2
--- arch/x86_64/kernel/x8664_ksyms.c	17 Jun 2005 19:48:29 -0000	1.1.1.2
+++ arch/x86_64/kernel/x8664_ksyms.c	25 Jan 2010 11:33:02 -0000	1.1.1.2.6.2
@@ -57,7 +57,11 @@ EXPORT_SYMBOL(enable_irq);
 EXPORT_SYMBOL(disable_irq);
 EXPORT_SYMBOL(disable_irq_nosync);
 EXPORT_SYMBOL(probe_irq_mask);
+#ifdef CONFIG_SSI
+EXPORT_SYMBOL(__kernel_thread_with_pid);
+#else
 EXPORT_SYMBOL(kernel_thread);
+#endif
 EXPORT_SYMBOL(pm_idle);
 EXPORT_SYMBOL(pm_power_off);
 EXPORT_SYMBOL(get_cmos_time);
@@ -87,15 +91,26 @@ EXPORT_SYMBOL(__put_user_8);
 EXPORT_SYMBOL(strpbrk);
 EXPORT_SYMBOL(strstr);
 
+#ifdef CONFIG_SSI
+EXPORT_SYMBOL(strncpy_from_user_lcl);
+EXPORT_SYMBOL(__strncpy_from_user_lcl);
+EXPORT_SYMBOL(clear_user_lcl);
+EXPORT_SYMBOL(__clear_user_lcl);
+EXPORT_SYMBOL(copy_from_user_lcl);
+EXPORT_SYMBOL(copy_to_user_lcl);
+EXPORT_SYMBOL(strnlen_user_lcl);
+#else
 EXPORT_SYMBOL(strncpy_from_user);
 EXPORT_SYMBOL(__strncpy_from_user);
 EXPORT_SYMBOL(clear_user);
 EXPORT_SYMBOL(__clear_user);
-EXPORT_SYMBOL(copy_user_generic);
 EXPORT_SYMBOL(copy_from_user);
 EXPORT_SYMBOL(copy_to_user);
-EXPORT_SYMBOL(copy_in_user);
 EXPORT_SYMBOL(strnlen_user);
+#endif
+
+EXPORT_SYMBOL(copy_in_user);
+EXPORT_SYMBOL(copy_user_generic);
 
 #ifdef CONFIG_PCI
 EXPORT_SYMBOL(pci_alloc_consistent);
Index: arch/x86_64/lib/copy_user.S
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/arch/x86_64/lib/copy_user.S,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.10.1
diff -u -p -r1.1.1.1 -r1.1.1.1.10.1
--- arch/x86_64/lib/copy_user.S	2 Mar 2005 07:38:11 -0000	1.1.1.1
+++ arch/x86_64/lib/copy_user.S	25 Jan 2010 11:33:02 -0000	1.1.1.1.10.1
@@ -11,6 +11,11 @@
 	#include <asm/thread_info.h>
 	#include <asm/cpufeature.h>
 
+#ifdef CONFIG_SSI
+#define copy_to_user	copy_to_user_lcl
+#define copy_from_user	copy_from_user_lcl
+#endif
+
 /* Standard copy_to_user with segment limit checking */		
 	.globl copy_to_user
 	.p2align 4	
Index: arch/x86_64/lib/usercopy.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/arch/x86_64/lib/usercopy.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -p -r1.1.1.1 -r1.1.1.1.12.1
--- arch/x86_64/lib/usercopy.c	2 Mar 2005 07:37:48 -0000	1.1.1.1
+++ arch/x86_64/lib/usercopy.c	23 Jan 2010 12:09:21 -0000	1.1.1.1.12.1
@@ -41,7 +41,7 @@ do {									   \
 } while (0)
 
 long
-__strncpy_from_user(char *dst, const char __user *src, long count)
+__strncpy_from_user_lcl(char *dst, const char __user *src, long count)
 {
 	long res;
 	__do_strncpy_from_user(dst, src, count, res);
@@ -49,7 +49,7 @@ __strncpy_from_user(char *dst, const cha
 }
 
 long
-strncpy_from_user(char *dst, const char __user *src, long count)
+strncpy_from_user_lcl(char *dst, const char __user *src, long count)
 {
 	long res = -EFAULT;
 	if (access_ok(VERIFY_READ, src, 1))
@@ -61,7 +61,7 @@ strncpy_from_user(char *dst, const char 
  * Zero Userspace
  */
 
-unsigned long __clear_user(void __user *addr, unsigned long size)
+unsigned long __clear_user_lcl(void __user *addr, unsigned long size)
 {
 	long __d0;
 	might_sleep();
@@ -96,10 +96,10 @@ unsigned long __clear_user(void __user *
 }
 
 
-unsigned long clear_user(void __user *to, unsigned long n)
+unsigned long clear_user_lcl(void __user *to, unsigned long n)
 {
 	if (access_ok(VERIFY_WRITE, to, n))
-		return __clear_user(to, n);
+		return __clear_user_lcl(to, n);
 	return n;
 }
 
@@ -109,7 +109,7 @@ unsigned long clear_user(void __user *to
  * Return 0 on exception, a value greater than N if too long
  */
 
-long strnlen_user(const char __user *s, long n)
+long strnlen_user_lcl(const char __user *s, long n)
 {
 	long res = 0;
 	char c;
@@ -120,7 +120,7 @@ long strnlen_user(const char __user *s, 
 	while (1) {
 		if (res>n)
 			return n+1;
-		if (__get_user(c, s))
+		if (__get_user_lcl(c, s))
 			return 0;
 		if (!c)
 			return res+1;
@@ -129,13 +129,13 @@ long strnlen_user(const char __user *s, 
 	}
 }
 
-long strlen_user(const char __user *s)
+long strlen_user_lcl(const char __user *s)
 {
 	long res = 0;
 	char c;
 
 	for (;;) {
-		if (get_user(c, s))
+		if (get_user_lcl(c, s))
 			return 0;
 		if (!c)
 			return res+1;
Index: include/asm-x86_64/atomic.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/atomic.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -p -r1.1.1.1 -r1.1.1.1.12.1
--- include/asm-x86_64/atomic.h	2 Mar 2005 07:38:32 -0000	1.1.1.1
+++ include/asm-x86_64/atomic.h	22 Jan 2010 12:12:25 -0000	1.1.1.1.12.1
@@ -378,4 +378,20 @@ __asm__ __volatile__(LOCK "orl %0,%1" \
 #define smp_mb__before_atomic_inc()	barrier()
 #define smp_mb__after_atomic_inc()	barrier()
 
+#ifdef __HAVE_ARCH_CMPXCHG
+
+static __inline__ int atomic_test_and_add(int i, atomic_t *v)
+{
+	int o, n;
+	do {
+		o = atomic_read(v);
+		if (o <= 0)
+			return 0;
+		n = o + i;
+	} while (cmpxchg((volatile int *)v, o, n) != o);
+	return 1;
+}
+
+#endif
+
 #endif
Index: include/asm-x86_64/desc.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/desc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.8.1
diff -u -p -r1.1.1.1 -r1.1.1.1.8.1
--- include/asm-x86_64/desc.h	2 Mar 2005 07:38:34 -0000	1.1.1.1
+++ include/asm-x86_64/desc.h	22 Jan 2010 12:12:25 -0000	1.1.1.1.8.1
@@ -212,6 +212,10 @@ static inline void load_LDT(mm_context_t
 
 extern struct desc_ptr idt_descr;
 
+#ifdef CONFIG_SSI
+extern int copy_ldt(mm_context_t *new, mm_context_t *old);
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #endif
Index: include/asm-x86_64/fcntl.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/fcntl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.10.1
diff -u -p -r1.1.1.1 -r1.1.1.1.10.1
--- include/asm-x86_64/fcntl.h	2 Mar 2005 07:38:37 -0000	1.1.1.1
+++ include/asm-x86_64/fcntl.h	22 Jan 2010 12:12:25 -0000	1.1.1.1.10.1
@@ -22,6 +22,10 @@
 #define O_NOFOLLOW	0400000 /* don't follow links */
 #define O_NOATIME	01000000
 
+#ifdef CONFIG_SSI
+#define O_NOOPEN       02000000 /* don't call open op */
+#endif
+
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
 #define F_SETFD		2	/* set/clear close_on_exec */
Index: include/asm-x86_64/mman.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/mman.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -p -r1.1.1.1 -r1.1.1.1.12.1
--- include/asm-x86_64/mman.h	2 Mar 2005 07:38:13 -0000	1.1.1.1
+++ include/asm-x86_64/mman.h	22 Jan 2010 12:12:26 -0000	1.1.1.1.12.1
@@ -23,6 +23,10 @@
 #define MAP_NORESERVE	0x4000		/* don't check for reservations */
 #define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x10000		/* do not block on IO */
+#ifdef CONFIG_SSI
+#define MAP_MIGRATE     0x40000         /* mapping that should be taken to the remote node */
+#endif
+
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
Index: include/asm-x86_64/semaphore.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/semaphore.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.2
diff -u -p -r1.1.1.1 -r1.1.1.1.12.2
--- include/asm-x86_64/semaphore.h	2 Mar 2005 07:37:30 -0000	1.1.1.1
+++ include/asm-x86_64/semaphore.h	25 Jan 2010 11:24:54 -0000	1.1.1.1.12.2
@@ -42,19 +42,53 @@
 #include <linux/wait.h>
 #include <linux/rwsem.h>
 #include <linux/stringify.h>
+#ifdef CONFIG_SSI
+#include <asm/current.h>
+#endif
 
 struct semaphore {
 	atomic_t count;
 	int sleepers;
+#ifdef CONFIG_SSI
+	void *owner;
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
+/* Support recursive non-interruptible acquired sempahore. This is needed
+ * for OpenSSI CFS client@server because in those code paths
+ * the VM revisits -eg. generic_file_writev() on memory pressure.	-Roger
+ */
+	void *flusher;
+#endif
+#endif
 	wait_queue_head_t wait;
 };
 
+#ifdef CONFIG_SSI
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
 #define __SEMAPHORE_INITIALIZER(name, n)				\
 {									\
 	.count		= ATOMIC_INIT(n),				\
 	.sleepers	= 0,						\
+	.owner		= NULL,						\
+	.flusher	= NULL,						\
 	.wait		= __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)	\
 }
+#else
+#define __SEMAPHORE_INITIALIZER(name, n)                                \
+{                                                                       \
+	.count          = ATOMIC_INIT(n),                               \
+	.sleepers       = 0,                                            \
+	.owner          = NULL,                                         \
+	.wait           = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)    \
+}
+#endif
+#else
+#define __SEMAPHORE_INITIALIZER(name, n)				\
+{									\
+	.count		= ATOMIC_INIT(n),				\
+	.sleepers	= 0,						\
+	.wait		= __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)	\
+}
+#endif
 
 #define __MUTEX_INITIALIZER(name) \
 	__SEMAPHORE_INITIALIZER(name,1)
@@ -75,6 +109,12 @@ static inline void sema_init (struct sem
  */
 	atomic_set(&sem->count, val);
 	sem->sleepers = 0;
+#ifdef CONFIG_SSI
+	sem->owner = NULL;
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
+	sem->flusher = NULL;
+#endif
+#endif
 	init_waitqueue_head(&sem->wait);
 }
 
@@ -98,6 +138,19 @@ asmlinkage int  __down_interruptible(str
 asmlinkage int  __down_trylock(struct semaphore * sem);
 asmlinkage void __up(struct semaphore * sem);
 
+#ifdef CONFIG_SSI
+static inline int sem_owned(struct semaphore *sem)
+{
+	return (sem->owner == current);
+}
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
+static inline int sem_flushing(struct semaphore *sem)
+{
+	return (sem->flusher == current);
+}
+
+#endif
+#endif
 /*
  * This is ugly, but we want the default case to fall through.
  * "__down_failed" is a special asm handler that calls the C
@@ -105,6 +158,12 @@ asmlinkage void __up(struct semaphore * 
  */
 static inline void down(struct semaphore * sem)
 {
+#ifdef CONFIG_SSI
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
+	if (sem_flushing(sem))
+		return;
+#endif
+#endif
 	might_sleep();
 
 	__asm__ __volatile__(
@@ -119,6 +178,9 @@ static inline void down(struct semaphore
 		:"=m" (sem->count)
 		:"D" (sem)
 		:"memory");
+#ifdef CONFIG_SSI
+	sem->owner = current;
+#endif
 }
 
 /*
@@ -144,6 +206,10 @@ static inline int down_interruptible(str
 		:"=a" (result), "=m" (sem->count)
 		:"D" (sem)
 		:"memory");
+#ifdef CONFIG_SSI
+	if (result == 0)
+		sem->owner = current;
+#endif
 	return result;
 }
 
@@ -168,6 +234,10 @@ static inline int down_trylock(struct se
 		:"=a" (result), "=m" (sem->count)
 		:"D" (sem)
 		:"memory","cc");
+#ifdef CONFIG_SSI
+	if (result == 0)
+		sem->owner = current;
+#endif
 	return result;
 }
 
@@ -179,6 +249,13 @@ static inline int down_trylock(struct se
  */
 static inline void up(struct semaphore * sem)
 {
+#ifdef CONFIG_SSI
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
+	if (sem_flushing(sem))
+		return;
+#endif
+	sem->owner = NULL;
+#endif
 	__asm__ __volatile__(
 		"# atomic up operation\n\t"
 		LOCK "incl %0\n\t"     /* ++sem->count */
@@ -192,5 +269,6 @@ static inline void up(struct semaphore *
 		:"D" (sem)
 		:"memory");
 }
+
 #endif /* __KERNEL__ */
 #endif
Index: include/asm-x86_64/system.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/system.h,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.4.1
diff -u -p -r1.1.1.2 -r1.1.1.2.4.1
--- include/asm-x86_64/system.h	17 Jun 2005 19:48:29 -0000	1.1.1.2
+++ include/asm-x86_64/system.h	22 Jan 2010 12:12:26 -0000	1.1.1.2.4.1
@@ -70,6 +70,12 @@ extern void load_gs_index(unsigned); 
 		".previous"			\
 		: :"r" (value), "r" (0))
 
+/*
+ * Save a segment register away
+ */
+#define savesegment(seg, value) \
+	asm volatile("movw %%" #seg ",%0":"=m" (value))
+
 #define set_debug(value,register) \
                 __asm__("movq %0,%%db" #register  \
 		: /* no output */ \
Index: include/asm-x86_64/uaccess.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/asm-x86_64/uaccess.h,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.6.2
diff -u -p -r1.1.1.2 -r1.1.1.2.6.2
--- include/asm-x86_64/uaccess.h	17 Jun 2005 19:48:29 -0000	1.1.1.2
+++ include/asm-x86_64/uaccess.h	25 Jan 2010 11:33:02 -0000	1.1.1.2.6.2
@@ -98,7 +98,7 @@ struct exception_table_entry
 		:"r8")
 
 /* Careful: we have to cast the result to the type of the pointer for sign reasons */
-#define get_user(x,ptr)							\
+#define get_user_lcl(x,ptr)						\
 ({	unsigned long __val_gu;						\
 	int __ret_gu; 							\
 	__chk_user_ptr(ptr);						\
@@ -125,12 +125,12 @@ extern void __put_user_bad(void);
 		:"c" (ptr),"d" (x)					\
 		:"r8")
 
-#define put_user(x,ptr)							\
+#define put_user_lcl(x,ptr)							\
   __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
 
-#define __get_user(x,ptr) \
+#define __get_user_lcl(x,ptr) \
   __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
-#define __put_user(x,ptr) \
+#define __put_user_lcl(x,ptr) \
   __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
 
 #define __get_user_unaligned __get_user
@@ -247,11 +247,12 @@ do {									\
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 
 
-extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 
-extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 
+extern unsigned long copy_to_user_lcl(void __user *to, const void *from, unsigned len); 
+extern unsigned long copy_from_user_lcl(void *to, const void __user *from, unsigned len); 
+/* SSI_FIXMEL: What to do for this? */
 extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 
 
-static inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 
+static inline int __copy_from_user_lcl(void *dst, const void __user *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
@@ -280,7 +281,7 @@ static inline int __copy_from_user(void 
 	}
 }	
 
-static inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 
+static inline int __copy_to_user_lcl(void __user *dst, const void *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
@@ -352,14 +353,19 @@ static inline int __copy_in_user(void __
 	}
 }	
 
-long strncpy_from_user(char *dst, const char __user *src, long count);
-long __strncpy_from_user(char *dst, const char __user *src, long count);
-long strnlen_user(const char __user *str, long n);
-long strlen_user(const char __user *str);
-unsigned long clear_user(void __user *mem, unsigned long len);
-unsigned long __clear_user(void __user *mem, unsigned long len);
+long strncpy_from_user_lcl(char *dst, const char __user *src, long count);
+long __strncpy_from_user_lcl(char *dst, const char __user *src, long count);
+long strnlen_user_lcl(const char __user *str, long n);
+long strlen_user_lcl(const char __user *str);
+unsigned long clear_user_lcl(void __user *mem, unsigned long len);
+unsigned long __clear_user_lcl(void __user *mem, unsigned long len);
+
+#define __copy_to_user_inatomic_lcl __copy_to_user_lcl
+#define __copy_from_user_inatomic_lcl __copy_from_user_lcl
 
 #define __copy_to_user_inatomic __copy_to_user
 #define __copy_from_user_inatomic __copy_from_user
 
+#include <cluster/ssi/rcopy_uaccess.h>
+
 #endif /* __X86_64_UACCESS_H */