Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jun 2015 15:28:03 +0300
From:      Ivan Klymenko <fidaj@ukr.net>
To:        Mateusz Guzik <mjg@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r284215 - in head/sys: amd64/linux32 compat/linux compat/svr4 dev/drm2/i915 fs/fdescfs i386/ibcs2 i386/linux kern ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/mthca sys vm
Message-ID:  <20150610152803.2f9e4276@nonamehost.local>
In-Reply-To: <20150610151613.1176c1e3@nonamehost.local>
References:  <201506101048.t5AAmD1O029382@svn.freebsd.org> <20150610151613.1176c1e3@nonamehost.local>

next in thread | previous in thread | raw e-mail | index | archive | help
Wed, 10 Jun 2015 15:16:13 +0300
Ivan Klymenko <fidaj@ukr.net> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:

> Wed, 10 Jun 2015 10:48:13 +0000 (UTC)
> Mateusz Guzik <mjg@FreeBSD.org> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=B2:
>=20
> > Author: mjg
> > Date: Wed Jun 10 10:48:12 2015
> > New Revision: 284215
> > URL: https://svnweb.freebsd.org/changeset/base/284215
> >=20
> > Log:
> >   Implement lockless resource limits.
> >  =20
> >   Use the same scheme implemented to manage credentials.
> >  =20
> >   Code needing to look at process's credentials (as opposed to
> > thred's) is provided with *_proc variants of relevant functions.
> >  =20
> >   Places which possibly had to take the proc lock anyway still use
> > the proc pointer to access limits.
> >=20
> > Modified:
> >   head/sys/amd64/linux32/linux32_machdep.c
> >   head/sys/compat/linux/linux_misc.c
> >   head/sys/compat/svr4/imgact_svr4.c
> >   head/sys/compat/svr4/svr4_misc.c
> >   head/sys/compat/svr4/svr4_resource.c
> >   head/sys/dev/drm2/i915/i915_gem.c
> >   head/sys/fs/fdescfs/fdesc_vfsops.c
> >   head/sys/i386/ibcs2/ibcs2_misc.c
> >   head/sys/i386/linux/imgact_linux.c
> >   head/sys/i386/linux/linux_machdep.c
> >   head/sys/kern/imgact_aout.c
> >   head/sys/kern/imgact_elf.c
> >   head/sys/kern/imgact_gzip.c
> >   head/sys/kern/kern_descrip.c
> >   head/sys/kern/kern_event.c
> >   head/sys/kern/kern_exec.c
> >   head/sys/kern/kern_fork.c
> >   head/sys/kern/kern_proc.c
> >   head/sys/kern/kern_resource.c
> >   head/sys/kern/kern_sig.c
> >   head/sys/kern/kern_syscalls.c
> >   head/sys/kern/kern_thread.c
> >   head/sys/kern/subr_uio.c
> >   head/sys/kern/sysv_shm.c
> >   head/sys/kern/tty_pts.c
> >   head/sys/kern/uipc_sockbuf.c
> >   head/sys/kern/vfs_vnops.c
> >   head/sys/ofed/drivers/infiniband/core/umem.c
> >   head/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c
> >   head/sys/sys/proc.h
> >   head/sys/sys/resourcevar.h
> >   head/sys/sys/vnode.h
> >   head/sys/vm/swap_pager.c
> >   head/sys/vm/vm_map.c
> >   head/sys/vm/vm_mmap.c
> >   head/sys/vm/vm_pageout.c
> >   head/sys/vm/vm_unix.c
> >=20
> > ...
>=20
> /head/sys/amd64/linux/linux_machdep.c
> --- linux_machdep.c.orig        2015-06-10 14:57:12.171984000 +0300
> +++ linux_machdep.c     2015-06-10 14:57:22.662331000 +0300
> @@ -251,7 +251,7 @@
>                          */
>                         PROC_LOCK(p);
>                         p->p_vmspace->vm_maxsaddr =3D (char *)USRSTACK -
> -                           lim_cur(p, RLIMIT_STACK);
> +                           lim_cur_proc(p, RLIMIT_STACK);
>                         PROC_UNLOCK(p);
>                 }
>=20
> must also change because:
> ...
> --- linux_stats.o ---
> /usr/local/libexec/ccache/world/cc -target x86_64-unknown-freebsd11.0
> --sysroot=3D/media/da0s1/obj/usr/src/tmp
> -B/media/da0s1/obj/usr/src/tmp/usr/bin -O2 -pipe
> -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc
> -DHAVE_KERNEL_OPTION_HEADERS
> -include /media/da0s1/obj/usr/src/sys/mk11/opt_global.h -I.
> -I/usr/src/sys -fno-common -g -fno-omit-frame-pointer
> -mno-omit-leaf-frame-pointer -I/media/da0s1/obj/usr/src/sys/mk11
> -mcmodel=3Dkernel -mno-red-zone -mno-mmx -mno-sse -msoft-float
> -fno-asynchronous-unwind-tables -ffreestanding -fwrapv
> -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs
> -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline
> -Wcast-qual  -Wundef -Wno-pointer-sign
> -D__printf__=3D__freebsd_kprintf__  -Wmissing-include-dirs
> -fdiagnostics-show-option  -Wno-unknown-pragmas
> -Wno-error-tautological-compare -Wno-error-empty-body
> -Wno-error-parentheses-equality -Wno-error-unused-function
> -Wno-error-pointer-sign  -mno-aes -mno-avx  -std=3Diso9899:1999
> -c /usr/src/sys/modules/linux64/../../compat/linux/linux_stats.c -o
> linux_stats.o --- linux_machdep.o --- distcc[26181] ERROR:
> compile /usr/src/sys/modules/linux64/../../amd64/linux/linux_machdep.c
> on localhost
> failed /usr/src/sys/modules/linux64/../../amd64/linux/linux_machdep.c:254=
:16:
> error: incompatible pointer types passing 'struct proc *' to
> parameter of type 'struct thread
> *' [-Werror,-Wincompatible-pointer-types] lim_cur(p, RLIMIT_STACK);
> ^ /usr/src/sys/sys/resourcevar.h:133:32: note: passing argument to
> parameter 'td' here rlim_t   lim_cur(struct thread *td, int which); ^
> 1 error generated. *** [linux_machdep.o] Error code 1
>=20
> make[4]: stopped in /usr/src/sys/modules/linux64
> --- linux_stats.o ---
> ctfconvert -L VERSION -g linux_stats.o
> --- linux_file.o ---
> ctfconvert -L VERSION -g linux_file.o
> --- linux_misc.o ---
> ctfconvert -L VERSION -g linux_misc.o
> 1 error
>=20
> make[4]: stopped in /usr/src/sys/modules/linux64
> *** [all_subdir_linux64] Error code 2
>=20
> make[3]: stopped in /usr/src/sys/modules
> --- all_subdir_mac_lomac ---
> ctfconvert -L VERSION -g mac_lomac.o
> A failure has been detected in another branch of the parallel make
>=20
> make[4]: stopped in /usr/src/sys/modules/mac_lomac
> *** [all_subdir_mac_lomac] Error code 2
>=20
> make[3]: stopped in /usr/src/sys/modules
> 2 errors
>=20
> make[3]: stopped in /usr/src/sys/modules
> *** [modules-all] Error code 2
>=20
> make[2]: stopped in /media/da0s1/obj/usr/src/sys/mk11
> 1 error
>=20
> make[2]: stopped in /media/da0s1/obj/usr/src/sys/mk11
> *** [buildkernel] Error code 2
>=20
> make[1]: stopped in /usr/src
> 1 error
>=20
> make[1]: stopped in /usr/src
> *** [buildkernel] Error code 2
>=20
> make: stopped in /usr/src
> 1 error
>=20
> make: stopped in /usr/src
>=20
>=20
>=20
>=20
> and something must be changed
>=20
>=20
> /usr/local/libexec/ccache/world/cc -target x86_64-unknown-freebsd11.0
> --sysroot=3D/media/da0s1/obj/usr/src/tmp
> -B/media/da0s1/obj/usr/src/tmp/usr/bin -c -O2 -pipe
> -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys
> -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS
> -include opt_global.h  -fno-omit-frame-pointer
> -mno-omit-leaf-frame-pointer -mcmodel=3Dkernel -mno-red-zone -mno-mmx
> -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
> -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls
> -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes
> -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign
> -D__printf__=3D__freebsd_kprintf__  -Wmissing-include-dirs
> -fdiagnostics-show-option  -Wno-unknown-pragmas
> -Wno-error-tautological-compare -Wno-error-empty-body
> -Wno-error-parentheses-equality -Wno-error-unused-function
> -Wno-error-pointer-sign  -mno-aes -mno-avx  -std=3Diso9899:1999
> -Werror  /usr/src/sys/kern/kern_fork.c --- kern_cons.o --- ctfconvert
> -L VERSION -g kern_cons.o --- kern_descrip.o --- distcc[27122] ERROR:
> compile /usr/src/sys/kern/kern_descrip.c on localhost
> failed /usr/src/sys/kern/kern_descrip.c:338:12: error: use of
> undeclared identifier 'p' PROC_LOCK(p);
> ^ /usr/src/sys/sys/proc.h:778:33: note: expanded from macro
> 'PROC_LOCK' #define PROC_LOCK(p)    mtx_lock(&(p)->p_mtx)
> ^ /usr/src/sys/sys/mutex.h:305:38: note: expanded from macro
> 'mtx_lock' #define mtx_lock(m)             mtx_lock_flags((m), 0)
> ^ /usr/src/sys/sys/mutex.h:366:19: note: expanded from macro
> 'mtx_lock_flags' mtx_lock_flags_((m), (opts), LOCK_FILE, LOCK_LINE)
> ^ /usr/src/sys/sys/mutex.h:345:14: note: expanded from macro
> 'mtx_lock_flags_' __mtx_lock((m), curthread, (opts), (file), (line))
> ^ /usr/src/sys/sys/mutex.h:188:25: note: expanded from macro
> '__mtx_lock' if (!_mtx_obtain_lock((mp),
> _tid))                              \
> ^ /usr/src/sys/sys/mutex.h:168:26: note: expanded from macro
> '_mtx_obtain_lock' atomic_cmpset_acq_ptr(&(mp)->mtx_lock,
> MTX_UNOWNED, (tid)) ^ /usr/src/sys/kern/kern_descrip.c:338:12: error:
> use of undeclared identifier 'p' /usr/src/sys/sys/proc.h:778:33:
> note: expanded from macro 'PROC_LOCK' #define PROC_LOCK(p)
> mtx_lock(&(p)->p_mtx) ^ /usr/src/sys/sys/mutex.h:305:38: note:
> expanded from macro 'mtx_lock' #define mtx_lock(m)
> mtx_lock_flags((m), 0) ^ /usr/src/sys/sys/mutex.h:366:19: note:
> expanded from macro 'mtx_lock_flags' mtx_lock_flags_((m), (opts),
> LOCK_FILE, LOCK_LINE) ^ /usr/src/sys/sys/mutex.h:345:14: note:
> expanded from macro 'mtx_lock_flags_' __mtx_lock((m), curthread,
> (opts), (file), (line)) ^ /usr/src/sys/sys/mutex.h:189:20: note:
> expanded from macro '__mtx_lock' _mtx_lock_sleep((mp), _tid, (opts),
> (file), (line));    \ ^ /usr/src/sys/sys/mutex.h:142:21: note:
> expanded from macro '_mtx_lock_sleep'
> __mtx_lock_sleep(&(m)->mtx_lock, t, o, f, l)
> ^ /usr/src/sys/kern/kern_descrip.c:338:12: error: use of undeclared
> identifier 'p' /usr/src/sys/sys/proc.h:778:33: note: expanded from
> macro 'PROC_LOCK' #define PROC_LOCK(p)    mtx_lock(&(p)->p_mtx)
> ^ /usr/src/sys/sys/mutex.h:305:38: note: expanded from macro
> 'mtx_lock' #define mtx_lock(m)             mtx_lock_flags((m), 0)
> ^ /usr/src/sys/sys/mutex.h:366:19: note: expanded from macro
> 'mtx_lock_flags' mtx_lock_flags_((m), (opts), LOCK_FILE, LOCK_LINE) ^
> /usr/src/sys/sys/mutex.h:345:14: note: expanded from macro
> 'mtx_lock_flags_' __mtx_lock((m), curthread, (opts), (file), (line))
>                     ^
> /usr/src/sys/sys/mutex.h:192:7: note: expanded from macro '__mtx_lock'
>                     mp, 0, 0, (file),
> (line));                          \ ^
> /usr/src/sys/sys/lockstat.h:190:42: note: expanded from macro
> 'LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS' (*lockstat_probe_func)(id,
> (uintptr_t)(lp), 0, 0, 0, 0);     \ ^
> /usr/src/sys/kern/kern_descrip.c:340:14: error: use of undeclared
> identifier 'p' PROC_UNLOCK(p);
>                     ^
> /usr/src/sys/sys/proc.h:780:37: note: expanded from macro
> 'PROC_UNLOCK' #define PROC_UNLOCK(p)  mtx_unlock(&(p)->p_mtx)
>                                      ^
> /usr/src/sys/sys/mutex.h:308:42: note: expanded from macro
> 'mtx_unlock' #define mtx_unlock(m)           mtx_unlock_flags((m), 0)
>                                                   ^
> /usr/src/sys/sys/mutex.h:368:21: note: expanded from macro
> 'mtx_unlock_flags' mtx_unlock_flags_((m), (opts), LOCK_FILE,
> LOCK_LINE) ^
> /usr/src/sys/sys/mutex.h:347:16: note: expanded from macro
> 'mtx_unlock_flags_' __mtx_unlock((m), curthread, (opts), (file),
> (line)) ^
> /usr/src/sys/sys/mutex.h:233:7: note: expanded from macro
> '__mtx_unlock' if ((mp)->mtx_recurse =3D=3D
> 0)                                     \ ^
> /usr/src/sys/kern/kern_descrip.c:340:14: error: use of undeclared
> identifier 'p' /usr/src/sys/sys/proc.h:780:37: note: expanded from
> macro 'PROC_UNLOCK' #define PROC_UNLOCK(p)  mtx_unlock(&(p)->p_mtx)
>                                      ^
> /usr/src/sys/sys/mutex.h:308:42: note: expanded from macro
> 'mtx_unlock' #define mtx_unlock(m)           mtx_unlock_flags((m), 0)
>                                                   ^
> /usr/src/sys/sys/mutex.h:368:21: note: expanded from macro
> 'mtx_unlock_flags' mtx_unlock_flags_((m), (opts), LOCK_FILE,
> LOCK_LINE) ^
> /usr/src/sys/sys/mutex.h:347:16: note: expanded from macro
> 'mtx_unlock_flags_' __mtx_unlock((m), curthread, (opts), (file),
> (line)) ^
> /usr/src/sys/sys/mutex.h:235:8: note: expanded from macro
> '__mtx_unlock' (mp));                                              \
>                      ^
> /usr/src/sys/sys/lockstat.h:198:42: note: expanded from macro
> 'LOCKSTAT_PROFILE_RELEASE_LOCK' (*lockstat_probe_func)(id,
> (uintptr_t)(lp), 0, 0, 0, 0);     \ ^
> /usr/src/sys/kern/kern_descrip.c:340:14: error: use of undeclared
> identifier 'p' /usr/src/sys/sys/proc.h:780:37: note: expanded from
> macro 'PROC_UNLOCK' #define PROC_UNLOCK(p)  mtx_unlock(&(p)->p_mtx)
>                                      ^
> /usr/src/sys/sys/mutex.h:308:42: note: expanded from macro
> 'mtx_unlock' #define mtx_unlock(m)           mtx_unlock_flags((m), 0)
>                                                   ^
> /usr/src/sys/sys/mutex.h:368:21: note: expanded from macro
> 'mtx_unlock_flags' mtx_unlock_flags_((m), (opts), LOCK_FILE,
> LOCK_LINE) ^
> /usr/src/sys/sys/mutex.h:347:16: note: expanded from macro
> 'mtx_unlock_flags_' __mtx_unlock((m), curthread, (opts), (file),
> (line)) ^
> /usr/src/sys/sys/mutex.h:236:26: note: expanded from macro
> '__mtx_unlock' if (!_mtx_release_lock((mp),
> _tid))                             \ ^
> /usr/src/sys/sys/mutex.h:172:26: note: expanded from macro
> '_mtx_release_lock' atomic_cmpset_rel_ptr(&(mp)->mtx_lock, (tid),
> MTX_UNOWNED) ^
> /usr/src/sys/kern/kern_descrip.c:340:14: error: use of undeclared
> identifier 'p' /usr/src/sys/sys/proc.h:780:37: note: expanded from
> macro 'PROC_UNLOCK' #define PROC_UNLOCK(p)  mtx_unlock(&(p)->p_mtx)
>                                      ^
> /usr/src/sys/sys/mutex.h:308:42: note: expanded from macro
> 'mtx_unlock' #define mtx_unlock(m)           mtx_unlock_flags((m), 0)
>                                                   ^
> /usr/src/sys/sys/mutex.h:368:21: note: expanded from macro
> 'mtx_unlock_flags' mtx_unlock_flags_((m), (opts), LOCK_FILE,
> LOCK_LINE) ^
> /usr/src/sys/sys/mutex.h:347:16: note: expanded from macro
> 'mtx_unlock_flags_' __mtx_unlock((m), curthread, (opts), (file),
> (line)) ^
> /usr/src/sys/sys/mutex.h:237:22: note: expanded from macro
> '__mtx_unlock' _mtx_unlock_sleep((mp), (opts), (file),
> (line));        \ ^
> /usr/src/sys/sys/mutex.h:144:23: note: expanded from macro
> '_mtx_unlock_sleep' __mtx_unlock_sleep(&(m)->mtx_lock, o, f, l)
>                              ^
> 7 errors generated.
> *** [kern_descrip.o] Error code 1
>=20
> make[2]: stopped in /media/da0s1/obj/usr/src/sys/mk11
> --- kern_exec.o ---
> ctfconvert -L VERSION -g kern_exec.o
> --- kern_exit.o ---
> ctfconvert -L VERSION -g kern_exit.o
> --- kern_fork.o ---
> ctfconvert -L VERSION -g kern_fork.o
> 1 error
>=20
> make[2]: stopped in /media/da0s1/obj/usr/src/sys/mk11
> *** [buildkernel] Error code 2
>=20
> make[1]: stopped in /usr/src
> 1 error
>=20
> make[1]: stopped in /usr/src
> *** [buildkernel] Error code 2
>=20
> make: stopped in /usr/src
> 1 error
>=20
> make: stopped in /usr/src


--- kern_descrip.c.orig 2015-06-10 15:26:41.858458000 +0300
+++ kern_descrip.c      2015-06-10 15:26:50.484285000 +0300
@@ -329,6 +329,7 @@
 sys_getdtablesize(struct thread *td, struct getdtablesize_args *uap)
 {
 #ifdef RACCT
+       struct proc *p =3D td->td_proc;
        uint64_t lim;
 #endif



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