Date: Sat, 9 Jan 2016 14:53:08 +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-10@freebsd.org Subject: svn commit: r293490 - in stable/10/sys: amd64/amd64 arm/arm compat/ia32 compat/svr4 i386/i386 i386/ibcs2 kern mips/mips powerpc/powerpc sparc64/sparc64 sys Message-ID: <201601091453.u09Er8S5008620@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Sat Jan 9 14:53:08 2016 New Revision: 293490 URL: https://svnweb.freebsd.org/changeset/base/293490 Log: MFC r283382: In preparation for switching linuxulator to the use the native 1:1 threads add a hook for cleaning thread resources before the thread die. Modified: stable/10/sys/amd64/amd64/elf_machdep.c stable/10/sys/arm/arm/elf_machdep.c stable/10/sys/compat/ia32/ia32_sysvec.c stable/10/sys/compat/svr4/svr4_sysvec.c stable/10/sys/i386/i386/elf_machdep.c stable/10/sys/i386/ibcs2/ibcs2_sysvec.c stable/10/sys/kern/imgact_aout.c stable/10/sys/kern/init_main.c stable/10/sys/kern/kern_thread.c stable/10/sys/mips/mips/elf_machdep.c stable/10/sys/mips/mips/freebsd32_machdep.c stable/10/sys/powerpc/powerpc/elf32_machdep.c stable/10/sys/powerpc/powerpc/elf64_machdep.c stable/10/sys/sparc64/sparc64/elf_machdep.c stable/10/sys/sys/sysent.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/elf_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/amd64/amd64/elf_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_shared_page_base = SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); Modified: stable/10/sys/arm/arm/elf_machdep.c ============================================================================== --- stable/10/sys/arm/arm/elf_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/arm/arm/elf_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -79,6 +79,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf32_Brandinfo freebsd_brand_info = { Modified: stable/10/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/10/sys/compat/ia32/ia32_sysvec.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/compat/ia32/ia32_sysvec.c Sat Jan 9 14:53:08 2016 (r293490) @@ -139,6 +139,7 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_shared_page_base = FREEBSD32_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec); Modified: stable/10/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- stable/10/sys/compat/svr4/svr4_sysvec.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/compat/svr4/svr4_sysvec.c Sat Jan 9 14:53:08 2016 (r293490) @@ -196,6 +196,7 @@ struct sysentvec svr4_sysvec = { .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = NULL, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; const char svr4_emul_path[] = "/compat/svr4"; Modified: stable/10/sys/i386/i386/elf_machdep.c ============================================================================== --- stable/10/sys/i386/i386/elf_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/i386/i386/elf_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -88,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_shared_page_base = SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: stable/10/sys/i386/ibcs2/ibcs2_sysvec.c ============================================================================== --- stable/10/sys/i386/ibcs2/ibcs2_sysvec.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/i386/ibcs2/ibcs2_sysvec.c Sat Jan 9 14:53:08 2016 (r293490) @@ -89,6 +89,7 @@ struct sysentvec ibcs2_svr3_sysvec = { .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = NULL, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static int Modified: stable/10/sys/kern/imgact_aout.c ============================================================================== --- stable/10/sys/kern/imgact_aout.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/kern/imgact_aout.c Sat Jan 9 14:53:08 2016 (r293490) @@ -99,6 +99,7 @@ struct sysentvec aout_sysvec = { .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; #elif defined(__amd64__) Modified: stable/10/sys/kern/init_main.c ============================================================================== --- stable/10/sys/kern/init_main.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/kern/init_main.c Sat Jan 9 14:53:08 2016 (r293490) @@ -414,6 +414,7 @@ struct sysentvec null_sysvec = { .sv_fetch_syscall_args = null_fetch_syscall_args, .sv_syscallnames = NULL, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; /* Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/kern/kern_thread.c Sat Jan 9 14:53:08 2016 (r293490) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sched.h> #include <sys/sleepqueue.h> #include <sys/selinfo.h> +#include <sys/sysent.h> #include <sys/turnstile.h> #include <sys/ktr.h> #include <sys/rwlock.h> @@ -885,6 +886,14 @@ thread_suspend_check(int return_instead) if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { PROC_UNLOCK(p); tidhash_remove(td); + + /* + * Allow Linux emulation layer to do some work + * before thread suicide. + */ + if (__predict_false(p->p_sysent->sv_thread_detach != NULL)) + (p->p_sysent->sv_thread_detach)(td); + PROC_LOCK(p); tdsigcleanup(td); umtx_thread_exit(td); Modified: stable/10/sys/mips/mips/elf_machdep.c ============================================================================== --- stable/10/sys/mips/mips/elf_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/mips/mips/elf_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -83,6 +83,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf64_Brandinfo freebsd_brand_info = { @@ -139,6 +140,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf32_Brandinfo freebsd_brand_info = { Modified: stable/10/sys/mips/mips/freebsd32_machdep.c ============================================================================== --- stable/10/sys/mips/mips/freebsd32_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/mips/mips/freebsd32_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -106,6 +106,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: stable/10/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/elf32_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/powerpc/powerpc/elf32_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -107,6 +107,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_shared_page_base = FREEBSD32_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: stable/10/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/elf64_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/powerpc/powerpc/elf64_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -83,6 +83,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_shared_page_base = SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); Modified: stable/10/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/elf_machdep.c Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/sparc64/sparc64/elf_machdep.c Sat Jan 9 14:53:08 2016 (r293490) @@ -87,6 +87,7 @@ static struct sysentvec elf64_freebsd_sy .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf64_Brandinfo freebsd_brand_info = { Modified: stable/10/sys/sys/sysent.h ============================================================================== --- stable/10/sys/sys/sysent.h Sat Jan 9 14:51:50 2016 (r293489) +++ stable/10/sys/sys/sysent.h Sat Jan 9 14:53:08 2016 (r293490) @@ -130,6 +130,7 @@ struct sysentvec { uint32_t sv_timekeep_gen; void *sv_shared_page_obj; void (*sv_schedtail)(struct thread *); + void (*sv_thread_detach)(struct thread *); }; #define SV_ILP32 0x000100
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601091453.u09Er8S5008620>