Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jun 2011 03:45:41 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r222846 - in stable/8/sys: amd64/amd64 amd64/linux32 arm/arm compat/ia32 compat/linux compat/svr4 i386/i386 i386/ibcs2 i386/linux ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc6...
Message-ID:  <201106080345.p583jfE0013001@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Wed Jun  8 03:45:40 2011
New Revision: 222846
URL: http://svn.freebsd.org/changeset/base/222846

Log:
  MFC r219405:
  Extend struct sysvec with new method sv_schedtail, which is used for an
  explicit process at fork trampoline path instead of eventhadler(schedtail)
  invocation for each child process.
  
  Remove eventhandler(schedtail) code and change linux ABI to use newly added
  sysvec method.
  
  While here replace explicit comparing of module sysentvec structure with the
  newly created process sysentvec to detect the linux ABI.
  
  MFC r219421:
  Remove bogus since r219405 check of the Linux ABI.

Modified:
  stable/8/sys/amd64/amd64/elf_machdep.c
  stable/8/sys/amd64/linux32/linux32_sysvec.c
  stable/8/sys/arm/arm/elf_machdep.c
  stable/8/sys/compat/ia32/ia32_sysvec.c
  stable/8/sys/compat/linux/linux_emul.c
  stable/8/sys/compat/linux/linux_emul.h
  stable/8/sys/compat/svr4/svr4_sysvec.c
  stable/8/sys/i386/i386/elf_machdep.c
  stable/8/sys/i386/ibcs2/ibcs2_sysvec.c
  stable/8/sys/i386/linux/linux_sysvec.c
  stable/8/sys/ia64/ia64/elf_machdep.c
  stable/8/sys/kern/imgact_aout.c
  stable/8/sys/kern/init_main.c
  stable/8/sys/kern/kern_fork.c
  stable/8/sys/mips/mips/elf64_machdep.c
  stable/8/sys/mips/mips/elf_machdep.c
  stable/8/sys/powerpc/powerpc/elf_machdep.c
  stable/8/sys/sparc64/sparc64/elf_machdep.c
  stable/8/sys/sys/eventhandler.h
  stable/8/sys/sys/param.h
  stable/8/sys/sys/sysent.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/amd64/amd64/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -79,6 +79,7 @@ struct sysentvec elf64_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf64_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/8/sys/amd64/linux32/linux32_sysvec.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/amd64/linux32/linux32_sysvec.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -128,7 +128,6 @@ static void	linux32_fixlimit(struct rlim
 static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static eventhandler_tag linux_exit_tag;
-static eventhandler_tag linux_schedtail_tag;
 static eventhandler_tag linux_exec_tag;
 
 /*
@@ -1073,6 +1072,7 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = linux32_fetch_syscall_args,
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= linux_schedtail,
 };
 
 static char GNU_ABI_VENDOR[] = "GNU";
@@ -1166,8 +1166,6 @@ linux_elf_modevent(module_t mod, int typ
 			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
 			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
 			    linux_proc_exit, NULL, 1000);
-			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail,
-			    linux_schedtail, NULL, 1000);
 			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
 			    linux_proc_exec, NULL, 1000);
 			linux_szplatform = roundup(strlen(linux_platform) + 1,
@@ -1199,7 +1197,6 @@ linux_elf_modevent(module_t mod, int typ
 			sx_destroy(&emul_shared_lock);
 			mtx_destroy(&futex_mtx);
 			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
-			EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
 			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
 			linux_osd_jail_deregister();
 			if (bootverbose)

Modified: stable/8/sys/arm/arm/elf_machdep.c
==============================================================================
--- stable/8/sys/arm/arm/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/arm/arm/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -78,6 +78,7 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = NULL, /* XXXKIB */
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- stable/8/sys/compat/ia32/ia32_sysvec.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/compat/ia32/ia32_sysvec.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -141,6 +141,7 @@ struct sysentvec ia32_freebsd_sysvec = {
 	.sv_set_syscall_retval = ia32_set_syscall_retval,
 	.sv_fetch_syscall_args = ia32_fetch_syscall_args,
 	.sv_syscallnames = freebsd32_syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 

Modified: stable/8/sys/compat/linux/linux_emul.c
==============================================================================
--- stable/8/sys/compat/linux/linux_emul.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/compat/linux/linux_emul.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -300,14 +300,14 @@ linux_proc_exec(void *arg __unused, stru
 }
 
 void
-linux_schedtail(void *arg __unused, struct proc *p)
+linux_schedtail(struct thread *td)
 {
 	struct linux_emuldata *em;
+	struct proc *p;
 	int error = 0;
 	int *child_set_tid;
 
-	if (__predict_true(p->p_sysent != &elf_linux_sysvec))
-		return;
+	p = td->td_proc;
 
 	/* find the emuldata */
 	em = em_find(p, EMUL_DOLOCK);

Modified: stable/8/sys/compat/linux/linux_emul.h
==============================================================================
--- stable/8/sys/compat/linux/linux_emul.h	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/compat/linux/linux_emul.h	Wed Jun  8 03:45:40 2011	(r222846)
@@ -82,7 +82,7 @@ struct linux_emuldata	*em_find(struct pr
 
 int	linux_proc_init(struct thread *, pid_t, int);
 void	linux_proc_exit(void *, struct proc *);
-void	linux_schedtail(void *, struct proc *);
+void	linux_schedtail(struct thread *);
 void	linux_proc_exec(void *, struct proc *, struct image_params *);
 void	linux_kill_threads(struct thread *, int);
 

Modified: stable/8/sys/compat/svr4/svr4_sysvec.c
==============================================================================
--- stable/8/sys/compat/svr4/svr4_sysvec.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/compat/svr4/svr4_sysvec.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -195,6 +195,7 @@ struct sysentvec svr4_sysvec = {
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= NULL,
 };
 
 const char      svr4_emul_path[] = "/compat/svr4";

Modified: stable/8/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/i386/i386/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -78,6 +78,7 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/i386/ibcs2/ibcs2_sysvec.c
==============================================================================
--- stable/8/sys/i386/ibcs2/ibcs2_sysvec.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/i386/ibcs2/ibcs2_sysvec.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -90,6 +90,7 @@ struct sysentvec ibcs2_svr3_sysvec = {
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= NULL,
 };
 
 static int

Modified: stable/8/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/8/sys/i386/linux/linux_sysvec.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/i386/linux/linux_sysvec.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -112,7 +112,6 @@ static int linux_szplatform;
 const char *linux_platform;
 
 static eventhandler_tag linux_exit_tag;
-static eventhandler_tag linux_schedtail_tag;
 static eventhandler_tag linux_exec_tag;
 
 /*
@@ -1004,6 +1003,7 @@ struct sysentvec linux_sysvec = {
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = linux_fetch_syscall_args,
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= linux_schedtail,
 };
 
 struct sysentvec elf_linux_sysvec = {
@@ -1038,6 +1038,7 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = linux_fetch_syscall_args,
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= linux_schedtail,
 };
 
 static char GNU_ABI_VENDOR[] = "GNU";
@@ -1131,8 +1132,6 @@ linux_elf_modevent(module_t mod, int typ
 			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
 			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
 			      NULL, 1000);
-			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail,
-			      NULL, 1000);
 			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,
 			      NULL, 1000);
 			linux_get_machine(&linux_platform);
@@ -1165,7 +1164,6 @@ linux_elf_modevent(module_t mod, int typ
 			sx_destroy(&emul_shared_lock);
 			mtx_destroy(&futex_mtx);
 			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
-			EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
 			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
 			linux_osd_jail_deregister();
 			if (bootverbose)

Modified: stable/8/sys/ia64/ia64/elf_machdep.c
==============================================================================
--- stable/8/sys/ia64/ia64/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/ia64/ia64/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -85,6 +85,7 @@ struct sysentvec elf64_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf64_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/kern/imgact_aout.c
==============================================================================
--- stable/8/sys/kern/imgact_aout.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/kern/imgact_aout.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -93,6 +93,7 @@ struct sysentvec aout_sysvec = {
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static int

Modified: stable/8/sys/kern/init_main.c
==============================================================================
--- stable/8/sys/kern/init_main.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/kern/init_main.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -375,6 +375,7 @@ struct sysentvec null_sysvec = {
 	.sv_set_syscall_retval = null_set_syscall_retval,
 	.sv_fetch_syscall_args = null_fetch_syscall_args,
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= NULL,
 };
 
 /*

Modified: stable/8/sys/kern/kern_fork.c
==============================================================================
--- stable/8/sys/kern/kern_fork.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/kern/kern_fork.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/unistd.h>	
 #include <sys/sdt.h>
 #include <sys/sx.h>
+#include <sys/sysent.h>
 #include <sys/signalvar.h>
 
 #include <security/audit/audit.h>
@@ -870,7 +871,8 @@ fork_exit(callout, arg, frame)
 	}
 	mtx_assert(&Giant, MA_NOTOWNED);
 
-	EVENTHANDLER_INVOKE(schedtail, p);
+	if (p->p_sysent->sv_schedtail != NULL)
+		(p->p_sysent->sv_schedtail)(td);
 }
 
 /*

Modified: stable/8/sys/mips/mips/elf64_machdep.c
==============================================================================
--- stable/8/sys/mips/mips/elf64_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/mips/mips/elf64_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = NULL, /* XXXKIB */
 	.sv_syscallnames = NULL,
+	.sv_schedtail	= NULL,
 };
 
 static Elf64_Brandinfo freebsd_brand_gnutools_info64 = {

Modified: stable/8/sys/mips/mips/elf_machdep.c
==============================================================================
--- stable/8/sys/mips/mips/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/mips/mips/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -79,6 +79,7 @@ struct sysentvec elf64_freebsd_sysvec = 
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
 	.sv_flags	= SV_ABI_FREEBSD | SV_LP64
+	.sv_schedtail	= NULL,
 };
 
 static Elf64_Brandinfo freebsd_brand_info = {
@@ -134,6 +135,7 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = NULL, /* XXXKIB */
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/powerpc/powerpc/elf_machdep.c
==============================================================================
--- stable/8/sys/powerpc/powerpc/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/powerpc/powerpc/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -80,6 +80,7 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/sparc64/sparc64/elf_machdep.c
==============================================================================
--- stable/8/sys/sparc64/sparc64/elf_machdep.c	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/sparc64/sparc64/elf_machdep.c	Wed Jun  8 03:45:40 2011	(r222846)
@@ -86,6 +86,7 @@ static struct sysentvec elf64_freebsd_sy
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_schedtail	= NULL,
 };
 
 static Elf64_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/sys/eventhandler.h
==============================================================================
--- stable/8/sys/sys/eventhandler.h	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/sys/eventhandler.h	Wed Jun  8 03:45:40 2011	(r222846)
@@ -237,6 +237,4 @@ typedef void (*uma_zone_chfn)(void *);
 EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn);
 EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
 
-typedef void(*schedtail_fn)(void *, struct proc *);
-EVENTHANDLER_DECLARE(schedtail, schedtail_fn);
 #endif /* SYS_EVENTHANDLER_H */

Modified: stable/8/sys/sys/param.h
==============================================================================
--- stable/8/sys/sys/param.h	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/sys/param.h	Wed Jun  8 03:45:40 2011	(r222846)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 802507	/* Master, propagated to newvers */
+#define __FreeBSD_version 802508	/* Master, propagated to newvers */
 
 #ifdef _KERNEL
 #define	P_OSREL_SIGSEGV		700004

Modified: stable/8/sys/sys/sysent.h
==============================================================================
--- stable/8/sys/sys/sysent.h	Wed Jun  8 03:02:11 2011	(r222845)
+++ stable/8/sys/sys/sysent.h	Wed Jun  8 03:45:40 2011	(r222846)
@@ -108,6 +108,7 @@ struct sysentvec {
 	int		(*sv_fetch_syscall_args)(struct thread *, struct
 			    syscall_args *);
 	const char	**sv_syscallnames;
+	void		(*sv_schedtail)(struct thread *);
 };
 
 #define	SV_ILP32	0x000100



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106080345.p583jfE0013001>