svn commit: r362951 - head/sys/kern

2020-07-05 Thread Mateusz Guzik
Author: mjg
Date: Mon Jul  6 02:00:35 2020
New Revision: 362951
URL: https://svnweb.freebsd.org/changeset/base/362951

Log:
  vfs: expand on vhold_smr comment

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSun Jul  5 23:07:54 2020(r362950)
+++ head/sys/kern/vfs_subr.cMon Jul  6 02:00:35 2020(r362951)
@@ -3441,10 +3441,23 @@ vholdnz(struct vnode *vp)
 }
 
 /*
- * Grab a hold count as long as the vnode is not getting freed.
+ * Grab a hold count unless the vnode is freed.
  *
  * Only use this routine if vfs smr is the only protection you have against
  * freeing the vnode.
+ *
+ * The code loops trying to add a hold count as long as the VHOLD_NO_SMR flag
+ * is not set.  After the flag is set the vnode becomes immutable to anyone but
+ * the thread which managed to set the flag.
+ *
+ * It may be tempting to replace the loop with:
+ * count = atomic_fetchadd_int(>v_holdcnt, 1);
+ * if (count & VHOLD_NO_SMR) {
+ * backpedal and error out;
+ * }
+ *
+ * However, while this is more performant, it hinders debugging by eliminating
+ * the previously mentioned invariant.
  */
 bool
 vhold_smr(struct vnode *vp)
___
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: r362950 - head/sys/kern

2020-07-05 Thread Mateusz Guzik
Author: mjg
Date: Sun Jul  5 23:07:54 2020
New Revision: 362950
URL: https://svnweb.freebsd.org/changeset/base/362950

Log:
  lockf: elide avoidable locking in lf_advlockasync
  
  While here assert on ls_threads state.

Modified:
  head/sys/kern/kern_lockf.c

Modified: head/sys/kern/kern_lockf.c
==
--- head/sys/kern/kern_lockf.c  Sun Jul  5 21:55:16 2020(r362949)
+++ head/sys/kern/kern_lockf.c  Sun Jul  5 23:07:54 2020(r362950)
@@ -637,6 +637,7 @@ retry_setlock:
VI_UNLOCK(vp);
} else {
state = *statep;
+   MPASS(state->ls_threads >= 0);
state->ls_threads++;
VI_UNLOCK(vp);
 
@@ -647,6 +648,7 @@ retry_setlock:
free(ls, M_LOCKF);
}
} else {
+   MPASS(state->ls_threads >= 0);
state->ls_threads++;
VI_UNLOCK(vp);
}
@@ -657,8 +659,9 @@ retry_setlock:
 * locked. lf_purgelocks() requires that no new threads add
 * pending locks when vnode is marked by VIRF_DOOMED flag.
 */
-   VI_LOCK(vp);
if (VN_IS_DOOMED(vp)) {
+   VI_LOCK(vp);
+   MPASS(state->ls_threads > 0);
state->ls_threads--;
wakeup(state);
VI_UNLOCK(vp);
@@ -666,7 +669,6 @@ retry_setlock:
lf_free_lock(lock);
return (ENOENT);
}
-   VI_UNLOCK(vp);
 
switch (ap->a_op) {
case F_SETLK:
@@ -728,15 +730,11 @@ retry_setlock:
sx_xunlock(>ls_lock);
 
VI_LOCK(vp);
-
+   MPASS(state->ls_threads > 0);
state->ls_threads--;
-   if (LIST_EMPTY(>ls_active) && state->ls_threads == 0) {
-   KASSERT(LIST_EMPTY(>ls_pending),
-   ("freeable state with pending locks"));
-   } else {
+   if (state->ls_threads != 0) {
wakeup(state);
}
-
VI_UNLOCK(vp);
 
if (error == EDOOFUS) {
@@ -790,6 +788,7 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep)
VI_UNLOCK(vp);
goto out_free;
}
+   MPASS(state->ls_threads >= 0);
state->ls_threads++;
VI_UNLOCK(vp);
 
@@ -1953,6 +1952,7 @@ lf_iteratelocks_vnode(struct vnode *vp, lf_iterator *f
VI_UNLOCK(vp);
return (0);
}
+   MPASS(ls->ls_threads >= 0);
ls->ls_threads++;
VI_UNLOCK(vp);
 
@@ -1976,6 +1976,7 @@ lf_iteratelocks_vnode(struct vnode *vp, lf_iterator *f
}
sx_xunlock(>ls_lock);
VI_LOCK(vp);
+   MPASS(ls->ls_threads > 0);
ls->ls_threads--;
wakeup(ls);
VI_UNLOCK(vp);
___
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: r362949 - head/sys/fs/nfs

2020-07-05 Thread Rick Macklem
Author: rmacklem
Date: Sun Jul  5 21:55:16 2020
New Revision: 362949
URL: https://svnweb.freebsd.org/changeset/base/362949

Log:
  Add support for ext_pgs mbufs to nfsm_strtom().
  
  Also, add a new function nfsm_add_ext_pgs() which will either add a page
  or add a new ext_pgs mbuf with a page to the mbuf list. Used by nfsm_strtom().
  This is another in the series of commits that add support to the NFS client
  and server for building RPC messages in ext_pgs mbufs with anonymous pages.
  This is useful so that the entire mbuf list does not need to be
  copied before calling sosend() when NFS over TLS is enabled.
  
  Since ND_EXTPG is never set yet, there is no semantic change at this time.

Modified:
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfs_var.h

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cSun Jul  5 20:54:01 2020
(r362948)
+++ head/sys/fs/nfs/nfs_commonsubs.cSun Jul  5 21:55:16 2020
(r362949)
@@ -832,22 +832,38 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp,
bytesize = NFSX_UNSIGNED + siz + rem;
m2 = nd->nd_mb;
cp2 = nd->nd_bpos;
-   left = M_TRAILINGSPACE(m2);
+   if ((nd->nd_flag & ND_EXTPG) != 0)
+   left = nd->nd_bextpgsiz;
+   else
+   left = M_TRAILINGSPACE(m2);
 
+   KASSERT(((m2->m_flags & (M_EXT | M_EXTPG)) ==
+   (M_EXT | M_EXTPG) && (nd->nd_flag & ND_EXTPG) != 0) ||
+   ((m2->m_flags & (M_EXT | M_EXTPG)) !=
+   (M_EXT | M_EXTPG) && (nd->nd_flag & ND_EXTPG) == 0),
+   ("nfsm_strtom: ext_pgs and non-ext_pgs mbufs mixed"));
/*
 * Loop around copying the string to mbuf(s).
 */
while (siz > 0) {
if (left == 0) {
-   if (siz > ncl_mbuf_mlen)
-   NFSMCLGET(m1, M_WAITOK);
-   else
-   NFSMGET(m1);
-   m1->m_len = 0;
-   m2->m_next = m1;
-   m2 = m1;
-   cp2 = mtod(m2, caddr_t);
-   left = M_TRAILINGSPACE(m2);
+   if ((nd->nd_flag & ND_EXTPG) != 0) {
+   m2 = nfsm_add_ext_pgs(m2,
+   nd->nd_maxextsiz, >nd_bextpg);
+   cp2 = (char *)(void *)PHYS_TO_DMAP(
+   m2->m_epg_pa[nd->nd_bextpg]);
+   nd->nd_bextpgsiz = left = PAGE_SIZE;
+   } else {
+   if (siz > ncl_mbuf_mlen)
+   NFSMCLGET(m1, M_WAITOK);
+   else
+   NFSMGET(m1);
+   m1->m_len = 0;
+   cp2 = mtod(m1, char *);
+   left = M_TRAILINGSPACE(m1);
+   m2->m_next = m1;
+   m2 = m1;
+   }
}
if (left >= siz)
xfer = siz;
@@ -855,18 +871,31 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp,
xfer = left;
NFSBCOPY(cp, cp2, xfer);
cp += xfer;
+   cp2 += xfer;
m2->m_len += xfer;
siz -= xfer;
left -= xfer;
+   if ((nd->nd_flag & ND_EXTPG) != 0) {
+   nd->nd_bextpgsiz -= xfer;
+   m2->m_epg_last_len += xfer;
+   }
if (siz == 0 && rem) {
if (left < rem)
panic("nfsm_strtom");
-   NFSBZERO(cp2 + xfer, rem);
+   NFSBZERO(cp2, rem);
m2->m_len += rem;
+   cp2 += rem;
+   if ((nd->nd_flag & ND_EXTPG) != 0) {
+   nd->nd_bextpgsiz -= rem;
+   m2->m_epg_last_len += rem;
+   }
}
}
nd->nd_mb = m2;
-   nd->nd_bpos = mtod(m2, caddr_t) + m2->m_len;
+   if ((nd->nd_flag & ND_EXTPG) != 0)
+   nd->nd_bpos = cp2;
+   else
+   nd->nd_bpos = mtod(m2, char *) + m2->m_len;
return (bytesize);
 }
 
@@ -4844,4 +4873,35 @@ nfsm_set(struct nfsrv_descript *nd, u_int offs)
nd->nd_bextpgsiz = PAGE_SIZE;
} else
nd->nd_bpos = mtod(m, char *) + offs;
+}
+
+/*
+ * Grow a ext_pgs mbuf list.  Either allocate another page or add
+ * an mbuf to the list.
+ */
+struct mbuf *
+nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *bextpg)
+{
+   struct mbuf *mp;
+   vm_page_t pg;
+
+   if ((m->m_epg_npgs + 1) * 

svn commit: r362948 - head/sys/kern

2020-07-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jul  5 20:54:01 2020
New Revision: 362948
URL: https://svnweb.freebsd.org/changeset/base/362948

Log:
  Fix typo.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Sun Jul  5 19:53:54 2020(r362947)
+++ head/sys/kern/vfs_vnops.c   Sun Jul  5 20:54:01 2020(r362948)
@@ -1557,7 +1557,7 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre
 *   "a filesystem-specific preferred I/O block size for this 
 *object.  In some filesystem types, this may vary from file
 *to file"
-* Use miminum/default of PAGE_SIZE (e.g. for VCHR).
+* Use minimum/default of PAGE_SIZE (e.g. for VCHR).
 */
 
sb->st_blksize = max(PAGE_SIZE, vap->va_blocksize);
___
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: r362947 - head/usr.bin/truss

2020-07-05 Thread Paweł Biernacki
Before: 

__sysctl("sysctl.name2oid",2,0x7f763a80,0x7f763280,0x7f763680,8) = 
0 (0x0)
__sysctl("sysctl.oidfmt.6.2",4,0x7f763ae0,0x7f762e78,0x0,0) = 0 (0x0)
__sysctl("sysctl.name.6.2",4,0x7f762180,0x7f761d00,0x0,0) = 0 (0x0)
__sysctl("sysctl.oidfmt.6.2",4,0x7f762980,0x7f761d08,0x0,0) = 0 (0x0)
__sysctl("sysctl.oiddescr.6.2",4,0x7f762580,0x7f761d00,0x0,0) = 0 (0x0)

After:

__sysctl("sysctl.name2oid 
hw.model",2,0x7f161e60,0x7f161660,0x7f161a60,8) = 0 (0x0)
__sysctl("sysctl.oidfmt hw.model",4,0x7f161ec0,0x7f161258,0x0,0) = 0 
(0x0)
__sysctl("sysctl.name { 6.2 }",4,0x7f160560,0x7f1600e0,0x0,0) = 0 (0x0)
__sysctl("sysctl.oidfmt hw.model",4,0x7f160d60,0x7f1600e8,0x0,0) = 0 
(0x0)
__sysctl("sysctl.oiddescr hw.model",4,0x7f160960,0x7f1600e0,0x0,0) = 0 
(0x0)

Reminded by:mjg


> On 5 Jul 2020, at 21:53, Pawel Biernacki  wrote:
> 
> Author: kaktus
> Date: Sun Jul  5 19:53:54 2020
> New Revision: 362947
> URL: https://svnweb.freebsd.org/changeset/base/362947
> 
> Log:
>  truss: print more information about traced sysctls
> 
>  MFC after:   2 weeks
>  Sponsored by:Mysterious Code Ltd.
> 
> Modified:
>  head/usr.bin/truss/syscalls.c
> 
> Modified: head/usr.bin/truss/syscalls.c
> ==
> --- head/usr.bin/truss/syscalls.c Sun Jul  5 19:38:36 2020
> (r362946)
> +++ head/usr.bin/truss/syscalls.c Sun Jul  5 19:53:54 2020
> (r362947)
> @@ -1577,14 +1577,37 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct 
> }
> 
> static void
> -print_sysctl_oid(FILE *fp, int *oid, int len)
> +print_sysctl_oid(FILE *fp, int *oid, size_t len)
> {
> - int i;
> + size_t i;
> + bool first;
> 
> - for (i = 0; i < len; i++)
> - fprintf(fp, ".%d", oid[i]);
> + first = true;
> + fprintf(fp, "{ ");
> + for (i = 0; i < len; i++) {
> + fprintf(fp, "%s%d", first ? "" : ".", oid[i]);
> + first = false;
> + }
> + fprintf(fp, " }");
> }
> 
> +static void
> +print_sysctl(FILE *fp, int *oid, size_t len)
> +{
> + char name[BUFSIZ];
> + int qoid[CTL_MAXNAME + 2];
> + size_t i;
> +
> + qoid[0] = CTL_SYSCTL;
> + qoid[1] = CTL_SYSCTL_NAME;
> + memcpy(qoid + 2, oid, len * sizeof(int));
> + i = sizeof(name);
> + if (sysctl(qoid, len + 2, name, , 0, 0) == -1)
> + print_sysctl_oid(fp, oid, len);
> + else
> + fprintf(fp, "%s", name);
> +}
> +
> /*
>  * Converts a syscall argument into a string.  Said string is
>  * allocated via malloc(), so needs to be free()'d.  sc is
> @@ -2298,9 +2321,8 @@ print_arg(struct syscall_args *sc, unsigned long *args
>   break;
>   case Sysctl: {
>   char name[BUFSIZ];
> - int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2];
> - size_t i;
> - int len;
> + int oid[CTL_MAXNAME + 2];
> + size_t len;
> 
>   memset(name, 0, sizeof(name));
>   len = args[sc->offset + 1];
> @@ -2314,39 +2336,35 @@ print_arg(struct syscall_args *sc, unsigned long *args
>   fprintf(fp, "debug");
>   break;
>   case CTL_SYSCTL_NAME:
> - fprintf(fp, "name");
> + fprintf(fp, "name ");
>   print_sysctl_oid(fp, oid + 2, len - 2);
>   break;
>   case CTL_SYSCTL_NEXT:
>   fprintf(fp, "next");
>   break;
>   case CTL_SYSCTL_NAME2OID:
> - fprintf(fp, "name2oid");
> + fprintf(fp, "name2oid %s",
> + get_string(pid,
> + args[sc->offset + 4],
> + args[sc->offset + 5]));
>   break;
>   case CTL_SYSCTL_OIDFMT:
> - fprintf(fp, "oidfmt");
> - print_sysctl_oid(fp, oid + 2, len - 2);
> + fprintf(fp, "oidfmt ");
> + print_sysctl(fp, oid + 2, len - 2);
>   break;
>   case CTL_SYSCTL_OIDDESCR:
> - fprintf(fp, "oiddescr");
> - print_sysctl_oid(fp, oid + 2, len - 2);
> + fprintf(fp, "oiddescr ");
> + print_sysctl(fp, oid + 2, len - 2);
>   

svn commit: r362947 - head/usr.bin/truss

2020-07-05 Thread Pawel Biernacki
Author: kaktus
Date: Sun Jul  5 19:53:54 2020
New Revision: 362947
URL: https://svnweb.freebsd.org/changeset/base/362947

Log:
  truss: print more information about traced sysctls
  
  MFC after:2 weeks
  Sponsored by: Mysterious Code Ltd.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Sun Jul  5 19:38:36 2020
(r362946)
+++ head/usr.bin/truss/syscalls.c   Sun Jul  5 19:53:54 2020
(r362947)
@@ -1577,14 +1577,37 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct 
 }
 
 static void
-print_sysctl_oid(FILE *fp, int *oid, int len)
+print_sysctl_oid(FILE *fp, int *oid, size_t len)
 {
-   int i;
+   size_t i;
+   bool first;
 
-   for (i = 0; i < len; i++)
-   fprintf(fp, ".%d", oid[i]);
+   first = true;
+   fprintf(fp, "{ ");
+   for (i = 0; i < len; i++) {
+   fprintf(fp, "%s%d", first ? "" : ".", oid[i]);
+   first = false;
+   }
+   fprintf(fp, " }");
 }
 
+static void
+print_sysctl(FILE *fp, int *oid, size_t len)
+{
+   char name[BUFSIZ];
+   int qoid[CTL_MAXNAME + 2];
+   size_t i;
+
+   qoid[0] = CTL_SYSCTL;
+   qoid[1] = CTL_SYSCTL_NAME;
+   memcpy(qoid + 2, oid, len * sizeof(int));
+   i = sizeof(name);
+   if (sysctl(qoid, len + 2, name, , 0, 0) == -1)
+   print_sysctl_oid(fp, oid, len);
+   else
+   fprintf(fp, "%s", name);
+}
+
 /*
  * Converts a syscall argument into a string.  Said string is
  * allocated via malloc(), so needs to be free()'d.  sc is
@@ -2298,9 +2321,8 @@ print_arg(struct syscall_args *sc, unsigned long *args
break;
case Sysctl: {
char name[BUFSIZ];
-   int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2];
-   size_t i;
-   int len;
+   int oid[CTL_MAXNAME + 2];
+   size_t len;
 
memset(name, 0, sizeof(name));
len = args[sc->offset + 1];
@@ -2314,39 +2336,35 @@ print_arg(struct syscall_args *sc, unsigned long *args
fprintf(fp, "debug");
break;
case CTL_SYSCTL_NAME:
-   fprintf(fp, "name");
+   fprintf(fp, "name ");
print_sysctl_oid(fp, oid + 2, len - 2);
break;
case CTL_SYSCTL_NEXT:
fprintf(fp, "next");
break;
case CTL_SYSCTL_NAME2OID:
-   fprintf(fp, "name2oid");
+   fprintf(fp, "name2oid %s",
+   get_string(pid,
+   args[sc->offset + 4],
+   args[sc->offset + 5]));
break;
case CTL_SYSCTL_OIDFMT:
-   fprintf(fp, "oidfmt");
-   print_sysctl_oid(fp, oid + 2, len - 2);
+   fprintf(fp, "oidfmt ");
+   print_sysctl(fp, oid + 2, len - 2);
break;
case CTL_SYSCTL_OIDDESCR:
-   fprintf(fp, "oiddescr");
-   print_sysctl_oid(fp, oid + 2, len - 2);
+   fprintf(fp, "oiddescr ");
+   print_sysctl(fp, oid + 2, len - 2);
break;
case CTL_SYSCTL_OIDLABEL:
-   fprintf(fp, "oidlabel");
-   print_sysctl_oid(fp, oid + 2, len - 2);
+   fprintf(fp, "oidlabel ");
+   print_sysctl(fp, oid + 2, len - 2);
break;
default:
-   print_sysctl_oid(fp, oid + 1, len - 1);
+   print_sysctl(fp, oid + 1, len - 1);
}
} else {
-   qoid[0] = CTL_SYSCTL;
-   qoid[1] = CTL_SYSCTL_NAME;
-   memcpy(qoid + 2, oid, len * sizeof(int));
-   i = sizeof(name);
-   if (sysctl(qoid, len + 2, name, , 0, 0) == -1)
-

svn commit: r362946 - head/sys/compat/linuxkpi/common/include/linux

2020-07-05 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Jul  5 19:38:36 2020
New Revision: 362946
URL: https://svnweb.freebsd.org/changeset/base/362946

Log:
  Fix include file order in io.h in the LinuxKPI.
  Make sure sys/types.h is included before machine/vm.h.
  
  PR:   247775
  Submitted by: pkubaj@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/io.h

Modified: head/sys/compat/linuxkpi/common/include/linux/io.h
==
--- head/sys/compat/linuxkpi/common/include/linux/io.h  Sun Jul  5 14:43:14 
2020(r362945)
+++ head/sys/compat/linuxkpi/common/include/linux/io.h  Sun Jul  5 19:38:36 
2020(r362946)
@@ -31,9 +31,10 @@
 #ifndef_LINUX_IO_H_
 #define_LINUX_IO_H_
 
-#include 
 #include 
 #include 
+
+#include 
 
 #include 
 #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: r362809 - head/contrib/mandoc

2020-07-05 Thread Rodney W. Grimes
> On Thu, Jul 02, 2020 at 12:06:13AM +, Alexey Dokuchaev wrote:
> > On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote:
> > > Thats good, but realize the page already contains history that
> > > reads like:
> > > 
> > > HISTORY
> > >  Part of the functionality of whatis was already provided by the 
> > > former
> > >  manwhere utility in 1BSD. The apropos and whatis utilities first ap-
> > >  peared in 2BSD.  They were rewritten from scratch for OpenBSD 5.6.
> > > 
> > >  The -M option and the MANPATH variable first appeared in 4.3BSD; -m 
> > > in
> > >  4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for 
> > > apropos
> > >  and in OpenBSD 5.6 for whatis.  The options -acfhIKklOTWw appeared in
> > >  OpenBSD 5.7.
> > > 
> > > And further contains:
> > > 
> > > AUTHORS
> > >  Bill Joy wrote manwhere in 1977 and the original BSD apropos and 
> > > whatis
> > >  in February 1979. The current version was written by Kristaps 
> > > Dzonsons
> > >   and Ingo Schwarze .
> > > 
> > > So the history is rich and complete, do we really need to say when we
> > > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page?
> > 
> > Ah, in this case, the only thing lacking from the current version is mention
> > of FreeBSD 11.1.  Sorry for not checking with that before writing my reply.
> > My main point, however, was that reverse chronological order looks strange.
> 
> I have created the following differential and integrated the given feedback.
> 
> https://reviews.freebsd.org/D25566
> 
> If necessary I could revert r362809, but somebody should explicit request it.

Consider it so requested.

> --Gordon
-- 
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: r362945 - head

2020-07-05 Thread Stefan Eßer
Author: se
Date: Sun Jul  5 14:43:14 2020
New Revision: 362945
URL: https://svnweb.freebsd.org/changeset/base/362945

Log:
  Add a note regarding the introduction of the new bc and dc implementations
  that are built by default on -CURRENT after 2020-06-26.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sun Jul  5 14:38:22 2020(r362944)
+++ head/UPDATING   Sun Jul  5 14:43:14 2020(r362945)
@@ -26,6 +26,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20200627:
+   A new implementation of bc and dc has been imorted in r362681. This
+   implementation corrects non-conformant behavior of the previous bc
+   and adds GNU bc compatible options. It offers a number of extensions,
+   is much faster on large values, and has support for message catalogs
+   (a number of languages are already supported, contributions of further
+   languages welcome). The option WITHOUT_GH_BC can be used to build the
+   world with the previous versions of bc and dc.
+
 20200625:
r362639 changed the internal API used between the NFS kernel modules.
As such, they all need to be rebuilt from sources.
___
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: r362944 - in head/sys: amd64/amd64 arm64/arm64 kern sys

2020-07-05 Thread Andrew Turner
Author: andrew
Date: Sun Jul  5 14:38:22 2020
New Revision: 362944
URL: https://svnweb.freebsd.org/changeset/base/362944

Log:
  Rerun kernel ifunc resolvers after all CPUs have started
  
  On architectures that use RELA relocations it is safe to rerun the ifunc
  resolvers on after all CPUs have started, but while they are sill parked.
  
  On arm64 with big.LITTLE this is needed as some SoCs have shipped with
  different ID register values the big and little clusters meaning we were
  unable to rely on the register values from the boot CPU.
  
  Add support for rerunning the resolvers on arm64 and amd64 as these are
  both RELA using architectures.
  
  Reviewed by:  kib
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D25455

Modified:
  head/sys/amd64/amd64/elf_machdep.c
  head/sys/amd64/amd64/machdep.c
  head/sys/arm64/arm64/elf_machdep.c
  head/sys/arm64/arm64/machdep.c
  head/sys/kern/link_elf.c
  head/sys/sys/linker.h

Modified: head/sys/amd64/amd64/elf_machdep.c
==
--- head/sys/amd64/amd64/elf_machdep.c  Sun Jul  5 13:15:13 2020
(r362943)
+++ head/sys/amd64/amd64/elf_machdep.c  Sun Jul  5 14:38:22 2020
(r362944)
@@ -186,7 +186,7 @@ elf_is_ifunc_reloc(Elf_Size r_info)
 /* Process one elf relocation with addend. */
 static int
 elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
-int type, elf_lookup_fn lookup)
+int type, bool late_ifunc, elf_lookup_fn lookup)
 {
Elf64_Addr *where, val;
Elf32_Addr *where32, val32;
@@ -226,6 +226,13 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
panic("unknown reloc type %d\n", type);
}
 
+   if (late_ifunc) {
+   KASSERT(type == ELF_RELOC_RELA,
+   ("Only RELA ifunc relocations are supported"));
+   if (rtype != R_X86_64_IRELATIVE)
+   return (0);
+   }
+
switch (rtype) {
case R_X86_64_NONE: /* none */
break;
@@ -305,7 +312,7 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const 
 elf_lookup_fn lookup)
 {
 
-   return (elf_reloc_internal(lf, relocbase, data, type, lookup));
+   return (elf_reloc_internal(lf, relocbase, data, type, false, lookup));
 }
 
 int
@@ -313,7 +320,15 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, 
 int type, elf_lookup_fn lookup)
 {
 
-   return (elf_reloc_internal(lf, relocbase, data, type, lookup));
+   return (elf_reloc_internal(lf, relocbase, data, type, false, lookup));
+}
+
+int
+elf_reloc_late(linker_file_t lf, Elf_Addr relocbase, const void *data,
+int type, elf_lookup_fn lookup)
+{
+
+   return (elf_reloc_internal(lf, relocbase, data, type, true, lookup));
 }
 
 int

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Sun Jul  5 13:15:13 2020
(r362943)
+++ head/sys/amd64/amd64/machdep.c  Sun Jul  5 14:38:22 2020
(r362944)
@@ -320,6 +320,13 @@ cpu_startup(dummy)
cpu_setregs();
 }
 
+static void
+late_ifunc_resolve(void *dummy __unused)
+{
+   link_elf_late_ireloc();
+}
+SYSINIT(late_ifunc_resolve, SI_SUB_CPU, SI_ORDER_ANY, late_ifunc_resolve, 
NULL);
+
 /*
  * Send an interrupt to process.
  *

Modified: head/sys/arm64/arm64/elf_machdep.c
==
--- head/sys/arm64/arm64/elf_machdep.c  Sun Jul  5 13:15:13 2020
(r362943)
+++ head/sys/arm64/arm64/elf_machdep.c  Sun Jul  5 14:38:22 2020
(r362944)
@@ -143,8 +143,10 @@ reloc_instr_imm(Elf32_Addr *where, Elf_Addr val, u_int
  */
 static int
 elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
-int type, int local, elf_lookup_fn lookup)
+int type, int flags, elf_lookup_fn lookup)
 {
+#defineARM64_ELF_RELOC_LOCAL   (1 << 0)
+#defineARM64_ELF_RELOC_LATE_IFUNC  (1 << 1)
Elf_Addr *where, addr, addend, val;
Elf_Word rtype, symidx;
const Elf_Rel *rel;
@@ -170,7 +172,14 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
panic("unknown reloc type %d\n", type);
}
 
-   if (local) {
+   if ((flags & ARM64_ELF_RELOC_LATE_IFUNC) != 0) {
+   KASSERT(type == ELF_RELOC_RELA,
+   ("Only RELA ifunc relocations are supported"));
+   if (rtype != R_AARCH64_IRELATIVE)
+   return (0);
+   }
+
+   if ((flags & ARM64_ELF_RELOC_LOCAL) != 0) {
if (rtype == R_AARCH64_RELATIVE)
*where = elf_relocaddr(lf, relocbase + addend);
return (0);
@@ -229,7 +238,8 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, 
 int type, elf_lookup_fn lookup)
 {
 
-   return 

svn commit: r362943 - head/share/man/man4

2020-07-05 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Jul  5 13:15:13 2020
New Revision: 362943
URL: https://svnweb.freebsd.org/changeset/base/362943

Log:
  Make linux(4) man page also mention /compat/linux/dev.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man4/linux.4

Modified: head/share/man/man4/linux.4
==
--- head/share/man/man4/linux.4 Sun Jul  5 13:08:17 2020(r362942)
+++ head/share/man/man4/linux.4 Sun Jul  5 13:15:13 2020(r362943)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 4, 2020
+.Dd July 5, 2020
 .Dt LINUX 4
 .Os
 .Sh NAME
@@ -129,6 +129,9 @@ Defaults to 0.
 .Bl -tag -width /compat/linux/dev/shm -compact
 .It Pa /compat/linux
 minimal Linux run-time environment
+.It Pa /compat/linux/dev
+device file system, see
+.Xr devfs 5
 .It Pa /compat/linux/dev/fd
 file descriptor file system mounted with the
 .Cm linrdlnk
___
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: r362942 - head/sbin/shutdown

2020-07-05 Thread Niclas Zeising
Author: zeising (doc,ports committer)
Date: Sun Jul  5 13:08:17 2020
New Revision: 362942
URL: https://svnweb.freebsd.org/changeset/base/362942

Log:
  shutdown.8: Fix typo
  
  Fix a typo in shutdown.8, use ',' instead of '.' when listing items.
  
  MFC after:1 week

Modified:
  head/sbin/shutdown/shutdown.8

Modified: head/sbin/shutdown/shutdown.8
==
--- head/sbin/shutdown/shutdown.8   Sun Jul  5 10:57:28 2020
(r362941)
+++ head/sbin/shutdown/shutdown.8   Sun Jul  5 13:08:17 2020
(r362942)
@@ -135,7 +135,7 @@ suffix:
 .Dq Li s ,
 .Dq Li sec ,
 .Dq Li m ,
-.Dq Li min .
+.Dq Li min ,
 .Dq Li h ,
 .Dq Li hour .
 .Pp
___
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: r362941 - head/sys/compat/linux

2020-07-05 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Jul  5 10:57:28 2020
New Revision: 362941
URL: https://svnweb.freebsd.org/changeset/base/362941

Log:
  Fix Linux recvmsg(2) when msg_namelen returned is 0.  Previously
  it would fail with EINVAL, breaking some of the Python regression
  tests.
  
  While here, cap the user-controlled message length.
  
  Note that the code doesn't seem to be copying out the new length
  in either (success or failure) case. This will be addressed separately.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25392

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cSun Jul  5 06:51:39 2020
(r362940)
+++ head/sys/compat/linux/linux_socket.cSun Jul  5 10:57:28 2020
(r362941)
@@ -1196,11 +1196,14 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
if (error != 0)
return (error);
 
-   if (msg->msg_name) {
+   if (msg->msg_name != NULL && msg->msg_namelen > 0) {
+   msg->msg_namelen = min(msg->msg_namelen, SOCK_MAXADDRLEN);
sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK);
msg->msg_name = sa;
-   } else
+   } else {
sa = NULL;
+   msg->msg_name = NULL;
+   }
 
uiov = msg->msg_iov;
msg->msg_iov = iov;
@@ -1210,7 +1213,10 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
if (error != 0)
goto bad;
 
-   if (msg->msg_name) {
+   /*
+* Note that kern_recvit() updates msg->msg_namelen.
+*/
+   if (msg->msg_name != NULL && msg->msg_namelen > 0) {
msg->msg_name = PTRIN(linux_msghdr.msg_name);
error = bsd_to_linux_sockaddr(sa, , msg->msg_namelen);
if (error == 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: r362809 - head/contrib/mandoc

2020-07-05 Thread Gordon Bergling
On Thu, Jul 02, 2020 at 12:06:13AM +, Alexey Dokuchaev wrote:
> On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote:
> > Thats good, but realize the page already contains history that
> > reads like:
> > 
> > HISTORY
> >  Part of the functionality of whatis was already provided by the former
> >  manwhere utility in 1BSD. The apropos and whatis utilities first ap-
> >  peared in 2BSD.  They were rewritten from scratch for OpenBSD 5.6.
> > 
> >  The -M option and the MANPATH variable first appeared in 4.3BSD; -m in
> >  4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for 
> > apropos
> >  and in OpenBSD 5.6 for whatis.  The options -acfhIKklOTWw appeared in
> >  OpenBSD 5.7.
> > 
> > And further contains:
> > 
> > AUTHORS
> >  Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis
> >  in February 1979. The current version was written by Kristaps Dzonsons
> >   and Ingo Schwarze .
> > 
> > So the history is rich and complete, do we really need to say when we
> > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page?
> 
> Ah, in this case, the only thing lacking from the current version is mention
> of FreeBSD 11.1.  Sorry for not checking with that before writing my reply.
> My main point, however, was that reverse chronological order looks strange.

I have created the following differential and integrated the given feedback.

https://reviews.freebsd.org/D25566

If necessary I could revert r362809, but somebody should explicit request it.

--Gordon
___
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"