svn commit: r340621 - head/sys/kern
Author: hselasky Date: Mon Nov 19 09:35:16 2018 New Revision: 340621 URL: https://svnweb.freebsd.org/changeset/base/340621 Log: Be more verbose when a sysctl fails to unregister. Print name of sysctl in question. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Mon Nov 19 08:56:34 2018(r340620) +++ head/sys/kern/kern_sysctl.c Mon Nov 19 09:35:16 2018(r340621) @@ -565,8 +565,10 @@ sysctl_unregister_oid(struct sysctl_oid *oidp) * being unloaded afterwards. It should not be a panic() * for normal use. */ - if (error) - printf("%s: failed to unregister sysctl\n", __func__); + if (error) { + printf("%s: failed(%d) to unregister sysctl(%s)\n", + __func__, error, oidp->oid_name); + } } /* Initialize a new context to keep track of dynamically added sysctls. */ ___ 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: r340622 - head/sys/kern
Author: hselasky Date: Mon Nov 19 09:36:09 2018 New Revision: 340622 URL: https://svnweb.freebsd.org/changeset/base/340622 Log: Minor code factoring. No functional change. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Mon Nov 19 09:35:16 2018(r340621) +++ head/sys/kern/kern_sysctl.c Mon Nov 19 09:36:09 2018(r340622) @@ -546,10 +546,10 @@ sysctl_unregister_oid(struct sysctl_oid *oidp) int error; SYSCTL_ASSERT_WLOCKED(); - error = ENOENT; if (oidp->oid_number == OID_AUTO) { error = EINVAL; } else { + error = ENOENT; SLIST_FOREACH(p, oidp->oid_parent, oid_link) { if (p == oidp) { SLIST_REMOVE(oidp->oid_parent, oidp, ___ 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: r340450 - head/sys/sys
On Mon, 19 Nov 2018, Warner Losh wrote: On Mon, Nov 19, 2018 at 12:31 AM Andriy Gapon wrote: On 19/11/2018 03:38, Warner Losh wrote: I'll talk to Allan to see if he can test that. the bare 1 should be handled properly because of C's promotion rules. 1ull << 32 is an unsigned long long. What I really wanted was "~(uint32_t)0" but that construct has bit me in the past. Using the long long abomination is only one of the bugs. Not a critical one. The critical one in this constant is that it is garbage. The correct constant is 2**64 divided by a power of 10. For nanoseconds, the power of 10 os 10**9, and 2**64/10**9 resembles the garbage constant. It is 4.29 times larger. This 4.29 rounded down is SBT_1NS, and it also works to add SBT_1NS outside of the shift... I think that you could just do (unsigned int)-1 or UINT_MAX. Perhaps. This avoids using the abomination, but still uses a garbage constant and the garbage constant is off by 1 relative to the intended garbage constant. As a side note, I wonder if those functions are ever used on negative values, given the type of the argument, and if anyone checked their correctness in that case. I don't think so, but an assert would be good to make sure. I checked them on all valid values. They obviously can't work, since the constant is garbage. Unfortunately, I lost the test program. IIRC, it finds about 80 million out of 1 billion wrong results for nsec precision, 32 out of 1 million wrong for usec precision, and 0 out of 1000 wrong for msec precision. But I think I understand the problem now. mstosbt(1000) is overflowing with my change, but not without because we're adding 2^32 to a number that's ~900 away from overflowing changing a very This value is just invalid. Negative values are obviously invalid. Positive values of more than 1 second are invalid. In the old version, values of precisely 1 second don't overflow since the scale factor is rounded down; the result is just 1 unit lower than 1 second. Overflow (actually truncation) occurs at 1 unit above 1 second. E.g., sbttoms(mstosbt(1000)) was 999 and sbttoms(mstosbt(1001)) was 0. Now in my fixed version, sbttoms(mstosbt(1000)) is truncated to 0 and sbttoms(mstosbt(1001)) is truncated to 1. The test program also showed that in the old version, all valid args except 0 are reduced by precisely 1 by conversion to sbt and back. large sleep of 1 second to a tiny sleep of 0 (which is 1ms at the default Hz). I think we get this in the mlx code because there's a msleep(1000) in at least one place. msleep(1001) would have failed before my change. Now I think msleep(999) works, but msleep(1000) fails. Since the code is waiting a second for hardware to initialize, a 1ms instead is likely to catch the hardware before it's finished. I think this will cause problems no matter cold or not, since it's all pause_sbt() under the covers and a delay of 0 is still 0 either way. Bug in the mlx code. The seconds part must be converted separately, as in tstosbt(). The fix I think is something like: diff --git a/sys/sys/time.h b/sys/sys/time.h index 2207767813f2..00c6bb4a20fb 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -204,8 +204,12 @@ sbttoms(sbintime_t _sbt) static __inline sbintime_t mstosbt(int64_t _ms) { + sbintime_t sb; - return ((_ms * (((uint64_t)1 << 63) / 500) + (1ull << 32) - 1) >> 32); + sb = (_ms / 1000) * SBT_1S; + _ms = _ms % 1000; + sb += (_ms * (((uint64_t)1 << 42) / 1000) + 1023) >> 10; + return (sb); } sbt never supported this. This pessimizes correct code and bloats the functions with divisions. I know too much about this because I wrote similar code for {ts,tv}<->bt conversions but phk disapproved of it and only committed a comment in sys/time.h saying not to do it. The comment forbids doing it for sbt too. However, the comment allows truncation to correct values. The sbt values are truncated to far below the floor of the infinite-precision values, because the scaling is sloppy. The scaling is much sloppier for sbt than for bt since the scale factor is in fixed point with 64 bits for bt but only 32 bits for sbt. 32 bits is barely enough for the error to be only 1 after converting back. This is because SBT_1NS is 4, so nanonseconds can be represented to an accuracy of about 1/4 using sbt; rounding down loses at most 1/4 on the nsec scale so converting back loses at most 1 provided scaling and other rounding steps don't lose several quarters. Here is a working version with too many comments. XX Index: time.h XX === XX --- time.h (revision 340473) XX +++ time.h (working copy) XX @@ -97,11 +97,11 @@ XX { XX uint64_t _p1, _p2; XX XX - _p1 = (_bt->frac & 0xull) * _x; XX +_p1 = (_bt->frac & 0x) * _x; XX _p2 = (_bt->frac >> 32) * _x + (_p1 >> 32); XX _bt->sec *= _x; XX _bt->sec += (_p2 >> 32); XX -_b
Re: svn commit: r340450 - head/sys/sys
On Tue, 20 Nov 2018, Bruce Evans wrote: On Mon, 19 Nov 2018, Warner Losh wrote: On Mon, Nov 19, 2018 at 12:31 AM Andriy Gapon wrote: As a side note, I wonder if those functions are ever used on negative values, given the type of the argument, and if anyone checked their correctness in that case. I don't think so, but an assert would be good to make sure. I checked them on all valid values. They obviously can't work, since the constant is garbage. Unfortunately, I lost the test program. IIRC, it finds about 80 million out of 1 billion wrong results for nsec precision, 32 out of 1 million wrong for usec precision, and 0 out of 1000 wrong for msec precision. I found my test program. But I think I understand the problem now. mstosbt(1000) is overflowing with my change, but not without because we're adding 2^32 to a number that's ~900 away from overflowing changing a very This value is just invalid. Negative values are obviously invalid. Positive values of more than 1 second are invalid. In the old version, values of precisely 1 second don't overflow since the scale factor is rounded down; the result is just 1 unit lower than 1 second. Overflow (actually truncation) occurs at 1 unit above 1 second. E.g., sbttoms(mstosbt(1000)) was 999 and sbttoms(mstosbt(1001)) was 0. Now in my fixed version, sbttoms(mstosbt(1000)) is truncated to 0 and sbttoms(mstosbt(1001)) is truncated to 1. The test program also showed that in the old version, all valid args except 0 are reduced by precisely 1 by conversion to sbt and back. large sleep of 1 second to a tiny sleep of 0 (which is 1ms at the default Hz). I think we get this in the mlx code because there's a msleep(1000) in at least one place. msleep(1001) would have failed before my change. Now I think msleep(999) works, but msleep(1000) fails. Since the code is waiting a second for hardware to initialize, a 1ms instead is likely to catch the hardware before it's finished. I think this will cause problems no matter cold or not, since it's all pause_sbt() under the covers and a delay of 0 is still 0 either way. Bug in the mlx code. The seconds part must be converted separately, as in tstosbt(). mlx doesn't seem to use sbt directly, or even msleep(), so the bug does seem to be central. mlx actually uses mtx_sleep() with timo = hz(). mtx_sleep() is actually an obfuscated macro wrapping _sleep(). The conversion to sbt is done by the macro and is sloppy. It multiplies timo by tick_sbt. tick_sbt is SBT_1S / hz, so the sbt is SBT_1S / hz * hz which is SBT_1S reduced a little. This is not affected by the new code, and it still isn't converted back to 1 second in ms, us or ns. Even if it is converted back and then forth to sbt using the new code, it remains less than 1 second as an sbt so shouldn't cause any new problems. Here is the test program: XX /* Test decimal<->sbt conversions. */ XX XX #include XX XX #include XX XX int XX main(int argc, char **argcv) XX { XX uint64_t sbt; XX int i, j, wrong; XX XX wrong = 0; XX for (i = 0; i < 1000; i++) { XX sbt = mstosbt(i); XX j = sbttoms(sbt); XX if (i != j) { XX wrong++; XX if (argc > 1) XX printf("%d -> %#jx -> %d\n", XX i, (uintmax_t)sbt, j); XX } XX } XX printf("%d wrong values for ms\n", wrong); XX XX wrong = 0; XX for (i = 0; i < 100; i++) { XX sbt = ustosbt(i); XX j = sbttous(sbt); XX if (i != j) { XX wrong++; XX if (argc > 1) XX printf("%d -> %#jx -> %d\n", XX i, (uintmax_t)sbt, j); XX } XX } XX printf("%d wrong values for us\n", wrong); XX XX wrong = 0; XX for (i = 0; i < 10; i++) { XX sbt = nstosbt(i); XX j = sbttons(sbt); XX if (i != j) { XX wrong++; XX if (argc > 1) XX printf("%d -> %#jx -> %d\n", XX i, (uintmax_t)sbt, j); XX } XX } XX printf("%d wrong values for ns\n", wrong); XX } Output: 0 wrong values for ms 32 wrong values for us 82602428 wrong values for ns Bruce ___ 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: r340631 - head/sys/compat/linux
Author: tijl Date: Mon Nov 19 15:31:54 2018 New Revision: 340631 URL: https://svnweb.freebsd.org/changeset/base/340631 Log: Do proper copyin of control message data in the Linux sendmsg syscall. Instead of calling m_append with a user address, allocate an mbuf cluster and copy data into it using copyin. For the SCM_CREDS case, instead of zeroing a stack variable and appending that to the mbuf, zero part of the mbuf cluster directly. One mbuf cluster is also the size limit used by the FreeBSD sendmsg syscall (uipc_syscalls.c:sockargs()). PR: 217901 Reviewed by: kib MFC after:3 days Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cMon Nov 19 15:29:40 2018 (r340630) +++ head/sys/compat/linux/linux_socket.cMon Nov 19 15:31:54 2018 (r340631) @@ -1085,7 +1085,6 @@ linux_sendmsg_common(struct thread *td, l_int s, struc l_uint flags) { struct cmsghdr *cmsg; - struct cmsgcred cmcred; struct mbuf *control; struct msghdr msg; struct l_cmsghdr linux_cmsg; @@ -1096,6 +1095,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc struct sockaddr *sa; sa_family_t sa_family; void *data; + l_size_t len; int error; error = copyin(msghdr, &linux_msg, sizeof(linux_msg)); @@ -1126,7 +1126,6 @@ linux_sendmsg_common(struct thread *td, l_int s, struc return (error); control = NULL; - cmsg = NULL; if ((ptr_cmsg = LINUX_CMSG_FIRSTHDR(&linux_msg)) != NULL) { error = kern_getsockname(td, s, &sa, &datalen); @@ -1136,8 +1135,10 @@ linux_sendmsg_common(struct thread *td, l_int s, struc free(sa, M_SONAME); error = ENOBUFS; - cmsg = malloc(CMSG_HDRSZ, M_LINUX, M_WAITOK|M_ZERO); control = m_get(M_WAITOK, MT_CONTROL); + MCLGET(control, M_WAITOK); + data = mtod(control, void *); + datalen = 0; do { error = copyin(ptr_cmsg, &linux_cmsg, @@ -1149,10 +1150,14 @@ linux_sendmsg_common(struct thread *td, l_int s, struc if (linux_cmsg.cmsg_len < sizeof(struct l_cmsghdr)) goto bad; + if (datalen + CMSG_HDRSZ > MCLBYTES) + goto bad; + /* * Now we support only SCM_RIGHTS and SCM_CRED, * so return EINVAL in any other cmsg_type */ + cmsg = data; cmsg->cmsg_type = linux_to_bsd_cmsg_type(linux_cmsg.cmsg_type); cmsg->cmsg_level = @@ -1170,35 +1175,34 @@ linux_sendmsg_common(struct thread *td, l_int s, struc if (sa_family != AF_UNIX) continue; - data = LINUX_CMSG_DATA(ptr_cmsg); - datalen = linux_cmsg.cmsg_len - L_CMSG_HDRSZ; + if (cmsg->cmsg_type == SCM_CREDS) { + len = sizeof(struct cmsgcred); + if (datalen + CMSG_SPACE(len) > MCLBYTES) + goto bad; - switch (cmsg->cmsg_type) - { - case SCM_RIGHTS: - break; - - case SCM_CREDS: - data = &cmcred; - datalen = sizeof(cmcred); - /* * The lower levels will fill in the structure */ - bzero(data, datalen); - break; + memset(CMSG_DATA(data), 0, len); + } else { + len = linux_cmsg.cmsg_len - L_CMSG_HDRSZ; + if (datalen + CMSG_SPACE(len) < datalen || + datalen + CMSG_SPACE(len) > MCLBYTES) + goto bad; + + error = copyin(LINUX_CMSG_DATA(ptr_cmsg), + CMSG_DATA(data), len); + if (error != 0) + goto bad; } - cmsg->cmsg_len = CMSG_LEN(datalen); - - error = ENOBUFS; - if (!m_append(control, CMSG_HDRSZ, (c_caddr_t)cmsg)) - goto bad; - if (!m_append(control, datalen, (c_caddr_t)data)) -
svn commit: r340632 - head/sys/powerpc/conf
Author: zeising (doc,ports committer) Date: Mon Nov 19 15:36:58 2018 New Revision: 340632 URL: https://svnweb.freebsd.org/changeset/base/340632 Log: Enable evdev on ppc64 Enable evdev on ppc64 as well, similar to what was done for amd64 and i386 in r340387. Evdev can be used by X and is used by wayland to handle input devices. Approved by: mmacy MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D18026 Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Mon Nov 19 15:31:54 2018 (r340631) +++ head/sys/powerpc/conf/GENERIC64 Mon Nov 19 15:36:58 2018 (r340632) @@ -246,3 +246,8 @@ device snd_uaudio # USB Audio # Netmap provides direct access to TX/RX rings on supported NICs device netmap # netmap(4) support + +# evdev interface +optionsEVDEV_SUPPORT # evdev support in legacy drivers +device evdev # input event device support +device uinput # install /dev/uinput cdev ___ 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: r340632 - head/sys/powerpc/conf
On Mon, 19 Nov 2018 15:36:58 + (UTC) Niclas Zeising wrote: > Author: zeising (doc,ports committer) > Date: Mon Nov 19 15:36:58 2018 > New Revision: 340632 > URL: https://svnweb.freebsd.org/changeset/base/340632 > > Log: > Enable evdev on ppc64 > > Enable evdev on ppc64 as well, similar to what was done for amd64 > and i386 in r340387. > > Evdev can be used by X and is used by wayland to handle input > devices. > Approved by:mmacy > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D18026 > > Modified: > head/sys/powerpc/conf/GENERIC64 > > Modified: head/sys/powerpc/conf/GENERIC64 > == > --- head/sys/powerpc/conf/GENERIC64 Mon Nov 19 15:31:54 > 2018 (r340631) +++ head/sys/powerpc/conf/GENERIC64 Mon > Nov 19 15:36:58 2018 (r340632) @@ -246,3 +246,8 @@ > devicesnd_uaudio # USB Audio > # Netmap provides direct access to TX/RX rings on supported NICs > device netmap # netmap(4) support > + > +# evdev interface > +options EVDEV_SUPPORT # evdev support in > legacy drivers +deviceevdev # > input event device support +device > uinput# install /dev/uinput cdev > Is there a reason this is only in GENERIC64, not GENERIC as well? Does it not compile for 32-bit powerpc? - Justin ___ 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: r339476 - head/sys/i386/conf
On 10/20/18 9:16 PM, Conrad Meyer wrote: Author: cem Date: Sat Oct 20 19:16:43 2018 New Revision: 339476 URL: https://svnweb.freebsd.org/changeset/base/339476 Log: Add a MINIMAL config for i386, based on amd64 Any plans to MFC this? Regards -- Niclas Zeising ___ 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: r340450 - head/sys/sys
On Tue, 20 Nov 2018, Bruce Evans wrote: On Tue, 20 Nov 2018, Bruce Evans wrote: On Mon, 19 Nov 2018, Warner Losh wrote: On Mon, Nov 19, 2018 at 12:31 AM Andriy Gapon wrote: ... I found my test program. But I think I understand the problem now. mstosbt(1000) is overflowing with my change, but not without because we're adding 2^32 to a number that's ~900 away from overflowing changing a very This value is just invalid. Negative values are obviously invalid. Positive values of more than 1 second are invalid. In the old version, values of precisely 1 second don't overflow since the scale factor is rounded down; the result is just 1 unit lower than 1 second. Overflow (actually truncation) occurs at 1 unit above 1 second. E.g., sbttoms(mstosbt(1000)) was 999 and sbttoms(mstosbt(1001)) was 0. Now in my fixed version, sbttoms(mstosbt(1000)) is truncated to 0 and sbttoms(mstosbt(1001)) is truncated to 1. The test program also showed that in the old version, all valid args except 0 are reduced by precisely 1 by conversion to sbt and back. large sleep of 1 second to a tiny sleep of 0 (which is 1ms at the default Hz). I think we get this in the mlx code because there's a msleep(1000) in at least one place. msleep(1001) would have failed before my change. Now I think msleep(999) works, but msleep(1000) fails. Since the code is waiting a second for hardware to initialize, a 1ms instead is likely to catch the hardware before it's finished. I think this will cause problems no matter cold or not, since it's all pause_sbt() under the covers and a delay of 0 is still 0 either way. Bug in the mlx code. The seconds part must be converted separately, as in tstosbt(). mlx doesn't seem to use sbt directly, or even msleep(), so the bug does seem to be central. mlx actually uses mtx_sleep() with timo = hz(). mtx_sleep() is actually an obfuscated macro wrapping _sleep(). The conversion to sbt is done by the macro and is sloppy. It multiplies timo by tick_sbt. tick_sbt is SBT_1S / hz, so the sbt is SBT_1S / hz * hz which is SBT_1S reduced a little. This is not affected by the new code, and it still isn't converted back to 1 second in ms, us or ns. Even if it is converted back and then forth to sbt using the new code, it remains less than 1 second as an sbt so shouldn't cause any new problems. Here are all uses of these functions in kern outside of sys/time.h: XX arm/arm/mpcore_timer.c: sc->et.et_min_period = nstosbt(20); OK since 20 ns is less than 1 second. XX cddl/compat/opensolaris/sys/kcondvar.h: return (cv_timedwait_sbt(cvp, mp, nstosbt(tim), nstosbt(res), 0)); XX cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c: pause_sbt("dmu_tx_delay", nstosbt(wakeup), XX cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c: nstosbt(zfs_delay_resolution_ns), C_ABSOLUTE); XX cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c:sbintime_t sleep = nstosbt((zilog->zl_last_lwb_latency * pct) / 100); XX compat/linuxkpi/common/include/linux/delay.h:pause_sbt("lnxsleep", mstosbt(ms), 0, C_HARDCLOCK); XX compat/linuxkpi/common/src/linux_hrtimer.c: nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0); XX compat/linuxkpi/common/src/linux_hrtimer.c: callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(time)), XX compat/linuxkpi/common/src/linux_hrtimer.c: nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); XX compat/linuxkpi/common/src/linux_hrtimer.c: callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(interval)), XX compat/linuxkpi/common/src/linux_hrtimer.c: nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, 0); XX compat/linuxkpi/common/src/linux_schedule.c: ret = -pause_sbt("lnxsleep", mstosbt(ms), 0, C_HARDCLOCK | C_CATCH); All of the above might are broken unless their timeout arg is restricted to less than 1 second. Also, at least the sleep and pause calls in the above probably have a style bug in knowing about sbt's at all. More important functions like msleep() hide the use of sbt's and use fuzzier scale factors like tick_sbt. XX dev/iicbus/nxprtc.c: pause_sbt("nxpotp", mstosbt(100), mstosbt(10), 0); XX dev/iicbus/nxprtc.c: pause_sbt("nxpbat", mstosbt(100), 0, 0); OK since 100 ms is less than 1 second. XX kern/kern_sysctl.c: sb = ustosbt(tt); XX kern/kern_sysctl.c: sb = mstosbt(tt); Recently added bugs. The args is supplied by applications so can be far above 1 second. Also, these functions have a bogus API that takes uint64_t args. sbt's can't represent that high, and the API doesn't support failure, so callers have the burden of passing valid values. It is easiest to only support args up to 1 second and require the caller to handle seconds. Lots of itimer and select() code handle the corresponding problem for timevals and timespecs almost correctly. Timevals and timespecs already have the seconds part separate and itimer and select() syscalls do validity checking on the fractio
Re: svn commit: r340632 - head/sys/powerpc/conf
On 11/19/18 4:42 PM, Justin Hibbits wrote: On Mon, 19 Nov 2018 15:36:58 + (UTC) Niclas Zeising wrote: Author: zeising (doc,ports committer) Date: Mon Nov 19 15:36:58 2018 New Revision: 340632 URL: https://svnweb.freebsd.org/changeset/base/340632 Log: Enable evdev on ppc64 Enable evdev on ppc64 as well, similar to what was done for amd64 and i386 in r340387. Evdev can be used by X and is used by wayland to handle input devices. Approved by: mmacy MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18026 Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Mon Nov 19 15:31:54 2018(r340631) +++ head/sys/powerpc/conf/GENERIC64 Mon Nov 19 15:36:58 2018(r340632) @@ -246,3 +246,8 @@ device snd_uaudio # USB Audio # Netmap provides direct access to TX/RX rings on supported NICs devicenetmap # netmap(4) support + +# evdev interface +optionsEVDEV_SUPPORT # evdev support in legacy drivers +device evdev # input event device support +device uinput # install /dev/uinput cdev Is there a reason this is only in GENERIC64, not GENERIC as well? Does it not compile for 32-bit powerpc? - Justin Hi! mmacy only asked about ppc64, and as far as I know it's only tested there. I can create a patch for ppc32 as well, but I can't test myself. Regards -- Niclas Zeising ___ 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: r340363 - in head: . contrib/tcpdump contrib/traceroute lib/libcasper/services/cap_dns lib/libcasper/services/cap_dns/tests sbin/ping
On Mon, 12 Nov 2018 at 10:53, Mariusz Zaborski wrote: > > Author: oshogbo > Date: Mon Nov 12 15:52:45 2018 > New Revision: 340363 > URL: https://svnweb.freebsd.org/changeset/base/340363 > > Log: > libcasper: [ch]ange the name of limits in cap_dns so the intentions are > obvious. Mariusz and I discussed this on IRC but for the sake of the archives this breaks applications with existing calls to cap_dns_type_limit using the old names - e.g., upstream tcpdump. As tcpdump is the only out-of-tree consumer of cap_dns_type_limit that I'm aware of we could probably fix this by submitting a patch to tcpdump to add a configure test or a __FreeBSD_version conditional. However, it seems easiest to just allow either string in cap_dns. ___ 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: r340635 - head/lib/libbe
Author: kevans Date: Mon Nov 19 16:47:21 2018 New Revision: 340635 URL: https://svnweb.freebsd.org/changeset/base/340635 Log: libbe(3): Handle non-ZFS rootfs better If rootfs isn't ZFS, current version will emit an error claiming so and fail to initialize libbe. As a consumer, bectl -r (undocumented) can be specified to operate on a BE independently of whether on a UFS or ZFS root. Unbreak this for the UFS case by only erroring out the init if we can't determine a ZFS dataset for rootfs and no BE root was specified. Consumers of libbe should take care to ensure that rootfs is non-empty if they're trying to use it, because this could certainly be the case. Some check is needed before zfs_path_to_zhandle because it will unconditionally emit to stderr if the path isn't a ZFS filesystem, which is unhelpful for our purposes. This should also unbreak the bectl(8) tests on a UFS root, as is the case in Jenkins' -test runs. MFC after:3 days Modified: head/lib/libbe/be.c Modified: head/lib/libbe/be.c == --- head/lib/libbe/be.c Mon Nov 19 16:40:19 2018(r340634) +++ head/lib/libbe/be.c Mon Nov 19 16:47:21 2018(r340635) @@ -58,8 +58,22 @@ static int be_create_child_cloned(libbe_handle_t *lbh, static int be_locate_rootfs(libbe_handle_t *lbh) { + struct statfs sfs; + struct extmnttab entry; zfs_handle_t *zfs; + /* +* Check first if root is ZFS; if not, we'll bail on rootfs capture. +* Unfortunately needed because zfs_path_to_zhandle will emit to +* stderr if / isn't actually a ZFS filesystem, which we'd like +* to avoid. +*/ + if (statfs("/", &sfs) == 0) { + statfs2mnttab(&sfs, &entry); + if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) + return (1); + } else + return (1); zfs = zfs_path_to_zhandle(lbh->lzh, "/", ZFS_TYPE_FILESYSTEM); if (zfs == NULL) return (1); @@ -93,8 +107,11 @@ libbe_init(const char *root) * Grab rootfs, we'll work backwards from there if an optional BE root * has not been passed in. */ - if (be_locate_rootfs(lbh) != 0) - goto err; + if (be_locate_rootfs(lbh) != 0) { + if (root == NULL) + goto err; + *lbh->rootfs = '\0'; + } if (root == NULL) { /* Strip off the final slash from rootfs to get the be root */ strlcpy(lbh->root, lbh->rootfs, sizeof(lbh->root)); ___ 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: r340636 - head/sbin/bectl/tests
Author: kevans Date: Mon Nov 19 17:09:57 2018 New Revision: 340636 URL: https://svnweb.freebsd.org/changeset/base/340636 Log: bectl(8) tests: attempt to load the ZFS module Observed in a CI test image, bectl_create test will run and be marked as skipped because the module is not loaded. The first zpool invocation will automagically load the module, but bectl_create is still skipped. Subsequent tests all pass as expected because the module is now loaded and everything is OK. MFC after:3 days Modified: head/sbin/bectl/tests/bectl_test.sh Modified: head/sbin/bectl/tests/bectl_test.sh == --- head/sbin/bectl/tests/bectl_test.sh Mon Nov 19 16:47:21 2018 (r340635) +++ head/sbin/bectl/tests/bectl_test.sh Mon Nov 19 17:09:57 2018 (r340636) @@ -34,7 +34,7 @@ bectl_create_setup() disk=$2 mnt=$3 - kldstat -qm zfs || atf_skip "ZFS module not loaded on the current system" + kldload -n -q zfs || atf_skip "ZFS module not loaded on the current system" atf_check mkdir -p ${mnt} atf_check truncate -s 1G ${disk} atf_check zpool create -o altroot=${mnt} ${zpool} ${disk} ___ 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: r340637 - head/sys/vm
Author: alc Date: Mon Nov 19 17:17:23 2018 New Revision: 340637 URL: https://svnweb.freebsd.org/changeset/base/340637 Log: Use swp_pager_isondev() throughout. Submitted by: o...@j.email.ne.jp Change swp_pager_isondev()'s return type to bool. Reviewed by: kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D16712 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cMon Nov 19 17:09:57 2018(r340636) +++ head/sys/vm/swap_pager.cMon Nov 19 17:17:23 2018(r340637) @@ -756,7 +756,7 @@ done: return (blk); } -static int +static bool swp_pager_isondev(daddr_t blk, struct swdevt *sp) { @@ -770,7 +770,7 @@ swp_pager_strategy(struct buf *bp) mtx_lock(&sw_dev_mtx); TAILQ_FOREACH(sp, &swtailq, sw_list) { - if (bp->b_blkno >= sp->sw_first && bp->b_blkno < sp->sw_end) { + if (swp_pager_isondev(bp->b_blkno, sp)) { mtx_unlock(&sw_dev_mtx); if ((sp->sw_flags & SW_UNMAPPED) != 0 && unmapped_buf_allowed) { @@ -804,7 +804,7 @@ swp_pager_freeswapspace(daddr_t blk, daddr_t npages) return; mtx_lock(&sw_dev_mtx); TAILQ_FOREACH(sp, &swtailq, sw_list) { - if (blk >= sp->sw_first && blk < sp->sw_end) { + if (swp_pager_isondev(blk, sp)) { sp->sw_used -= npages; /* * If we are attempting to stop swapping on ___ 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: r340638 - head/lib/libcasper/services/cap_dns
Author: oshogbo Date: Mon Nov 19 17:22:52 2018 New Revision: 340638 URL: https://svnweb.freebsd.org/changeset/base/340638 Log: libcasper: provide compatibility with the old version of service Some external tools like tcpdump(1) have upstream the changes with old limits name. Because of that provide compatibility with the old names. Reported by: emaste Modified: head/lib/libcasper/services/cap_dns/cap_dns.c Modified: head/lib/libcasper/services/cap_dns/cap_dns.c == --- head/lib/libcasper/services/cap_dns/cap_dns.c Mon Nov 19 17:17:23 2018(r340637) +++ head/lib/libcasper/services/cap_dns/cap_dns.c Mon Nov 19 17:22:52 2018(r340638) @@ -474,7 +474,8 @@ dns_gethostbyname(const nvlist_t *limits, const nvlist struct hostent *hp; int family; - if (!dns_allowed_type(limits, "NAME2ADDR")) + if (!dns_allowed_type(limits, "NAME2ADDR") && + !dns_allowed_type(limits, "NAME")) return (NO_RECOVERY); family = (int)nvlist_get_number(nvlin, "family"); @@ -498,7 +499,8 @@ dns_gethostbyaddr(const nvlist_t *limits, const nvlist size_t addrsize; int family; - if (!dns_allowed_type(limits, "ADDR2NAME")) + if (!dns_allowed_type(limits, "ADDR2NAME") && + !dns_allowed_type(limits, "ADDR")) return (NO_RECOVERY); family = (int)nvlist_get_number(nvlin, "family"); @@ -524,7 +526,8 @@ dns_getnameinfo(const nvlist_t *limits, const nvlist_t socklen_t salen; int error, flags; - if (!dns_allowed_type(limits, "ADDR2NAME")) + if (!dns_allowed_type(limits, "ADDR2NAME") && + !dns_allowed_type(limits, "ADDR")) return (NO_RECOVERY); error = 0; @@ -617,7 +620,8 @@ dns_getaddrinfo(const nvlist_t *limits, const nvlist_t unsigned int ii; int error, family, n; - if (!dns_allowed_type(limits, "NAME2ADDR")) + if (!dns_allowed_type(limits, "NAME2ADDR") && + !dns_allowed_type(limits, "NAME")) return (NO_RECOVERY); hostname = dnvlist_get_string(nvlin, "hostname", NULL); @@ -703,7 +707,9 @@ dns_limit(const nvlist_t *oldlimits, const nvlist_t *n return (EINVAL); type = nvlist_get_string(newlimits, name); if (strcmp(type, "ADDR2NAME") != 0 && - strcmp(type, "NAME2ADDR") != 0) { + strcmp(type, "NAME2ADDR") != 0 && + strcmp(type, "ADDR") != 0 && + strcmp(type, "NAME") != 0) { return (EINVAL); } if (!dns_allowed_type(oldlimits, type)) ___ 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: r333263 - in head: lib/libjail sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs sys/compat/linsysfs sys/fs/devfs sys/fs/fdescfs sys/fs/nullfs sys/fs/procfs sys/fs/ps
On Fri, Nov 16, 2018 at 7:16 PM James Gritton wrote: > On 2018-11-16 16:30, Alan Somers wrote: > > On Fri, Nov 16, 2018 at 2:28 PM James Gritton wrote: > >> On 2018-11-16 10:34, Alan Somers wrote: >> >> On Fri, May 4, 2018 at 2:54 PM Jamie Gritton wrote: >> >>> Author: jamie >>> Date: Fri May 4 20:54:27 2018 >>> New Revision: 333263 >>> URL: https://svnweb.freebsd.org/changeset/base/333263 >>> >>> Log: >>> Make it easier for filesystems to count themselves as jail-enabled, >>> by doing most of the work in a new function prison_add_vfs in >>> kern_jail.c >>> Now a jail-enabled filesystem need only mark itself with VFCF_JAIL, and >>> the rest is taken care of. This includes adding a jail parameter like >>> allow.mount.foofs, and a sysctl like security.jail.mount_foofs_allowed. >>> Both of these used to be a static list of known filesystems, with >>> predefined permission bits. >>> >>> Reviewed by: kib >>> Differential Revision:D14681 >>> >>> Modified: >>> head/lib/libjail/jail.c >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c >>> head/sys/compat/linprocfs/linprocfs.c >>> head/sys/compat/linsysfs/linsysfs.c >>> head/sys/fs/devfs/devfs_vfsops.c >>> head/sys/fs/fdescfs/fdesc_vfsops.c >>> head/sys/fs/nullfs/null_vfsops.c >>> head/sys/fs/procfs/procfs.c >>> head/sys/fs/pseudofs/pseudofs.h >>> head/sys/fs/tmpfs/tmpfs_vfsops.c >>> head/sys/kern/kern_jail.c >>> head/sys/kern/vfs_init.c >>> head/sys/kern/vfs_mount.c >>> head/sys/kern/vfs_subr.c >>> head/sys/sys/jail.h >>> head/sys/sys/mount.h >>> head/usr.sbin/jail/jail.8 >>> >>> Modified: head/lib/libjail/jail.c >>> >>> == >>> --- head/lib/libjail/jail.c Fri May 4 20:38:26 2018(r333262) >>> +++ head/lib/libjail/jail.c Fri May 4 20:54:27 2018(r333263) >>> @@ -1048,7 +1048,13 @@ kldload_param(const char *name) >>> else if (strcmp(name, "sysvmsg") == 0 || strcmp(name, "sysvsem") >>> == 0 || >>> strcmp(name, "sysvshm") == 0) >>> kl = kldload(name); >>> - else { >>> + else if (strncmp(name, "allow.mount.", 12) == 0) { >>> + /* Load the matching filesystem */ >>> + kl = kldload(name + 12); >>> + if (kl < 0 && errno == ENOENT && >>> + strncmp(name + 12, "no", 2) == 0) >>> + kl = kldload(name + 14); >>> + } else { >>> errno = ENOENT; >>> return (-1); >>> } >>> >> I'm curious about this part of the change. Why is it necessary to load >> the module in the "allow.mount.noXXXfs" case, when the jail is forbidden to >> mount the filesystem? It seems like that would just load modules that >> aren't going to be used. >> Additional discussion at https://github.com/iocage/iocage/issues/689 . >> -Alan >> >> Presumably such a parameter would be included in some jails in >> conjunction with the positive being included in others (perhaps as a >> default). The truth is I never really considered whether the "no" option >> would be used, I just always treat these option as pairs. >> It may be reasonable (at least in the allow.mount.* case) to silently >> disregard a "no" option that doesn't exist, but I don't know how many >> places would need to be modified for that to go smoothly. Though I don't >> expect that there would be too many people who bother to include a jail >> parameter about a filesystem which they're not planning to use. >> - Jamie >> > > Well, many people use the "no" option because one of the most popular jail > managers, iocage, uses it under the hood. But since "no" is the default, > its presence on the command line is a noop. Are there any situations in > which the "no" option has an effect? The only two possibilities I could > think of were: > > 1) Somebody puts both the positive and negative options on the same > command line. From experiment, it seems like the last option takes > effect. In this case, the presence of the positive option would cause the > kld to be loaded, regardless of the presence of the negative option. > 2) When using hierarchical jails, it might make sense to use the positive > option for the outer jail and the negative option for the inner jail. But > this would only be important if the inner jail inherited the outer jail's > parameters, which doesn't seem to be the case. > > So I can't think of any reason to continue to mount the kld for "no" > options. Can you? > > > 3) There's allow.mount.foofs as a global parameter, with some jails > overriding that with a jail-specific allow.mount.nofoofs. In that case, > KLD loading shouldn't be a problem as global parameters typically come > first. > > It makes sense not to load a KLD for a "no" option, as long as that option > is then silently ignored. I wouldn't want it to error out with "unknown > parameter". > See also https://gi
svn commit: r340639 - head/sys/fs/fuse
Author: markj Date: Mon Nov 19 17:33:44 2018 New Revision: 340639 URL: https://svnweb.freebsd.org/changeset/base/340639 Log: Remove comments made obsolete by the ino64 work. MFC after:3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/fuse/fuse_internal.c head/sys/fs/fuse/fuse_internal.h Modified: head/sys/fs/fuse/fuse_internal.c == --- head/sys/fs/fuse/fuse_internal.cMon Nov 19 17:22:52 2018 (r340638) +++ head/sys/fs/fuse/fuse_internal.cMon Nov 19 17:33:44 2018 (r340639) @@ -350,7 +350,7 @@ fuse_internal_readdir_processdata(struct uio *uio, fiov_adjust(cookediov, bytesavail); de = (struct dirent *)cookediov->base; - de->d_fileno = fudge->ino; /* XXX: truncation */ + de->d_fileno = fudge->ino; de->d_reclen = bytesavail; de->d_type = fudge->type; de->d_namlen = fudge->namelen; Modified: head/sys/fs/fuse/fuse_internal.h == --- head/sys/fs/fuse/fuse_internal.hMon Nov 19 17:22:52 2018 (r340638) +++ head/sys/fs/fuse/fuse_internal.hMon Nov 19 17:33:44 2018 (r340639) @@ -212,7 +212,7 @@ fuse_internal_attr_fat2vat(struct mount *mp, vattr_null(vap); vap->va_fsid = mp->mnt_stat.f_fsid.val[0]; -vap->va_fileid = fat->ino; /* XXX cast from 64 bits to 32 */ +vap->va_fileid = fat->ino; vap->va_mode = fat->mode & ~S_IFMT; vap->va_nlink = fat->nlink; vap->va_uid = fat->uid; ___ 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: r340640 - head/lib/libc
Author: emaste Date: Mon Nov 19 18:12:39 2018 New Revision: 340640 URL: https://svnweb.freebsd.org/changeset/base/340640 Log: libc: forcibly disable BIND_NOW Building libc WITH_BIND_NOW results in segfault at process start. For now force BIND_NOW off until the root cause can be identified and fixed. PR: 23 Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/Makefile Modified: head/lib/libc/Makefile == --- head/lib/libc/Makefile Mon Nov 19 17:33:44 2018(r340639) +++ head/lib/libc/Makefile Mon Nov 19 18:12:39 2018(r340640) @@ -6,6 +6,8 @@ SHLIBDIR?= /lib .include +# BIND_NOW in libc results in segfault at startup (PR 23) +MK_BIND_NOW= no # Force building of libc_pic.a MK_TOOLCHAIN= yes ___ 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: r340641 - head/lib/libc/gen
Author: trasz Date: Mon Nov 19 18:23:17 2018 New Revision: 340641 URL: https://svnweb.freebsd.org/changeset/base/340641 Log: Make sysconf(_SC_PAGESIZE) return the value from getpagesize(3). That avoids a syscall - getpagesize(3) gets the value from the ELF aux strings. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D17989 Modified: head/lib/libc/gen/sysconf.c Modified: head/lib/libc/gen/sysconf.c == --- head/lib/libc/gen/sysconf.c Mon Nov 19 18:12:39 2018(r340640) +++ head/lib/libc/gen/sysconf.c Mon Nov 19 18:23:17 2018(r340641) @@ -291,10 +291,7 @@ do_NAME_MAX: mib[1] = CTL_P1003_1B_MQ_OPEN_MAX; goto yesno; case _SC_PAGESIZE: - defaultresult = getpagesize(); - mib[0] = CTL_P1003_1B; - mib[1] = CTL_P1003_1B_PAGESIZE; - goto yesno; + return (getpagesize()); case _SC_RTSIG_MAX: mib[0] = CTL_P1003_1B; mib[1] = CTL_P1003_1B_RTSIG_MAX; ___ 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: r340642 - head/lib/libthr/thread
Author: trasz Date: Mon Nov 19 18:24:08 2018 New Revision: 340642 URL: https://svnweb.freebsd.org/changeset/base/340642 Log: Make libthr(3) use sysconf(_SC_NPROCESSORS_CONF); this shaves off two calls to sysctl(2) from the binary startup. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D18046 Modified: head/lib/libthr/thread/thr_init.c Modified: head/lib/libthr/thread/thr_init.c == --- head/lib/libthr/thread/thr_init.c Mon Nov 19 18:23:17 2018 (r340641) +++ head/lib/libthr/thread/thr_init.c Mon Nov 19 18:24:08 2018 (r340642) @@ -474,8 +474,9 @@ init_private(void) PANIC("Cannot get stack rlimit"); _thr_stack_initial = rlim.rlim_cur; } - len = sizeof(_thr_is_smp); - sysctlbyname("kern.smp.cpus", &_thr_is_smp, &len, NULL, 0); + _thr_is_smp = sysconf(_SC_NPROCESSORS_CONF); + if (_thr_is_smp == -1) + PANIC("Cannot get _SC_NPROCESSORS_CONF"); _thr_is_smp = (_thr_is_smp > 1); _thr_page_size = getpagesize(); _thr_guard_default = _thr_page_size; ___ 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: r340644 - in head/sys: dev/acpica kern sys
Author: bwidawsk Date: Mon Nov 19 18:29:03 2018 New Revision: 340644 URL: https://svnweb.freebsd.org/changeset/base/340644 Log: acpi: fix acpi_ec_probe to only check EC devices This patch utilizes the fixed_devclass attribute in order to make sure other acpi devices with params don't get confused for an EC device. The existing code assumes that acpi_ec_probe is only ever called with a dereferencable acpi param. Aside from being incorrect because other devices of ACPI_TYPE_DEVICE may be probed here which aren't ec devices, (and they may have set acpi private data), it is even more nefarious if another ACPI driver uses private data which is not dereferancable. This will result in a pointer deref during boot and therefore boot failure. On X86, as it stands today, no other devices actually do this (acpi_cpu checks for PROCESSOR type devices) and so there is no issue. I ran into this because I am adding such a device which gets probed before acpi_ec_probe and sets private data. If ARM ever has an EC, I think they'd run into this issue as well. There have been several iterations of this patch. Earlier iterations had ECDT enumerated ECs not call into the probe/attach functions of this driver. This change was Suggested by: jhb@. Reviewed by:jhb Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D16635 Modified: head/sys/dev/acpica/acpi_ec.c head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/dev/acpica/acpi_ec.c == --- head/sys/dev/acpica/acpi_ec.c Mon Nov 19 18:26:11 2018 (r340643) +++ head/sys/dev/acpica/acpi_ec.c Mon Nov 19 18:29:03 2018 (r340644) @@ -345,92 +345,95 @@ acpi_ec_probe(device_t dev) struct acpi_ec_params *params; static char *ec_ids[] = { "PNP0C09", NULL }; +ret = ENXIO; + /* Check that this is a device and that EC is not disabled. */ if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec")) - return (ENXIO); + return (ret); -/* - * If probed via ECDT, set description and continue. Otherwise, - * we can access the namespace and make sure this is not a - * duplicate probe. - */ -ret = ENXIO; -ecdt = 0; +if (device_is_devclass_fixed(dev)) { + /* +* If probed via ECDT, set description and continue. Otherwise, we can +* access the namespace and make sure this is not a duplicate probe. +*/ +ecdt = 1; +params = acpi_get_private(dev); + if (params != NULL) + ret = 0; + + goto out; +} + +ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL); +if (ret > 0) + return (ret); + +params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO); + buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; -params = acpi_get_private(dev); -if (params != NULL) { - ecdt = 1; - ret = 0; -} else { - ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL); - if (ret > 0) - goto out; - params = malloc(sizeof(struct acpi_ec_params), M_TEMP, - M_WAITOK | M_ZERO); - h = acpi_get_handle(dev); +h = acpi_get_handle(dev); - /* -* Read the unit ID to check for duplicate attach and the -* global lock value to see if we should acquire it when -* accessing the EC. -*/ - status = acpi_GetInteger(h, "_UID", ¶ms->uid); - if (ACPI_FAILURE(status)) - params->uid = 0; - status = acpi_GetInteger(h, "_GLK", ¶ms->glk); - if (ACPI_FAILURE(status)) - params->glk = 0; +/* + * Read the unit ID to check for duplicate attach and the global lock value + * to see if we should acquire it when accessing the EC. + */ +status = acpi_GetInteger(h, "_UID", ¶ms->uid); +if (ACPI_FAILURE(status)) + params->uid = 0; - /* -* Evaluate the _GPE method to find the GPE bit used by the EC to -* signal status (SCI). If it's a package, it contains a reference -* and GPE bit, similar to _PRW. -*/ - status = AcpiEvaluateObject(h, "_GPE", NULL, &buf); - if (ACPI_FAILURE(status)) { - device_printf(dev, "can't evaluate _GPE - %s\n", - AcpiFormatException(status)); - goto out; - } - obj = (ACPI_OBJECT *)buf.Pointer; - if (obj == NULL) - goto out; +status = acpi_GetInteger(h, "_GLK", ¶ms->glk); +if (ACPI_FAILURE(status)) + params->glk = 0; - switch (obj->Type) { - case ACPI_TYPE_INTEGER: - params->gpe_handle = NULL; - params->gpe_bit = obj->Integer.Value; - break; - case ACPI_TYPE_PACKAGE: - if (!ACPI_PKG_VALID(obj, 2)) - goto out; - params->gpe_han
Re: svn commit: r339476 - head/sys/i386/conf
No. On Mon, Nov 19, 2018 at 7:58 AM Niclas Zeising wrote: > > On 10/20/18 9:16 PM, Conrad Meyer wrote: > > Author: cem > > Date: Sat Oct 20 19:16:43 2018 > > New Revision: 339476 > > URL: https://svnweb.freebsd.org/changeset/base/339476 > > > > Log: > >Add a MINIMAL config for i386, based on amd64 > > > > Any plans to MFC this? > Regards > -- > Niclas Zeising ___ 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: r340645 - head/tools/build
Author: arichardson Date: Mon Nov 19 18:58:34 2018 New Revision: 340645 URL: https://svnweb.freebsd.org/changeset/base/340645 Log: Add capsicum_helpers.h to -legacy if needed This fixes bootstrap of capsicumized strings on FreeBSD 11. Reviewed By: oshogbo, bdrewery Differential Revision: https://reviews.freebsd.org/D17971 Modified: head/tools/build/Makefile Modified: head/tools/build/Makefile == --- head/tools/build/Makefile Mon Nov 19 18:29:03 2018(r340644) +++ head/tools/build/Makefile Mon Nov 19 18:58:34 2018(r340645) @@ -48,6 +48,16 @@ INCS+= strings.h SRCS+= explicit_bzero.c .endif +.if exists(/usr/include/capsicum_helpers.h) +_WITH_CAPH_ENTER!= grep -c caph_enter /usr/include/capsicum_helpers.h || true +.endif +.if !defined(_WITH_CAPH_ENTER) || ${_WITH_CAPH_ENTER} == 0 +.PATH: ${SRCTOP}/lib/libcapsicum +INCS+= capsicum_helpers.h +.PATH: ${SRCTOP}/lib/libcasper/libcasper +INCS+= libcasper.h +.endif + .if empty(SRCS) SRCS= dummy.c .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: r340640 - head/lib/libc
On Mon, Nov 19, 2018 at 06:12:39PM +, Ed Maste wrote: > Author: emaste > Date: Mon Nov 19 18:12:39 2018 > New Revision: 340640 > URL: https://svnweb.freebsd.org/changeset/base/340640 > > Log: > libc: forcibly disable BIND_NOW > > Building libc WITH_BIND_NOW results in segfault at process start. For > now force BIND_NOW off until the root cause can be identified and fixed. > > PR: 23 > Sponsored by: The FreeBSD Foundation > > Modified: > head/lib/libc/Makefile > > Modified: head/lib/libc/Makefile > == > --- head/lib/libc/MakefileMon Nov 19 17:33:44 2018(r340639) > +++ head/lib/libc/MakefileMon Nov 19 18:12:39 2018(r340640) > @@ -6,6 +6,8 @@ SHLIBDIR?= /lib > > .include > > +# BIND_NOW in libc results in segfault at startup (PR 23) > +MK_BIND_NOW= no Since the use of ifunc in libc is only applicable to amd64, I wonder if it would be best to disable BIND_NOW in lib/libc/amd64/Makefile.inc. I don't believe there's any need to disable BIND_NOW for libc on other architectures. Thanks, -- Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal:+1 443-546-8752 Tor+XMPP+OTR:latt...@is.a.hacker.sx GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE signature.asc Description: PGP signature
Re: svn commit: r340640 - head/lib/libc
On Mon, 19 Nov 2018 at 14:38, Shawn Webb wrote: > > Since the use of ifunc in libc is only applicable to amd64, I wonder > if it would be best to disable BIND_NOW in > lib/libc/amd64/Makefile.inc. I don't believe there's any need to > disable BIND_NOW for libc on other architectures. At least arm64 and i386 will probably start making use of ifuncs in the not-too-distant future. After some more investigation and if we're sure that it's only ifuncs that are affected this might be made machine-dependent. ___ 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: r340649 - head/usr.bin/fortune/datfiles
Author: bcr (doc committer) Date: Mon Nov 19 20:45:49 2018 New Revision: 340649 URL: https://svnweb.freebsd.org/changeset/base/340649 Log: Add a fortune describing how to upload a machine's dmesg information to the NYCBUG database. We want to encourage our users to upload their dmesgs so that the project can get a better insight into what kind of hardware is run on. This helps in making data-driven decisions about i.e., platform and driver support. Note that dmesgs may contain sensitive information like hardware serial numbers, hence uploading them without review is discouraged. Reviewed by: brooks, imp, allanjude Approved by: allanjude MFC after:5 days Differential Revision:https://reviews.freebsd.org/D17705 Modified: head/usr.bin/fortune/datfiles/freebsd-tips Modified: head/usr.bin/fortune/datfiles/freebsd-tips == --- head/usr.bin/fortune/datfiles/freebsd-tips Mon Nov 19 19:05:07 2018 (r340648) +++ head/usr.bin/fortune/datfiles/freebsd-tips Mon Nov 19 20:45:49 2018 (r340649) @@ -554,3 +554,9 @@ Use "sysrc name=value" to add an entry and "sysrc -x n -- Lars Engels % +You can upload the dmesg of your system to help developers get an overview of commonly used hardware and peripherals for FreeBSD. +Use the curl package to upload it in one command: +curl -v -d "nickname=$USER" -d "description=FreeBSD/$(uname -m) on \ +$(kenv smbios.system.maker) $(kenv smbios.system.product)" -d "do=addd" \ +--data-urlencode 'dmesg@/var/run/dmesg.boot' http://dmesgd.nycbug.org/index.cgi +% ___ 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: r340650 - head/share/mk
Author: emaste Date: Mon Nov 19 20:48:47 2018 New Revision: 340650 URL: https://svnweb.freebsd.org/changeset/base/340650 Log: Avoid retpolineplt with static linking Statically linked binaries linked with -zretpolineplt crash at startup as lld produces a broken PLT. PR: 26 Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.prog.mk == --- head/share/mk/bsd.prog.mk Mon Nov 19 20:45:49 2018(r340649) +++ head/share/mk/bsd.prog.mk Mon Nov 19 20:48:47 2018(r340650) @@ -41,7 +41,10 @@ LDFLAGS+= -Wl,-znow .if ${MK_RETPOLINE} != "no" CFLAGS+= -mretpoline CXXFLAGS+= -mretpoline +# retpolineplt is broken with static linking (PR 26) +.if !defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO" LDFLAGS+= -Wl,-zretpolineplt +.endif .endif .if defined(CRUNCH_CFLAGS) ___ 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: r340450 - head/sys/sys
On Mon, Nov 19, 2018 at 9:05 AM Bruce Evans wrote: > On Tue, 20 Nov 2018, Bruce Evans wrote: > > > On Tue, 20 Nov 2018, Bruce Evans wrote: > > > >> On Mon, 19 Nov 2018, Warner Losh wrote: > >> > >>> On Mon, Nov 19, 2018 at 12:31 AM Andriy Gapon wrote: > > ... > > I found my test program. > > > >>> But I think I understand the problem now. > >>> > >>> mstosbt(1000) is overflowing with my change, but not without because > we're > >>> adding 2^32 to a number that's ~900 away from overflowing changing a > very > >> > >> This value is just invalid. Negative values are obviously invalid. > >> Positive > >> values of more than 1 second are invalid. In the old version, values of > >> precisely 1 second don't overflow since the scale factor is rounded > down; > >> the result is just 1 unit lower than 1 second. Overflow (actually > >> truncation) > >> occurs at 1 unit above 1 second. E.g., sbttoms(mstosbt(1000)) was 999 > and > >> sbttoms(mstosbt(1001)) was 0. Now in my fixed version, > >> sbttoms(mstosbt(1000)) > >> is truncated to 0 and sbttoms(mstosbt(1001)) is truncated to 1. > >> > >> The test program also showed that in the old version, all valid args > except > >> 0 are reduced by precisely 1 by conversion to sbt and back. > >> > >>> large sleep of 1 second to a tiny sleep of 0 (which is 1ms at the > default > >>> Hz). I think we get this in the mlx code because there's a > msleep(1000) in > >>> at least one place. msleep(1001) would have failed before my change. > Now I > >>> think msleep(999) works, but msleep(1000) fails. Since the code is > waiting > >>> a second for hardware to initialize, a 1ms instead is likely to catch > the > >>> hardware before it's finished. I think this will cause problems no > matter > >>> cold or not, since it's all pause_sbt() under the covers and a delay > of 0 > >>> is still 0 either way. > >> > >> Bug in the mlx code. The seconds part must be converted separately, as > in > >> tstosbt(). > > > > mlx doesn't seem to use sbt directly, or even msleep(), so the bug does > > seem to be central. > > > > mlx actually uses mtx_sleep() with timo = hz(). mtx_sleep() is actually > > an obfuscated macro wrapping _sleep(). The conversion to sbt is done by > > the macro and is sloppy. It multiplies timo by tick_sbt. > > > > tick_sbt is SBT_1S / hz, so the sbt is SBT_1S / hz * hz which is SBT_1S > > reduced a little. This is not affected by the new code, and it still > isn't > > converted back to 1 second in ms, us or ns. Even if it is converted back > > and then forth to sbt using the new code, it remains less than 1 second > as > > an sbt so shouldn't cause any new problems. > > Here are all uses of these functions in kern outside of sys/time.h: > > XX arm/arm/mpcore_timer.c: sc->et.et_min_period = nstosbt(20); > > OK since 20 ns is less than 1 second. > > XX cddl/compat/opensolaris/sys/kcondvar.h: return > (cv_timedwait_sbt(cvp, mp, nstosbt(tim), nstosbt(res), 0)); > XX cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c: > pause_sbt("dmu_tx_delay", nstosbt(wakeup), > XX cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c: > nstosbt(zfs_delay_resolution_ns), C_ABSOLUTE); > XX cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c:sbintime_t sleep = > nstosbt((zilog->zl_last_lwb_latency * pct) / 100); > XX compat/linuxkpi/common/include/linux/delay.h: > pause_sbt("lnxsleep", mstosbt(ms), 0, C_HARDCLOCK); > XX compat/linuxkpi/common/src/linux_hrtimer.c: > nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0); > XX compat/linuxkpi/common/src/linux_hrtimer.c: > callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(time)), > XX compat/linuxkpi/common/src/linux_hrtimer.c: nstosbt(nsec), > hrtimer_call_handler, hrtimer, 0); > XX compat/linuxkpi/common/src/linux_hrtimer.c: > callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(interval)), > XX compat/linuxkpi/common/src/linux_hrtimer.c: > nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, 0); > XX compat/linuxkpi/common/src/linux_schedule.c: ret = > -pause_sbt("lnxsleep", mstosbt(ms), 0, C_HARDCLOCK | C_CATCH); > > All of the above might are broken unless their timeout arg is restricted to > less than 1 second. > > Also, at least the sleep and pause calls in the above probably have a > style bug in knowing about sbt's at all. More important functions > like msleep() hide the use of sbt's and use fuzzier scale factors like > tick_sbt. > Yes. It's for these users I'm fixing the >= 1s cases. > XX dev/iicbus/nxprtc.c: pause_sbt("nxpotp", mstosbt(100), > mstosbt(10), 0); > XX dev/iicbus/nxprtc.c: pause_sbt("nxpbat", mstosbt(100), 0, 0); > > OK since 100 ms is less than 1 second. > > XX kern/kern_sysctl.c: sb = ustosbt(tt); > XX kern/kern_sysctl.c: sb = mstosbt(tt); > > Recently added bugs. The args is supplied by applications so can be far > above > 1 second. > > Also, these functions have a bogus API that takes uint64_t args. sbt's > can't represent that high, and the
svn commit: r340651 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware
Author: np Date: Mon Nov 19 21:59:07 2018 New Revision: 340651 URL: https://svnweb.freebsd.org/changeset/base/340651 Log: cxgbe(4): Update T4/5/6 firmwares to 1.22.0.3. Obtained from:Chelsio Communications MFC after:2 months Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/firmware/t4fw-1.22.0.3.bin.uu (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.22.0.3.bin.uu (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.22.0.3.bin.uu (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.19.1.0.bin.uu head/sys/dev/cxgbe/firmware/t5fw-1.19.1.0.bin.uu head/sys/dev/cxgbe/firmware/t6fw-1.19.1.0.bin.uu Modified: head/sys/conf/files head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/t6_firmware/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Mon Nov 19 20:48:47 2018(r340650) +++ head/sys/conf/files Mon Nov 19 21:59:07 2018(r340651) @@ -1451,7 +1451,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule\ clean "t4fw.fwo" t4fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.19.1.0.bin.uu"\ + dependency "$S/dev/cxgbe/firmware/t4fw-1.22.0.3.bin.uu"\ compile-with"${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1485,7 +1485,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule\ clean "t5fw.fwo" t5fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.19.1.0.bin.uu"\ + dependency "$S/dev/cxgbe/firmware/t5fw-1.22.0.3.bin.uu"\ compile-with"${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1519,7 +1519,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule\ clean "t6fw.fwo" t6fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.19.1.0.bin.uu"\ + dependency "$S/dev/cxgbe/firmware/t6fw-1.22.0.3.bin.uu"\ compile-with"${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t6fw.fw" Added: head/sys/dev/cxgbe/firmware/t4fw-1.22.0.3.bin.uu == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/firmware/t4fw-1.22.0.3.bin.uuMon Nov 19 21:59:07 2018(r340651) @@ -0,0 +1,9881 @@ +/*- + * Copyright (c) 2018 Chelsio Communications, 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, 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. + */ +begin-base64 644 t4fw +AAAESQEWAAMAAQkEAAAB + +BCwEOwRD +AA
Re: svn commit: r339898 - head/lib/libc/amd64/sys
On 05/11/2018 21:51, Konstantin Belousov wrote: > For you, but not for me. > Turns out I omitted the fact that I have WITH_RETPOLINE enabled, which caused all this. emaste@ reported in PR 26 and committed r340650. -- Charlie Li Can't think of a witty .sigline today… (This email address is for mailing list use only; replace local-part with vishwin for off-list communication) signature.asc Description: OpenPGP digital signature
svn commit: r340652 - head/rescue/rescue
Author: emaste Date: Mon Nov 19 22:18:18 2018 New Revision: 340652 URL: https://svnweb.freebsd.org/changeset/base/340652 Log: rescue: set NO_SHARED in Makefile The rescue binary is built statically via the Makefile generated by crunchgen, but that does not trigger other shared/static logic in bsd.prog.mk - in particular disabling retpolineplt with static linking. PR: 26 Reported by: Charlie Li Sponsored by: The FreeBSD Foundation Modified: head/rescue/rescue/Makefile Modified: head/rescue/rescue/Makefile == --- head/rescue/rescue/Makefile Mon Nov 19 21:59:07 2018(r340651) +++ head/rescue/rescue/Makefile Mon Nov 19 22:18:18 2018(r340652) @@ -6,6 +6,7 @@ PACKAGE=rescue MAN= MK_SSP=no +NO_SHARED= yes PROG= rescue BINDIR?=/rescue ___ 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: r340653 - in head/sys/powerpc: fpu include powerpc
Author: jhibbits Date: Mon Nov 19 23:54:49 2018 New Revision: 340653 URL: https://svnweb.freebsd.org/changeset/base/340653 Log: powerpc: Sync icache on SIGILL, in case of cache issues The update of jemalloc to 5.1.0 exposed a cache syncing issue on a Freescale e500 base system. There was already code in the FPU emulator to address this, but it was limited to a single static variable, and did not attempt to sync the cache. This pulls that out to the higher level program exception handler, and syncs the cache. If a SIGILL is hit a second time at the same address, it will be treated as a real illegal instruction, and handled accordingly. Modified: head/sys/powerpc/fpu/fpu_emu.c head/sys/powerpc/include/pcb.h head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/fpu/fpu_emu.c == --- head/sys/powerpc/fpu/fpu_emu.c Mon Nov 19 22:18:18 2018 (r340652) +++ head/sys/powerpc/fpu/fpu_emu.c Mon Nov 19 23:54:49 2018 (r340653) @@ -189,7 +189,6 @@ fpu_emulate(struct trapframe *frame, struct fpu *fpf) { union instr insn; struct fpemu fe; - static int lastill = 0; int sig; /* initialize insn.is_datasize to tell it is *not* initialized */ @@ -243,17 +242,11 @@ fpu_emulate(struct trapframe *frame, struct fpu *fpf) opc_disasm(frame->srr0, insn.i_int); } #endif - /* - * retry an illegal insn once due to cache issues. - */ - if (lastill == frame->srr0) { - sig = SIGILL; + sig = SIGILL; #ifdef DEBUG - if (fpe_debug & FPE_EX) - kdb_enter(KDB_WHY_UNSET, "illegal instruction"); + if (fpe_debug & FPE_EX) + kdb_enter(KDB_WHY_UNSET, "illegal instruction"); #endif - } - lastill = frame->srr0; break; } Modified: head/sys/powerpc/include/pcb.h == --- head/sys/powerpc/include/pcb.h Mon Nov 19 22:18:18 2018 (r340652) +++ head/sys/powerpc/include/pcb.h Mon Nov 19 23:54:49 2018 (r340653) @@ -89,6 +89,7 @@ struct pcb { register_t dbcr0; } booke; } pcb_cpu; + vm_offset_t pcb_lastill;/* Last illegal instruction */ }; #endif Modified: head/sys/powerpc/powerpc/exec_machdep.c == --- head/sys/powerpc/powerpc/exec_machdep.c Mon Nov 19 22:18:18 2018 (r340652) +++ head/sys/powerpc/powerpc/exec_machdep.c Mon Nov 19 23:54:49 2018 (r340653) @@ -94,6 +94,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #ifdef FPU_EMU #include #endif @@ -1099,6 +1101,14 @@ ppc_instr_emulate(struct trapframe *frame, struct pcb } sig = fpu_emulate(frame, &pcb->pcb_fpu); #endif + if (sig == SIGILL) { + if (pcb->pcb_lastill != frame->srr0) { + /* Allow a second chance, in case of cache sync issues. */ + sig = 0; + pmap_sync_icache(PCPU_GET(curpmap), frame->srr0, 4); + pcb->pcb_lastill = frame->srr0; + } + } return (sig); } ___ 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: r340654 - head/sys/dev/sdhci
Author: marius Date: Mon Nov 19 23:56:33 2018 New Revision: 340654 URL: https://svnweb.freebsd.org/changeset/base/340654 Log: For consistency within the front-end, prefer SDHCI_{READ,WRITE}_{2,4}() to sdhci_acpi_{read,write}_{2,4}() in the sdhci_acpi_set_uhs_timing() added in r340543. Modified: head/sys/dev/sdhci/sdhci_acpi.c Modified: head/sys/dev/sdhci/sdhci_acpi.c == --- head/sys/dev/sdhci/sdhci_acpi.c Mon Nov 19 23:54:49 2018 (r340653) +++ head/sys/dev/sdhci/sdhci_acpi.c Mon Nov 19 23:56:33 2018 (r340654) @@ -203,7 +203,7 @@ sdhci_acpi_set_uhs_timing(device_t dev, struct sdhci_s enum mmc_bus_timing timing; bus = slot->bus; - old_timing = sdhci_acpi_read_2(bus, slot, SDHCI_HOST_CONTROL2); + old_timing = SDHCI_READ_2(bus, slot, SDHCI_HOST_CONTROL2); old_timing &= SDHCI_CTRL2_UHS_MASK; sdhci_generic_set_uhs_timing(dev, slot); @@ -220,19 +220,19 @@ sdhci_acpi_set_uhs_timing(device_t dev, struct sdhci_s timing = ios->timing; if (old_timing == SDHCI_CTRL2_UHS_SDR104 && timing == bus_timing_hs) - sdhci_acpi_write_2(bus, slot, SDHCI_HOST_CONTROL2, - sdhci_acpi_read_2(bus, slot, SDHCI_HOST_CONTROL2) & + SDHCI_WRITE_2(bus, slot, SDHCI_HOST_CONTROL2, + SDHCI_READ_2(bus, slot, SDHCI_HOST_CONTROL2) & ~SDHCI_CTRL2_SAMPLING_CLOCK); if (ios->clock > SD_SDR50_MAX && old_timing != SDHCI_CTRL2_MMC_HS400 && timing == bus_timing_mmc_hs400) { - sdhci_acpi_write_2(bus, slot, SDHCI_HOST_CONTROL2, - sdhci_acpi_read_2(bus, slot, SDHCI_HOST_CONTROL2) | + SDHCI_WRITE_2(bus, slot, SDHCI_HOST_CONTROL2, + SDHCI_READ_2(bus, slot, SDHCI_HOST_CONTROL2) | SDHCI_CTRL2_SAMPLING_CLOCK); - sdhci_acpi_write_4(bus, slot, SDHCI_AMD_RESET_DLL_REG, + SDHCI_WRITE_4(bus, slot, SDHCI_AMD_RESET_DLL_REG, 0x40003210); DELAY(20); - sdhci_acpi_write_4(bus, slot, SDHCI_AMD_RESET_DLL_REG, + SDHCI_WRITE_4(bus, slot, SDHCI_AMD_RESET_DLL_REG, 0x40033210); } } ___ 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: r340655 - head/usr.bin/pom
Author: tmunro Date: Tue Nov 20 00:06:53 2018 New Revision: 340655 URL: https://svnweb.freebsd.org/changeset/base/340655 Log: pom: Fix fencepost bugs. Under some conditions pom would report "waning" and then "full", show higher percentages than it should, and get confused by DST. Fix. Before: 2018.01.30: The Moon is Waxing Gibbous (97% of Full) 2018.01.31: The Moon is Waning Gibbous (100% of Full) 2018.02.01: The Moon is Full 2018.02.02: The Moon is Waning Gibbous (98% of Full) After: 2018.01.30: The Moon is Waxing Gibbous (96% of Full) 2018.01.31: The Moon is Waxing Gibbous (99% of Full) 2018.02.01: The Moon is Full 2018.02.02: The Moon is Waning Gibbous (97% of Full) PR:231705 Submitted by: Andrew Gierth Approved by: allanjude (mentor) MFC after: 2 weeks Differential Revision: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231705 Modified: head/usr.bin/pom/pom.c Modified: head/usr.bin/pom/pom.c == --- head/usr.bin/pom/pom.c Mon Nov 19 23:56:33 2018(r340654) +++ head/usr.bin/pom/pom.c Tue Nov 20 00:06:53 2018(r340655) @@ -135,11 +135,13 @@ main(int argc, char **argv) tmd.tm_hour = 0; tmd.tm_min = 0; tmd.tm_sec = 0; + tmd.tm_isdst = -1; } if (otime != NULL) { tmd.tm_hour = strtol(otime, NULL, 10); tmd.tm_min = strtol(otime + 3, NULL, 10); tmd.tm_sec = strtol(otime + 6, NULL, 10); + tmd.tm_isdst = -1; } tt = mktime(&tmd); } @@ -149,19 +151,19 @@ main(int argc, char **argv) (GMT.tm_min / 60.0) + (GMT.tm_sec / 3600.0)) / 24.0); for (cnt = EPOCH; cnt < GMT.tm_year; ++cnt) days += isleap(1900 + cnt) ? 366 : 365; - today = potm(days) + .5; + today = potm(days); if (pflag) { (void)printf("%1.0f\n", today); return (0); } (void)printf("The Moon is "); - if ((int)today == 100) + if (today >= 99.5) (void)printf("Full\n"); - else if (!(int)today) + else if (today < 0.5) (void)printf("New\n"); else { tomorrow = potm(days + 1); - if ((int)today == 50) + if (today >= 49.5 && today < 50.5) (void)printf("%s\n", tomorrow > today ? "at the First Quarter" : "at the Last Quarter"); else { ___ 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: r340656 - head/sys/sparc64/sparc64
Author: marius Date: Tue Nov 20 00:08:33 2018 New Revision: 340656 URL: https://svnweb.freebsd.org/changeset/base/340656 Log: Given that the idea of D15374 was to "make memmove a first class citizen", provide a _MEMMOVE extension of _MEMCPY that deals with overlap based on the previous bcopy(9) implementation and use the former for bcopy(9) and memmove(9). This addresses my D15374 review comment, avoiding extra MOVs in case of memmove(9) and trashing the stack pointer. Modified: head/sys/sparc64/sparc64/support.S Modified: head/sys/sparc64/sparc64/support.S == --- head/sys/sparc64/sparc64/support.S Tue Nov 20 00:06:53 2018 (r340655) +++ head/sys/sparc64/sparc64/support.S Tue Nov 20 00:08:33 2018 (r340656) @@ -207,6 +207,30 @@ __FBSDID("$FreeBSD$"); 6: /* + * Extension of _MEMCPY dealing with overlap, but unaware of ASIs. + * Used for bcopy() and memmove(). + */ +#define_MEMMOVE(dst, src, len) \ + /* Check for overlap, and copy backwards if so. */ \ + sub dst, src, %g1 ; \ + cmp %g1, len ; \ + bgeu,a,pt %xcc, 2f ; \ +nop ; \ + /* Copy backwards. */ \ + add src, len, src ; \ + add dst, len, dst ; \ +1: deccc 1, len ; \ + bl,pn %xcc, 3f ; \ +dec1, src ; \ + ldub[src], %g1 ; \ + dec 1, dst ; \ + ba %xcc, 1b ; \ +stb%g1, [dst] ; \ +2: /* Do the fast version. */ \ + _MEMCPY(dst, src, len, EMPTY, EMPTY, EMPTY, EMPTY) ; \ +3: + +/* * void ascopy(u_long asi, vm_offset_t src, vm_offset_t dst, size_t len) */ ENTRY(ascopy) @@ -265,49 +289,14 @@ ENTRY(bcmp) END(bcmp) /* - * void *memmove(void *dst, const void *src, size_t len) * void bcopy(const void *src, void *dst, size_t len) */ -ENTRY(memmove) - /* -* Swap src/dst for memmove/bcopy differences -*/ - mov %o0, %o6 - mov %o1, %o0 - mov %o6, %o1 -ALTENTRY(bcopy) - /* -* Check for overlap, and copy backwards if so. -*/ - sub %o1, %o0, %g1 - cmp %g1, %o2 - bgeu,a,pt %xcc, 3f +ENTRY(bcopy) + _MEMMOVE(%o1, %o0, %o2) + retl nop +END(bcopy) - /* -* Copy backwards. -*/ - add %o0, %o2, %o0 - add %o1, %o2, %o1 -1: deccc 1, %o2 - bl,a,pn %xcc, 2f -nop - dec 1, %o0 - ldub[%o0], %g1 - dec 1, %o1 - ba %xcc, 1b -stb%g1, [%o1] -2: retl -mov%o6, %o0 - - /* -* Do the fast version. -*/ -3: _MEMCPY(%o1, %o0, %o2, EMPTY, EMPTY, EMPTY, EMPTY) - retl -mov%o6, %o0 -END(memmove) - /* * void bzero(void *b, size_t len) */ @@ -335,6 +324,16 @@ ENTRY(memcpy) retl nop END(memcpy) + +/* + * void *memmove(void *dst, const void *src, size_t len) + */ +ENTRY(memmove) + mov %o0, %o3 + _MEMMOVE(%o3, %o1, %o2) + retl +nop +END(memmove) /* * void *memset(void *b, int c, size_t len) ___ 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: r340653 - in head/sys/powerpc: fpu include powerpc
Is this reasonable? What if the junk in the cache happened to be a *valid* instruction? Won't this approach result in silent corruption and later failure? -Nathan On 11/19/18 3:54 PM, Justin Hibbits wrote: > Author: jhibbits > Date: Mon Nov 19 23:54:49 2018 > New Revision: 340653 > URL: https://svnweb.freebsd.org/changeset/base/340653 > > Log: > powerpc: Sync icache on SIGILL, in case of cache issues > > The update of jemalloc to 5.1.0 exposed a cache syncing issue on a Freescale > e500 base system. There was already code in the FPU emulator to address > this, but it was limited to a single static variable, and did not attempt to > sync the cache. This pulls that out to the higher level program exception > handler, and syncs the cache. > > If a SIGILL is hit a second time at the same address, it will be treated as > a real illegal instruction, and handled accordingly. > > Modified: > head/sys/powerpc/fpu/fpu_emu.c > head/sys/powerpc/include/pcb.h > head/sys/powerpc/powerpc/exec_machdep.c > > Modified: head/sys/powerpc/fpu/fpu_emu.c > == > --- head/sys/powerpc/fpu/fpu_emu.cMon Nov 19 22:18:18 2018 > (r340652) > +++ head/sys/powerpc/fpu/fpu_emu.cMon Nov 19 23:54:49 2018 > (r340653) > @@ -189,7 +189,6 @@ fpu_emulate(struct trapframe *frame, struct fpu *fpf) > { > union instr insn; > struct fpemu fe; > - static int lastill = 0; > int sig; > > /* initialize insn.is_datasize to tell it is *not* initialized */ > @@ -243,17 +242,11 @@ fpu_emulate(struct trapframe *frame, struct fpu *fpf) > opc_disasm(frame->srr0, insn.i_int); > } > #endif > - /* > - * retry an illegal insn once due to cache issues. > - */ > - if (lastill == frame->srr0) { > - sig = SIGILL; > + sig = SIGILL; > #ifdef DEBUG > - if (fpe_debug & FPE_EX) > - kdb_enter(KDB_WHY_UNSET, "illegal instruction"); > + if (fpe_debug & FPE_EX) > + kdb_enter(KDB_WHY_UNSET, "illegal instruction"); > #endif > - } > - lastill = frame->srr0; > break; > } > > > Modified: head/sys/powerpc/include/pcb.h > == > --- head/sys/powerpc/include/pcb.hMon Nov 19 22:18:18 2018 > (r340652) > +++ head/sys/powerpc/include/pcb.hMon Nov 19 23:54:49 2018 > (r340653) > @@ -89,6 +89,7 @@ struct pcb { > register_t dbcr0; > } booke; > } pcb_cpu; > + vm_offset_t pcb_lastill;/* Last illegal instruction */ > }; > #endif > > > Modified: head/sys/powerpc/powerpc/exec_machdep.c > == > --- head/sys/powerpc/powerpc/exec_machdep.c Mon Nov 19 22:18:18 2018 > (r340652) > +++ head/sys/powerpc/powerpc/exec_machdep.c Mon Nov 19 23:54:49 2018 > (r340653) > @@ -94,6 +94,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > + > #ifdef FPU_EMU > #include > #endif > @@ -1099,6 +1101,14 @@ ppc_instr_emulate(struct trapframe *frame, struct pcb > } > sig = fpu_emulate(frame, &pcb->pcb_fpu); > #endif > + if (sig == SIGILL) { > + if (pcb->pcb_lastill != frame->srr0) { > + /* Allow a second chance, in case of cache sync issues. > */ > + sig = 0; > + pmap_sync_icache(PCPU_GET(curpmap), frame->srr0, 4); > + pcb->pcb_lastill = frame->srr0; > + } > + } > > return (sig); > } > ___ 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: r340653 - in head/sys/powerpc: fpu include powerpc
Well, this is to allow a retry in case the cache wasn't properly flushed already. This came about because the blrl instruction in the GOT was seen as an illegal instruction, and it didn't seem to matter if I synced in pmap_enter(), it would still SIGILL probabilistically. Since this block was already present for a reason it made sense to make it actually functional, since it does solve that problem. I don't know if there's yet another hardware errata on the e500, regarding caching, because I would expect a page load like this to get synced no matter the load address. - Justin On Mon, Nov 19, 2018, 18:14 Nathan Whitehorn Is this reasonable? What if the junk in the cache happened to be a > *valid* instruction? Won't this approach result in silent corruption and > later failure? > -Nathan > > On 11/19/18 3:54 PM, Justin Hibbits wrote: > > Author: jhibbits > > Date: Mon Nov 19 23:54:49 2018 > > New Revision: 340653 > > URL: https://svnweb.freebsd.org/changeset/base/340653 > > > > Log: > > powerpc: Sync icache on SIGILL, in case of cache issues > > > > The update of jemalloc to 5.1.0 exposed a cache syncing issue on a > Freescale > > e500 base system. There was already code in the FPU emulator to > address > > this, but it was limited to a single static variable, and did not > attempt to > > sync the cache. This pulls that out to the higher level program > exception > > handler, and syncs the cache. > > > > If a SIGILL is hit a second time at the same address, it will be > treated as > > a real illegal instruction, and handled accordingly. > > > > Modified: > > head/sys/powerpc/fpu/fpu_emu.c > > head/sys/powerpc/include/pcb.h > > head/sys/powerpc/powerpc/exec_machdep.c > > > > Modified: head/sys/powerpc/fpu/fpu_emu.c > > > == > > --- head/sys/powerpc/fpu/fpu_emu.cMon Nov 19 22:18:18 2018 > (r340652) > > +++ head/sys/powerpc/fpu/fpu_emu.cMon Nov 19 23:54:49 2018 > (r340653) > > @@ -189,7 +189,6 @@ fpu_emulate(struct trapframe *frame, struct fpu *fpf) > > { > > union instr insn; > > struct fpemu fe; > > - static int lastill = 0; > > int sig; > > > > /* initialize insn.is_datasize to tell it is *not* initialized */ > > @@ -243,17 +242,11 @@ fpu_emulate(struct trapframe *frame, struct fpu > *fpf) > > opc_disasm(frame->srr0, insn.i_int); > > } > > #endif > > - /* > > - * retry an illegal insn once due to cache issues. > > - */ > > - if (lastill == frame->srr0) { > > - sig = SIGILL; > > + sig = SIGILL; > > #ifdef DEBUG > > - if (fpe_debug & FPE_EX) > > - kdb_enter(KDB_WHY_UNSET, "illegal > instruction"); > > + if (fpe_debug & FPE_EX) > > + kdb_enter(KDB_WHY_UNSET, "illegal instruction"); > > #endif > > - } > > - lastill = frame->srr0; > > break; > > } > > > > > > Modified: head/sys/powerpc/include/pcb.h > > > == > > --- head/sys/powerpc/include/pcb.hMon Nov 19 22:18:18 2018 > (r340652) > > +++ head/sys/powerpc/include/pcb.hMon Nov 19 23:54:49 2018 > (r340653) > > @@ -89,6 +89,7 @@ struct pcb { > > register_t dbcr0; > > } booke; > > } pcb_cpu; > > + vm_offset_t pcb_lastill;/* Last illegal instruction */ > > }; > > #endif > > > > > > Modified: head/sys/powerpc/powerpc/exec_machdep.c > > > == > > --- head/sys/powerpc/powerpc/exec_machdep.c Mon Nov 19 22:18:18 2018 > (r340652) > > +++ head/sys/powerpc/powerpc/exec_machdep.c Mon Nov 19 23:54:49 2018 > (r340653) > > @@ -94,6 +94,8 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > > > +#include > > + > > #ifdef FPU_EMU > > #include > > #endif > > @@ -1099,6 +1101,14 @@ ppc_instr_emulate(struct trapframe *frame, struct > pcb > > } > > sig = fpu_emulate(frame, &pcb->pcb_fpu); > > #endif > > + if (sig == SIGILL) { > > + if (pcb->pcb_lastill != frame->srr0) { > > + /* Allow a second chance, in case of cache sync > issues. */ > > + sig = 0; > > + pmap_sync_icache(PCPU_GET(curpmap), frame->srr0, > 4); > > + pcb->pcb_lastill = frame->srr0; > > + } > > + } > > > > return (sig); > > } > > > > ___ 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: r340661 - head/sys/fs/nfsserver
Author: rmacklem Date: Tue Nov 20 01:52:45 2018 New Revision: 340661 URL: https://svnweb.freebsd.org/changeset/base/340661 Log: r304026 added code that started statistics gathering for an operation before the operation number (the variable called "op") was sanity checked. This patch moves the code down to below the range sanity check for "op". Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c == --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Tue Nov 20 01:12:21 2018 (r340660) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Tue Nov 20 01:52:45 2018 (r340661) @@ -766,11 +766,6 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram *repp = *tl; op = fxdr_unsigned(int, *tl); NFSD_DEBUG(4, "op=%d\n", op); - - binuptime(&start_time); - nfsrvd_statstart(op, &start_time); - statsinprog = 1; - if (op < NFSV4OP_ACCESS || (op >= NFSV4OP_NOPS && (nd->nd_flag & ND_NFSV41) == 0) || (op >= NFSV41_NOPS && (nd->nd_flag & ND_NFSV41) != 0)) { @@ -782,6 +777,11 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram } else { repp++; } + + binuptime(&start_time); + nfsrvd_statstart(op, &start_time); + statsinprog = 1; + if (i == 0) op0 = op; if (i == numops - 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: r340662 - head/sys/fs/nfs
Author: rmacklem Date: Tue Nov 20 01:56:34 2018 New Revision: 340662 URL: https://svnweb.freebsd.org/changeset/base/340662 Log: nfsm_advance() would panic() when the offs argument was negative. The code assumed that this would indicate a corrupted mbuf chain, but it could simply be caused by bogus RPC message data. This patch replaces the panic() with a printf() plus error return. MFC after:1 week Modified: head/sys/fs/nfs/nfs_commonsubs.c Modified: head/sys/fs/nfs/nfs_commonsubs.c == --- head/sys/fs/nfs/nfs_commonsubs.cTue Nov 20 01:52:45 2018 (r340661) +++ head/sys/fs/nfs/nfs_commonsubs.cTue Nov 20 01:56:34 2018 (r340662) @@ -725,10 +725,14 @@ nfsm_advance(struct nfsrv_descript *nd, int offs, int if (offs == 0) goto out; /* -* A negative offs should be considered a serious problem. +* A negative offs might indicate a corrupted mbuf chain and, +* as such, a printf is logged. */ - if (offs < 0) - panic("nfsrv_advance"); + if (offs < 0) { + printf("nfsrv_advance: negative offs\n"); + error = EBADRPC; + goto out; + } /* * If left == -1, calculate it here. ___ 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: r340663 - head/sys/fs/nfsserver
Author: rmacklem Date: Tue Nov 20 01:59:57 2018 New Revision: 340663 URL: https://svnweb.freebsd.org/changeset/base/340663 Log: Improve sanity checking for the dircount hint argument to NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code checked for a zero argument, but did not check for a very large value. This patch clips dircount at the server's maximum data size. MFC after:1 week Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cTue Nov 20 01:56:34 2018 (r340662) +++ head/sys/fs/nfsserver/nfs_nfsdport.cTue Nov 20 01:59:57 2018 (r340663) @@ -2107,9 +2107,15 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg * cookie) should be in the reply. At least one client "hints" 0, * so I set it to cnt for that case. I also round it up to the * next multiple of DIRBLKSIZ. +* Since the size of a Readdirplus directory entry reply will always +* be greater than a directory entry returned by VOP_READDIR(), it +* does not make sense to read more than NFS_SRVMAXDATA() via +* VOP_READDIR(). */ if (siz <= 0) siz = cnt; + else if (siz > NFS_SRVMAXDATA(nd)) + siz = NFS_SRVMAXDATA(nd); siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1)); if (nd->nd_flag & ND_NFSV4) { ___ 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: r340661 - head/sys/fs/nfsserver
>Author: rmacklem >Date: Tue Nov 20 01:52:45 2018 >New Revision: 340661 >URL: https://svnweb.freebsd.org/changeset/base/340661 > >Log: > r304026 added code that started statistics gathering for an operation > before the operation number (the variable called "op") was sanity checked. > This patch moves the code down to below the range sanity check for "op". I missed... MFC: 1 week Discussed with: emaste (the Discussed with should also have been on r340662 and r340663) rick [commit stuff snipped] ___ 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: r340664 - head/sys/sys
Author: imp Date: Tue Nov 20 07:11:23 2018 New Revision: 340664 URL: https://svnweb.freebsd.org/changeset/base/340664 Log: Ensure that all values of ns, us and ms work for {n,u,m}stosbt Integer overflows and wrong constants limited the accuracy of these functions and created situatiosn where sbttoXs(Xstosbt(Y)) != Y. This was especailly true in the ns case where we had millions of values that were wrong. Instead, used fixed constants because there's no way to say ceil(X) for integer math. Document what these crazy constants are. Also, use a shift one fewer left to avoid integer overflow causing incorrect results, and adjust the equasion accordingly. Document this. Allow times >= 1s to be well defined for these conversion functions (at least the Xstosbt). There's too many users in the tree that they work for >= 1s. This fixes a failure on boot to program firmware on the mlx4 NIC. There was a msleep(1000) in the code. Prior to my recent rounding changes, msleep(1000) worked, but msleep(1001) did not because the old code rounded to just below 2^64 and the new code rounds to just above it (overflowing, causing the msleep(1000) to really sleep 1ms). A test program to test all cases will be committed shortly. The test exaustively tries every value (thanks to bde for the test). Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D18051 Modified: head/sys/sys/time.h Modified: head/sys/sys/time.h == --- head/sys/sys/time.h Tue Nov 20 01:59:57 2018(r340663) +++ head/sys/sys/time.h Tue Nov 20 07:11:23 2018(r340664) @@ -162,9 +162,24 @@ sbttobt(sbintime_t _sbt) * large roundoff errors which sbttons() and nstosbt() avoid. Millisecond and * microsecond functions are also provided for completeness. * - * These functions return the smallest sbt larger or equal to the number of - * seconds requested so that sbttoX(Xtosbt(y)) == y. The 1 << 32 - 1 term added - * transforms the >> 32 from floor() to ceil(). + * These functions return the smallest sbt larger or equal to the + * number of seconds requested so that sbttoX(Xtosbt(y)) == y. Unlike + * top of second computations below, which require that we tick at the + * top of second, these need to be rounded up so we do whatever for at + * least as long as requested. + * + * The naive computation we'd do is this + * ((unit * 2^64 / SIFACTOR) + 2^32-1) >> 32 + * However, that overflows. Instead, we compute + * ((unit * 2^63 / SIFACTOR) + 2^31-1) >> 32 + * and use pre-computed constants that are the ceil of the 2^63 / SIFACTOR + * term to ensure we are using exactly the right constant. We use the lesser + * evil of ull rather than a uint64_t cast to ensure we have well defined + * right shift semantics. With these changes, we get all the ns, us and ms + * conversions back and forth right. + * Note: This file is used for both kernel and userland includes, so we can't + * rely on KASSERT being defined, nor can we pollute the namespace by including + * assert.h. */ static __inline int64_t sbttons(sbintime_t _sbt) @@ -176,8 +191,18 @@ sbttons(sbintime_t _sbt) static __inline sbintime_t nstosbt(int64_t _ns) { + sbintime_t sb = 0; - return ((_ns * (((uint64_t)1 << 63) / 5) + (1ull << 32) - 1) >> 32); +#ifdef KASSERT + KASSERT(_ns >= 0, ("Negative values illegal for nstosbt: %jd", _ns)); +#endif + if (_ns >= SBT_1S) { + sb = (_ns / 10) * SBT_1S; + _ns = _ns % 10; + } + /* 9223372037 = ceil(2^63 / 10) */ + sb += ((_ns * 9223372037ull) + 0x7fff) >> 31; + return (sb); } static __inline int64_t @@ -190,8 +215,18 @@ sbttous(sbintime_t _sbt) static __inline sbintime_t ustosbt(int64_t _us) { + sbintime_t sb = 0; - return ((_us * (((uint64_t)1 << 63) / 50) + (1ull << 32) - 1) >> 32); +#ifdef KASSERT + KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us)); +#endif + if (_us >= SBT_1S) { + sb = (_us / 100) * SBT_1S; + _us = _us % 100; + } + /* 9223372036855 = ceil(2^63 / 100) */ + sb += ((_us * 9223372036855ull) + 0x7fff) >> 31; + return (sb); } static __inline int64_t @@ -204,8 +239,18 @@ sbttoms(sbintime_t _sbt) static __inline sbintime_t mstosbt(int64_t _ms) { + sbintime_t sb = 0; - return ((_ms * (((uint64_t)1 << 63) / 500) + (1ull << 32) - 1) >> 32); +#ifdef KASSERT + KASSERT(_ms >= 0, ("Negative values illegal for mstosbt: %jd", _ms)); +#endif + if (_ms >= SBT_1S) { + sb = (_ms / 1000) * SBT_1S; + _ms = _ms % 1000; + } + /* 9223372036854776 = ceil(2^63 / 1000) */ + sb += ((_ms * 9223372036854776ull) + 0x7fff) >> 31; + return (sb); } /*- _