svn commit: r329447 - head/sys/compat/linuxkpi/common/include/asm
Author: hselasky Date: Sat Feb 17 08:12:35 2018 New Revision: 329447 URL: https://svnweb.freebsd.org/changeset/base/329447 Log: Compile fix for GCC in the LinuxKPI. Older versions of GCC don't allow flexible array members in a union. Use a zero length array instead. MFC after:1 week Reported by: jbeich@ Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h == --- head/sys/compat/linuxkpi/common/include/asm/atomic.hSat Feb 17 06:57:43 2018(r329446) +++ head/sys/compat/linuxkpi/common/include/asm/atomic.hSat Feb 17 08:12:35 2018(r329447) @@ -162,10 +162,10 @@ atomic_cmpxchg(atomic_t *v, int old, int new) #definecmpxchg(ptr, old, new) ({ \ union { \ __typeof(*(ptr)) val; \ - u8 u8[];\ - u16 u16[]; \ - u32 u32[]; \ - u64 u64[]; \ + u8 u8[0]; \ + u16 u16[0]; \ + u32 u32[0]; \ + u64 u64[0]; \ } __ret = { .val = (old) }, __new = { .val = (new) }; \ \ CTASSERT(sizeof(__ret.val) == 1 || sizeof(__ret.val) == 2 ||\ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329371 - head/sys/compat/linuxkpi/common/include/asm
On 02/17/18 08:32, Hans Petter Selasky wrote: On 02/17/18 01:42, Jan Beich wrote: Hans Petter Selasky writes: Author: hselasky Date: Fri Feb 16 15:20:21 2018 New Revision: 329371 URL: https://svnweb.freebsd.org/changeset/base/329371 Log: Allow the cmpxchg() macro in the LinuxKPI to work on pointers without generating compiler warnings, -Wint-conversion . [...] To generate errors instead ? $ make clean all -C /usr/ports/graphics/drm-next-kmod [...] drm_lock.c:72:10: error: flexible array member 'u8' in a union is not allowed prev = cmpxchg(lock, old, new); ^ I believe this is a regression issue in GCC: https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01505.html See r329447. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329448 - head/sys/kern
Author: mjg Date: Sat Feb 17 08:48:45 2018 New Revision: 329448 URL: https://svnweb.freebsd.org/changeset/base/329448 Log: exit: get rid of PROC_SLOCK when checking a process to report All accessed fields are protected with already held process lock. Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Sat Feb 17 08:12:35 2018(r329447) +++ head/sys/kern/kern_exit.c Sat Feb 17 08:48:45 2018(r329448) @@ -1228,15 +1228,11 @@ loop_locked: nfound++; PROC_LOCK_ASSERT(p, MA_OWNED); - if ((options & (WTRAPPED | WUNTRACED)) != 0) - PROC_SLOCK(p); - if ((options & WTRAPPED) != 0 && (p->p_flag & P_TRACED) != 0 && (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && p->p_suspcount == p->p_numthreads && (p->p_flag & P_WAITED) == 0) { - PROC_SUNLOCK(p); CTR4(KTR_PTRACE, "wait: returning trapped pid %d status %#x " "(xstat %d) xthread %d", @@ -1251,13 +1247,10 @@ loop_locked: (p->p_flag & P_STOPPED_SIG) != 0 && p->p_suspcount == p->p_numthreads && (p->p_flag & P_WAITED) == 0) { - PROC_SUNLOCK(p); report_alive_proc(td, p, siginfo, status, options, CLD_STOPPED); return (0); } - if ((options & (WTRAPPED | WUNTRACED)) != 0) - PROC_SUNLOCK(p); if ((options & WCONTINUED) != 0 && (p->p_flag & P_CONTINUED) != 0) { report_alive_proc(td, p, siginfo, status, options, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329449 - head/sys/kern
Author: mjg Date: Sat Feb 17 09:03:11 2018 New Revision: 329449 URL: https://svnweb.freebsd.org/changeset/base/329449 Log: exit: stop doing PROC_SLOCK just to call proc_reap It immediately does PROC_SUNLOCK anyway and the lock plays no role. Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Sat Feb 17 08:48:45 2018(r329448) +++ head/sys/kern/kern_exit.c Sat Feb 17 09:03:11 2018(r329449) @@ -817,12 +817,10 @@ proc_reap(struct thread *td, struct proc *p, int *stat sx_assert(&proctree_lock, SA_XLOCKED); PROC_LOCK_ASSERT(p, MA_OWNED); - PROC_SLOCK_ASSERT(p, MA_OWNED); KASSERT(p->p_state == PRS_ZOMBIE, ("proc_reap: !PRS_ZOMBIE")); q = td->td_proc; - PROC_SUNLOCK(p); if (status) *status = KW_EXITCODE(p->p_xexit, p->p_xsig); if (options & WNOWAIT) { @@ -1090,7 +1088,6 @@ proc_to_reap(struct thread *td, struct proc *p, idtype } if (p->p_state == PRS_ZOMBIE && !check_only) { - PROC_SLOCK(p); proc_reap(td, p, status, options); return (-1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329371 - head/sys/compat/linuxkpi/common/include/asm
Hans Petter Selasky writes: > On 02/17/18 01:42, Jan Beich wrote: > >> To generate errors instead ? > > Which compiler are you using? > > This was tested with clang over here. $ cc -v FreeBSD clang version 6.0.0 (branches/release_60 324090) (based on LLVM 6.0.0) Target: x86_64-unknown-freebsd12.0 Thread model: posix InstalledDir: /usr/bin $ cat a.c union { char i8[]; short i16[]; int i32[]; long i64[]; } foo; $ cc -c a.c a.c:2:9: error: flexible array member 'i8' in a union is not allowed char i8[]; ^ a.c:3:9: error: flexible array member 'i16' in a union is not allowed short i16[]; ^ a.c:4:9: error: flexible array member 'i32' in a union is not allowed int i32[]; ^ a.c:5:9: error: flexible array member 'i64' in a union is not allowed long i64[]; ^ 4 errors generated. $ gcc7 -c a.c a.c:2:9: error: flexible array member in union char i8[]; ^~ a.c:3:9: error: flexible array member in union short i16[]; ^~~ a.c:4:9: error: flexible array member in union int i32[]; ^~~ a.c:5:9: error: flexible array member in union long i64[]; ^~~ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329371 - head/sys/compat/linuxkpi/common/include/asm
Hans Petter Selasky writes: > On 02/17/18 01:42, Jan Beich wrote: > >> Hans Petter Selasky writes: >> >>> Author: hselasky >>> Date: Fri Feb 16 15:20:21 2018 >>> New Revision: 329371 >>> URL: https://svnweb.freebsd.org/changeset/base/329371 >>> >>> Log: >>>Allow the cmpxchg() macro in the LinuxKPI to work on pointers without >>>generating compiler warnings, -Wint-conversion . >> [...] >> >> To generate errors instead ? >> >> $ make clean all -C /usr/ports/graphics/drm-next-kmod >> [...] >> drm_lock.c:72:10: error: flexible array member 'u8' in a union is not allowed >> prev = cmpxchg(lock, old, new); >> ^ > > I believe this is a regression issue in GCC: > > https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01505.html If you didn't notice that bug is for C++, not C. GCC and Clang accept flexible array members in unions only in C++. cmpxchg() from linuxkpi doesn't seem to be used anywhere in the tree. If the macro didn't expand there's nothing to produce an error for. Anyway, I confirm r329447 fixed graphics/drm-next-kmod build. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329371 - head/sys/compat/linuxkpi/common/include/asm
On 02/17/18 10:33, Jan Beich wrote: Hans Petter Selasky writes: On 02/17/18 01:42, Jan Beich wrote: Hans Petter Selasky writes: Author: hselasky Date: Fri Feb 16 15:20:21 2018 New Revision: 329371 URL: https://svnweb.freebsd.org/changeset/base/329371 Log: Allow the cmpxchg() macro in the LinuxKPI to work on pointers without generating compiler warnings, -Wint-conversion . [...] To generate errors instead ? $ make clean all -C /usr/ports/graphics/drm-next-kmod [...] drm_lock.c:72:10: error: flexible array member 'u8' in a union is not allowed prev = cmpxchg(lock, old, new); ^ I believe this is a regression issue in GCC: https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01505.html If you didn't notice that bug is for C++, not C. GCC and Clang accept flexible array members in unions only in C++. cmpxchg() from linuxkpi doesn't seem to be used anywhere in the tree. If the macro didn't expand there's nothing to produce an error for. Anyway, I confirm r329447 fixed graphics/drm-next-kmod build. Hi, It looks like there has been a testing issue on my side: drm_lock.c:72:10: error: field has incomplete type 'u64 []' This is an older clang. Thanks for reporting! --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329371 - head/sys/compat/linuxkpi/common/include/asm
BTW: drm-next-kmod now also builds on FreeBSD-11-stable (latest) --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > Author: mjg > Date: Sat Feb 17 08:48:45 2018 > New Revision: 329448 > URL: https://svnweb.freebsd.org/changeset/base/329448 > > Log: > exit: get rid of PROC_SLOCK when checking a process to report Was this tested ? In particular, are you aware of r309539 ? > > All accessed fields are protected with already held process lock. > > Modified: > head/sys/kern/kern_exit.c > > Modified: head/sys/kern/kern_exit.c > == > --- head/sys/kern/kern_exit.c Sat Feb 17 08:12:35 2018(r329447) > +++ head/sys/kern/kern_exit.c Sat Feb 17 08:48:45 2018(r329448) > @@ -1228,15 +1228,11 @@ loop_locked: > nfound++; > PROC_LOCK_ASSERT(p, MA_OWNED); > > - if ((options & (WTRAPPED | WUNTRACED)) != 0) > - PROC_SLOCK(p); > - > if ((options & WTRAPPED) != 0 && > (p->p_flag & P_TRACED) != 0 && > (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && > p->p_suspcount == p->p_numthreads && > (p->p_flag & P_WAITED) == 0) { > - PROC_SUNLOCK(p); > CTR4(KTR_PTRACE, > "wait: returning trapped pid %d status %#x " > "(xstat %d) xthread %d", > @@ -1251,13 +1247,10 @@ loop_locked: > (p->p_flag & P_STOPPED_SIG) != 0 && > p->p_suspcount == p->p_numthreads && > (p->p_flag & P_WAITED) == 0) { > - PROC_SUNLOCK(p); > report_alive_proc(td, p, siginfo, status, options, > CLD_STOPPED); > return (0); > } > - if ((options & (WTRAPPED | WUNTRACED)) != 0) > - PROC_SUNLOCK(p); > if ((options & WCONTINUED) != 0 && > (p->p_flag & P_CONTINUED) != 0) { > report_alive_proc(td, p, siginfo, status, options, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329451 - in head/sys: kern sys
Author: mjg Date: Sat Feb 17 12:07:09 2018 New Revision: 329451 URL: https://svnweb.freebsd.org/changeset/base/329451 Log: Undo LOCK_PROFILING pessimisation after r313454 and r313455 With the option used to compile the kernel both sx and rw shared ops would always go to the slow path which added avoidable overhead even when the facility is disabled. Furthermore the increased time spent doing uncontested shared lock acquire would be bogusly added to total wait time, somewhat skewing the results. Restore old behaviour of going there only when profiling is enabled. This change is a no-op for kernels without LOCK_PROFILING (which is the default). Modified: head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/sys/lockstat.h Modified: head/sys/kern/kern_rwlock.c == --- head/sys/kern/kern_rwlock.c Sat Feb 17 09:58:53 2018(r329450) +++ head/sys/kern/kern_rwlock.c Sat Feb 17 12:07:09 2018(r329451) @@ -645,9 +645,12 @@ __rw_rlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DE WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); v = RW_READ_VALUE(rw); - if (__predict_false(LOCKSTAT_OOL_PROFILE_ENABLED(rw__acquire) || + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || !__rw_rlock_try(rw, td, &v, true LOCK_FILE_LINE_ARG))) __rw_rlock_hard(rw, td, v LOCK_FILE_LINE_ARG); + else + lock_profile_obtain_lock_success(&rw->lock_object, 0, 0, + file, line); LOCK_LOG_LOCK("RLOCK", &rw->lock_object, 0, 0, file, line); WITNESS_LOCK(&rw->lock_object, 0, file, line); @@ -839,9 +842,11 @@ _rw_runlock_cookie_int(struct rwlock *rw LOCK_FILE_LIN td = curthread; v = RW_READ_VALUE(rw); - if (__predict_false(LOCKSTAT_OOL_PROFILE_ENABLED(rw__release) || + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) || !__rw_runlock_try(rw, td, &v))) __rw_runlock_hard(rw, td, v LOCK_FILE_LINE_ARG); + else + lock_profile_release_lock(&rw->lock_object); TD_LOCKS_DEC(curthread); } Modified: head/sys/kern/kern_sx.c == --- head/sys/kern/kern_sx.c Sat Feb 17 09:58:53 2018(r329450) +++ head/sys/kern/kern_sx.c Sat Feb 17 12:07:09 2018(r329451) @@ -1122,9 +1122,12 @@ _sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_A error = 0; x = SX_READ_VALUE(sx); - if (__predict_false(LOCKSTAT_OOL_PROFILE_ENABLED(sx__acquire) || + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__acquire) || !__sx_slock_try(sx, &x LOCK_FILE_LINE_ARG))) error = _sx_slock_hard(sx, opts, x LOCK_FILE_LINE_ARG); + else + lock_profile_obtain_lock_success(&sx->lock_object, 0, 0, + file, line); if (error == 0) { LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line); WITNESS_LOCK(&sx->lock_object, 0, file, line); @@ -1252,9 +1255,11 @@ _sx_sunlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) LOCK_LOG_LOCK("SUNLOCK", &sx->lock_object, 0, 0, file, line); x = SX_READ_VALUE(sx); - if (__predict_false(LOCKSTAT_OOL_PROFILE_ENABLED(sx__release) || + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__release) || !_sx_sunlock_try(sx, &x))) _sx_sunlock_hard(sx, x LOCK_FILE_LINE_ARG); + else + lock_profile_release_lock(&sx->lock_object); TD_LOCKS_DEC(curthread); } Modified: head/sys/sys/lockstat.h == --- head/sys/sys/lockstat.h Sat Feb 17 09:58:53 2018(r329450) +++ head/sys/sys/lockstat.h Sat Feb 17 12:07:09 2018(r329451) @@ -109,12 +109,7 @@ extern volatile int lockstat_enabled; LOCKSTAT_RECORD1(probe, lp, a); \ } while (0) -#ifndef LOCK_PROFILING #defineLOCKSTAT_PROFILE_ENABLED(probe) __predict_false(lockstat_enabled) -#defineLOCKSTAT_OOL_PROFILE_ENABLED(probe) LOCKSTAT_PROFILE_ENABLED(probe) -#else -#defineLOCKSTAT_OOL_PROFILE_ENABLED(probe) 1 -#endif struct lock_object; uint64_t lockstat_nsecs(struct lock_object *); @@ -139,10 +134,7 @@ uint64_t lockstat_nsecs(struct lock_object *); #defineLOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a) \ LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) -#ifndef LOCK_PROFILING #defineLOCKSTAT_PROFILE_ENABLED(probe) 0 -#endif -#defineLOCKSTAT_OOL_PROFILE_ENABLED(probe) 1 #endif /* !KDTRACE_HOOKS */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-h
svn commit: r329452 - in head/lib/libcasper: libcasper services/cap_dns services/cap_grp services/cap_pwd services/cap_random services/cap_sysctl services/cap_syslog
Author: oshogbo Date: Sat Feb 17 12:22:29 2018 New Revision: 329452 URL: https://svnweb.freebsd.org/changeset/base/329452 Log: Introduce channel flags in libcasper. Instead of passing flags (which describe a type of nvlist) every send/recv we remember them in channel. It's enough for use to extract them only during unwrap. This simplify use of Casper. Reviewed by: bruffer@, bcr@ (both man page) Differential Revision:https://reviews.freebsd.org/D14196 (man page) Modified: head/lib/libcasper/libcasper/Makefile head/lib/libcasper/libcasper/libcasper.3 head/lib/libcasper/libcasper/libcasper.c head/lib/libcasper/libcasper/libcasper.h head/lib/libcasper/libcasper/libcasper_impl.h head/lib/libcasper/libcasper/libcasper_service.c head/lib/libcasper/libcasper/libcasper_service.h head/lib/libcasper/libcasper/service.c head/lib/libcasper/services/cap_dns/Makefile head/lib/libcasper/services/cap_dns/cap_dns.c head/lib/libcasper/services/cap_grp/Makefile head/lib/libcasper/services/cap_grp/cap_grp.c head/lib/libcasper/services/cap_pwd/Makefile head/lib/libcasper/services/cap_pwd/cap_pwd.c head/lib/libcasper/services/cap_random/Makefile head/lib/libcasper/services/cap_random/cap_random.c head/lib/libcasper/services/cap_sysctl/Makefile head/lib/libcasper/services/cap_sysctl/cap_sysctl.c head/lib/libcasper/services/cap_syslog/Makefile head/lib/libcasper/services/cap_syslog/cap_syslog.c Modified: head/lib/libcasper/libcasper/Makefile == --- head/lib/libcasper/libcasper/Makefile Sat Feb 17 12:07:09 2018 (r329451) +++ head/lib/libcasper/libcasper/Makefile Sat Feb 17 12:22:29 2018 (r329452) @@ -8,7 +8,7 @@ PACKAGE=casper .if ${MK_CASPER} != "no" SHLIB= casper -SHLIB_MAJOR= 0 +SHLIB_MAJOR= 1 SRCS= libcasper.c SRCS+= libcasper_impl.c Modified: head/lib/libcasper/libcasper/libcasper.3 == --- head/lib/libcasper/libcasper/libcasper.3Sat Feb 17 12:07:09 2018 (r329451) +++ head/lib/libcasper/libcasper/libcasper.3Sat Feb 17 12:22:29 2018 (r329452) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 5, 2018 +.Dd February 17, 2018 .Dt LIBCASPER 3 .Os .Sh NAME @@ -53,9 +53,9 @@ .Ft "cap_channel_t *" .Fn cap_init "void" .Ft "cap_channel_t *" -.Fn cap_wrap "int sock" +.Fn cap_wrap "int sock" "int flags" .Ft "int" -.Fn cap_unwrap "cap_channel_t *chan" +.Fn cap_unwrap "cap_channel_t *chan" "int *flags" .Ft "int" .Fn cap_sock "const cap_channel_t *chan" .Ft "cap_channel_t *" @@ -69,9 +69,9 @@ .Ft "int" .Fn cap_send_nvlist "const cap_channel_t *chan" "const nvlist_t *nvl" .Ft "nvlist_t *" -.Fn cap_recv_nvlist "const cap_channel_t *chan" "int flags" +.Fn cap_recv_nvlist "const cap_channel_t *chan" .Ft "nvlist_t *" -.Fn cap_xfer_nvlist "const cap_channel_t *chan" "nvlist_t *nvl" "int flags" +.Fn cap_xfer_nvlist "const cap_channel_t *chan" "nvlist_t *nvl" .Ft "cap_channel_t *" .Fn cap_service_open "const cap_channel_t *chan" "const char *name" .Sh DESCRIPTION @@ -105,6 +105,14 @@ or send over domain socket as a regular file descriptor and has to be represented as .Vt cap_channel_t again. +The +.Fa flags +argument defines the channel behavior. +The supported flags are: +.Bl -ohang -offset indent +.It CASPER_NO_UNIQ +The communication between process and casper uses no unique version of nvlist. +.El .Pp The .Fn cap_unwrap @@ -164,23 +172,11 @@ Most services should provide higher level API. The .Fn cap_recv_nvlist function receives the given nvlist over the given capability. -The -.Fa flags -argument defines what type the top nvlist is expected to be. -If the nvlist flags do not match the flags passed to -.Fn cap_recv_nvlist , -the nvlist will not be returned. .Pp The .Fn cap_xfer_nvlist function sends the given nvlist, destroys it and receives new nvlist in response over the given capability. -The -.Fa flags -argument defines what type the top nvlist is expected to be. -If the nvlist flags do not match the flags passed to -.Fn cap_xfer_nvlist , -the nvlist will not be returned. It does not matter if the function succeeds or fails, the nvlist given for sending will always be destroyed once the function returns. .Pp Modified: head/lib/libcasper/libcasper/libcasper.c == --- head/lib/libcasper/libcasper/libcasper.cSat Feb 17 12:07:09 2018 (r329451) +++ head/lib/libcasper/libcasper/libcasper.cSat Feb 17 12:22:29 2018 (r329452) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include "libcasper.h" #include "libcasper_impl.h" +#defineCASPER_VALID_FLAGS (CASPER_NO_UNIQ) + /* * Structure describing communication channel between two separated processes. */ @@ -62,6 +64,8 @@ struct cap_channel { int cch_sock;
svn commit: r329453 - head/bin/uuidgen
Author: oshogbo Date: Sat Feb 17 12:32:53 2018 New Revision: 329453 URL: https://svnweb.freebsd.org/changeset/base/329453 Log: Capsicumize uuidgen. Modified: head/bin/uuidgen/uuidgen.c Modified: head/bin/uuidgen/uuidgen.c == --- head/bin/uuidgen/uuidgen.c Sat Feb 17 12:22:29 2018(r329452) +++ head/bin/uuidgen/uuidgen.c Sat Feb 17 12:32:53 2018(r329453) @@ -28,6 +28,9 @@ #include __FBSDID("$FreeBSD$"); +#include + +#include #include #include #include @@ -79,6 +82,12 @@ main(int argc, char *argv[]) if (argc) usage(); + + caph_cache_catpages(); + if (caph_limit_stdio() < 0) + err(1, "Unable to limit stdio"); + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); if (count == -1) count = 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329454 - head/sys/dev/usb
Author: hselasky Date: Sat Feb 17 12:38:46 2018 New Revision: 329454 URL: https://svnweb.freebsd.org/changeset/base/329454 Log: Revert redundant parts of r329440 after recent devmatch(8) changes. Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/usb_hub.c == --- head/sys/dev/usb/usb_hub.c Sat Feb 17 12:32:53 2018(r329453) +++ head/sys/dev/usb/usb_hub.c Sat Feb 17 12:38:46 2018(r329454) @@ -1733,12 +1733,7 @@ uhub_child_pnpinfo_string(device_t parent, device_t ch } iface = usbd_get_iface(res.udev, res.iface_index); if (iface && iface->idesc) { - snprintf(buf, buflen, - "bus=usb " -#if USB_HAVE_UGEN - "device=%s " -#endif - "vendor=0x%04x product=0x%04x " + snprintf(buf, buflen, "vendor=0x%04x product=0x%04x " "devclass=0x%02x devsubclass=0x%02x " "devproto=0x%02x " "sernum=\"%s\" " @@ -1746,9 +1741,6 @@ uhub_child_pnpinfo_string(device_t parent, device_t ch "mode=%s " "intclass=0x%02x intsubclass=0x%02x " "intprotocol=0x%02x" "%s%s", -#if USB_HAVE_UGEN - res.udev->ugen_name, -#endif UGETW(res.udev->ddesc.idVendor), UGETW(res.udev->ddesc.idProduct), res.udev->ddesc.bDeviceClass, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329455 - head/etc/devd
Author: hselasky Date: Sat Feb 17 13:13:55 2018 New Revision: 329455 URL: https://svnweb.freebsd.org/changeset/base/329455 Log: Invoke devmatch rc.d script directly instead of depending on "service" which is installed in usr/sbin and might not be available at the time devd is started. Sponsored by: Mellanox Technologies Modified: head/etc/devd/devmatch.conf Modified: head/etc/devd/devmatch.conf == --- head/etc/devd/devmatch.conf Sat Feb 17 12:38:46 2018(r329454) +++ head/etc/devd/devmatch.conf Sat Feb 17 13:13:55 2018(r329455) @@ -9,7 +9,7 @@ # # Generic NOMATCH event nomatch 100 { - action "service devmatch start '?$_'"; + action "/etc/rc.d/devmatch start '?$_'"; }; # Add the following to devd.conf to prevent this from running: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329456 - head/etc/rc.d
Author: hselasky Date: Sat Feb 17 13:32:29 2018 New Revision: 329456 URL: https://svnweb.freebsd.org/changeset/base/329456 Log: Fix handling of "one_nomatch" shell variable to preserve its contents appearing as a single argument passed to devmatch(8). Don't depend on "sort" utility from usr/bin which might not be available when devd is started. Sponsored by: Mellanox Technologies Modified: head/etc/rc.d/devmatch Modified: head/etc/rc.d/devmatch == --- head/etc/rc.d/devmatch Sat Feb 17 13:13:55 2018(r329455) +++ head/etc/rc.d/devmatch Sat Feb 17 13:32:29 2018(r329456) @@ -37,13 +37,17 @@ desc="Use devmatch(8) to load kernel modules" start_cmd="${name}_start" stop_cmd=':' -[ -n "$2" ] && one_nomatch="-p '$2'" +one_nomatch="$2" devmatch_start() { local x - x=$(devmatch ${one_nomatch} | sort -u) + if [ -n "$one_nomatch" ]; then + x=$(devmatch -p "${one_nomatch}") + else + x=$(devmatch) + fi [ -n "$x" ] || return @@ -53,8 +57,8 @@ devmatch_start() # We also optimize against the false positives # or drivers that have symbolic links that # confuse devmatch by running it -n. - echo "Autoloading modules: ${x}" for m in ${x}; do + echo "Autoloading module: ${m}" kldload -n ${m} done } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329457 - head/stand/lua
Author: kevans Date: Sat Feb 17 14:30:39 2018 New Revision: 329457 URL: https://svnweb.freebsd.org/changeset/base/329457 Log: stand/lua: dumpModules => lsModules rgrimes@ notes that this behavior is more befitting of the latter name than the former, and I'm inclined to agree. Reported by: rgrimes Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sat Feb 17 13:32:29 2018(r329456) +++ head/stand/lua/config.lua Sat Feb 17 14:30:39 2018(r329457) @@ -37,7 +37,7 @@ function config.setKey(k, n, v) modules[k][n] = v; end -function config.dumpModules() +function config.lsModules() print("== Dumping modules"); for k, v in pairs(modules) do print(k, v.load); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329458 - head/sbin/devmatch
Author: hselasky Date: Sat Feb 17 14:34:47 2018 New Revision: 329458 URL: https://svnweb.freebsd.org/changeset/base/329458 Log: Fix USB driver matching in devmatch(8). Multiple drivers can match on the same USB device and the order of loading decides which driver gets the device. Use the supplied mask value as an indication of priority, so that vendor specific device drivers are loaded before more generic ones. Sponsored by: Mellanox Technologies Modified: head/sbin/devmatch/devmatch.c Modified: head/sbin/devmatch/devmatch.c == --- head/sbin/devmatch/devmatch.c Sat Feb 17 14:30:39 2018 (r329457) +++ head/sbin/devmatch/devmatch.c Sat Feb 17 14:34:47 2018 (r329458) @@ -54,6 +54,14 @@ static struct option longopts[] = { { NULL, 0, NULL, 0 } }; +#defineDEVMATCH_MAX_HITS 256 + +static struct match_data { + char *descr; + int priority; +} match_data[DEVMATCH_MAX_HITS]; + +static int hit_index; static int all_flag; static int dump_flag; static char *linker_hints; @@ -236,6 +244,35 @@ pnpval_as_str(const char *val, const char *pnpinfo) return retval; } +static int +match_data_compare(const void *_pa, const void *_pb) +{ + const struct match_data *pa = _pa; + const struct match_data *pb = _pb; + + /* biggest value first */ + if (pa->priority > pb->priority) + return (-1); + else if (pa->priority < pb->priority) + return (1); + + /* then sort by string */ + return (strcmp(pa->descr, pb->descr)); +} + +static int +bitrev16(int input) +{ + int retval = 0; + int x; + + for (x = 0; x != 16; x++) { + if ((input >> x) & 1) + retval |= (0x8000 >> x); + } + return (retval); +} + static void search_hints(const char *bus, const char *dev, const char *pnpinfo) { @@ -367,9 +404,20 @@ search_hints(const char *bus, const char *dev, const c printf("\n"); else if (!notme) { if (!unbound_flag) { + char *descr = NULL; + if (all_flag) - printf("%s: ", *dev ? dev : "unattached" ); - printf("%s\n", lastmod); + asprintf(&descr, "%s: %s", *dev ? dev : "unattached", lastmod); + else + asprintf(&descr, "%s", lastmod); + + if (descr != NULL && hit_index < DEVMATCH_MAX_HITS) { + match_data[hit_index].descr = descr; + match_data[hit_index].priority = bitrev16(mask); + hit_index++; + } else { + free(descr); + } } found++; } @@ -382,6 +430,19 @@ search_hints(const char *bus, const char *dev, const c } walker = (void *)(len - sizeof(int) + (intptr_t)walker); } + if (hit_index != 0) { + /* sort hits by priority */ + mergesort(match_data, hit_index, sizeof(match_data[0]), &match_data_compare); + + /* printout */ + for (i = 0; i != hit_index; i++) { + puts(match_data[i].descr); + free(match_data[i].descr); + } + + /* reset hit_index */ + hit_index = 0; + } if (unbound_flag && found == 0 && *pnpinfo) { if (verbose_flag) printf("- "); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329457 - head/stand/lua
[ Charset UTF-8 unsupported, converting... ] > Author: kevans > Date: Sat Feb 17 14:30:39 2018 > New Revision: 329457 > URL: https://svnweb.freebsd.org/changeset/base/329457 > > Log: > stand/lua: dumpModules => lsModules > > rgrimes@ notes that this behavior is more befitting of the latter name than > the former, and I'm inclined to agree. > > Reported by:rgrimes > > Modified: > head/stand/lua/config.lua > > Modified: head/stand/lua/config.lua > == > --- head/stand/lua/config.lua Sat Feb 17 13:32:29 2018(r329456) > +++ head/stand/lua/config.lua Sat Feb 17 14:30:39 2018(r329457) > @@ -37,7 +37,7 @@ function config.setKey(k, n, v) > modules[k][n] = v; > end > > -function config.dumpModules() > +function config.lsModules() > print("== Dumping modules"); ^^^ I was more after this word :) > for k, v in pairs(modules) do > print(k, v.load); > > -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329459 - head/tools/tools/bus_autoconf
Author: hselasky Date: Sat Feb 17 14:40:28 2018 New Revision: 329459 URL: https://svnweb.freebsd.org/changeset/base/329459 Log: Remove obsolete tool, bus_autoconf, which is replaced by devmatch(8). Deleted: head/tools/tools/bus_autoconf/ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329460 - head/sys/dev/usb
Author: hselasky Date: Sat Feb 17 14:44:03 2018 New Revision: 329460 URL: https://svnweb.freebsd.org/changeset/base/329460 Log: Remove unused bus_autoconf section from usb.ko. Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_lookup.c Modified: head/sys/dev/usb/usb_lookup.c == --- head/sys/dev/usb/usb_lookup.c Sat Feb 17 14:40:28 2018 (r329459) +++ head/sys/dev/usb/usb_lookup.c Sat Feb 17 14:44:03 2018 (r329460) @@ -153,70 +153,3 @@ usbd_lookup_id_by_uaa(const struct usb_device_id *id, return (ENXIO); } -/** - * Export the USB device ID format we use to userspace tools. - **/ -#if BYTE_ORDER == LITTLE_ENDIAN -#defineU16_XOR "0" -#else -#defineU16_XOR "8" -#endif - -#if defined(KLD_MODULE) && (USB_HAVE_ID_SECTION != 0) -static const char __section("bus_autoconf_format") __used usb_id_format[] = { - - /* Declare that three different sections use the same format */ - - "usb_host_id{256,:}" - "usb_device_id{256,:}" - "usb_dual_id{256,:}" - - /* List size of fields in the usb_device_id structure */ - - "mf_vendor{" U16_XOR ",1}" - "mf_product{" U16_XOR ",1}" - "mf_dev_lo{" U16_XOR ",1}" - "mf_dev_hi{" U16_XOR ",1}" - - "mf_dev_class{" U16_XOR ",1}" - "mf_dev_subclass{" U16_XOR ",1}" - "mf_dev_protocol{" U16_XOR ",1}" - "mf_int_class{" U16_XOR ",1}" - - "mf_int_subclass{" U16_XOR ",1}" - "mf_int_protocol{" U16_XOR ",1}" - "unused{" U16_XOR ",6}" - - "idVendor[0]{" U16_XOR ",8}" - "idVendor[1]{" U16_XOR ",8}" - "idProduct[0]{" U16_XOR ",8}" - "idProduct[1]{" U16_XOR ",8}" - "bcdDevice_lo[0]{" U16_XOR ",8}" - "bcdDevice_lo[1]{" U16_XOR ",8}" - "bcdDevice_hi[0]{" U16_XOR ",8}" - "bcdDevice_hi[1]{" U16_XOR ",8}" - - "bDeviceClass{0,8}" - "bDeviceSubClass{0,8}" - "bDeviceProtocol{0,8}" - "bInterfaceClass{0,8}" - "bInterfaceSubClass{0,8}" - "bInterfaceProtocol{0,8}" - -#if USB_HAVE_COMPAT_LINUX - "mfl_vendor{" U16_XOR ",1}" - "mfl_product{" U16_XOR ",1}" - "mfl_dev_lo{" U16_XOR ",1}" - "mfl_dev_hi{" U16_XOR ",1}" - - "mfl_dev_class{" U16_XOR ",1}" - "mfl_dev_subclass{" U16_XOR ",1}" - "mfl_dev_protocol{" U16_XOR ",1}" - "mfl_int_class{" U16_XOR ",1}" - - "mfl_int_subclass{" U16_XOR ",1}" - "mfl_int_protocol{" U16_XOR ",1}" - "unused{" U16_XOR ",6}" -#endif -}; -#endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329456 - head/etc/rc.d
On Sat, Feb 17, 2018 at 6:32 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Feb 17 13:32:29 2018 > New Revision: 329456 > URL: https://svnweb.freebsd.org/changeset/base/329456 > > Log: > Fix handling of "one_nomatch" shell variable to preserve its contents > appearing as a single argument passed to devmatch(8). > > Don't depend on "sort" utility from usr/bin which might not be > available when devd is started. > It's more the unique part than the sort part since otherwise we try to load things a large number of times. I'd preferred if you'd talked to me about a non-urgent change like this (split / and /usr is broken already and there's a few other places that are also a problem) Warner > Sponsored by: Mellanox Technologies > > Modified: > head/etc/rc.d/devmatch > > Modified: head/etc/rc.d/devmatch > > == > --- head/etc/rc.d/devmatch Sat Feb 17 13:13:55 2018(r329455) > +++ head/etc/rc.d/devmatch Sat Feb 17 13:32:29 2018(r329456) > @@ -37,13 +37,17 @@ desc="Use devmatch(8) to load kernel modules" > > start_cmd="${name}_start" > stop_cmd=':' > -[ -n "$2" ] && one_nomatch="-p '$2'" > +one_nomatch="$2" > > devmatch_start() > { > local x > > - x=$(devmatch ${one_nomatch} | sort -u) > + if [ -n "$one_nomatch" ]; then > + x=$(devmatch -p "${one_nomatch}") > + else > + x=$(devmatch) > + fi > > [ -n "$x" ] || return > > @@ -53,8 +57,8 @@ devmatch_start() > # We also optimize against the false positives > # or drivers that have symbolic links that > # confuse devmatch by running it -n. > - echo "Autoloading modules: ${x}" > for m in ${x}; do > + echo "Autoloading module: ${m}" > kldload -n ${m} > done > } > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On Sat, Feb 17, 2018 at 7:34 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Feb 17 14:34:47 2018 > New Revision: 329458 > URL: https://svnweb.freebsd.org/changeset/base/329458 > > Log: > Fix USB driver matching in devmatch(8). > > Multiple drivers can match on the same USB device and the order of > loading > decides which driver gets the device. Use the supplied mask value as an > indication of priority, so that vendor specific device drivers are loaded > before more generic ones. > This change isn't right. I mean, it might cause the special case of USB to get the driver you want loaded, but using the MASK this way is wrong. It's fixing the wrong problem. devmatch can't know who the winners will be and has to recommend all the drivers to load and those drivers have to cope with that. The right fix there, I think, is to load them all at once, in one kldload operation and not loop in /etc/rc.d/devmatch. I'd request you make no further changes to devmatch without a review. Warner > > Sponsored by: Mellanox Technologies > > Modified: > head/sbin/devmatch/devmatch.c > > Modified: head/sbin/devmatch/devmatch.c > > == > --- head/sbin/devmatch/devmatch.c Sat Feb 17 14:30:39 2018 > (r329457) > +++ head/sbin/devmatch/devmatch.c Sat Feb 17 14:34:47 2018 > (r329458) > @@ -54,6 +54,14 @@ static struct option longopts[] = { > { NULL, 0, NULL, 0 } > }; > > +#defineDEVMATCH_MAX_HITS 256 > + > +static struct match_data { > + char *descr; > + int priority; > +} match_data[DEVMATCH_MAX_HITS]; > + > +static int hit_index; > static int all_flag; > static int dump_flag; > static char *linker_hints; > @@ -236,6 +244,35 @@ pnpval_as_str(const char *val, const char *pnpinfo) > return retval; > } > > +static int > +match_data_compare(const void *_pa, const void *_pb) > +{ > + const struct match_data *pa = _pa; > + const struct match_data *pb = _pb; > + > + /* biggest value first */ > + if (pa->priority > pb->priority) > + return (-1); > + else if (pa->priority < pb->priority) > + return (1); > + > + /* then sort by string */ > + return (strcmp(pa->descr, pb->descr)); > +} > + > +static int > +bitrev16(int input) > +{ > + int retval = 0; > + int x; > + > + for (x = 0; x != 16; x++) { > + if ((input >> x) & 1) > + retval |= (0x8000 >> x); > + } > + return (retval); > +} > + > static void > search_hints(const char *bus, const char *dev, const char *pnpinfo) > { > @@ -367,9 +404,20 @@ search_hints(const char *bus, const char *dev, const c > printf("\n"); > else if (!notme) { > if (!unbound_flag) { > + char *descr = NULL; > + > if (all_flag) > - printf("%s: ", > *dev ? dev : "unattached" ); > - printf("%s\n", lastmod); > + asprintf(&descr, > "%s: %s", *dev ? dev : "unattached", lastmod); > + else > + asprintf(&descr, > "%s", lastmod); > + > + if (descr != NULL && > hit_index < DEVMATCH_MAX_HITS) { > + > match_data[hit_index].descr = descr; > + > match_data[hit_index].priority = bitrev16(mask); > + hit_index++; > + } else { > + free(descr); > + } > } > found++; > } > @@ -382,6 +430,19 @@ search_hints(const char *bus, const char *dev, const c > } > walker = (void *)(len - sizeof(int) + (intptr_t)walker); > } > + if (hit_index != 0) { > + /* sort hits by priority */ > + mergesort(match_data, hit_index, sizeof(match_data[0]), > &match_data_compare); > + > + /* printout */ > + for (i = 0; i != hit_index; i++) { > + puts(match_data[i].descr); > + free(match_data[i].descr); > + } > + > + /* reset hit_index */ > + hit_index = 0; > + } > if (unbound_flag && found == 0 && *pnpinfo) { > if (verbose_flag) > printf("- "); > > ___
Re: svn commit: r329456 - head/etc/rc.d
On 02/17/18 15:51, Warner Losh wrote: It's more the unique part than the sort part since otherwise we try to load things a large number of times. I'd preferred if you'd talked to me about a non-urgent change like this (split / and /usr is broken already and there's a few other places that are also a problem) This needs to be handled inside devmatch. USB cannot use this sorting at all. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On 02/17/18 15:56, Warner Losh wrote: I'd request you make no further changes to devmatch without a review. I don't have a problem with that. You can see now what changes are needed. Please make sure you test with real USB devices! Some people are using FreeBSD-current on desktops, and the USB auto-load feature has been broken for almost a week now. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329457 - head/stand/lua
On Feb 17, 2018 8:39 AM, "Rodney W. Grimes" wrote: [ Charset UTF-8 unsupported, converting... ] > Author: kevans > Date: Sat Feb 17 14:30:39 2018 > New Revision: 329457 > URL: https://svnweb.freebsd.org/changeset/base/329457 > > Log: > stand/lua: dumpModules => lsModules > > rgrimes@ notes that this behavior is more befitting of the latter name than > the former, and I'm inclined to agree. > > Reported by:rgrimes > > Modified: > head/stand/lua/config.lua > > Modified: head/stand/lua/config.lua > == > --- head/stand/lua/config.lua Sat Feb 17 13:32:29 2018(r329456) > +++ head/stand/lua/config.lua Sat Feb 17 14:30:39 2018(r329457) > @@ -37,7 +37,7 @@ function config.setKey(k, n, v) > modules[k][n] = v; > end > > -function config.dumpModules() > +function config.lsModules() > print("== Dumping modules"); ^^^ I was more after this word :) > for k, v in pairs(modules) do > print(k, v.load); > > (apologies for the broken quoting, no longer near a reasonable mail client) Feel free to change it- I personally believe it's pretty obvious from the context once you see this message that these things are being dumped out to the console. It wasn't necessarily obvious from the name of the function that this was the case. Either way, this is purely a debugging aide while I was trying to figure out why it wasn't loading modules on kernel change. I don't really care much about the output as long as it still tells me just as much as it does now. As an aside, for anyone interested that reads this far, it's still handling module_path wrong but in a more subtle way. Every kernel change prepends the kernel path to module_path, and we keep building on this. Eventually you'd end up with: "/boot/kernel.GENERIC;/boot/kernel;..." So it may fallback to another kernel path for modules that may or may not match the current kernel version. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329456 - head/etc/rc.d
On Sat, Feb 17, 2018 at 7:56 AM, Hans Petter Selasky wrote: > On 02/17/18 15:51, Warner Losh wrote: > >> It's more the unique part than the sort part since otherwise we try to >> load >> things a large number of times. >> I'd preferred if you'd talked to me about a non-urgent change like this >> (split / and /usr is broken already and there's a few other places that >> are >> also a problem) >> > > This needs to be handled inside devmatch. USB cannot use this sorting at > all. This sorting isn't for USB. This sorting is to uniquify the list of modules. so we don't pass ums.ko multiple times, for example. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On 02/17/18 15:56, Warner Losh wrote: The right fix there, I think, is to load them all at once, in one kldload operation and not loop in /etc/rc.d/devmatch. Each driver will invoke the driver loaded device method, so this will race aswell! You have a point. But, that means devmatch should read ahead the nomatch events until the end, to make sure the correct driver is loaded. For example if first a driver is loaded for a generic device, uhid, then comes a long a ums device, we have a problem this way. Matching should then understand how to reduce the hints, maybe by stripping down the "mask" from least significant bit. It is then important that the order from devmatch is not messed up by "sort -u". BTW: The "sort" utility lives in usr/bin and is not suitable for /etc/rc.d/devmatch, like already pointed out. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On Sat, Feb 17, 2018 at 7:58 AM, Hans Petter Selasky wrote: > On 02/17/18 15:56, Warner Losh wrote: > >> I'd request you make no further changes to devmatch without a review. >> > > I don't have a problem with that. > > You can see now what changes are needed. Please make sure you test with > real USB devices! Some people are using FreeBSD-current on desktops, and > the USB auto-load feature has been broken for almost a week now. (a) It's current (b) It took longer to sort out than I'd hoped (c) I tested with a keyboard and mouse on my main server. It was absolutely tested. Snide comments like this aren't helping my already grumpy mood over this. It would be more helpful if you could turn on devd's logging (by adding !devd *.>=info /var/log/devd.log to /etc/syslog.conf, restarting syslog and then giving me the exact scenario that's failing so I can add it to a test suite I'm writing. The data will be in /var/log/devd.log. I can't possibly test all the crazy USB scenarios with the hardware I have (there's too many of them), but I can test it in simulation and make sure we're good. The multiple driver matching thing was never ever mentioned in prior things, so getting snippy with me over it for not testing it is not helpful. Understanding what to look for will be helpful in making sure the test suites catch it and we fix the underlying issues. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On Sat, Feb 17, 2018 at 8:04 AM, Hans Petter Selasky wrote: > On 02/17/18 15:56, Warner Losh wrote: > >> The right fix there, I think, is to load them all at once, in one kldload >> operation and not loop in /etc/rc.d/devmatch. >> > > Each driver will invoke the driver loaded device method, so this will race > aswell! > > You have a point. But, that means devmatch should read ahead the nomatch > events until the end, to make sure the correct driver is loaded. > We could batch them in the kernel. But that's still unsatisfying since there could still be other races because multiple drivers wanting the same device is well defined only when all the drivers are there at probe/attach time. > For example if first a driver is loaded for a generic device, uhid, then > comes a long a ums device, we have a problem this way. > That makes sense. We likely need to enhance our device model to cope with drivers arriving after a device is attached so this isn't racy. Matching should then understand how to reduce the hints, maybe by stripping > down the "mask" from least significant bit. > > It is then important that the order from devmatch is not messed up by > "sort -u". > No, devmatch is necessarily unordered. We can't reliably use the match like you say. It simply will not work. devmatch has no way of knowing (the mask isn't a viable way) who will win. There must be some other method invented. > BTW: The "sort" utility lives in usr/bin and is not suitable for > /etc/rc.d/devmatch, like already pointed out. Yes. I know that. Continuing to belabor the obvious won't help make me less grumpy. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On 02/17/18 16:07, Warner Losh wrote: It would be more helpful if you could turn on devd's logging (by adding !devd *.>=info /var/log/devd.log to /etc/syslog.conf, restarting syslog and then giving me the exact scenario that's failing so I can add it to a test suite I'm writing. The data will be in /var/log/devd.log. I can't possibly test all the crazy USB scenarios with the hardware I have (there's too many of them), but I can test it in simulation and make sure we're good. It wasn't a problem with devd. It was a problem with /etc/rc.d/devmatch . In your initial devmatch rc.d, look at this: one_nomatch="-p '$2'" devmatch ${one_nomatch} Try this (your initial devmatch): #!/bin/sh test='? at bus=0 hubaddr=1 port=6 devaddr=8 interface=1 ugen=ugen0.8 vendor=0x8087 product=0x0a2b devclass=0xe0 devsubclass=0x01 devproto=0x01 release=0x0001 mode=host intclass=0xe0 intsubclass=0x01 intprotocol=0x01 on uhub0' one_nomatch="-p '$test'" devmatch ${one_nomatch} I fixed it to this, which works: #!/bin/sh test='? at bus=0 hubaddr=1 port=6 devaddr=8 interface=1 ugen=ugen0.8 vendor=0x8087 product=0x0a2b devclass=0xe0 devsubclass=0x01 devproto=0x01 release=0x0001 mode=host intclass=0xe0 intsubclass=0x01 intprotocol=0x01 on uhub0' one_nomatch="$test" devmatch -p "${one_nomatch}" Because the $2 variable already contains ''s from devd, the variable expansion then makes devmatch receive the whole devd generated variable list like a separate arguments. Which leads me to believe you are not using /bin/sh or you tested something different than was committed ?? --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329458 - head/sbin/devmatch
On 02/17/18 16:12, Warner Losh wrote: Yes. I know that. Continuing to belabor the obvious won't help make me less grumpy. I'm sorry about that. Implementing a generic solution to match drivers and devices seems more complicated than at first thought :-) OK, I will say away from *devmatch* and discuss with you first. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov wrote: > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > Author: mjg > > Date: Sat Feb 17 08:48:45 2018 > > New Revision: 329448 > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > Log: > > exit: get rid of PROC_SLOCK when checking a process to report > Was this tested ? > I was trussing multithreaded microbenchmarks, no issues. > In particular, are you aware of r309539 ? > So it looks like I misread the code - I have grepped thread_suspend_switch operating with the proc locked and misread thread_suspend_one's assert as PROC_LOCK_ASSERT. That said, I think this is harmless. Regardless of the lock the inspecting thread can race and check "too soon". Even for a case where it decides to report, I don't see anything which would depend on the suspending thread to finish. However, locking can be employed in a way which is avoided in the common case: diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index b063bda5b7ff..4ae24bcd7059 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1174,6 +1174,7 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status, struct proc *p, *q; pid_t pid; int error, nfound, ret; + bool report; AUDIT_ARG_VALUE((int)idtype); /* XXX - This is likely wrong! */ AUDIT_ARG_PID((pid_t)id); /* XXX - This may be wrong! */ @@ -1226,27 +1227,36 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status, PROC_LOCK_ASSERT(p, MA_OWNED); if ((options & WTRAPPED) != 0 && - (p->p_flag & P_TRACED) != 0 && - (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && - p->p_suspcount == p->p_numthreads && - (p->p_flag & P_WAITED) == 0) { + (p->p_flag & P_TRACED) != 0) { + PROC_SLOCK(p); + report = + ((p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) && + p->p_suspcount == p->p_numthreads && + (p->p_flag & P_WAITED) == 0); + PROC_SUNLOCK(p); + if (report) { CTR4(KTR_PTRACE, "wait: returning trapped pid %d status %#x " "(xstat %d) xthread %d", p->p_pid, W_STOPCODE(p->p_xsig), p->p_xsig, p->p_xthread != NULL ? p->p_xthread->td_tid : -1); - report_alive_proc(td, p, siginfo, status, options, - CLD_TRAPPED); - return (0); + report_alive_proc(td, p, siginfo, status, + options, CLD_TRAPPED); + return (0); + } } if ((options & WUNTRACED) != 0 && - (p->p_flag & P_STOPPED_SIG) != 0 && - p->p_suspcount == p->p_numthreads && - (p->p_flag & P_WAITED) == 0) { - report_alive_proc(td, p, siginfo, status, options, + report_alive_proc(td, p, siginfo, status, + options, CLD_TRAPPED); + return (0); + } } if ((options & WUNTRACED) != 0 && - (p->p_flag & P_STOPPED_SIG) != 0 && - p->p_suspcount == p->p_numthreads && - (p->p_flag & P_WAITED) == 0) { - report_alive_proc(td, p, siginfo, status, options, - CLD_STOPPED); - return (0); + (p->p_flag & P_STOPPED_SIG) != 0) { + PROC_SLOCK(p); + report = (p->p_suspcount == p->p_numthreads && + ((p->p_flag & P_WAITED) == 0)); + PROC_SUNLOCK(p); + if (report) { + report_alive_proc(td, p, siginfo, status, + options, CLD_STOPPED); + return (0); + } } if ((options & WCONTINUED) != 0 && (p->p_flag & P_CONTINUED) != 0) { On Sat, Feb 17, 2018 at 12:27 PM, Konstantin Belousov wrote: > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > Author: mjg > > Date: Sat Feb 17 08:48:45 2018 > > New Revision: 329448 > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > Log: > > exit: get rid of PROC_SLOCK when checking a process to report > Was this tested ? > > In particular, are you aware of r309539 ? > > > > > All accessed fields are protected with already held process lock. > >
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov wrote: > > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > > Author: mjg > > > Date: Sat Feb 17 08:48:45 2018 > > > New Revision: 329448 > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > Log: > > > exit: get rid of PROC_SLOCK when checking a process to report > > Was this tested ? > > > > I was trussing multithreaded microbenchmarks, no issues. > > > In particular, are you aware of r309539 ? > > > > So it looks like I misread the code - I have grepped > thread_suspend_switch operating with the proc locked and misread > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > That said, I think this is harmless. Regardless of the lock the > inspecting thread can race and check "too soon". Even for a case where > it decides to report, I don't see anything which would depend on the > suspending thread to finish. It was definitely not harmless when I tried to avoid the spin lock there, but I do not remember exact failure mode. Most likely, it was a missed report of the traced child indeed, but I am not sure that truss triggered it. Most likely, Peter Holm was the reporter, since he is listed in the commit. > > However, locking can be employed in a way which is avoided in the common > case: > > diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c > index b063bda5b7ff..4ae24bcd7059 100644 > --- a/sys/kern/kern_exit.c > +++ b/sys/kern/kern_exit.c > @@ -1174,6 +1174,7 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t > id, int *status, > struct proc *p, *q; > pid_t pid; > int error, nfound, ret; > + bool report; > > AUDIT_ARG_VALUE((int)idtype); /* XXX - This is likely wrong! */ > AUDIT_ARG_PID((pid_t)id); /* XXX - This may be wrong! */ > @@ -1226,27 +1227,36 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t > id, int *status, > PROC_LOCK_ASSERT(p, MA_OWNED); > > if ((options & WTRAPPED) != 0 && > - (p->p_flag & P_TRACED) != 0 && > - (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && > - p->p_suspcount == p->p_numthreads && > - (p->p_flag & P_WAITED) == 0) { > + (p->p_flag & P_TRACED) != 0) { > + PROC_SLOCK(p); > + report = > + ((p->p_flag & (P_STOPPED_TRACE | > P_STOPPED_SIG)) && > + p->p_suspcount == p->p_numthreads && > + (p->p_flag & P_WAITED) == 0); > + PROC_SUNLOCK(p); > + if (report) { > CTR4(KTR_PTRACE, > "wait: returning trapped pid %d status %#x " > "(xstat %d) xthread %d", > p->p_pid, W_STOPCODE(p->p_xsig), p->p_xsig, > p->p_xthread != NULL ? > p->p_xthread->td_tid : -1); > - report_alive_proc(td, p, siginfo, status, options, > - CLD_TRAPPED); > - return (0); > + report_alive_proc(td, p, siginfo, status, > + options, CLD_TRAPPED); > + return (0); > + } > } > if ((options & WUNTRACED) != 0 && > - (p->p_flag & P_STOPPED_SIG) != 0 && > - p->p_suspcount == p->p_numthreads && > - (p->p_flag & P_WAITED) == 0) { > - report_alive_proc(td, p, siginfo, status, options, > + report_alive_proc(td, p, siginfo, status, > + options, CLD_TRAPPED); > + return (0); > + } > } > if ((options & WUNTRACED) != 0 && > - (p->p_flag & P_STOPPED_SIG) != 0 && > - p->p_suspcount == p->p_numthreads && > - (p->p_flag & P_WAITED) == 0) { > - report_alive_proc(td, p, siginfo, status, options, > - CLD_STOPPED); > - return (0); > + (p->p_flag & P_STOPPED_SIG) != 0) { > + PROC_SLOCK(p); > + report = (p->p_suspcount == p->p_numthreads && > + ((p->p_flag & P_WAITED) == 0)); > + PROC_SUNLOCK(p); > + if (report) { > + report_alive_proc(td, p, siginfo, status, > + options, CLD_STOPPED); > + return (0); > + } > } > if ((option
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 06:26:32PM +0200, Konstantin Belousov wrote: > On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov wrote: > > > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > > > Author: mjg > > > > Date: Sat Feb 17 08:48:45 2018 > > > > New Revision: 329448 > > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > > > Log: > > > > exit: get rid of PROC_SLOCK when checking a process to report > > > Was this tested ? > > > > > > > I was trussing multithreaded microbenchmarks, no issues. > > > > > In particular, are you aware of r309539 ? > > > > > > > So it looks like I misread the code - I have grepped > > thread_suspend_switch operating with the proc locked and misread > > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > > > That said, I think this is harmless. Regardless of the lock the > > inspecting thread can race and check "too soon". Even for a case where > > it decides to report, I don't see anything which would depend on the > > suspending thread to finish. > It was definitely not harmless when I tried to avoid the spin lock there, > but I do not remember exact failure mode. Most likely, it was a missed > report of the traced child indeed, but I am not sure that truss triggered > it. Most likely, Peter Holm was the reporter, since he is listed in > the commit. > I ran a truss(1) test on r329456 and it fails. I have not had a chance to look closer at this, but this is what I see: [root@mercat1 /home/pho]# pgrep truss | xargs ps -Hlp UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND 0 41149 41118 0 52 0 11532 2588 wait I 0 0:01.38 truss /tmp/ttruss 10 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.98 /tmp/ttruss 10 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.00 /tmp/ttruss 10 [root@mercat1 /home/pho]# procstat -k 41151 PIDTID COMMTDNAME KSTACK 41151 100211 ttruss - mi_switch thread_suspend_switch ptracestop amd64_syscall fast_syscall_common 41151 100765 ttruss - mi_switch thread_suspend_check ast doreti_ast [root@mercat1 /home/pho]# > > > > However, locking can be employed in a way which is avoided in the common > > case: > > > > diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c > > index b063bda5b7ff..4ae24bcd7059 100644 > > --- a/sys/kern/kern_exit.c > > +++ b/sys/kern/kern_exit.c > > @@ -1174,6 +1174,7 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t > > id, int *status, > > struct proc *p, *q; > > pid_t pid; > > int error, nfound, ret; > > + bool report; > > > > AUDIT_ARG_VALUE((int)idtype); /* XXX - This is likely wrong! */ > > AUDIT_ARG_PID((pid_t)id); /* XXX - This may be wrong! */ > > @@ -1226,27 +1227,36 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t > > id, int *status, > > PROC_LOCK_ASSERT(p, MA_OWNED); > > > > if ((options & WTRAPPED) != 0 && > > - (p->p_flag & P_TRACED) != 0 && > > - (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && > > - p->p_suspcount == p->p_numthreads && > > - (p->p_flag & P_WAITED) == 0) { > > + (p->p_flag & P_TRACED) != 0) { > > + PROC_SLOCK(p); > > + report = > > + ((p->p_flag & (P_STOPPED_TRACE | > > P_STOPPED_SIG)) && > > + p->p_suspcount == p->p_numthreads && > > + (p->p_flag & P_WAITED) == 0); > > + PROC_SUNLOCK(p); > > + if (report) { > > CTR4(KTR_PTRACE, > > "wait: returning trapped pid %d status %#x " > > "(xstat %d) xthread %d", > > p->p_pid, W_STOPCODE(p->p_xsig), p->p_xsig, > > p->p_xthread != NULL ? > > p->p_xthread->td_tid : -1); > > - report_alive_proc(td, p, siginfo, status, options, > > - CLD_TRAPPED); > > - return (0); > > + report_alive_proc(td, p, siginfo, status, > > + options, CLD_TRAPPED); > > + return (0); > > + } > > } > > if ((options & WUNTRACED) != 0 && > > - (p->p_flag & P_STOPPED_SIG) != 0 && > > - p->p_suspcount == p->p_numthreads && > > - (p->p_flag & P_WAITED) == 0) { > > - report_alive_proc(td, p, siginfo, status, options, > > + report_alive_proc(td, p, siginfo, status
svn commit: r329461 - head/sys/kern
Author: mjg Date: Sat Feb 17 17:23:43 2018 New Revision: 329461 URL: https://svnweb.freebsd.org/changeset/base/329461 Log: Revert r329448. Turns out is is actually racy, reproducible with stress2/misc/truss.sh Requested by: kib Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Sat Feb 17 14:44:03 2018(r329460) +++ head/sys/kern/kern_exit.c Sat Feb 17 17:23:43 2018(r329461) @@ -1225,11 +1225,15 @@ loop_locked: nfound++; PROC_LOCK_ASSERT(p, MA_OWNED); + if ((options & (WTRAPPED | WUNTRACED)) != 0) + PROC_SLOCK(p); + if ((options & WTRAPPED) != 0 && (p->p_flag & P_TRACED) != 0 && (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && p->p_suspcount == p->p_numthreads && (p->p_flag & P_WAITED) == 0) { + PROC_SUNLOCK(p); CTR4(KTR_PTRACE, "wait: returning trapped pid %d status %#x " "(xstat %d) xthread %d", @@ -1244,10 +1248,13 @@ loop_locked: (p->p_flag & P_STOPPED_SIG) != 0 && p->p_suspcount == p->p_numthreads && (p->p_flag & P_WAITED) == 0) { + PROC_SUNLOCK(p); report_alive_proc(td, p, siginfo, status, options, CLD_STOPPED); return (0); } + if ((options & (WTRAPPED | WUNTRACED)) != 0) + PROC_SUNLOCK(p); if ((options & WCONTINUED) != 0 && (p->p_flag & P_CONTINUED) != 0) { report_alive_proc(td, p, siginfo, status, options, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 5:38 PM, Peter Holm wrote: > On Sat, Feb 17, 2018 at 06:26:32PM +0200, Konstantin Belousov wrote: > > On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > > > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov wrote: > > > > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > > > > Author: mjg > > > > > Date: Sat Feb 17 08:48:45 2018 > > > > > New Revision: 329448 > > > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > > > > > Log: > > > > > exit: get rid of PROC_SLOCK when checking a process to report > > > > Was this tested ? > > > > > > > > > > I was trussing multithreaded microbenchmarks, no issues. > > > > > > > In particular, are you aware of r309539 ? > > > > > > > > > > So it looks like I misread the code - I have grepped > > > thread_suspend_switch operating with the proc locked and misread > > > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > > > > > That said, I think this is harmless. Regardless of the lock the > > > inspecting thread can race and check "too soon". Even for a case where > > > it decides to report, I don't see anything which would depend on the > > > suspending thread to finish. > > It was definitely not harmless when I tried to avoid the spin lock there, > > but I do not remember exact failure mode. Most likely, it was a missed > > report of the traced child indeed, but I am not sure that truss triggered > > it. Most likely, Peter Holm was the reporter, since he is listed in > > the commit. > > > > I ran a truss(1) test on r329456 and it fails. I have not had a > chance to look closer at this, but this is what I see: > > [root@mercat1 /home/pho]# pgrep truss | xargs ps -Hlp > UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND > 0 41149 41118 0 52 0 11532 2588 wait I 0 0:01.38 truss > /tmp/ttruss 10 > 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.98 /tmp/ttruss > 10 > 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.00 /tmp/ttruss > 10 > [root@mercat1 /home/pho]# procstat -k 41151 > PIDTID COMMTDNAME KSTACK > 41151 100211 ttruss - mi_switch > thread_suspend_switch ptracestop amd64_syscall fast_syscall_common > 41151 100765 ttruss - mi_switch > thread_suspend_check ast doreti_ast > [root@mercat1 /home/pho]# > > Ok, I reproduced the bug with your script. I reverted the change. The patch I mailed in this thread fixes it for me. Below is a variant which can be applied on top of fresh head: https://people.freebsd.org/~mjg/wait6_slock.diff Now that the bug got reported it is rather obvious: the suspending thread does lock -> wakeup -> slock -> unlock -> sunlock -> sleep Only locking the proc puts as in a spot where we are past the wakeup, but before it gets the chance to bump the counter. On the other hand if we slock, we effectively wait for it to bump and go to sleep after which we see what's going on. -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329463 - head/sys/arm/allwinner
Author: manu Date: Sat Feb 17 18:30:25 2018 New Revision: 329463 URL: https://svnweb.freebsd.org/changeset/base/329463 Log: aw_mmc: Only change the clock if it has really changed This also seems to fix problem when booting Pine64 from the mmc. Tested On:Pine64 Tested On:Pine64-LTS Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c == --- head/sys/arm/allwinner/aw_mmc.c Sat Feb 17 18:00:01 2018 (r329462) +++ head/sys/arm/allwinner/aw_mmc.c Sat Feb 17 18:30:25 2018 (r329463) @@ -117,6 +117,7 @@ struct aw_mmc_softc { int32_t aw_vdd; regulator_t aw_reg_vmmc; regulator_t aw_reg_vqmmc; + unsigned intaw_clock; /* Fields required for DMA access. */ bus_addr_t aw_dma_desc_phys; @@ -939,8 +940,8 @@ aw_mmc_update_ios(device_t bus, device_t child) reg &= ~AW_MMC_CTRL_DDR_MOD_SEL; AW_MMC_WRITE_4(sc, AW_MMC_GCTL, reg); - if (ios->clock) { - clock = ios->clock; + if (ios->clock && ios->clock != sc->aw_clock) { + sc->aw_clock = clock = ios->clock; /* Disable clock */ error = aw_mmc_update_clock(sc, 0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 06:34:34PM +0100, Mateusz Guzik wrote: > On Sat, Feb 17, 2018 at 5:38 PM, Peter Holm wrote: > > > On Sat, Feb 17, 2018 at 06:26:32PM +0200, Konstantin Belousov wrote: > > > On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > > > > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov wrote: > > > > > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > > > > > Author: mjg > > > > > > Date: Sat Feb 17 08:48:45 2018 > > > > > > New Revision: 329448 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > > > > > > > Log: > > > > > > exit: get rid of PROC_SLOCK when checking a process to report > > > > > Was this tested ? > > > > > > > > > > > > > I was trussing multithreaded microbenchmarks, no issues. > > > > > > > > > In particular, are you aware of r309539 ? > > > > > > > > > > > > > So it looks like I misread the code - I have grepped > > > > thread_suspend_switch operating with the proc locked and misread > > > > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > > > > > > > That said, I think this is harmless. Regardless of the lock the > > > > inspecting thread can race and check "too soon". Even for a case where > > > > it decides to report, I don't see anything which would depend on the > > > > suspending thread to finish. > > > It was definitely not harmless when I tried to avoid the spin lock there, > > > but I do not remember exact failure mode. Most likely, it was a missed > > > report of the traced child indeed, but I am not sure that truss triggered > > > it. Most likely, Peter Holm was the reporter, since he is listed in > > > the commit. > > > > > > > I ran a truss(1) test on r329456 and it fails. I have not had a > > chance to look closer at this, but this is what I see: > > > > [root@mercat1 /home/pho]# pgrep truss | xargs ps -Hlp > > UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND > > 0 41149 41118 0 52 0 11532 2588 wait I 0 0:01.38 truss > > /tmp/ttruss 10 > > 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.98 /tmp/ttruss > > 10 > > 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.00 /tmp/ttruss > > 10 > > [root@mercat1 /home/pho]# procstat -k 41151 > > PIDTID COMMTDNAME KSTACK > > 41151 100211 ttruss - mi_switch > > thread_suspend_switch ptracestop amd64_syscall fast_syscall_common > > 41151 100765 ttruss - mi_switch > > thread_suspend_check ast doreti_ast > > [root@mercat1 /home/pho]# > > > > > Ok, I reproduced the bug with your script. I reverted the change. > > The patch I mailed in this thread fixes it for me. Below is a variant > which can be applied on top of fresh head: > > https://people.freebsd.org/~mjg/wait6_slock.diff > Yes, this also works for me with the truss(1) test scenario. Would you like me to run the full set of test? - Peter ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329448 - head/sys/kern
On Sat, Feb 17, 2018 at 7:42 PM, Peter Holm wrote: > On Sat, Feb 17, 2018 at 06:34:34PM +0100, Mateusz Guzik wrote: > > On Sat, Feb 17, 2018 at 5:38 PM, Peter Holm wrote: > > > > > On Sat, Feb 17, 2018 at 06:26:32PM +0200, Konstantin Belousov wrote: > > > > On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > > > > > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov > wrote: > > > > > > On Sat, Feb 17, 2018 at 08:48:46AM +, Mateusz Guzik wrote: > > > > > > > Author: mjg > > > > > > > Date: Sat Feb 17 08:48:45 2018 > > > > > > > New Revision: 329448 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > > > > > > > > > Log: > > > > > > > exit: get rid of PROC_SLOCK when checking a process to report > > > > > > Was this tested ? > > > > > > > > > > > > > > > > I was trussing multithreaded microbenchmarks, no issues. > > > > > > > > > > > In particular, are you aware of r309539 ? > > > > > > > > > > > > > > > > So it looks like I misread the code - I have grepped > > > > > thread_suspend_switch operating with the proc locked and misread > > > > > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > > > > > > > > > That said, I think this is harmless. Regardless of the lock the > > > > > inspecting thread can race and check "too soon". Even for a case > where > > > > > it decides to report, I don't see anything which would depend on > the > > > > > suspending thread to finish. > > > > It was definitely not harmless when I tried to avoid the spin lock > there, > > > > but I do not remember exact failure mode. Most likely, it was a > missed > > > > report of the traced child indeed, but I am not sure that truss > triggered > > > > it. Most likely, Peter Holm was the reporter, since he is listed in > > > > the commit. > > > > > > > > > > I ran a truss(1) test on r329456 and it fails. I have not had a > > > chance to look closer at this, but this is what I see: > > > > > > [root@mercat1 /home/pho]# pgrep truss | xargs ps -Hlp > > > UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND > > > 0 41149 41118 0 52 0 11532 2588 wait I 0 0:01.38 truss > > > /tmp/ttruss 10 > > > 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.98 > /tmp/ttruss > > > 10 > > > 0 41151 41149 0 52 0 13156 2300 - TX0 0:00.00 > /tmp/ttruss > > > 10 > > > [root@mercat1 /home/pho]# procstat -k 41151 > > > PIDTID COMMTDNAME KSTACK > > > 41151 100211 ttruss - mi_switch > > > thread_suspend_switch ptracestop amd64_syscall fast_syscall_common > > > 41151 100765 ttruss - mi_switch > > > thread_suspend_check ast doreti_ast > > > [root@mercat1 /home/pho]# > > > > > > > > Ok, I reproduced the bug with your script. I reverted the change. > > > > The patch I mailed in this thread fixes it for me. Below is a variant > > which can be applied on top of fresh head: > > > > https://people.freebsd.org/~mjg/wait6_slock.diff > > > > Yes, this also works for me with the truss(1) test scenario. > Would you like me to run the full set of test? > > If you have free cycles I don't see why not, thanks. -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329464 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 20:09:43 2018 New Revision: 329464 URL: https://svnweb.freebsd.org/changeset/base/329464 Log: Add checks for valid IRQ tag before setting up or tearing down an interrupt handler in the LinuxKPI. This is needed when the interrupt handler is disabled before freeing the interrupt. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h == --- head/sys/compat/linuxkpi/common/include/linux/interrupt.h Sat Feb 17 18:30:25 2018(r329463) +++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h Sat Feb 17 20:09:43 2018(r329464) @@ -121,7 +121,7 @@ enable_irq(unsigned int irq) if (dev == NULL) return -EINVAL; irqe = linux_irq_ent(dev, irq); - if (irqe == NULL) + if (irqe == NULL || irqe->tag != NULL) return -EINVAL; return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | INTR_MPSAFE, NULL, linux_irq_handler, irqe, &irqe->tag); @@ -139,7 +139,8 @@ disable_irq(unsigned int irq) irqe = linux_irq_ent(dev, irq); if (irqe == NULL) return; - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); irqe->tag = NULL; } @@ -174,7 +175,8 @@ free_irq(unsigned int irq, void *device) irqe = linux_irq_ent(dev, irq); if (irqe == NULL) return; - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); list_del(&irqe->links); kfree(irqe); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329465 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 20:37:21 2018 New Revision: 329465 URL: https://svnweb.freebsd.org/changeset/base/329465 Log: Move the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the LinuxKPI to be compatible with Linux. No functional change. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Added: head/sys/compat/linuxkpi/common/include/linux/irqreturn.h (contents, props changed) Modified: head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/interrupt.h Modified: head/sys/compat/linuxkpi/common/include/linux/device.h == --- head/sys/compat/linuxkpi/common/include/linux/device.h Sat Feb 17 20:09:43 2018(r329464) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Sat Feb 17 20:37:21 2018(r329465) @@ -46,9 +46,6 @@ #include -enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED, IRQ_WAKE_THREAD, }; -typedef enum irqreturn irqreturn_t; - struct device; struct fwnode_handle; Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h == --- head/sys/compat/linuxkpi/common/include/linux/interrupt.h Sat Feb 17 20:09:43 2018(r329464) +++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h Sat Feb 17 20:37:21 2018(r329465) @@ -33,13 +33,12 @@ #include #include +#include #include #include typedefirqreturn_t (*irq_handler_t)(int, void *); - -#defineIRQ_RETVAL(x) ((x) != IRQ_NONE) #defineIRQF_SHARED RF_SHAREABLE Added: head/sys/compat/linuxkpi/common/include/linux/irqreturn.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/irqreturn.h Sat Feb 17 20:37:21 2018(r329465) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2017 Limelight Networks, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_IRQRETURN_H +#define_LINUX_IRQRETURN_H + +typedef enum irqreturn { + IRQ_NONE = 0, + IRQ_HANDLED = 1, + IRQ_WAKE_THREAD = 2 +} irqreturn_t; + +#defineIRQ_RETVAL(x) ((x) ? IRQ_HANDLED : IRQ_NONE) + +#endif /* _LINUX_IRQRETURN_H */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329466 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 20:50:18 2018 New Revision: 329466 URL: https://svnweb.freebsd.org/changeset/base/329466 Log: Add support for __percpu and __weak macros in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h == --- head/sys/compat/linuxkpi/common/include/linux/compiler.hSat Feb 17 20:37:21 2018(r329465) +++ head/sys/compat/linuxkpi/common/include/linux/compiler.hSat Feb 17 20:50:18 2018(r329466) @@ -56,6 +56,8 @@ #define__devexit #define __exit #define__rcu +#define__percpu +#define__weak __weak_symbol #define__malloc #define___stringify(...) #__VA_ARGS__ #define__stringify(...)___stringify(__VA_ARGS__) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329467 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 20:52:54 2018 New Revision: 329467 URL: https://svnweb.freebsd.org/changeset/base/329467 Log: Add support for mmgrab() function in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/mm_types.h Modified: head/sys/compat/linuxkpi/common/include/linux/mm_types.h == --- head/sys/compat/linuxkpi/common/include/linux/mm_types.hSat Feb 17 20:50:18 2018(r329466) +++ head/sys/compat/linuxkpi/common/include/linux/mm_types.hSat Feb 17 20:52:54 2018(r329467) @@ -62,6 +62,12 @@ mmput(struct mm_struct *mm) mmdrop(mm); } +static inline void +mmgrab(struct mm_struct *mm) +{ + atomic_inc(&mm->mm_count); +} + extern struct mm_struct *linux_get_task_mm(struct task_struct *); #defineget_task_mm(task) linux_get_task_mm(task) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329468 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 20:56:35 2018 New Revision: 329468 URL: https://svnweb.freebsd.org/changeset/base/329468 Log: Add support for kref_read() function in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kref.h Modified: head/sys/compat/linuxkpi/common/include/linux/kref.h == --- head/sys/compat/linuxkpi/common/include/linux/kref.hSat Feb 17 20:52:54 2018(r329467) +++ head/sys/compat/linuxkpi/common/include/linux/kref.hSat Feb 17 20:56:35 2018(r329468) @@ -52,6 +52,13 @@ kref_init(struct kref *kref) refcount_init(&kref->refcount.counter, 1); } +static inline unsigned int +kref_read(const struct kref *kref) +{ + + return (atomic_read(&kref->refcount)); +} + static inline void kref_get(struct kref *kref) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329469 - in head/sys/powerpc: aim booke include powerpc ps3 pseries
Author: jhibbits Date: Sat Feb 17 20:59:12 2018 New Revision: 329469 URL: https://svnweb.freebsd.org/changeset/base/329469 Log: Merge AIM and Book-E PCPU fields This is part of a long-term goal of merging Book-E and AIM into a single GENERIC kernel. As more work is done, the struct may be optimized further. Reviewed by: nwhitehorn Modified: head/sys/powerpc/aim/aim_machdep.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/moea64_native.c head/sys/powerpc/aim/slb.c head/sys/powerpc/booke/booke_machdep.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/pcpu.h head/sys/powerpc/powerpc/genassym.c head/sys/powerpc/powerpc/trap.c head/sys/powerpc/ps3/mmu_ps3.c head/sys/powerpc/pseries/mmu_phyp.c Modified: head/sys/powerpc/aim/aim_machdep.c == --- head/sys/powerpc/aim/aim_machdep.c Sat Feb 17 20:56:35 2018 (r329468) +++ head/sys/powerpc/aim/aim_machdep.c Sat Feb 17 20:59:12 2018 (r329469) @@ -442,7 +442,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz) { #ifdef __powerpc64__ /* Copy the SLB contents from the current CPU */ -memcpy(pcpu->pc_slb, PCPU_GET(slb), sizeof(pcpu->pc_slb)); +memcpy(pcpu->pc_aim.slb, PCPU_GET(aim.slb), sizeof(pcpu->pc_aim.slb)); #endif } Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cSat Feb 17 20:56:35 2018 (r329468) +++ head/sys/powerpc/aim/mmu_oea64.cSat Feb 17 20:59:12 2018 (r329469) @@ -601,7 +601,7 @@ moea64_bootstrap_slb_prefault(vm_offset_t va, int larg uint64_t esid, slbe; uint64_t i; - cache = PCPU_GET(slb); + cache = PCPU_GET(aim.slb); esid = va >> ADDR_SR_SHFT; slbe = (esid << SLBE_ESID_SHIFT) | SLBE_VALID; @@ -840,8 +840,8 @@ moea64_mid_bootstrap(mmu_t mmup, vm_offset_t kernelsta */ #ifdef __powerpc64__ for (i = 0; i < 64; i++) { - pcpup->pc_slb[i].slbv = 0; - pcpup->pc_slb[i].slbe = 0; + pcpup->pc_aim.slb[i].slbv = 0; + pcpup->pc_aim.slb[i].slbe = 0; } #else for (i = 0; i < 16; i++) @@ -1017,9 +1017,10 @@ moea64_pmap_init_qpages(void) if (pc->pc_qmap_addr == 0) panic("pmap_init_qpages: unable to allocate KVA"); PMAP_LOCK(kernel_pmap); - pc->pc_qmap_pvo = moea64_pvo_find_va(kernel_pmap, pc->pc_qmap_addr); + pc->pc_aim.qmap_pvo = + moea64_pvo_find_va(kernel_pmap, pc->pc_qmap_addr); PMAP_UNLOCK(kernel_pmap); - mtx_init(&pc->pc_qmap_lock, "qmap lock", NULL, MTX_DEF); + mtx_init(&pc->pc_aim.qmap_lock, "qmap lock", NULL, MTX_DEF); } } @@ -1038,7 +1039,7 @@ moea64_activate(mmu_t mmu, struct thread *td) CPU_SET(PCPU_GET(cpuid), &pm->pm_active); #ifdef __powerpc64__ - PCPU_SET(userslb, pm->pm_slb); + PCPU_SET(aim.userslb, pm->pm_slb); __asm __volatile("slbmte %0, %1; isync" :: "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE)); #else @@ -1057,7 +1058,7 @@ moea64_deactivate(mmu_t mmu, struct thread *td) pm = &td->td_proc->p_vmspace->vm_pmap; CPU_CLR(PCPU_GET(cpuid), &pm->pm_active); #ifdef __powerpc64__ - PCPU_SET(userslb, NULL); + PCPU_SET(aim.userslb, NULL); #else PCPU_SET(curpmap, NULL); #endif @@ -1153,12 +1154,12 @@ moea64_copy_pages_dmap(mmu_t mmu, vm_page_t *ma, vm_of while (xfersize > 0) { a_pg_offset = a_offset & PAGE_MASK; cnt = min(xfersize, PAGE_SIZE - a_pg_offset); - a_cp = (char *)PHYS_TO_DMAP( + a_cp = (char *)(uintptr_t)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT])) + a_pg_offset; b_pg_offset = b_offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - b_pg_offset); - b_cp = (char *)PHYS_TO_DMAP( + b_cp = (char *)(uintptr_t)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(mb[b_offset >> PAGE_SHIFT])) + b_pg_offset; bcopy(a_cp, b_cp, cnt); @@ -1219,7 +1220,7 @@ moea64_zero_page_area(mmu_t mmu, vm_page_t m, int off, panic("moea64_zero_page: size + off > PAGE_SIZE"); if (hw_direct_map) { - bzero((caddr_t)PHYS_TO_DMAP(pa) + off, size); + bzero((caddr_t)(uintptr_t)PHYS_TO_DMAP(pa) + off, size); } else { mtx_lock(&moea64_scratchpage_mtx); moea64_set_scratchpage_pa(mmu, 0, pa); @@ -1270,10 +1271,10 @@ moea64_quick_enter_page(mmu_t mmu, vm_page_t m) */ sched_pin(); - mtx_assert(PCPU_PTR(qmap_lock), MA_NOTOWNED); - pvo = PCPU_GE
svn commit: r329470 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 21:25:19 2018 New Revision: 329470 URL: https://svnweb.freebsd.org/changeset/base/329470 Log: Add support for printk_ratelimit() function macro and improve the existing printk_ratelimited() function macro to return a boolean stating if there was a printout, true, or not, false. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/printk.h Modified: head/sys/compat/linuxkpi/common/include/linux/printk.h == --- head/sys/compat/linuxkpi/common/include/linux/printk.h Sat Feb 17 20:59:12 2018(r329469) +++ head/sys/compat/linuxkpi/common/include/linux/printk.h Sat Feb 17 21:25:19 2018(r329470) @@ -106,10 +106,16 @@ print_hex_dump_bytes(const char *prefix_str, const int print_hex_dump(NULL, prefix_str, prefix_type, 16, 1, buf, len, 0); } -#defineprintk_ratelimited(...) do {\ +#defineprintk_ratelimit() ({ \ static linux_ratelimit_t __ratelimited; \ - if (linux_ratelimited(&__ratelimited)) \ + linux_ratelimited(&__ratelimited); \ +}) + +#defineprintk_ratelimited(...) ({ \ + bool __retval = printk_ratelimit(); \ + if (__retval) \ printk(__VA_ARGS__);\ -} while (0) + __retval; \ +}) #endif /* _LINUX_PRINTK_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329471 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 21:40:19 2018 New Revision: 329471 URL: https://svnweb.freebsd.org/changeset/base/329471 Log: Implement BUILD_BUG_ON_INVALID() function macro in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h == --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Sat Feb 17 21:25:19 2018(r329470) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Sat Feb 17 21:40:19 2018(r329471) @@ -89,6 +89,7 @@ #defineBUILD_BUG_ON(x) CTASSERT(!(x)) #defineBUILD_BUG_ON_MSG(x, msg)BUILD_BUG_ON(x) #defineBUILD_BUG_ON_NOT_POWER_OF_2(x) BUILD_BUG_ON(!powerof2(x)) +#defineBUILD_BUG_ON_INVALID(expr) while (0) { (void)(expr); } #defineBUG() panic("BUG at %s:%d", __FILE__, __LINE__) #defineBUG_ON(cond)do {\ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329472 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 21:47:15 2018 New Revision: 329472 URL: https://svnweb.freebsd.org/changeset/base/329472 Log: Allow the put_user() function macro to put constant values by using the existing __put_user() macro. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/uaccess.h Modified: head/sys/compat/linuxkpi/common/include/linux/uaccess.h == --- head/sys/compat/linuxkpi/common/include/linux/uaccess.h Sat Feb 17 21:40:19 2018(r329471) +++ head/sys/compat/linuxkpi/common/include/linux/uaccess.h Sat Feb 17 21:47:15 2018(r329472) @@ -58,7 +58,7 @@ linux_copyout(&(__x), (_p), sizeof(*(_p))); \ }) #defineget_user(_x, _p)linux_copyin((_p), &(_x), sizeof(*(_p))) -#defineput_user(_x, _p)linux_copyout(&(_x), (_p), sizeof(*(_p))) +#defineput_user(_x, _p)__put_user(_x, _p) #defineclear_user(...) linux_clear_user(__VA_ARGS__) #defineaccess_ok(...) linux_access_ok(__VA_ARGS__) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329473 - head/stand/liblua
Author: cem Date: Sat Feb 17 22:17:21 2018 New Revision: 329473 URL: https://svnweb.freebsd.org/changeset/base/329473 Log: liblua: Clean up io/loader C module registration Utilize registration APIs Lua provides to make module definition a little cleaner. Discussed with: imp Sponsored by: Dell EMC Isilon Modified: head/stand/liblua/lutils.c head/stand/liblua/lutils.h Modified: head/stand/liblua/lutils.c == --- head/stand/liblua/lutils.c Sat Feb 17 21:47:15 2018(r329472) +++ head/stand/liblua/lutils.c Sat Feb 17 22:17:21 2018(r329473) @@ -210,59 +210,34 @@ lua_readfile(lua_State *L) return 2; } -void -lregister(lua_State *L, const char *tableName, const char *funcName, int (*funcPointer)(lua_State *)) -{ - lua_getglobal(L, tableName); - if (!lua_istable(L, -1)) { - lua_pop(L, 1); - lua_newtable(L); - lua_setglobal(L, tableName); - lua_getglobal(L, tableName); - } +#define REG_SIMPLE(n) { #n, lua_ ## n } +static const struct luaL_Reg loaderlib[] = { + REG_SIMPLE(delay), + REG_SIMPLE(getenv), + REG_SIMPLE(perform), + REG_SIMPLE(printc), + REG_SIMPLE(setenv), + REG_SIMPLE(time), + REG_SIMPLE(unsetenv), + { NULL, NULL }, +}; - lua_pushcfunction(L, funcPointer); - lua_setfield(L, -2, funcName); - lua_pop(L, 1); -} +static const struct luaL_Reg iolib[] = { + { "close", lua_closefile }, + REG_SIMPLE(getchar), + REG_SIMPLE(gets), + REG_SIMPLE(ischar), + { "open", lua_openfile }, + { "read", lua_readfile }, + { NULL, NULL }, +}; +#undef REG_SIMPLE - -typedef struct utils_func -{ - int (*func)(lua_State *); - const char *table; - const char *name; -} utils_func; - -static utils_func reg_funcs[] = { - {lua_delay, "loader", "delay"}, - {lua_getenv, "loader", "getenv"}, - {lua_perform, "loader", "perform"}, - {lua_printc, "loader", "printc"}, - {lua_setenv, "loader", "setenv"}, - {lua_time, "loader", "time"}, - {lua_unsetenv, "loader", "unsetenv"}, - - {lua_closefile, "io", "close"}, - {lua_getchar, "io", "getchar"}, - {lua_gets, "io", "gets"}, - {lua_ischar, "io", "ischar"}, - {lua_openfile, "io", "open"}, - {lua_readfile, "io", "read"}, - - {NULL, NULL, NULL}, - }; - void register_utils(lua_State *L) { - utils_func *f = reg_funcs; - - while (f->func != NULL && f->name != NULL) { - if (f->table != NULL) - lregister(L, f->table, f->name, f->func); - else - lua_register(L, f->name, f->func); - ++f; - } + luaL_newlib(L, loaderlib); + lua_setglobal(L, "loader"); + luaL_newlib(L, iolib); + lua_setglobal(L, "io"); } Modified: head/stand/liblua/lutils.h == --- head/stand/liblua/lutils.h Sat Feb 17 21:47:15 2018(r329472) +++ head/stand/liblua/lutils.h Sat Feb 17 22:17:21 2018(r329473) @@ -28,5 +28,4 @@ #include -void lregister(lua_State *, const char *, const char *, int (*fptr)(lua_State *)); void register_utils(lua_State *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329474 - head/stand/liblua
Author: cem Date: Sat Feb 17 22:18:39 2018 New Revision: 329474 URL: https://svnweb.freebsd.org/changeset/base/329474 Log: liblua: Emulate DIR, opendir, fdopendir, closedir In a similar fashion to FILE, provide thin shims for the standard directory manipulation functions. Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D14417 Modified: head/stand/liblua/lstd.c head/stand/liblua/lstd.h Modified: head/stand/liblua/lstd.c == --- head/stand/liblua/lstd.cSat Feb 17 22:17:21 2018(r329473) +++ head/stand/liblua/lstd.cSat Feb 17 22:18:39 2018(r329474) @@ -127,6 +127,42 @@ getc(FILE *stream) return EOF; } +DIR * +opendir(const char *name) +{ + DIR *dp; + int fd; + + fd = open(name, O_RDONLY); + if (fd < 0) + return NULL; + dp = fdopendir(fd); + if (dp == NULL) + close(fd); + return dp; +} + +DIR * +fdopendir(int fd) +{ + DIR *dp; + + dp = malloc(sizeof(*dp)); + if (dp == NULL) + return NULL; + dp->fd = fd; + return dp; +} + +int +closedir(DIR *dp) +{ + close(dp->fd); + dp->fd = -1; + free(dp); + return 0; +} + void luai_writestring(const char *s, int i) { Modified: head/stand/liblua/lstd.h == --- head/stand/liblua/lstd.hSat Feb 17 22:17:21 2018(r329473) +++ head/stand/liblua/lstd.hSat Feb 17 22:18:39 2018(r329474) @@ -43,6 +43,11 @@ typedef struct FILE size_t size; } FILE; +typedef struct DIR +{ + int fd; +} DIR; + FILE *fopen(const char *filename, const char *mode); FILE *freopen( const char *filename, const char *mode, FILE *stream); size_t fread(void *ptr, size_t size, size_t count, FILE *stream); @@ -50,6 +55,9 @@ int fclose(FILE *stream); int ferror(FILE *stream); int feof(FILE *stream); int getc(FILE * stream); +DIR *opendir(const char *name); +DIR *fdopendir(int fd); +int closedir(DIR *); #ifndef EOF #define EOF (-1) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329475 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 22:33:26 2018 New Revision: 329475 URL: https://svnweb.freebsd.org/changeset/base/329475 Log: Implement get_task_pid() function macro in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pid.h Modified: head/sys/compat/linuxkpi/common/include/linux/pid.h == --- head/sys/compat/linuxkpi/common/include/linux/pid.h Sat Feb 17 22:18:39 2018(r329474) +++ head/sys/compat/linuxkpi/common/include/linux/pid.h Sat Feb 17 22:33:26 2018(r329475) @@ -58,6 +58,11 @@ enum pid_type { __ts; \ }) +#defineget_task_pid(task, type) ({ \ + CTASSERT((type) == PIDTYPE_PID);\ + (task)->task_thread->td_tid;\ +}) + struct task_struct; extern struct task_struct *linux_pid_task(pid_t); extern struct task_struct *linux_get_pid_task(pid_t); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329476 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 22:41:20 2018 New Revision: 329476 URL: https://svnweb.freebsd.org/changeset/base/329476 Log: Stub more lockdep function macros in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h == --- head/sys/compat/linuxkpi/common/include/linux/lockdep.h Sat Feb 17 22:33:26 2018(r329475) +++ head/sys/compat/linuxkpi/common/include/linux/lockdep.h Sat Feb 17 22:41:20 2018(r329476) @@ -48,5 +48,10 @@ struct lock_class_key { #definelockdep_is_held(m) (sx_xholder(&(m)->sx) == curthread) #definemight_lock(m) do { } while (0) +#definemight_lock_read(m) do { } while (0) + +#definelock_acquire(...) do { } while (0) +#definelock_release(...) do { } while (0) +#definelock_acquire_shared_recursive(...) do { } while (0) #endif /* _LINUX_LOCKDEP_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329477 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Sat Feb 17 22:45:15 2018 New Revision: 329477 URL: https://svnweb.freebsd.org/changeset/base/329477 Log: Implement spin_trylock_irq() function macro in the LinuxKPI. MFC after:1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/spinlock.h Modified: head/sys/compat/linuxkpi/common/include/linux/spinlock.h == --- head/sys/compat/linuxkpi/common/include/linux/spinlock.hSat Feb 17 22:41:20 2018(r329476) +++ head/sys/compat/linuxkpi/common/include/linux/spinlock.hSat Feb 17 22:45:15 2018(r329477) @@ -98,6 +98,9 @@ typedef struct { __ret; \ }) +#definespin_trylock_irq(_l)\ + spin_trylock(_l) + #definespin_lock_nested(_l, _n) do { \ if (SPIN_SKIP())\ break; \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329479 - head/sys/dev/usb/controller
Author: ian Date: Sat Feb 17 23:23:27 2018 New Revision: 329479 URL: https://svnweb.freebsd.org/changeset/base/329479 Log: Do not try to deallocate memory that wasn't allocated (you'd think that would be safe, but the function also tries to destroy mutexes that never got created). I guess this can only happen when imx_ehci_detach() is called on the error-exit path from imx_ehci_attach(), and that path never got exercised before today. Modified: head/sys/dev/usb/controller/ehci_imx.c Modified: head/sys/dev/usb/controller/ehci_imx.c == --- head/sys/dev/usb/controller/ehci_imx.c Sat Feb 17 23:05:19 2018 (r329478) +++ head/sys/dev/usb/controller/ehci_imx.c Sat Feb 17 23:23:27 2018 (r329479) @@ -268,6 +268,7 @@ struct imx_ehci_softc { device_tdev; struct resource *ehci_mem_res; /* EHCI core regs. */ struct resource *ehci_irq_res; /* EHCI core IRQ. */ + boolusb_mem_allocated; }; static struct ofw_compat_data compat_data[] = { @@ -331,7 +332,8 @@ imx_ehci_detach(device_t dev) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->ehci_mem_res); - usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); + if (sc->usb_mem_allocated) + usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); /* During module unload there are lots of children leftover */ device_delete_children(dev); @@ -413,6 +415,7 @@ imx_ehci_attach(device_t dev) err = ENOMEM; goto out; } + sc->usb_mem_allocated = true; /* * Set handle to USB related registers subregion used by ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329480 - head/sys/dev/sdhci
Author: ian Date: Sat Feb 17 23:39:10 2018 New Revision: 329480 URL: https://svnweb.freebsd.org/changeset/base/329480 Log: Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called. Also, do callout_init() very early in attach, so that callout_drain() can be called in detach without worrying about whether it ever got init'd. Modified: head/sys/dev/sdhci/fsl_sdhci.c Modified: head/sys/dev/sdhci/fsl_sdhci.c == --- head/sys/dev/sdhci/fsl_sdhci.c Sat Feb 17 23:23:27 2018 (r329479) +++ head/sys/dev/sdhci/fsl_sdhci.c Sat Feb 17 23:39:10 2018 (r329480) @@ -92,6 +92,7 @@ struct fsl_sdhci_softc { uint16_tsdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; + boolslot_init_done; }; #defineR1BFIX_NONE 0 /* No fix needed at next interrupt. */ @@ -810,6 +811,9 @@ fsl_sdhci_detach(device_t dev) callout_drain(&sc->r1bfix_callout); + if (sc->slot_init_done) + sdhci_cleanup_slot(&sc->slot); + if (sc->intr_cookie != NULL) bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); if (sc->irq_res != NULL) @@ -817,7 +821,6 @@ fsl_sdhci_detach(device_t dev) rman_get_rid(sc->irq_res), sc->irq_res); if (sc->mem_res != NULL) { - sdhci_cleanup_slot(&sc->slot); bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem_res), sc->mem_res); } @@ -837,6 +840,8 @@ fsl_sdhci_attach(device_t dev) sc->dev = dev; + callout_init(&sc->r1bfix_callout, 1); + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; if (sc->hwtype == HWTYPE_NONE) panic("Impossible: not compatible in fsl_sdhci_attach()"); @@ -924,8 +929,8 @@ fsl_sdhci_attach(device_t dev) WR4(sc, SDHC_PROT_CTRL, protctl); #endif - callout_init(&sc->r1bfix_callout, 1); sdhci_init_slot(dev, &sc->slot, 0); + sc->slot_init_done = true; bus_generic_probe(dev); bus_generic_attach(dev); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329483 - head/sys/arm/freescale/imx
Author: ian Date: Sun Feb 18 00:02:09 2018 New Revision: 329483 URL: https://svnweb.freebsd.org/changeset/base/329483 Log: Fix fallout from the import of fresh dts source files from linux 4.15. It appears that node names no longer include leading zeroes in the @address qualifiers, so we have to search for the nodes involved in interrupt fixup using both flavors of name to be compatible with old and new .dtb files. (You know you're in a bad place when you're applying a workaround to code that exists only as a workaround for another problem.) Modified: head/sys/arm/freescale/imx/imx6_machdep.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c == --- head/sys/arm/freescale/imx/imx6_machdep.c Sat Feb 17 23:54:59 2018 (r329482) +++ head/sys/arm/freescale/imx/imx6_machdep.c Sun Feb 18 00:02:09 2018 (r329483) @@ -88,6 +88,12 @@ static platform_cpu_reset_t imx6_cpu_reset; * per-soc logic. We handle this at platform attach time rather than via the * fdt_fixup_table, because the latter requires matching on the FDT "model" * property, and this applies to all boards including those not yet invented. + * + * This just in: as of the import of dts files from linux 4.15 on 2018-02-10, + * they appear to have applied a new style rule to the dts which forbids leading + * zeroes in the @address qualifiers on node names. Since we have to find those + * nodes by string matching we now have to search for both flavors of each node + * name involved. */ static void fix_fdt_interrupt_data(void) @@ -107,9 +113,13 @@ fix_fdt_interrupt_data(void) /* GIC node may be child of soc node, or appear directly at root. */ gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); + if (gicnode == -1) + gicnode = OF_finddevice("/soc/interrupt-controller@a01000"); if (gicnode == -1) { gicnode = OF_finddevice("/interrupt-controller@00a01000"); if (gicnode == -1) + gicnode = OF_finddevice("/interrupt-controller@a01000"); + if (gicnode == -1) return; } gicxref = OF_xref_from_node(gicnode); @@ -121,6 +131,8 @@ fix_fdt_interrupt_data(void) gicipar = gicxref; gpcnode = OF_finddevice("/soc/aips-bus@0200/gpc@020dc000"); + if (gpcnode == -1) + gpcnode = OF_finddevice("/soc/aips-bus@200/gpc@20dc000"); if (gpcnode == -1) return; result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329496 - head/stand/lua
Author: kevans Date: Sun Feb 18 00:44:09 2018 New Revision: 329496 URL: https://svnweb.freebsd.org/changeset/base/329496 Log: stand/lua: Fix verbiage and some typos "other_kernel" is decidedly not spelled "other_kern" Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sun Feb 18 00:27:35 2018(r329495) +++ head/stand/lua/config.lua Sun Feb 18 00:44:09 2018(r329496) @@ -38,11 +38,11 @@ function config.setKey(k, n, v) end function config.lsModules() - print("== Dumping modules"); + print("== Listing modules"); for k, v in pairs(modules) do print(k, v.load); end - print("== Dump ended"); + print("== List of modules ended"); end local pattern_table = { @@ -296,8 +296,8 @@ function config.loadkernel(other_kernel) local module_path = loader.getenv("module_path"); local res = nil; - if other_kern ~= nil then - kernel = other_kern; + if other_kernel ~= nil then + kernel = other_kernel; end -- first try load kernel with module_path = /boot/${kernel} -- then try load with module_path=${kernel} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329497 - head/stand/lua
Author: kevans Date: Sun Feb 18 00:56:12 2018 New Revision: 329497 URL: https://svnweb.freebsd.org/changeset/base/329497 Log: stand/lua: Fix module_path handling with multiple kernels Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepend the kernel directory to the current module_path and end up with multiple kernel paths, potentially with mismatched kernel/modules, added to module_path. Fix it by caching module_path at load() time and using the cached version whenever we load a new kernel. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sun Feb 18 00:44:09 2018(r329496) +++ head/stand/lua/config.lua Sun Feb 18 00:56:12 2018(r329497) @@ -115,6 +115,7 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) + print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -124,6 +125,7 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) + print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -293,7 +295,9 @@ function config.loadkernel(other_kernel) return false; end else - local module_path = loader.getenv("module_path"); + -- Use our cached module_path, so we don't end up with multiple + -- automatically added kernel paths to our final module_path + local module_path = config.module_path; local res = nil; if other_kernel ~= nil then @@ -308,9 +312,9 @@ function config.loadkernel(other_kernel) loader.setenv("module_path", v); res = load_bootfile(); - -- succeeded add path to module_path + -- succeeded, add path to module_path if res ~= nil then - if module_path ~= nil then + if (module_path ~= nil) then loader.setenv("module_path", v..";".. module_path); end @@ -349,6 +353,9 @@ function config.load(file) end end end + + -- Cache the provided module_path at load time for later use + config.module_path = loader.getenv("module_path"); print("Loading kernel..."); config.loadkernel(); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329498 - head/stand/lua
Author: kevans Date: Sun Feb 18 01:01:15 2018 New Revision: 329498 URL: https://svnweb.freebsd.org/changeset/base/329498 Log: stand/lua: Remove some debugging bits that snuck in... gr... Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sun Feb 18 00:56:12 2018(r329497) +++ head/stand/lua/config.lua Sun Feb 18 01:01:15 2018(r329498) @@ -115,7 +115,6 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -125,7 +124,6 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329499 - in head/stand: common liblua
Author: cem Date: Sun Feb 18 01:13:58 2018 New Revision: 329499 URL: https://svnweb.freebsd.org/changeset/base/329499 Log: interp_lua: Register io/loader with regular Lua module system Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D14421 Modified: head/stand/common/interp_lua.c head/stand/liblua/lutils.c head/stand/liblua/lutils.h Modified: head/stand/common/interp_lua.c == --- head/stand/common/interp_lua.c Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/common/interp_lua.c Sun Feb 18 01:13:58 2018 (r329499) @@ -85,6 +85,8 @@ static const luaL_Reg loadedlibs[] = { // {LUA_MATHLIBNAME, luaopen_math}, // {LUA_UTF8LIBNAME, luaopen_utf8}, // {LUA_DBLIBNAME, luaopen_debug}, + {"io", luaopen_io}, + {"loader", luaopen_loader}, {NULL, NULL} }; @@ -105,7 +107,6 @@ interp_init(void) abort(); } softc->luap = luap; - register_utils(luap); /* "require" functions from 'loadedlibs' and set results to global table */ for (lib = loadedlibs; lib->func; lib++) { Modified: head/stand/liblua/lutils.c == --- head/stand/liblua/lutils.c Sun Feb 18 01:01:15 2018(r329498) +++ head/stand/liblua/lutils.c Sun Feb 18 01:13:58 2018(r329499) @@ -233,11 +233,15 @@ static const struct luaL_Reg iolib[] = { }; #undef REG_SIMPLE -void -register_utils(lua_State *L) +int +luaopen_loader(lua_State *L) { luaL_newlib(L, loaderlib); - lua_setglobal(L, "loader"); - luaL_newlib(L, iolib); - lua_setglobal(L, "io"); + return 1; } + +int +luaopen_io(lua_State *L) +{ + luaL_newlib(L, iolib); + return 1; Modified: head/stand/liblua/lutils.h == --- head/stand/liblua/lutils.h Sun Feb 18 01:01:15 2018(r329498) +++ head/stand/liblua/lutils.h Sun Feb 18 01:13:58 2018(r329499) @@ -28,4 +28,5 @@ #include -void register_utils(lua_State *); +intluaopen_loader(lua_State *); +intluaopen_io(lua_State *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329500 - in head/stand: common liblua
Author: cem Date: Sun Feb 18 01:15:25 2018 New Revision: 329500 URL: https://svnweb.freebsd.org/changeset/base/329500 Log: Lua loader: Add barebones "lfs" module Add a Lua FileSystem module, an emulation of a subset of the permissively licensed (MIT) Lua library of the same name[0], to our loader's Lua environment. [0]: https://github.com/keplerproject/luafilesystem/ Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D14418 Added: head/stand/liblua/lfs.c (contents, props changed) head/stand/liblua/lfs.h (contents, props changed) Modified: head/stand/common/interp_lua.c head/stand/liblua/Makefile Modified: head/stand/common/interp_lua.c == --- head/stand/common/interp_lua.c Sun Feb 18 01:13:58 2018 (r329499) +++ head/stand/common/interp_lua.c Sun Feb 18 01:15:25 2018 (r329500) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include struct interp_lua_softc { lua_State *luap; @@ -86,6 +87,7 @@ static const luaL_Reg loadedlibs[] = { // {LUA_UTF8LIBNAME, luaopen_utf8}, // {LUA_DBLIBNAME, luaopen_debug}, {"io", luaopen_io}, + {"lfs", luaopen_lfs}, {"loader", luaopen_loader}, {NULL, NULL} }; Modified: head/stand/liblua/Makefile == --- head/stand/liblua/Makefile Sun Feb 18 01:13:58 2018(r329499) +++ head/stand/liblua/Makefile Sun Feb 18 01:15:25 2018(r329500) @@ -21,7 +21,7 @@ SRCS+=lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+=lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lstd.c lutils.c +SRCS+= lfs.c lstd.c lutils.c WARNS= 3 Added: head/stand/liblua/lfs.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/liblua/lfs.c Sun Feb 18 01:15:25 2018(r329500) @@ -0,0 +1,333 @@ +/*- + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Portions derived from https://github.com/keplerproject/luafilesystem under + * the terms of the MIT license: + * + * Copyright (c) 2003-2014 Kepler Project. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "lauxlib.h" +#include "lfs.h" +#include "lstd.h" +#include "lutils.h" +#include "bootstrap.h" + +#ifndef nitems +#definenitems(x) (sizeof((x)) / sizeof((
svn commit: r329501 - head/stand/lua
Author: cem Date: Sun Feb 18 01:16:37 2018 New Revision: 329501 URL: https://svnweb.freebsd.org/changeset/base/329501 Log: lua loader: Auto detect eligible list of kernels to boot Reviewed by: imp, kevans Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D14419 Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Sun Feb 18 01:15:25 2018(r329500) +++ head/stand/lua/core.lua Sun Feb 18 01:16:37 2018(r329501) @@ -127,17 +127,47 @@ function core.kernelList() local v = loader.getenv("kernels") or ""; local kernels = {}; + local unique = {}; local i = 0; if (k ~= nil) then i = i + 1; kernels[i] = k; + unique[k] = true; end for n in v:gmatch("([^; ]+)[; ]?") do - if (n ~= k) then + if (unique[n] == nil) then i = i + 1; kernels[i] = n; + unique[n] = true; end + end + + -- Automatically detect other bootable kernel directories using a + -- heuristic. Any directory in /boot that contains an ordinary file + -- named "kernel" is considered eligible. + for file in lfs.dir("/boot") do + local fname = "/boot/" .. file; + + if (file == "." or file == "..") then + goto continue; + end + + if (lfs.attributes(fname, "mode") ~= "directory") then + goto continue; + end + + if (lfs.attributes(fname .. "/kernel", "mode") ~= "file") then + goto continue; + end + + if (unique[file] == nil) then + i = i + 1; + kernels[i] = file; + unique[file] = true; + end + + ::continue:: end return kernels; end ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329503 - head/stand/liblua
Author: kevans Date: Sun Feb 18 01:31:18 2018 New Revision: 329503 URL: https://svnweb.freebsd.org/changeset/base/329503 Log: liblua: Fix missing '}' in lutil.c after r329499 Modified: head/stand/liblua/lutils.c Modified: head/stand/liblua/lutils.c == --- head/stand/liblua/lutils.c Sun Feb 18 01:21:52 2018(r329502) +++ head/stand/liblua/lutils.c Sun Feb 18 01:31:18 2018(r329503) @@ -245,3 +245,4 @@ luaopen_io(lua_State *L) { luaL_newlib(L, iolib); return 1; +} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329504 - head/stand/lua
Author: kevans Date: Sun Feb 18 01:35:46 2018 New Revision: 329504 URL: https://svnweb.freebsd.org/changeset/base/329504 Log: stand/lua: More style nits, config.lua Some other points I think we need to be consistent on: - Spacing around string concatenation (always) - Test against 'nil' explicitly rather than relying on 'not' for things that reasonably won't be returning a boolean. e.g. loader.getenv Eventually this will all get formalized somewhere. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sun Feb 18 01:31:18 2018(r329503) +++ head/stand/lua/config.lua Sun Feb 18 01:35:46 2018(r329504) @@ -31,7 +31,7 @@ local config = {}; local modules = {}; function config.setKey(k, n, v) - if modules[k] == nil then + if (modules[k] == nil) then modules[k] = {}; end modules[k][n] = v; @@ -54,7 +54,7 @@ local pattern_table = { [2] = { str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if modules[k] == nil then + if (modules[k] == nil) then modules[k] = {}; end modules[k].load = v:upper(); @@ -106,8 +106,8 @@ local pattern_table = { [9] = { str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if loader.perform(k) ~= 0 then - print("Failed to exec '"..k.."'"); + if (loader.perform(k) ~= 0) then + print("Failed to exec '" .. k .. "'"); end end }, @@ -115,8 +115,9 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if loader.setenv(k, v) ~= 0 then - print("Failed to set '"..k.."' with value: "..v..""); + if (loader.setenv(k, v) ~= 0) then + print("Failed to set '" .. k .. + "' with value: " .. v .. ""); end end }, @@ -124,20 +125,21 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if loader.setenv(k, v) ~= 0 then - print("Failed to set '"..k.."' with value: "..v..""); + if (loader.setenv(k, v) ~= 0) then + print("Failed to set '" .. k .. + "' with value: " .. v .. ""); end end } }; function config.isValidComment(c) - if c ~= nil then + if (c ~= nil) then local s = c:match("^%s*#.*"); - if s == nil then + if (s == nil) then s = c:match("^%s*$"); end - if s == nil then + if (s == nil) then return false; end end @@ -147,43 +149,50 @@ end function config.loadmod(mod, silent) local status = true; for k, v in pairs(mod) do - if v.load == "YES" then + if (v.load == "YES") then local str = "load "; - if v.flags ~= nil then + if (v.flags ~= nil) then str = str .. v.flags .. " "; end - if v.type ~= nil then + if (v.type ~= nil) then str = str .. "-t " .. v.type .. " "; end - if v.name ~= nil then + if (v.name ~= nil) then str = str .. v.name; else str = str .. k; end - if v.before ~= nil then - if loader.perform(v.before) ~= 0 then - if not silent then - print("Failed to execute '"..v.before.."' before loading '"..k.."'"); + if (v.before ~= nil) then + if (loader.perform(v.before) ~= 0) then + if (not silent) then + print("Failed to execute '" .. + v.before .. + "' before loading '".. k
svn commit: r329505 - head/cddl/contrib/opensolaris/lib/libzfs/common
Author: mav Date: Sun Feb 18 01:42:17 2018 New Revision: 329505 URL: https://svnweb.freebsd.org/changeset/base/329505 Log: MFV r323911: 8502 illumos#7955 broke delegated datasets when libshare is not present illumos/illumos-gate@1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://github.com/illumos/illumos-gate/commit/1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://www.illumos.org/issues/8502 The code in lib/libzfs/common/libzfs_mount.c already basically handles the case when libshare is not installed. We just need to not fail in zfs_init_libshare_impl. I tested this in lx and things work as expected. I also tested there trying to set sharenfs and sharesmb on the delegated dataset. Neither is allowed from within a zone. The spew of msgs from a native zone is not ZFS specific. I see the same spew simply running the share command. Reviewed by: Robert Mustacchi Reviewed by: Yuri Pankov Approved by: Richard Lowe Author: Jerry Jelinek Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c == --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Sun Feb 18 01:35:46 2018(r329504) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Sun Feb 18 01:42:17 2018(r329505) @@ -24,6 +24,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. */ @@ -610,8 +611,14 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic int ret = SA_OK; #ifdef illumos + /* +* libshare is either not installed or we're in a branded zone. The +* rest of the wrapper functions around the libshare calls already +* handle NULL function pointers, but we don't want the callers of +* zfs_init_libshare() to fail prematurely if libshare is not available. +*/ if (_sa_init == NULL) - ret = SA_CONFIG_ERR; + return (SA_OK); if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329506 - head/sys/arm/freescale/imx
Author: ian Date: Sun Feb 18 02:01:41 2018 New Revision: 329506 URL: https://svnweb.freebsd.org/changeset/base/329506 Log: Add a detach method so that this can be a kldunload-friendly module. Modified: head/sys/arm/freescale/imx/imx_i2c.c Modified: head/sys/arm/freescale/imx/imx_i2c.c == --- head/sys/arm/freescale/imx/imx_i2c.cSun Feb 18 01:42:17 2018 (r329505) +++ head/sys/arm/freescale/imx/imx_i2c.cSun Feb 18 02:01:41 2018 (r329506) @@ -154,6 +154,7 @@ struct i2c_softc { static phandle_t i2c_get_node(device_t, device_t); static int i2c_probe(device_t); static int i2c_attach(device_t); +static int i2c_detach(device_t); static int i2c_repeated_start(device_t, u_char, int); static int i2c_start(device_t, u_char, int); @@ -165,6 +166,7 @@ static int i2c_write(device_t, const char *, int, int static device_method_t i2c_methods[] = { DEVMETHOD(device_probe, i2c_probe), DEVMETHOD(device_attach,i2c_attach), + DEVMETHOD(device_detach,i2c_detach), /* OFW methods */ DEVMETHOD(ofw_bus_get_node, i2c_get_node), @@ -445,6 +447,28 @@ no_recovery: /* Probe and attach the iicbus when interrupts are available. */ config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + return (0); +} + +static int +i2c_detach(device_t dev) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + if ((error = bus_generic_detach(sc->dev)) != 0) { + device_printf(sc->dev, "cannot detach child devices\n"); + return (error); + } + + if (sc->iicbus != NULL) + device_delete_child(dev, sc->iicbus); + + if (sc->res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329503 - head/stand/liblua
Thanks! I must have mismerged a rebase conflict. On Sat, Feb 17, 2018 at 5:31 PM, Kyle Evans wrote: > Author: kevans > Date: Sun Feb 18 01:31:18 2018 > New Revision: 329503 > URL: https://svnweb.freebsd.org/changeset/base/329503 > > Log: > liblua: Fix missing '}' in lutil.c after r329499 > > Modified: > head/stand/liblua/lutils.c > > Modified: head/stand/liblua/lutils.c > == > --- head/stand/liblua/lutils.c Sun Feb 18 01:21:52 2018(r329502) > +++ head/stand/liblua/lutils.c Sun Feb 18 01:31:18 2018(r329503) > @@ -245,3 +245,4 @@ luaopen_io(lua_State *L) > { > luaL_newlib(L, iolib); > return 1; > +} > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329507 - in head/sys: arm/conf modules modules/imx modules/imx/imx_i2c
Author: ian Date: Sun Feb 18 02:48:54 2018 New Revision: 329507 URL: https://svnweb.freebsd.org/changeset/base/329507 Log: Build modules specific to imx5/imx6 only when building those kernels. This adds sys/modules/imx with a SUBDIR makefile to make the whole collection of modules that are specific to these SoCs. Initially, that "whole collection" consists of the if_ffec and imx_i2c drivers. The if_ffec driver is referenced in its existing home in ../ffec rather than moving it into the imx directory, because it's used by powerpc too, but it is no longer built for all armv6/7 systems. The imx_i2c driver is newly added as a module. Added: head/sys/modules/imx/ head/sys/modules/imx/Makefile (contents, props changed) head/sys/modules/imx/imx_i2c/ head/sys/modules/imx/imx_i2c/Makefile (contents, props changed) Modified: head/sys/arm/conf/IMX53 head/sys/arm/conf/IMX6 head/sys/modules/Makefile Modified: head/sys/arm/conf/IMX53 == --- head/sys/arm/conf/IMX53 Sun Feb 18 02:01:41 2018(r329506) +++ head/sys/arm/conf/IMX53 Sun Feb 18 02:48:54 2018(r329507) @@ -117,6 +117,6 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree optionsFDT # Configure using FDT/DTB data -makeoptionsMODULES_EXTRA=dtb/imx5 +makeoptionsMODULES_EXTRA="dtb/imx5 imx" optionsINTRNG Modified: head/sys/arm/conf/IMX6 == --- head/sys/arm/conf/IMX6 Sun Feb 18 02:01:41 2018(r329506) +++ head/sys/arm/conf/IMX6 Sun Feb 18 02:48:54 2018(r329507) @@ -117,7 +117,7 @@ device hdmi # Flattened Device Tree optionsFDT # Configure using FDT/DTB data -makeoptionsMODULES_EXTRA=dtb/imx6 +makeoptionsMODULES_EXTRA="dtb/imx6 imx" # SoC-specific devices device ffec# Freescale Fast Ethernet Controller Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Sun Feb 18 02:01:41 2018(r329506) +++ head/sys/modules/Makefile Sun Feb 18 02:48:54 2018(r329507) @@ -813,10 +813,6 @@ _bcm283x_clkman= bcm283x_clkman _bcm283x_pwm= bcm283x_pwm .endif -.if ${MACHINE_ARCH:Marmv[67]*} != "" -_ffec= ffec -.endif - SUBDIR+=${MODULES_EXTRA} .for reject in ${WITHOUT_MODULES} Added: head/sys/modules/imx/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/imx/Makefile Sun Feb 18 02:48:54 2018 (r329507) @@ -0,0 +1,8 @@ +# $FreeBSD$ +# Build modules specific to freescale/nxp imx-family SoCs. + +SUBDIR = \ + ../ffec \ + imx_i2c \ + +.include Added: head/sys/modules/imx/imx_i2c/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/imx/imx_i2c/Makefile Sun Feb 18 02:48:54 2018 (r329507) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/arm/freescale/imx + +KMOD= imx_i2c +SRCS= imx_i2c.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + ofw_bus_if.h \ + opt_platform.h \ + +.include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329504 - head/stand/lua
On Sat, Feb 17, 2018 at 5:35 PM, Kyle Evans wrote: > Author: kevans > Date: Sun Feb 18 01:35:46 2018 > New Revision: 329504 > URL: https://svnweb.freebsd.org/changeset/base/329504 > > Log: > stand/lua: More style nits, config.lua > > Some other points I think we need to be consistent on: > - Spacing around string concatenation (always) +1. ".." is just another (infix) operator, and we put spaces around operators. > - Test against 'nil' explicitly rather than relying on 'not' for things that > reasonably won't be returning a boolean. e.g. loader.getenv > > Eventually this will all get formalized somewhere. +1. Ideally sooner rather than later. Maybe a luastyle.9? :-) One thing we've done so far I'm not sold on is parentheses around conditionals. Unlike C, this is not a language requirement, and it isn't common in other lua codebases, e.g., https://github.com/luarocks/lua-style-guide . (Take that guide with a grain of salt — it suggests treating nil as boolean false, which I agree is probably wrong.) Best, Conrad ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r329504 - head/stand/lua
On Sat, Feb 17, 2018 at 8:53 PM, Conrad Meyer wrote: > On Sat, Feb 17, 2018 at 5:35 PM, Kyle Evans wrote: >> Author: kevans >> Date: Sun Feb 18 01:35:46 2018 >> New Revision: 329504 >> URL: https://svnweb.freebsd.org/changeset/base/329504 >> >> Log: >> stand/lua: More style nits, config.lua >> >> Some other points I think we need to be consistent on: >> - Spacing around string concatenation (always) > > +1. ".." is just another (infix) operator, and we put spaces around > operators. > >> - Test against 'nil' explicitly rather than relying on 'not' for things >> that >> reasonably won't be returning a boolean. e.g. loader.getenv >> >> Eventually this will all get formalized somewhere. > > +1. Ideally sooner rather than later. Maybe a luastyle.9? :-) > > One thing we've done so far I'm not sold on is parentheses around > conditionals. Unlike C, this is not a language requirement, and it > isn't common in other lua codebases, e.g., > https://github.com/luarocks/lua-style-guide . (Take that guide with a > grain of salt — it suggests treating nil as boolean false, which I > agree is probably wrong.) I'm definitely not stuck on the idea of parentheses around conditionals, but it was inconsistently done before and I wanted to make some effort to move one way or the other. I started learning lua here [1] and therefore hold no strong position or prior knowledge, so if no-parentheses is the Lua way then I'm all aboard. =) [1] https://svnweb.freebsd.org/base?view=revision&revision=329274 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329508 - in head/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys
Author: mav Date: Sun Feb 18 04:00:29 2018 New Revision: 329508 URL: https://svnweb.freebsd.org/changeset/base/329508 Log: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Added: head/cddl/contrib/opensolaris/cmd/zdb/zdb.h - copied unchanged from r324198, vendor/illumos/dist/cmd/zdb/zdb.h Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c == --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Feb 18 02:48:54 2018 (r329507) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Feb 18 04:00:29 2018 (r329508) @@ -67,6 +67,8 @@ #undef verify #include +#include "zdb.h" + #defineZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ zio_compress_table[(idx)].ci_name : "UNKNOWN") #defineZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ @@ -90,14 +92,13 @@ uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; #endif -const char cmdname[] = "zdb"; +static const char cmdname[] = "zdb"; uint8_t dump_opt[256]; typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); -extern void dump_intent_log(zilog_t *); static uint64_t *zopt_object = NULL; -static int zopt_objects = 0; +static unsigned zopt_objects = 0; static libzfs_handle_t *g_zfs; static uint64_t max_inflight = 1000; @@ -285,8 +286,8 @@ zdb_nicenum(uint64_t num, char *buf, size_t buflen) nicenum(num, buf, sizeof (buf)); } -const char histo_stars[] = ""; -const int histo_width = sizeof (histo_stars) - 1; +static const char histo_stars[] = ""; +static const uint64_t histo_width = sizeof (histo_stars) - 1; static void dump_histogram(const uint64_t *histo, int size, int offset) @@ -392,7 +393,7 @@ dump_unknown(objset_t *os, uint64_t object, void *data } /*ARGSUSED*/ -void +static void dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) { } @@ -410,7 +411,7 @@ dump_zap(objset_t *os, uint64_t object, void *data, si zap_cursor_t zc; zap_attribute_t attr; void *prop; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -573,7 +574,7 @@ dump_sa_layouts(objset_t *os, uint64_t object, void *d zap_cursor_t zc; zap_attribute_t attr; uint16_t *layout_attrs; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -642,7 +643,7 @@ dump_zpldir(objset_t *os, uint64_t object, void *data, zap_cursor_fini(&zc); } -int +static int get_dtl_refcount(vdev_t *vd) { int refcount = 0; @@ -656,18 +657,18 @@ get_dtl_refcount(vdev_t *vd) return (0); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_dtl_refcount(vd->vdev_child[c]); return (refcount); } -int +static int get_metaslab_refcount(vdev_t *vd) { int refcount = 0; if (vd->vdev_top == vd && !vd->vdev_removing) { - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -675,7 +676,7 @@ get_metaslab_refcount(vdev_t *vd) refcount++; } } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_metaslab_refcount(vd->vdev_child[c]); return (refcount); @@ -707,7 +708,7 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", "INVAL