[SSI] openssi/kernel/arch/x86_64/kernel signal.c, 1.1.3.2.2.2, 1.1.3.2.2.3

John Hughes <[email protected]> Tue, 20 Apr 2010 21:56:12 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/arch/x86_64/kernel
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29876/kernel

Modified Files:
      Tag: OPENSSI-DEBIAN
	signal.c 
Log Message:
Add migration code for x86_64

Index: signal.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/arch/x86_64/kernel/signal.c,v
retrieving revision 1.1.3.2.2.2
retrieving revision 1.1.3.2.2.3
diff -u -d -r1.1.3.2.2.2 -r1.1.3.2.2.3
--- signal.c	20 Apr 2010 18:48:32 -0000	1.1.3.2.2.2
+++ signal.c	20 Apr 2010 21:56:10 -0000	1.1.3.2.2.3
@@ -29,6 +29,10 @@
 #include <asm/i387.h>
 #include <asm/proto.h>
 
+#ifdef CONFIG_SSI
+#include <linux/vproc.h>
+#endif
+
 /* #define DEBUG_SIG 1 */
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@ -42,6 +46,9 @@
 sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
 {
 	sigset_t saveset, newset;
+#ifdef CONFIG_SSI
+	unsigned long orig_rip = regs->rip;
+#endif
 
 	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
@@ -64,8 +71,25 @@
 	while (1) {
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
+#ifdef CONFIG_SSI
+		/*
+		 * If a signal is processed, the value in eax will be changed
+		 * from -ERESTARTNOHAND to -EINTR before the sigcontext is
+		 * set up and the instruction pointer will not be changed;
+		 * if a signal is not processed, then the instruction pointer
+		 * will have been changed to restart the system call and we
+		 * must fix it if we don't migrate. (We don't care about the
+		 * value in eax.) On i386, we will not return to here if
+		 * we successfully migrate.
+		 */
+		regs->rax = -ERESTARTNOHAND;
+#endif
+
 		if (do_signal(regs, &saveset))
 			return -EINTR;
+#ifdef CONFIG_SSI
+		regs->rip = orig_rip;
+#endif
 	}
 }
 
@@ -459,6 +483,11 @@
 			regs->rip -= 2;
 		}
 	}
+#ifdef CONFIG_SSI
+	if (test_and_clear_thread_flag(TIF_MIGPENDING))
+		ssi_quiesce_movement((void *)regs, 1);
+#endif
+
 	return 0;
 }
 
@@ -476,8 +505,24 @@
 	}
 
 	/* deal with pending signal delivery */
+#ifdef CONFIG_SSI
+	if (thread_info_flags & (_TIF_SIGPENDING|_TIF_MIGPENDING))
+#else
 	if (thread_info_flags & _TIF_SIGPENDING)
+#endif
 		do_signal(regs,oldset);
+
+#ifdef CONFIG_SSI
+	if (thread_info_flags & _TIF_MIGSTRESS) {
+		local_irq_enable();
+		if (!check_stress_mig_done()) {
+			if (check_stress_mig()) {
+				ssi_quiesce_movement((void *)regs, 1);
+				reset_stress_mig();
+			}
+		}
+	}
+#endif
 }
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)


------------------------------------------------------------------------------