svn commit: r328876 - head/sys/netinet6

2018-02-05 Thread Andrey V. Elsukov
Author: ae
Date: Mon Feb  5 09:22:07 2018
New Revision: 328876
URL: https://svnweb.freebsd.org/changeset/base/328876

Log:
  Modify ip6_get_prevhdr() to be able use it safely.
  
  Instead of returning pointer to the previous header, return its offset.
  In frag6_input() use m_copyback() and determined offset to store next
  header instead of accessing to it by pointer and assuming that the memory
  is contiguous.
  
  In rip6_input() use offset returned by ip6_get_prevhdr() instead of
  calculating it from pointers arithmetic, because IP header can belong
  to another mbuf in the chain.
  
  Reported by:  Maxime Villard 
  Reviewed by:  kp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14158

Modified:
  head/sys/netinet6/frag6.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_var.h
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Mon Feb  5 08:50:34 2018(r328875)
+++ head/sys/netinet6/frag6.c   Mon Feb  5 09:22:07 2018(r328876)
@@ -578,10 +578,8 @@ insert:
/*
 * Store NXT to the original.
 */
-   {
-   char *prvnxtp = ip6_get_prevhdr(m, offset); /* XXX */
-   *prvnxtp = nxt;
-   }
+   m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t),
+   (caddr_t)&nxt);
 
frag6_remque(q6);
V_frag6_nfrags -= q6->ip6q_nfrag;

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Mon Feb  5 08:50:34 2018
(r328875)
+++ head/sys/netinet6/ip6_input.c   Mon Feb  5 09:22:07 2018
(r328876)
@@ -1711,49 +1711,39 @@ ip6_pullexthdr(struct mbuf *m, size_t off, int nxt)
 /*
  * Get pointer to the previous header followed by the header
  * currently processed.
- * XXX: This function supposes that
- * M includes all headers,
- * the next header field and the header length field of each header
- * are valid, and
- * the sum of each header length equals to OFF.
- * Because of these assumptions, this function must be called very
- * carefully. Moreover, it will not be used in the near future when
- * we develop `neater' mechanism to process extension headers.
  */
-char *
+int
 ip6_get_prevhdr(const struct mbuf *m, int off)
 {
-   struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+   struct ip6_ext ip6e;
+   struct ip6_hdr *ip6;
+   int len, nlen, nxt;
 
if (off == sizeof(struct ip6_hdr))
-   return (&ip6->ip6_nxt);
-   else {
-   int len, nxt;
-   struct ip6_ext *ip6e = NULL;
+   return (offsetof(struct ip6_hdr, ip6_nxt));
+   if (off < sizeof(struct ip6_hdr))
+   panic("%s: off < sizeof(struct ip6_hdr)", __func__);
 
-   nxt = ip6->ip6_nxt;
-   len = sizeof(struct ip6_hdr);
-   while (len < off) {
-   ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + len);
-
-   switch (nxt) {
-   case IPPROTO_FRAGMENT:
-   len += sizeof(struct ip6_frag);
-   break;
-   case IPPROTO_AH:
-   len += (ip6e->ip6e_len + 2) << 2;
-   break;
-   default:
-   len += (ip6e->ip6e_len + 1) << 3;
-   break;
-   }
-   nxt = ip6e->ip6e_nxt;
+   ip6 = mtod(m, struct ip6_hdr *);
+   nxt = ip6->ip6_nxt;
+   len = sizeof(struct ip6_hdr);
+   nlen = 0;
+   while (len < off) {
+   m_copydata(m, len, sizeof(ip6e), (caddr_t)&ip6e);
+   switch (nxt) {
+   case IPPROTO_FRAGMENT:
+   nlen = sizeof(struct ip6_frag);
+   break;
+   case IPPROTO_AH:
+   nlen = (ip6e.ip6e_len + 2) << 2;
+   break;
+   default:
+   nlen = (ip6e.ip6e_len + 1) << 3;
}
-   if (ip6e)
-   return (&ip6e->ip6e_nxt);
-   else
-   return NULL;
+   len += nlen;
+   nxt = ip6e.ip6e_nxt;
}
+   return (len - nlen);
 }
 
 /*

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Mon Feb  5 08:50:34 2018(r328875)
+++ head/sys/netinet6/ip6_var.h Mon Feb  5 09:22:07 2018(r328876)
@@ -364,7 +364,7 @@ voidip6_direct_input(struct mbuf *);
 void   ip6_freepcbopts(struct ip6_pktopts *);
 
 intip6_unknown_opt(u_int8_t *, struct mbuf *, int);
-char * ip6_get_prevhdr(const stru

svn commit: r328880 - head/sys/vm

2018-02-05 Thread Konstantin Belousov
Author: kib
Date: Mon Feb  5 12:49:20 2018
New Revision: 328880
URL: https://svnweb.freebsd.org/changeset/base/328880

Log:
  On munlock(), unwire correct page.
  
  It is possible, for complex fork()/collapse situations, to have
  sibling address spaces to partially share shadow chains. If one
  sibling performs wiring, it can happen that a transient page, invalid
  and busy, is installed into a shadow object which is visible to other
  sibling for the duration of vm_fault_hold().  When the backing object
  contains the valid page, and the wiring is performed on read-only
  entry, the transient page is eventually removed.
  
  But the sibling which observed the transient page might perform the
  unwire, executing vm_object_unwire().  There, the first page found in
  the shadow chain is considered as the page that was wired for the
  mapping.  It is really the page below it which is wired.  So we unwire
  the wrong page, either triggering the asserts of breaking the page'
  wire counter.
  
  As the fix, wait for the busy state to finish if we find such page
  during unwire, and restart the shadow chain walk after the sleep.
  
  Reported and tested by:   pho
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D14184

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Mon Feb  5 10:29:57 2018(r328879)
+++ head/sys/vm/vm_object.c Mon Feb  5 12:49:20 2018(r328880)
@@ -2278,7 +2278,7 @@ void
 vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t length,
 uint8_t queue)
 {
-   vm_object_t tobject;
+   vm_object_t tobject, t1object;
vm_page_t m, tm;
vm_pindex_t end_pindex, pindex, tpindex;
int depth, locked_depth;
@@ -2292,6 +2292,7 @@ vm_object_unwire(vm_object_t object, vm_ooffset_t offs
return;
pindex = OFF_TO_IDX(offset);
end_pindex = pindex + atop(length);
+again:
locked_depth = 1;
VM_OBJECT_RLOCK(object);
m = vm_page_find_least(object, pindex);
@@ -2325,16 +2326,26 @@ vm_object_unwire(vm_object_t object, vm_ooffset_t offs
m = TAILQ_NEXT(m, listq);
}
vm_page_lock(tm);
+   if (vm_page_xbusied(tm)) {
+   for (tobject = object; locked_depth >= 1;
+   locked_depth--) {
+   t1object = tobject->backing_object;
+   VM_OBJECT_RUNLOCK(tobject);
+   tobject = t1object;
+   }
+   vm_page_busy_sleep(tm, "unwbo", true);
+   goto again;
+   }
vm_page_unwire(tm, queue);
vm_page_unlock(tm);
 next_page:
pindex++;
}
/* Release the accumulated object locks. */
-   for (depth = 0; depth < locked_depth; depth++) {
-   tobject = object->backing_object;
-   VM_OBJECT_RUNLOCK(object);
-   object = tobject;
+   for (tobject = object; locked_depth >= 1; locked_depth--) {
+   t1object = tobject->backing_object;
+   VM_OBJECT_RUNLOCK(tobject);
+   tobject = t1object;
}
 }
 
___
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: r328881 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-02-05 Thread Andriy Gapon
Author: avg
Date: Mon Feb  5 14:19:36 2018
New Revision: 328881
URL: https://svnweb.freebsd.org/changeset/base/328881

Log:
  zfs: move a utility function, ioflags, closer to its consumers
  
  No functional change.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Feb 
 5 12:49:20 2018(r328880)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Feb 
 5 14:19:36 2018(r328881)
@@ -4514,21 +4514,6 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int fla
 }
 
 static int
-ioflags(int ioflags)
-{
-   int flags = 0;
-
-   if (ioflags & IO_APPEND)
-   flags |= FAPPEND;
-   if (ioflags & IO_NDELAY)
-   flags |= FNONBLOCK;
-   if (ioflags & IO_SYNC)
-   flags |= (FSYNC | FDSYNC | FRSYNC);
-
-   return (flags);
-}
-
-static int
 zfs_getpages(struct vnode *vp, vm_page_t *m, int count, int *rbehind,
 int *rahead)
 {
@@ -4848,6 +4833,21 @@ zfs_freebsd_ioctl(ap)
 
return (zfs_ioctl(ap->a_vp, ap->a_command, (intptr_t)ap->a_data,
ap->a_fflag, ap->a_cred, NULL, NULL));
+}
+
+static int
+ioflags(int ioflags)
+{
+   int flags = 0;
+
+   if (ioflags & IO_APPEND)
+   flags |= FAPPEND;
+   if (ioflags & IO_NDELAY)
+   flags |= FNONBLOCK;
+   if (ioflags & IO_SYNC)
+   flags |= (FSYNC | FDSYNC | FRSYNC);
+
+   return (flags);
 }
 
 static int
___
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: r328882 - head/sys/fs/ext2fs

2018-02-05 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb  5 14:30:27 2018
New Revision: 328882
URL: https://svnweb.freebsd.org/changeset/base/328882

Log:
  ext2fs: Cleanup variable assignments for extents.
  
  Delay the initialization of variables until the are needed.
  
  In the case of ext4_ext_rm_leaf(), make sure 'error' value is not
  undefined.
  
  Reported by:  Clang's static analyzer
  Differential Revision:https://reviews.freebsd.org/D14193

Modified:
  head/sys/fs/ext2fs/ext2_extents.c

Modified: head/sys/fs/ext2fs/ext2_extents.c
==
--- head/sys/fs/ext2fs/ext2_extents.c   Mon Feb  5 14:19:36 2018
(r328881)
+++ head/sys/fs/ext2fs/ext2_extents.c   Mon Feb  5 14:30:27 2018
(r328882)
@@ -1159,14 +1159,13 @@ ext4_new_blocks(struct inode *ip, daddr_t lbn, e4fs_da
struct m_ext2fs *fs;
e4fs_daddr_t newblk;
 
-   fs = ip->i_e2fs;
-
/*
 * We will allocate only single block for now.
 */
if (*count > 1)
return (0);
 
+   fs = ip->i_e2fs;
EXT2_LOCK(ip->i_ump);
*perror = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newblk);
if (*perror)
@@ -1193,13 +1192,12 @@ ext4_ext_get_blocks(struct inode *ip, e4fs_daddr_t ibl
unsigned long allocated = 0;
int error = 0, depth;
 
-   fs = ip->i_e2fs;
-   *pallocated = 0;
-   path = NULL;
if(bpp)
*bpp = NULL;
+   *pallocated = 0;
 
/* Check cache. */
+   path = NULL;
if ((bpref = ext4_ext_in_cache(ip, iblk, &newex))) {
if (bpref == EXT4_EXT_CACHE_IN) {
/* Block is already allocated. */
@@ -1271,6 +1269,7 @@ out:
 
if (bpp)
{
+   fs = ip->i_e2fs;
error = bread(ip->i_devvp, fsbtodb(fs, newblk),
fs->e2fs_bsize, cred, &bp);
if (error) {
@@ -1304,7 +1303,7 @@ static inline struct ext4_extent_header *
 ext4_ext_header(struct inode *ip)
 {
 
-   return (struct ext4_extent_header *)ip->i_db;
+   return ((struct ext4_extent_header *)ip->i_db);
 }
 
 static int
@@ -1345,19 +1344,15 @@ static int
 ext4_ext_rm_leaf(struct inode *ip, struct ext4_extent_path *path,
 uint64_t start)
 {
-   struct m_ext2fs *fs;
-   int depth;
struct ext4_extent_header *eh;
+   struct ext4_extent *ex;
unsigned int a, b, block, num;
unsigned long ex_blk;
unsigned short ex_len;
-   struct ext4_extent *ex;
+   int depth;
int error, correct_index;
 
-   fs = ip->i_e2fs;
depth = ext4_ext_inode_depth(ip);
-   correct_index = 0;
-
if (!path[depth].ep_header) {
if (path[depth].ep_data == NULL)
return (EINVAL);
@@ -1367,7 +1362,8 @@ ext4_ext_rm_leaf(struct inode *ip, struct ext4_extent_
 
eh = path[depth].ep_header;
if (!eh) {
-   ext2_fserr(fs, ip->i_uid, "bad header => extent corrupted");
+   ext2_fserr(ip->i_e2fs, ip->i_uid,
+   "bad header => extent corrupted");
return (EIO);
}
 
@@ -1375,6 +1371,8 @@ ext4_ext_rm_leaf(struct inode *ip, struct ext4_extent_
ex_blk = ex->e_blk;
ex_len = ext4_ext_get_actual_len(ex);
 
+   error = 0;
+   correct_index = 0;
while (ex >= EXT_FIRST_EXTENT(eh) && ex_blk + ex_len > start) {
path[depth].ep_ext = ex;
a = ex_blk > start ? ex_blk : start;
@@ -1442,7 +1440,6 @@ ext4_read_extent_tree_block(struct inode *ip, e4fs_dad
int error;
 
fs = ip->i_e2fs;
-
error = bread(ip->i_devvp, fsbtodb(fs, pblk),
fs->e2fs_bsize, NOCRED, &bp);
if (error) {
@@ -1506,10 +1503,10 @@ ext4_ext_remove_space(struct inode *ip, off_t length, 
if (!path)
return (ENOMEM);
 
-   i = 0;
path[0].ep_header = ehp;
path[0].ep_depth = depth;
-   while (i >= 0 && error == 0) {
+   i = 0;
+   while (error == 0 && i >= 0) {
if (i == depth) {
/* This is leaf. */
error = ext4_ext_rm_leaf(ip, path, length);
@@ -1568,7 +1565,6 @@ ext4_ext_remove_space(struct inode *ip, off_t length, 
 ext4_ext_header(ip)->eh_depth = 0;
 ext4_ext_header(ip)->eh_max = ext4_ext_space_root(ip);
 ext4_ext_dirty(ip, path);
-
}
 
ext4_ext_drop_refs(path);
___
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: r328883 - in head/sys/modules: linux linux64

2018-02-05 Thread Ed Maste
Author: emaste
Date: Mon Feb  5 14:53:18 2018
New Revision: 328883
URL: https://svnweb.freebsd.org/changeset/base/328883

Log:
  Move assym.s to DPSRCS in linux modules
  
  assym.s exists only to be included by other .s files, and should not
  actually be assembled by itself.
  
  Sponsored by: Turing Robotic Industries Inc.

Modified:
  head/sys/modules/linux/Makefile
  head/sys/modules/linux64/Makefile

Modified: head/sys/modules/linux/Makefile
==
--- head/sys/modules/linux/Makefile Mon Feb  5 14:30:27 2018
(r328882)
+++ head/sys/modules/linux/Makefile Mon Feb  5 14:53:18 2018
(r328883)
@@ -17,9 +17,9 @@ SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c li
linux${SFX}_sysvec.c linux_uid16.c linux_time.c \
linux_timer.c linux_vdso.c \
opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \
-   device_if.h bus_if.h assym.s \
+   device_if.h bus_if.h \
linux${SFX}_support.s
-DPSRCS=linux${SFX}_genassym.c
+DPSRCS=assym.s linux${SFX}_genassym.c
 
 # XXX: for assym.s
 SRCS+=  opt_kstack_pages.h opt_nfs.h opt_compat.h opt_hwpmc_hooks.h

Modified: head/sys/modules/linux64/Makefile
==
--- head/sys/modules/linux64/Makefile   Mon Feb  5 14:30:27 2018
(r328882)
+++ head/sys/modules/linux64/Makefile   Mon Feb  5 14:53:18 2018
(r328883)
@@ -11,9 +11,9 @@ SRCS= linux_fork.c linux_dummy.c linux_file.c linux_ev
linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \
opt_inet6.h opt_compat.h opt_posix.h opt_usb.h \
-   vnode_if.h device_if.h bus_if.h assym.s \
+   vnode_if.h device_if.h bus_if.h \
linux_support.s
-DPSRCS=linux_genassym.c
+DPSRCS=assym.s linux_genassym.c
 
 # XXX: for assym.s
 SRCS+=  opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r328885 - head/sys/fs/ext2fs

2018-02-05 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb  5 15:14:01 2018
New Revision: 328885
URL: https://svnweb.freebsd.org/changeset/base/328885

Log:
  ext2fs: remove EXT4F_RO_INCOMPAT_SUPP
  
  This was a hack to be able to mount ext4 filesystems read-only while not
  supporting all the features. We now support all those features so it
  doesn't make sense to keep the undocumented hack.
  
  Discussed with:   fsu

Modified:
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==
--- head/sys/fs/ext2fs/ext2_vfsops.cMon Feb  5 15:02:35 2018
(r328884)
+++ head/sys/fs/ext2fs/ext2_vfsops.cMon Feb  5 15:14:01 2018
(r328885)
@@ -290,8 +290,7 @@ ext2_check_sb_compat(struct ext2fs *es, struct cdev *d
return (1);
}
if (es->e2fs_rev > E2FS_REV0) {
-   mask = es->e2fs_features_incompat & ~(EXT2F_INCOMPAT_SUPP |
-   EXT4F_RO_INCOMPAT_SUPP);
+   mask = es->e2fs_features_incompat & ~(EXT2F_INCOMPAT_SUPP);
if (mask) {
printf("WARNING: mount of %s denied due to "
"unsupported optional features:\n", devtoname(dev));

Modified: head/sys/fs/ext2fs/ext2fs.h
==
--- head/sys/fs/ext2fs/ext2fs.h Mon Feb  5 15:02:35 2018(r328884)
+++ head/sys/fs/ext2fs/ext2fs.h Mon Feb  5 15:14:01 2018(r328885)
@@ -319,11 +319,6 @@ static const struct ext2_feature incompat[] = {
  * - EXT2F_ROCOMPAT_HUGE_FILE
  * - EXT2F_INCOMPAT_EXTENTS
  *
- * We do not support these EXT4 features but they are irrelevant
- * for read-only support:
- * - EXT2F_INCOMPAT_RECOVER
- * - EXT2F_INCOMPAT_FLEX_BG
- * - EXT2F_INCOMPAT_META_BG
  */
 #defineEXT2F_COMPAT_SUPP   EXT2F_COMPAT_DIRHASHINDEX
 #defineEXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \
@@ -339,7 +334,6 @@ static const struct ext2_feature incompat[] = {
 EXT2F_INCOMPAT_64BIT | \
 EXT2F_INCOMPAT_FLEX_BG | \
 EXT2F_INCOMPAT_CSUM_SEED)
-#defineEXT4F_RO_INCOMPAT_SUPP  EXT2F_INCOMPAT_RECOVER
 
 /* Assume that user mode programs are passing in an ext2fs superblock, not
  * a kernel struct super_block.  This will allow us to call the feature-test
___
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: r328890 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2018-02-05 Thread Ed Maste
Author: emaste
Date: Mon Feb  5 17:29:12 2018
New Revision: 328890
URL: https://svnweb.freebsd.org/changeset/base/328890

Log:
  Linuxolator whitespace cleanup
  
  A version of each of the MD files by necessity exists for each CPU
  architecture supported by the Linuxolator.  Clean these up so that new
  architectures do not inherit whitespace issues.
  
  Clean up shared Linuxolator files while here.
  
  Sponsored by: Turing Robotic Industries Inc.

Modified:
  head/sys/amd64/linux/linux.h
  head/sys/amd64/linux/linux_ptrace.c
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/linux.h
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/linux32_locore.s
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/compat/linux/check_internal_locks.d
  head/sys/compat/linux/linux_emul.c
  head/sys/compat/linux/linux_event.c
  head/sys/compat/linux/linux_file.h
  head/sys/compat/linux/linux_fork.c
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_ioctl.h
  head/sys/compat/linux/linux_ipc.c
  head/sys/compat/linux/linux_ipc.h
  head/sys/compat/linux/linux_ipc64.h
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/linux/linux_persona.h
  head/sys/compat/linux/linux_signal.c
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_socket.h
  head/sys/compat/linux/linux_time.c
  head/sys/compat/linux/linux_util.h
  head/sys/compat/linux/stats_timing.d
  head/sys/compat/linux/trace_futexes.d
  head/sys/i386/linux/linux.h
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/linux_locore.s
  head/sys/i386/linux/linux_machdep.c
  head/sys/i386/linux/linux_support.s
  head/sys/i386/linux/linux_sysvec.c
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/linux.h
==
--- head/sys/amd64/linux/linux.hMon Feb  5 17:01:18 2018
(r328889)
+++ head/sys/amd64/linux/linux.hMon Feb  5 17:29:12 2018
(r328890)
@@ -459,7 +459,7 @@ struct l_pollfd {
 struct linux_robust_list {
l_uintptr_t next;
 };
- 
+
 struct linux_robust_list_head {
struct linux_robust_listlist;
l_long  futex_offset;

Modified: head/sys/amd64/linux/linux_ptrace.c
==
--- head/sys/amd64/linux/linux_ptrace.c Mon Feb  5 17:01:18 2018
(r328889)
+++ head/sys/amd64/linux/linux_ptrace.c Mon Feb  5 17:29:12 2018
(r328890)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 #defineLINUX_PTRACE_O_TRACEVFORKDONE   32
 #defineLINUX_PTRACE_O_TRACEEXIT64
 #defineLINUX_PTRACE_O_TRACESECCOMP 128
-#defineLINUX_PTRACE_O_EXITKILL 1048576 
+#defineLINUX_PTRACE_O_EXITKILL 1048576
 #defineLINUX_PTRACE_O_SUSPEND_SECCOMP  2097152
 
 #defineLINUX_NT_PRSTATUS   1
@@ -239,7 +239,7 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, 
if (data & LINUX_PTRACE_O_TRACEFORK)
mask |= PTRACE_FORK;
 
-   if (data & LINUX_PTRACE_O_TRACEVFORK)
+   if (data & LINUX_PTRACE_O_TRACEVFORK)
mask |= PTRACE_VFORK;
 
if (data & LINUX_PTRACE_O_TRACECLONE)

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Mon Feb  5 17:01:18 2018
(r328889)
+++ head/sys/amd64/linux/linux_sysvec.c Mon Feb  5 17:29:12 2018
(r328890)
@@ -758,7 +758,7 @@ linux_vsyscall(struct thread *td)
struct trapframe *frame;
uint64_t retqaddr;
int code, traced;
-   int error; 
+   int error;
 
frame = td->td_frame;
 
@@ -832,7 +832,7 @@ linux_vdso_install(void *param)
 
amd64_lower_shared_page(&elf_linux_sysvec);
 
-   linux_szsigcode = (&_binary_linux_locore_o_end - 
+   linux_szsigcode = (&_binary_linux_locore_o_end -
&_binary_linux_locore_o_start);
 
if (linux_szsigcode > elf_linux_sysvec.sv_shared_page_len)

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterMon Feb  5 17:01:18 2018
(r328889)
+++ head/sys/amd64/linux/syscalls.masterMon Feb  5 17:29:12 2018
(r328890)
@@ -471,10 +471,10 @@
 278AUE_NULLSTD { int linux_vmsplice(void); }
 279AUE_NULLSTD { int linux_move_pages(void); }
 280AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
-   const struct l_timespec *times, l_int 
flags); }
-281 AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
-l_

svn commit: r328891 - head/lib/libcasper/libcasper

2018-02-05 Thread Mark Johnston
Author: markj
Date: Mon Feb  5 17:33:16 2018
New Revision: 328891
URL: https://svnweb.freebsd.org/changeset/base/328891

Log:
  Document the need for WITH_CASPER.
  
  After r325062, consumers need to define WITH_CASPER for libcasper to
  function as expected.

Modified:
  head/lib/libcasper/libcasper/libcasper.3

Modified: head/lib/libcasper/libcasper/libcasper.3
==
--- head/lib/libcasper/libcasper/libcasper.3Mon Feb  5 17:29:12 2018
(r328890)
+++ head/lib/libcasper/libcasper/libcasper.3Mon Feb  5 17:33:16 2018
(r328891)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 3, 2018
+.Dd February 5, 2018
 .Dt LIBCASPER 3
 .Os
 .Sh NAME
@@ -47,6 +47,7 @@
 .Sh LIBRARY
 .Lb libcasper
 .Sh SYNOPSIS
+.Fd #define WITH_CASPER
 .In sys/nv.h
 .In libcasper.h
 .Ft "cap_channel_t *"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r328892 - head/sys/mips/mips

2018-02-05 Thread Brooks Davis
Author: brooks
Date: Mon Feb  5 18:06:54 2018
New Revision: 328892
URL: https://svnweb.freebsd.org/changeset/base/328892

Log:
  Garbage collect trailing whitespace.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/mips/mips/busdma_machdep.c

Modified: head/sys/mips/mips/busdma_machdep.c
==
--- head/sys/mips/mips/busdma_machdep.c Mon Feb  5 17:33:16 2018
(r328891)
+++ head/sys/mips/mips/busdma_machdep.c Mon Feb  5 18:06:54 2018
(r328892)
@@ -277,7 +277,7 @@ run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
  || (*dmat->filter)(dmat->filterarg, paddr) != 0))
retval = 1;
 
-   dmat = dmat->parent;
+   dmat = dmat->parent;
} while (retval == 0 && dmat != NULL);
return (retval);
 }
@@ -292,7 +292,7 @@ _bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t h
int i;
for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) {
if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1])
-   || (lowaddr < phys_avail[i] && 
+   || (lowaddr < phys_avail[i] &&
highaddr > phys_avail[i]))
return (1);
}
@@ -356,7 +356,7 @@ _busdma_alloc_dmamap(bus_dma_tag_t dmat)
return (map);
 }
 
-static __inline void 
+static __inline void
 _busdma_free_dmamap(bus_dmamap_t map)
 {
 
@@ -497,10 +497,10 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
if (dmat != NULL) {
if (dmat->map_count != 0)
return (EBUSY);
-   
+
while (dmat != NULL) {
bus_dma_tag_t parent;
-   
+
parent = dmat->parent;
atomic_subtract_int(&dmat->ref_count, 1);
if (dmat->ref_count == 0) {
@@ -1394,7 +1394,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
break;
}
bpage->busaddr = pmap_kextract(bpage->vaddr);
-   bpage->vaddr_nocache = 
+   bpage->vaddr_nocache =
(vm_offset_t)pmap_mapdev(bpage->busaddr, PAGE_SIZE);
mtx_lock(&bounce_lock);
STAILQ_INSERT_TAIL(&bz->bounce_page_list, bpage, links);
___
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: r328893 - head/lib/libc/mips/gen

2018-02-05 Thread John Baldwin
Author: jhb
Date: Mon Feb  5 18:10:28 2018
New Revision: 328893
URL: https://svnweb.freebsd.org/changeset/base/328893

Log:
  Fix makecontext() on MIPS O32.
  
  The GP register can be clobbered by the callback, so save it in S1
  while invoking the callback function.
  
  While here, add a comment expounding on the treatment of GP for the
  various ABIs and the assumptions made.
  
  Reviewed by:  jmallett (earlier version)
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D14179

Modified:
  head/lib/libc/mips/gen/_ctx_start.S

Modified: head/lib/libc/mips/gen/_ctx_start.S
==
--- head/lib/libc/mips/gen/_ctx_start.S Mon Feb  5 18:06:54 2018
(r328892)
+++ head/lib/libc/mips/gen/_ctx_start.S Mon Feb  5 18:10:28 2018
(r328893)
@@ -28,11 +28,25 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * XXX gp?
+ * This requires makecontext() to setup a valid GP for locating
+ * _ctx_done rather than deriving GP from T9 on entry.  Currently this
+ * uses the GP inherited from getcontext() assuming that getcontext()
+ * is in the same shared object as _ctx_done().  For N32 and N64, GP
+ * is caller-save so will be preserved across the call to the callback
+ * function.  For O32, GP is callee-save, so save it in a different
+ * caller-save register (S1) while invoking the callback.  This is
+ * done instead of the usual SETUP_GP/SAVE_GP to avoid disturbing the
+ * stack frame setup by makecontext() for the callback function.
  */
 ENTRY(_ctx_start)
+#ifdef __mips_o32
+   moves1, gp
+#endif
jalrt9
 
+#ifdef __mips_o32
+   movegp, s1
+#endif
movea0, s0
PTR_LA  t9, _ctx_done
jalrt9
___
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: r328894 - in head/sys: amd64/linux i386/linux

2018-02-05 Thread Ed Maste
Author: emaste
Date: Mon Feb  5 18:39:06 2018
New Revision: 328894
URL: https://svnweb.freebsd.org/changeset/base/328894

Log:
  Additional linuxolator whitespace cleanup, missed in r328890

Modified:
  head/sys/amd64/linux/syscalls.master
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterMon Feb  5 18:10:28 2018
(r328893)
+++ head/sys/amd64/linux/syscalls.masterMon Feb  5 18:39:06 2018
(r328894)
@@ -76,7 +76,7 @@
l_size_t nbyte, l_loff_t offset); }
 18 AUE_PWRITE  STD { int linux_pwrite(l_uint fd, char *buf, \
l_size_t nbyte, l_loff_t offset); }
-19 AUE_READV   NOPROTO { int readv(int fd, struct iovec *iovp, \
+19 AUE_READV   NOPROTO { int readv(int fd, struct iovec *iovp, \
u_int iovcnt); }
 20 AUE_WRITEV  NOPROTO { int writev(int fd, struct iovec *iovp, \
u_int iovcnt); }
@@ -472,7 +472,7 @@
 279AUE_NULLSTD { int linux_move_pages(void); }
 280AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
const struct l_timespec *times, l_int 
flags); }
-281AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
+281AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
l_int maxevents, l_int timeout, l_sigset_t 
*mask, \
l_size_t sigsetsize); }
 282AUE_NULLSTD { int linux_signalfd(void); }

Modified: head/sys/i386/linux/syscalls.master
==
--- head/sys/i386/linux/syscalls.master Mon Feb  5 18:10:28 2018
(r328893)
+++ head/sys/i386/linux/syscalls.master Mon Feb  5 18:39:06 2018
(r328894)
@@ -121,10 +121,10 @@
 61 AUE_CHROOT  NOPROTO { int chroot(char *path); }
 62 AUE_NULLSTD { int linux_ustat(l_dev_t dev, \
struct l_ustat *ubuf); }
-63 AUE_DUP2NOPROTO { int dup2(u_int from, u_int to); }
+63 AUE_DUP2NOPROTO { int dup2(u_int from, u_int to); }
 64 AUE_GETPPID STD { int linux_getppid(void); }
-65 AUE_GETPGRP NOPROTO { int getpgrp(void); }
-66 AUE_SETSID  NOPROTO { int setsid(void); }
+65 AUE_GETPGRP NOPROTO { int getpgrp(void); }
+66 AUE_SETSID  NOPROTO { int setsid(void); }
 67 AUE_NULLSTD { int linux_sigaction(l_int sig, \
l_osigaction_t *nsa, \
l_osigaction_t *osa); }
___
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: r328895 - head/etc

2018-02-05 Thread Ed Maste
Author: emaste
Date: Mon Feb  5 18:45:21 2018
New Revision: 328895
URL: https://svnweb.freebsd.org/changeset/base/328895

Log:
  Correct Russia spelling in regdomain.xml
  
  PR:   225658
  MFC after:1 week

Modified:
  head/etc/regdomain.xml

Modified: head/etc/regdomain.xml
==
--- head/etc/regdomain.xml  Mon Feb  5 18:39:06 2018(r328894)
+++ head/etc/regdomain.xml  Mon Feb  5 18:45:21 2018(r328895)
@@ -1595,7 +1595,7 @@
   642 Romania 
 
 
-  643 Rusia 
+  643 Russia 
 
 
   682 Saudi Arabia 
___
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: r328896 - in head: contrib/netbsd-tests/kernel tests/sys/kern

2018-02-05 Thread Brooks Davis
Author: brooks
Date: Mon Feb  5 18:48:00 2018
New Revision: 328896
URL: https://svnweb.freebsd.org/changeset/base/328896

Log:
  Fix and enable SysV IPC tests.
  
  Don't declare some types that FreeBSD incorrectly declares.
  
  Fix an incorrect call to open() (missing mode).
  
  ANSIfy prototypes.
  
  Enable SysV message queue, semaphore, and shared memory tests.
  
  With exception of the workaround for union semun, these fixes have been
  committed to NetBSD.
  
  Reviewed by:  asomers
  Approved by:  CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D13471

Modified:
  head/contrib/netbsd-tests/kernel/t_sysv.c
  head/tests/sys/kern/Makefile

Modified: head/contrib/netbsd-tests/kernel/t_sysv.c
==
--- head/contrib/netbsd-tests/kernel/t_sysv.c   Mon Feb  5 18:45:21 2018
(r328895)
+++ head/contrib/netbsd-tests/kernel/t_sysv.c   Mon Feb  5 18:48:00 2018
(r328896)
@@ -72,7 +72,7 @@ void  sharer(void);
 
 #defineMESSAGE_TEXT_LEN256
 
-struct mymsg {
+struct testmsg {
longmtype;
charmtext[MESSAGE_TEXT_LEN];
 };
@@ -94,11 +94,13 @@ key_t   msgkey, semkey, shmkey;
 
 intmaxloop = 1;
 
+#ifndef __FreeBSD__
 union semun {
int val;/* value for SETVAL */
struct  semid_ds *buf;  /* buffer for IPC_{STAT,SET} */
u_short *array; /* array for GETALL & SETALL */
 };
+#endif
 
 
 /* Writes an integer to a file.  To be used from the body of the test
@@ -174,7 +176,7 @@ key_t get_ftok(int id)
 
/* Create the file, since ftok() requires it to exist! */
 
-   fd = open(token_key, O_RDWR | O_CREAT | O_EXCL);
+   fd = open(token_key, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd == -1) {
rmdir(tmpdir);
atf_tc_fail("open() of temp file failed: %d", errno);
@@ -202,7 +204,7 @@ ATF_TC_BODY(msg, tc)
 {
struct sigaction sa;
struct msqid_ds m_ds;
-   struct mymsg m;
+   struct testmsg m;
sigset_t sigmask;
int sender_msqid;
int loop;
@@ -347,9 +349,7 @@ ATF_TC_CLEANUP(msg, tc)
 }
 
 void
-print_msqid_ds(mp, mode)
-   struct msqid_ds *mp;
-   mode_t mode;
+print_msqid_ds(struct msqid_ds *mp, mode_t mode)
 {
uid_t uid = geteuid();
gid_t gid = getegid();
@@ -381,9 +381,9 @@ print_msqid_ds(mp, mode)
 }
 
 void
-receiver()
+receiver(void)
 {
-   struct mymsg m;
+   struct testmsg m;
int msqid, loop;
 
if ((msqid = msgget(msgkey, 0)) == -1)
@@ -588,9 +588,7 @@ ATF_TC_CLEANUP(sem, tc)
 }
 
 void
-print_semid_ds(sp, mode)
-   struct semid_ds *sp;
-   mode_t mode;
+print_semid_ds(struct semid_ds *sp, mode_t mode)
 {
uid_t uid = geteuid();
gid_t gid = getegid();
@@ -620,7 +618,7 @@ print_semid_ds(sp, mode)
 }
 
 void
-waiter()
+waiter(void)
 {
struct sembuf s;
int semid;
@@ -789,9 +787,7 @@ ATF_TC_CLEANUP(shm, tc)
 }
 
 void
-print_shmid_ds(sp, mode)
-   struct shmid_ds *sp;
-   mode_t mode;
+print_shmid_ds(struct shmid_ds *sp, mode_t mode)
 {
uid_t uid = geteuid();
gid_t gid = getegid();
@@ -823,7 +819,7 @@ print_shmid_ds(sp, mode)
 }
 
 void
-sharer()
+sharer(void)
 {
int shmid;
void *shm_buf;

Modified: head/tests/sys/kern/Makefile
==
--- head/tests/sys/kern/MakefileMon Feb  5 18:45:21 2018
(r328895)
+++ head/tests/sys/kern/MakefileMon Feb  5 18:48:00 2018
(r328896)
@@ -26,6 +26,7 @@ LIBADD.unix_seqpacket_test+=  pthread
 
 NETBSD_ATF_TESTS_C+=   lockf_test
 NETBSD_ATF_TESTS_C+=   mqueue_test
+NETBSD_ATF_TESTS_C+=   sysv_test
 
 CFLAGS.mqueue_test+=   -I${SRCTOP}/tests
 LIBADD.mqueue_test+=   rt
___
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: r328898 - head/sys/kern

2018-02-05 Thread Brooks Davis
Author: brooks
Date: Mon Feb  5 18:58:55 2018
New Revision: 328898
URL: https://svnweb.freebsd.org/changeset/base/328898

Log:
  ANSIfy syscall implementations.
  
  Reviewed by:  rwatson
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14172

Modified:
  head/sys/kern/vfs_extattr.c

Modified: head/sys/kern/vfs_extattr.c
==
--- head/sys/kern/vfs_extattr.c Mon Feb  5 18:56:34 2018(r328897)
+++ head/sys/kern/vfs_extattr.c Mon Feb  5 18:58:55 2018(r328898)
@@ -56,16 +56,17 @@ __FBSDID("$FreeBSD$");
  *
  * Currently this is used only by UFS1 extended attributes.
  */
+#ifndef _SYS_SYSPROTO_H_
+struct extattrctl_args {
+   const char *path;
+   int cmd;
+   const char *filename;
+   int attrnamespace;
+   const char *attrname;
+};
+#endif
 int
-sys_extattrctl(td, uap)
-   struct thread *td;
-   struct extattrctl_args /* {
-   const char *path;
-   int cmd;
-   const char *filename;
-   int attrnamespace;
-   const char *attrname;
-   } */ *uap;
+sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
 {
struct vnode *filename_vp;
struct nameidata nd;
@@ -206,16 +207,17 @@ done:
return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct extattr_set_fd_args {
+   int fd;
+   int attrnamespace;
+   const char *attrname;
+   void *data;
+   size_t nbytes;
+};
+#endif
 int
-sys_extattr_set_fd(td, uap)
-   struct thread *td;
-   struct extattr_set_fd_args /* {
-   int fd;
-   int attrnamespace;
-   const char *attrname;
-   void *data;
-   size_t nbytes;
-   } */ *uap;
+sys_extattr_set_fd(struct thread *td, struct extattr_set_fd_args *uap)
 {
struct file *fp;
char attrname[EXTATTR_MAXNAMELEN];
@@ -241,16 +243,17 @@ sys_extattr_set_fd(td, uap)
return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct extattr_set_file_args {
+   const char *path;
+   int attrnamespace;
+   const char *attrname;
+   void *data;
+   size_t nbytes;
+};
+#endif
 int
-sys_extattr_set_file(td, uap)
-   struct thread *td;
-   struct extattr_set_file_args /* {
-   const char *path;
-   int attrnamespace;
-   const char *attrname;
-   void *data;
-   size_t nbytes;
-   } */ *uap;
+sys_extattr_set_file(struct thread *td, struct extattr_set_file_args *uap)
 {
struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
@@ -276,16 +279,17 @@ sys_extattr_set_file(td, uap)
return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct extattr_set_link_args {
+   const char *path;
+   int attrnamespace;
+   const char *attrname;
+   void *data;
+   size_t nbytes;
+};
+#endif
 int
-sys_extattr_set_link(td, uap)
-   struct thread *td;
-   struct extattr_set_link_args /* {
-   const char *path;
-   int attrnamespace;
-   const char *attrname;
-   void *data;
-   size_t nbytes;
-   } */ *uap;
+sys_extattr_set_link(struct thread *td, struct extattr_set_link_args *uap)
 {
struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
@@ -381,16 +385,17 @@ done:
return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct extattr_get_fd_args {
+   int fd;
+   int attrnamespace;
+   const char *attrname;
+   void *data;
+   size_t nbytes;
+};
+#endif
 int
-sys_extattr_get_fd(td, uap)
-   struct thread *td;
-   struct extattr_get_fd_args /* {
-   int fd;
-   int attrnamespace;
-   const char *attrname;
-   void *data;
-   size_t nbytes;
-   } */ *uap;
+sys_extattr_get_fd(struct thread *td, struct extattr_get_fd_args *uap)
 {
struct file *fp;
char attrname[EXTATTR_MAXNAMELEN];
@@ -416,16 +421,17 @@ sys_extattr_get_fd(td, uap)
return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct extattr_get_file_args {
+   const char *path;
+   int attrnamespace;
+   const char *attrname;
+   void *data;
+   size_t nbytes;
+};
+#endif
 int
-sys_extattr_get_file(td, uap)
-   struct thread *td;
-   struct extattr_get_file_args /* {
-   const char *path;
-   int attrnamespace;
-   const char *attrname;
-   void *data;
-   size_t nbytes;
-   } */ *uap;
+sys_extattr_get_file(struct thread *td, struct extattr_get_file_args *uap)
 {
struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
@@ -450,16 +456,17 @@ sys_extattr_get_file(td, uap)
return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct extattr_get_link_args {
+   const char *path;
+   int attrnamespace;
+   const char *attrnam

svn commit: r328899 - head/sys/kern

2018-02-05 Thread Brooks Davis
Author: brooks
Date: Mon Feb  5 19:06:34 2018
New Revision: 328899
URL: https://svnweb.freebsd.org/changeset/base/328899

Log:
  Reduce duplication in extattr_*_(file|link) syscalls.
  
  Reviewed by:  rwatson
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14173

Modified:
  head/sys/kern/vfs_extattr.c

Modified: head/sys/kern/vfs_extattr.c
==
--- head/sys/kern/vfs_extattr.c Mon Feb  5 18:58:55 2018(r328898)
+++ head/sys/kern/vfs_extattr.c Mon Feb  5 19:06:34 2018(r328899)
@@ -49,6 +49,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+static int kern_extattr_set_path(struct thread *td, const char *path,
+   int attrnamespace, const char *attrname, void *data,
+   size_t nbytes, int follow);
+static int kern_extattr_get_path(struct thread *td, const char *path,
+   int attrnamespace, const char *attrname, void *data,
+   size_t nbytes, int follow);
+static int kern_extattr_delete_path(struct thread *td, const char *path,
+   int attrnamespace, const char *attrname, int follow);
+static int kern_extattr_list_path(struct thread *td, const char *path,
+   int attrnamespace, void *data, size_t nbytes, int follow);
+
 /*
  * Syscall to push extended attribute configuration information into the VFS.
  * Accepts a path, which it converts to a mountpoint, as well as a command
@@ -255,28 +266,9 @@ struct extattr_set_file_args {
 int
 sys_extattr_set_file(struct thread *td, struct extattr_set_file_args *uap)
 {
-   struct nameidata nd;
-   char attrname[EXTATTR_MAXNAMELEN];
-   int error;
 
-   AUDIT_ARG_VALUE(uap->attrnamespace);
-   error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
-   if (error)
-   return (error);
-   AUDIT_ARG_TEXT(attrname);
-
-   NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE,
-   uap->path, td);
-   error = namei(&nd);
-   if (error)
-   return (error);
-   NDFREE(&nd, NDF_ONLY_PNBUF);
-
-   error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname,
-   uap->data, uap->nbytes, td);
-
-   vrele(nd.ni_vp);
-   return (error);
+   return (kern_extattr_set_path(td, uap->path, uap->attrnamespace,
+   uap->attrname, uap->data, uap->nbytes, FOLLOW));
 }
 
 #ifndef _SYS_SYSPROTO_H_
@@ -291,25 +283,33 @@ struct extattr_set_link_args {
 int
 sys_extattr_set_link(struct thread *td, struct extattr_set_link_args *uap)
 {
+
+   return (kern_extattr_set_path(td, uap->path, uap->attrnamespace,
+   uap->attrname, uap->data, uap->nbytes, NOFOLLOW));
+}
+
+static int
+kern_extattr_set_path(struct thread *td, const char *path, int attrnamespace,
+const char *uattrname, void *data, size_t nbytes, int follow)
+{
struct nameidata nd;
char attrname[EXTATTR_MAXNAMELEN];
int error;
 
-   AUDIT_ARG_VALUE(uap->attrnamespace);
-   error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+   AUDIT_ARG_VALUE(attrnamespace);
+   error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL);
if (error)
return (error);
AUDIT_ARG_TEXT(attrname);
 
-   NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, UIO_USERSPACE,
-   uap->path, td);
+   NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
error = namei(&nd);
if (error)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
 
-   error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname,
-   uap->data, uap->nbytes, td);
+   error = extattr_set_vp(nd.ni_vp, attrnamespace, attrname, data,
+   nbytes, td);
 
vrele(nd.ni_vp);
return (error);
@@ -433,27 +433,8 @@ struct extattr_get_file_args {
 int
 sys_extattr_get_file(struct thread *td, struct extattr_get_file_args *uap)
 {
-   struct nameidata nd;
-   char attrname[EXTATTR_MAXNAMELEN];
-   int error;
-
-   AUDIT_ARG_VALUE(uap->attrnamespace);
-   error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
-   if (error)
-   return (error);
-   AUDIT_ARG_TEXT(attrname);
-
-   NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td);
-   error = namei(&nd);
-   if (error)
-   return (error);
-   NDFREE(&nd, NDF_ONLY_PNBUF);
-
-   error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname,
-   uap->data, uap->nbytes, td);
-
-   vrele(nd.ni_vp);
-   return (error);
+   return (kern_extattr_get_path(td, uap->path, uap->attrnamespace,
+   uap->attrname, uap->data, uap->nbytes, FOLLOW));
 }
 
 #ifndef _SYS_SYSPROTO_H_
@@ -468,25 +449,32 @@ struct extattr_get_link_args {
 int
 sys_extattr_get_li

svn commit: r328900 - head/sys/dev/etherswitch/arswitch

2018-02-05 Thread Adrian Chadd
Author: adrian
Date: Mon Feb  5 20:30:53 2018
New Revision: 328900
URL: https://svnweb.freebsd.org/changeset/base/328900

Log:
  [arswitch] fix build breakage.
  
  Apparently the last time I checked building this it didn't pick up that the
  header had changed.

Modified:
  head/sys/dev/etherswitch/arswitch/arswitchreg.h

Modified: head/sys/dev/etherswitch/arswitch/arswitchreg.h
==
--- head/sys/dev/etherswitch/arswitch/arswitchreg.h Mon Feb  5 19:06:34 
2018(r328899)
+++ head/sys/dev/etherswitch/arswitch/arswitchreg.h Mon Feb  5 20:30:53 
2018(r328900)
@@ -364,7 +364,7 @@
 #defineAR934X_REG_OPER_MODE1_PHY4_MII_EN   (1 << 28)
 
 #defineAR934X_REG_FLOOD_MASK   0x2c
-#defineAR934X_FLOOD_MASK_MC_DP(_p) (1 << (0 + (_p)))
+#defineAR934X_FLOOD_MASK_UC_DP(_p) (1 << (0 + (_p)))
 #defineAR934X_FLOOD_MASK_MC_DP(_p) (1 << (16 + (_p)))
 #defineAR934X_FLOOD_MASK_BC_DP(_p) (1 << (25 + (_p)))
 
___
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: r328901 - head/sys/dev/etherswitch/arswitch

2018-02-05 Thread Adrian Chadd
Author: adrian
Date: Mon Feb  5 20:37:29 2018
New Revision: 328901
URL: https://svnweb.freebsd.org/changeset/base/328901

Log:
  [arswitch] disable ARP copy-to-CPU port for AR9340 for now.
  
  I'll have to go double check to see if it does indeed pass ARP frames between
  switch ports with this disabled, but it seems required for the CPU port to see
  ARP traffic.
  
  I'll dig into this some more.

Modified:
  head/sys/dev/etherswitch/arswitch/arswitch_9340.c

Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch_9340.c   Mon Feb  5 20:30:53 
2018(r328900)
+++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c   Mon Feb  5 20:37:29 
2018(r328901)
@@ -90,9 +90,11 @@ ar9340_atu_learn_default(struct arswitch_softc *sc)
arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL,
AR934X_QM_CTRL_ARP_EN, AR934X_QM_CTRL_ARP_EN);
 
+#if 0
/* Copy frame to CPU port, not just redirect it */
arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL,
AR934X_QM_CTRL_ARP_COPY_EN, AR934X_QM_CTRL_ARP_COPY_EN);
+#endif
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r328489 - head/sys/conf

2018-02-05 Thread O. Hartmann
Am Sun, 4 Feb 2018 10:22:31 -0800
Jason Harmening  schrieb:

> On 02/04/18 04:33, O. Hartmann wrote:
> > Am Mon, 29 Jan 2018 05:00:22 -0800
> > David Wolfskill  schrieb:
> >   
> >> On Mon, Jan 29, 2018 at 02:10:04AM -0800, Jason Harmening wrote:  
> 
>  This happens now if PORTS_MODULE=x11/nvidia-driver is defined in 
>  /etc/src.conf:
> 
>  [...]
>  --- kernel-install ---
>  mkdir -p /boot/kernel
>  install -p -m 555 -o root -g wheel kernel /boot/kernel/
>  --- ports-install ---
>  Variable OBJTOP is recursive.
> 
>  make[8]: stopped  
> >>> ...
> >>>
> >>> David sent me logs of the failing case; thanks David!  
> >>
> >> Happy to help! :-)
> >>  
> >>> The failure happens when buildkernel and installkernel are run
> >>> separately instead of all-up, e.g. 'make kernel'.  The installkernel
> >>> step is leaving MK_AUTO_OBJ=no in the env passed to the port build.  It
> >>> looks like at least one of the install stages of nvidia-driver needs to
> >>> generate temporary output, which leads to confusion when the port isn't
> >>> built as though it's an in-tree component.
> >>>
> >>> Can you guys try out the attached patch?  
> >>
> >> I tried it both on my build machine (which does not use kernel modules
> >> from ports, and thus did not exhibit the problem -- but I thought that
> >> verifying that the patch did not break that case worth checking) and on
> >> my laptop (which did exhibit the problem).
> >>
> >> It worked in both cases with no issues for me.
> >>
> >> Thanks! :-)
> >>
> >> Peace,
> >> david  
> > 
> > The problem still persists!
> > 
> > I'm on CURRENT, FreeBSD 12.0-CURRENT #32: Sun Feb  4 09:41:39 CET 2018 
> > amd64, the
> > source tree is at revision 328839.
> > 
> > 
> > I use WITH_META_MODE=YES in /etc/src.conf. My /etc/make.conf consists of a 
> > .include
> > statement which reels in /usr/local/etc/ports.conf in which I define 
> > everything
> > outside the source tree for ports (in case of the nvidia driver, its 
> > DISTVERSION).
> > This worked before and should work again. Today I checked out a completely
> > fresh /usr/src and gleanced the /usr/obj folder and rebuilt the system - 
> > and get the
> > error again:
> > 
> > [...]  
> > ===> Ports module x11/nvidia-driver (install)  
> > cd ${PORTSDIR:-/usr/ports}/x11/nvidia-driver; env  -u CC  -u CXX  -u CPP  -u
> > MAKESYSPATH MAKEFLAGS="-j 4 -J 15,16 .MAKE.LEVEL.ENV=MAKELEVEL KERNEL=kernel
> > MK_AUTO_OBJ=no  
> ^
> Looks like you haven't applied the patch?  MK_AUTO_OBJ being left set in 
> MAKEFLAGS by installkernel was part of the problem.
> 
> That said, the fix I have up for review is slightly different:
> https://reviews.freebsd.org/D14143
> 
> > TARGET=amd64 TARGET_ARCH=amd64"  SYSDIR=/usr/src/sys
> > PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
> > SRC_BASE=/usr/src  OSVERSION=1200056
> > WRKDIRPREFIX=/usr/obj/usr/src/amd64.amd64/sys/THOR make -B deinstall 
> > reinstall ===>
> > Deinstalling for nvidia-driver ===>   Deinstalling nvidia-driver-387.34 
> > Updating
> > database digests format: . done Checking integrity... done (0 conflicting)
> > Deinstallation has been requested for the following 1 packages (of 0 
> > packages in the
> > universe):
> > 
> > Installed packages to be REMOVED:
> >  nvidia-driver-387.34
> > 
> > Number of packages to be removed: 1
> > 
> > The operation will free 99 MiB.
> > [1/1] Deinstalling nvidia-driver-387.34...
> > [1/1] Deleting files for nvidia-driver-387.34: .. done  
> > ===>  Staging for nvidia-driver-387.34
> > ===>   nvidia-driver-387.34 depends on file: /usr/local/lib/libGL.so - found
> > ===>   nvidia-driver-387.34 depends on file: 
> > /usr/local/libdata/pkgconfig/x11.pc -
> > found ===>   nvidia-driver-387.34 depends on
> > file: /usr/local/libdata/pkgconfig/xorg-server.pc  
> > - found ===>   nvidia-driver-387.34 depends on
> > file: /usr/local/libdata/pkgconfig/xext.pc
> > - found ===>   Generating temporary packing list  
> > ===> src (install)
> > ===> src/nvidia (install)  
> > Variable OBJTOP is recursive.
> > 
> > make[8]: stopped
> > in 
> > /usr/obj/usr/src/amd64.amd64/sys/DUMMBOX/usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-387.34/src/nvidia
> > *** Error code 2
> > 
> > 
> > 
> > Oliver
> >   

make -jX installkernel with the above mentioned setting of PORTS_MODULE= set
in /usr/src.conf doesn't wor even on recent CURRENT r328901.

make kernel doesn't fail.


oh

-- 
O. Hartmann

Ich widerspreche der Nutzung oder Übermittlung meiner Daten für
Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG).


pgpWp0rOtZi_Q.pgp
Description: OpenPGP digital signature


Re: svn commit: r328489 - head/sys/conf

2018-02-05 Thread Jason Harmening
On Mon, Feb 5, 2018 at 1:25 PM, O. Hartmann  wrote:

> Am Sun, 4 Feb 2018 10:22:31 -0800
> Jason Harmening  schrieb:
>
> > On 02/04/18 04:33, O. Hartmann wrote:
> > > Am Mon, 29 Jan 2018 05:00:22 -0800
> > > David Wolfskill  schrieb:
> > >
> > >> On Mon, Jan 29, 2018 at 02:10:04AM -0800, Jason Harmening wrote:
> > 
> >  This happens now if PORTS_MODULE=x11/nvidia-driver is defined in
> /etc/src.conf:
> > 
> >  [...]
> >  --- kernel-install ---
> >  mkdir -p /boot/kernel
> >  install -p -m 555 -o root -g wheel kernel /boot/kernel/
> >  --- ports-install ---
> >  Variable OBJTOP is recursive.
> > 
> >  make[8]: stopped
> > >>> ...
> > >>>
> > >>> David sent me logs of the failing case; thanks David!
> > >>
> > >> Happy to help! :-)
> > >>
> > >>> The failure happens when buildkernel and installkernel are run
> > >>> separately instead of all-up, e.g. 'make kernel'.  The installkernel
> > >>> step is leaving MK_AUTO_OBJ=no in the env passed to the port build.
> It
> > >>> looks like at least one of the install stages of nvidia-driver needs
> to
> > >>> generate temporary output, which leads to confusion when the port
> isn't
> > >>> built as though it's an in-tree component.
> > >>>
> > >>> Can you guys try out the attached patch?
> > >>
> > >> I tried it both on my build machine (which does not use kernel modules
> > >> from ports, and thus did not exhibit the problem -- but I thought that
> > >> verifying that the patch did not break that case worth checking) and
> on
> > >> my laptop (which did exhibit the problem).
> > >>
> > >> It worked in both cases with no issues for me.
> > >>
> > >> Thanks! :-)
> > >>
> > >> Peace,
> > >> david
> > >
> > > The problem still persists!
> > >
> > > I'm on CURRENT, FreeBSD 12.0-CURRENT #32: Sun Feb  4 09:41:39 CET 2018
> amd64, the
> > > source tree is at revision 328839.
> > >
> > >
> > > I use WITH_META_MODE=YES in /etc/src.conf. My /etc/make.conf consists
> of a .include
> > > statement which reels in /usr/local/etc/ports.conf in which I define
> everything
> > > outside the source tree for ports (in case of the nvidia driver, its
> DISTVERSION).
> > > This worked before and should work again. Today I checked out a
> completely
> > > fresh /usr/src and gleanced the /usr/obj folder and rebuilt the system
> - and get the
> > > error again:
> > >
> > > [...]
> > > ===> Ports module x11/nvidia-driver (install)
> > > cd ${PORTSDIR:-/usr/ports}/x11/nvidia-driver; env  -u CC  -u CXX  -u
> CPP  -u
> > > MAKESYSPATH MAKEFLAGS="-j 4 -J 15,16 .MAKE.LEVEL.ENV=MAKELEVEL
> KERNEL=kernel
> > > MK_AUTO_OBJ=no
> > ^
> > Looks like you haven't applied the patch?  MK_AUTO_OBJ being left set in
> > MAKEFLAGS by installkernel was part of the problem.
> >
> > That said, the fix I have up for review is slightly different:
> > https://reviews.freebsd.org/D14143
> >
> > > TARGET=amd64 TARGET_ARCH=amd64"  SYSDIR=/usr/src/sys
> > > PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/
> usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/
> usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/
> amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/
> usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
> > > SRC_BASE=/usr/src  OSVERSION=1200056
> > > WRKDIRPREFIX=/usr/obj/usr/src/amd64.amd64/sys/THOR make -B deinstall
> reinstall ===>
> > > Deinstalling for nvidia-driver ===>   Deinstalling
> nvidia-driver-387.34 Updating
> > > database digests format: . done Checking integrity... done (0
> conflicting)
> > > Deinstallation has been requested for the following 1 packages (of 0
> packages in the
> > > universe):
> > >
> > > Installed packages to be REMOVED:
> > >  nvidia-driver-387.34
> > >
> > > Number of packages to be removed: 1
> > >
> > > The operation will free 99 MiB.
> > > [1/1] Deinstalling nvidia-driver-387.34...
> > > [1/1] Deleting files for nvidia-driver-387.34: .. done
> > > ===>  Staging for nvidia-driver-387.34
> > > ===>   nvidia-driver-387.34 depends on file: /usr/local/lib/libGL.so -
> found
> > > ===>   nvidia-driver-387.34 depends on file:
> /usr/local/libdata/pkgconfig/x11.pc -
> > > found ===>   nvidia-driver-387.34 depends on
> > > file: /usr/local/libdata/pkgconfig/xorg-server.pc
> > > - found ===>   nvidia-driver-387.34 depends on
> > > file: /usr/local/libdata/pkgconfig/xext.pc
> > > - found ===>   Generating temporary packing list
> > > ===> src (install)
> > > ===> src/nvidia (install)
> > > Variable OBJTOP is recursive.
> > >
> > > make[8]: stopped
> > > in /usr/obj/usr/src/amd64.amd64/sys/DUMMBOX/usr/ports/x11/
> nvidia-driver/work/NVIDIA-FreeBSD-x86_64-387.34/src/nvidia
> > > *** Error code 2
> > >
> > >
> > >
> > > Oliver
> > >
>
> make -jX installkernel with the above mentioned setting of PORTS_MODULE=
> set
> in /usr/src.conf doesn't wor even on recent CURRENT r328901.
>
> make kernel doesn't fail.
>

Yes

Re: svn commit: r328610 - head/sys/amd64/amd64

2018-02-05 Thread Ed Maste
On 31 January 2018 at 11:14, John Baldwin  wrote:
> On Wednesday, January 31, 2018 10:31:36 AM Ed Maste wrote:
>> On 30 January 2018 at 21:01, John Baldwin  wrote:
>> > On Tuesday, January 30, 2018 11:29:27 PM John Baldwin wrote:
>> >> Author: jhb
>> >> Date: Tue Jan 30 23:29:27 2018
>> >> New Revision: 328610
>> >> URL: https://svnweb.freebsd.org/changeset/base/328610
>> >>
>> >> Log:
>> >>   Ensure 'name' is not NULL before passing to strcmp().
>> >>
>> >>   This avoids a nested page fault when obtaining a stack trace in DDB if
>> >>   the address from the first frame does not resolve to a known symbol.
>> >>
>> >>   MFC after:  1 week
>> >>   Sponsored by:   Chelsio Communications
>> >
>> > This appears to be fallout from lld?  After fixing this, the stack trace
>> > for my next panic shows no symbols for functions in the kernel, only
>> > functions in kernel modules:
>>
>> It's fallout from loader changes in r328536. I reverted r328536 (and
>> r328603) locally and stack traces are fixed.
>
> Ouch.  I'll try to look at this later today unless someone else beats me to
> it.

I committed a band-aid fix in r328826 but it still needs more
investigation / proper fix.
___
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: r328909 - head/sys/kern

2018-02-05 Thread John Baldwin
Author: jhb
Date: Mon Feb  5 23:27:42 2018
New Revision: 328909
URL: https://svnweb.freebsd.org/changeset/base/328909

Log:
  Always give ELF brands a chance to veto a match.
  
  If a brand provides a header_supported hook, check it when trying to
  find a brand based on a matching interpreter as well as in the final
  loop for the fallback brand. Previously a brand might reject a binary
  via a header_supported hook in one of the earlier loops, but still be
  chosen by one of these later loops.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D13945

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Mon Feb  5 23:14:20 2018(r328908)
+++ head/sys/kern/imgact_elf.c  Mon Feb  5 23:27:42 2018(r328909)
@@ -321,7 +321,7 @@ __elfN(get_brandinfo)(struct image_params *imgp, const
strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND],
bi->compat_3_brand) == 0))) {
/* Looks good, but give brand a chance to veto */
-   if (!bi->header_supported ||
+   if (bi->header_supported == NULL ||
bi->header_supported(imgp)) {
/*
 * Again, prefer strictly matching
@@ -369,7 +369,8 @@ __elfN(get_brandinfo)(struct image_params *imgp, const
/* ELF image p_filesz includes terminating zero */
strlen(bi->interp_path) + 1 == interp_name_len &&
strncmp(interp, bi->interp_path, interp_name_len)
-   == 0)
+   == 0 && (bi->header_supported == NULL ||
+   bi->header_supported(imgp)))
return (bi);
}
}
@@ -381,7 +382,9 @@ __elfN(get_brandinfo)(struct image_params *imgp, const
(interp != NULL && (bi->flags & BI_BRAND_ONLY_STATIC) != 0))
continue;
if (hdr->e_machine == bi->machine &&
-   __elfN(fallback_brand) == bi->brand)
+   __elfN(fallback_brand) == bi->brand &&
+   (bi->header_supported == NULL ||
+   bi->header_supported(imgp)))
return (bi);
}
return (NULL);
___
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: r328910 - head/share/man/man7

2018-02-05 Thread John Baldwin
Author: jhb
Date: Mon Feb  5 23:29:50 2018
New Revision: 328910
URL: https://svnweb.freebsd.org/changeset/base/328910

Log:
  Fix a typo.

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Mon Feb  5 23:27:42 2018(r328909)
+++ head/share/man/man7/arch.7  Mon Feb  5 23:29:50 2018(r328910)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 31, 2018
+.Dd February 5, 2018
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -416,7 +416,7 @@ imply little endian.
 If we ever were to support the so-called x32 ABI (using 32-bit
 pointers on the amd64 architecture), it would most likely be encoded
 as amd64-x32.
-It is unfortunate that amd64 speifies the 64-bit evolution of the x86
+It is unfortunate that amd64 specifies the 64-bit evolution of the x86
 platform (it matches the 'first rule') as everybody else uses x86_64.
 There is no standard name for the processor: each OS selects its own
 conventions.
___
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: r328911 - in head: stand/common sys/kern

2018-02-05 Thread John Baldwin
Author: jhb
Date: Mon Feb  5 23:35:33 2018
New Revision: 328911
URL: https://svnweb.freebsd.org/changeset/base/328911

Log:
  Ignore relocation tables for non-memory-resident sections.
  
  As a followup to r328101, ignore relocation tables for ELF object
  sections that are not memory resident.  For modules loaded by the
  loader, ignore relocation tables whose associated section was not
  loaded by the loader (sh_addr is zero).  For modules loaded at runtime
  via kldload(2), ignore relocation tables whose associated section is
  not marked with SHF_ALLOC.
  
  Reported by:  Mori Hiroki , adrian
  Tested on:mips, mips64
  MFC after:1 month
  Sponsored by: DARPA / AFRL

Modified:
  head/stand/common/load_elf_obj.c
  head/sys/kern/link_elf_obj.c

Modified: head/stand/common/load_elf_obj.c
==
--- head/stand/common/load_elf_obj.cMon Feb  5 23:29:50 2018
(r328910)
+++ head/stand/common/load_elf_obj.cMon Feb  5 23:35:33 2018
(r328911)
@@ -282,6 +282,8 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_f
switch (shdr[i].sh_type) {
case SHT_REL:
case SHT_RELA:
+   if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0)
+   break;
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
shdr[i].sh_addr = (Elf_Addr)lastaddr;
lastaddr += shdr[i].sh_size;

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cMon Feb  5 23:29:50 2018
(r328910)
+++ head/sys/kern/link_elf_obj.cMon Feb  5 23:35:33 2018
(r328911)
@@ -272,9 +272,17 @@ link_elf_link_preload(linker_class_t cls, const char *
symstrindex = shdr[i].sh_link;
break;
case SHT_REL:
+   /*
+* Ignore relocation tables for sections not
+* loaded by the loader.
+*/
+   if (shdr[shdr[i].sh_info].sh_addr == 0)
+   break;
ef->nreltab++;
break;
case SHT_RELA:
+   if (shdr[shdr[i].sh_info].sh_addr == 0)
+   break;
ef->nrelatab++;
break;
}
@@ -398,12 +406,16 @@ link_elf_link_preload(linker_class_t cls, const char *
pb++;
break;
case SHT_REL:
+   if (shdr[shdr[i].sh_info].sh_addr == 0)
+   break;
ef->reltab[rl].rel = (Elf_Rel *)shdr[i].sh_addr;
ef->reltab[rl].nrel = shdr[i].sh_size / sizeof(Elf_Rel);
ef->reltab[rl].sec = shdr[i].sh_info;
rl++;
break;
case SHT_RELA:
+   if (shdr[shdr[i].sh_info].sh_addr == 0)
+   break;
ef->relatab[ra].rela = (Elf_Rela *)shdr[i].sh_addr;
ef->relatab[ra].nrela =
shdr[i].sh_size / sizeof(Elf_Rela);
@@ -620,9 +632,17 @@ link_elf_load_file(linker_class_t cls, const char *fil
symstrindex = shdr[i].sh_link;
break;
case SHT_REL:
+   /*
+* Ignore relocation tables for unallocated
+* sections.
+*/
+   if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0)
+   break;
ef->nreltab++;
break;
case SHT_RELA:
+   if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0)
+   break;
ef->nrelatab++;
break;
case SHT_STRTAB:
@@ -880,6 +900,8 @@ link_elf_load_file(linker_class_t cls, const char *fil
pb++;
break;
case SHT_REL:
+   if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0)
+   break;
ef->reltab[rl].rel = malloc(shdr[i].sh_size, M_LINKER,
M_WAITOK);
ef->reltab[rl].nrel = shdr[i].sh_size / sizeof(Elf_Rel);
@@ -898,6 +920,8 @@ link_elf_load_file(linker_class_t cls, const char *fil
rl++;
break;
case SHT_RELA:
+   if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0)
+   

svn commit: r328912 - in head: share/man/man4 sys/conf sys/dev/bhnd sys/dev/bwn sys/dev/siba sys/gnu/dev/bwn/phy_n sys/modules sys/modules/bwn sys/modules/bwn_pci sys/modules/siba_bwn

2018-02-05 Thread Landon J. Fuller
Author: landonf
Date: Mon Feb  5 23:38:15 2018
New Revision: 328912
URL: https://svnweb.freebsd.org/changeset/base/328912

Log:
  bwn(4): migrate bwn(4) to the native bhnd(9) interface, and drop siba_bwn.
  
  - Remove the shim interface that allowed bwn(4) to use either siba_bwn or
bhnd(4), replacing all siba_bwn calls with their bhnd(4) bus equivalents.
  - Drop the legay, now-unused siba_bwn bus driver.
  - Clean up bhnd(4) board flag defines referenced by bwn(4).
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D13518

Added:
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_sprom.c   (contents, props changed)
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_sprom.h   (contents, props changed)
Deleted:
  head/sys/dev/bwn/if_bwn_bhnd.c
  head/sys/dev/bwn/if_bwn_chipid.h
  head/sys/dev/bwn/if_bwn_siba.c
  head/sys/dev/bwn/if_bwn_siba.h
  head/sys/dev/bwn/if_bwn_siba_compat.c
  head/sys/dev/bwn/if_bwn_siba_compat.h
  head/sys/dev/siba/
  head/sys/modules/bwn_pci/
  head/sys/modules/siba_bwn/
Modified:
  head/share/man/man4/bwn.4
  head/sys/conf/files
  head/sys/dev/bhnd/bhnd_ids.h
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/bwn/if_bwn_misc.h
  head/sys/dev/bwn/if_bwn_pci.c
  head/sys/dev/bwn/if_bwn_phy_common.c
  head/sys/dev/bwn/if_bwn_phy_common.h
  head/sys/dev/bwn/if_bwn_phy_g.c
  head/sys/dev/bwn/if_bwn_phy_lp.c
  head/sys/dev/bwn/if_bwn_phy_n.c
  head/sys/dev/bwn/if_bwn_util.c
  head/sys/dev/bwn/if_bwnreg.h
  head/sys/dev/bwn/if_bwnvar.h
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.h
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
  head/sys/modules/Makefile
  head/sys/modules/bwn/Makefile

Modified: head/share/man/man4/bwn.4
==
--- head/share/man/man4/bwn.4   Mon Feb  5 23:35:33 2018(r328911)
+++ head/share/man/man4/bwn.4   Mon Feb  5 23:38:15 2018(r328912)
@@ -24,26 +24,29 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 11, 2015
+.Dd December 16, 2017
 .Dt BWN 4
 .Os
 .Sh NAME
 .Nm bwn
-.Nd Broadcom BCM43xx IEEE 802.11b/g wireless network driver
+.Nd Broadcom BCM43xx SoftMAC IEEE 802.11 wireless network driver
 .Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following lines in your
-kernel configuration file:
+To compile this driver into the kernel, add the following lines to the kernel
+configuration file:
 .Bd -ragged -offset indent
-.Cd "device siba_bwn"
 .Cd "device bwn"
+.Cd "device bhnd"
+.Cd "device bhndb"
+.Cd "device bhndb_pci"
+.Cd "device bcma"
+.Cd "device siba"
+.Cd "device gpio"
 .Cd "device wlan"
 .Cd "device wlan_amrr"
 .Cd "device firmware"
 .Ed
 .Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
+To load the driver as a module at boot, add the following lines to
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 if_bwn_load="YES"
@@ -122,9 +125,6 @@ Tunables can be set at the
 prompt before booting the kernel or stored in
 .Xr loader.conf 5 .
 .Bl -tag -width indent
-.It Va hw.bwn.msi_disable
-This tunable disables MSI support on the hardware.
-The default value is 0.
 .It Va hw.bwn.usedma
 This tunable enables DMA operations on the hardware.
 If the value is 0, PIO mode would be used.
@@ -132,10 +132,14 @@ The default value is 1.
 .El
 .Sh SEE ALSO
 .Xr arp 4 ,
+.Xr bcma 4 ,
+.Xr bhnd 4 ,
+.Xr bhndb 4 ,
 .Xr bwi 4 ,
 .Xr cardbus 4 ,
 .Xr intro 4 ,
 .Xr pci 4 ,
+.Xr siba 4 ,
 .Xr wlan 4 ,
 .Xr wlan_amrr 4 ,
 .Xr ifconfig 8 ,
@@ -145,12 +149,20 @@ The
 .Nm
 driver first appeared in
 .Fx 8.1 .
+The driver was updated to support the common Broadcom
+.Xr bhnd 4
+bus interface in
+.Fx 12.0 .
 .Sh AUTHORS
 .An -nosplit
 The
 .Nm
 driver was written by
 .An Weongyo Jeong Aq Mt weon...@freebsd.org .
+Support for
+.Xr bhnd 4
+was added by
+.An Landon Fuller Aq Mt land...@freebsd.org .
 .\".Sh BUGS
 .\"Some card based on the BCM4306 and BCM4309 chips do not work properly
 .\"on channel 1, 2 and 3.

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Feb  5 23:35:33 2018(r328911)
+++ head/sys/conf/files Mon Feb  5 23:38:15 2018(r328912)
@@ -1250,9 +1250,9 @@ dev/bhnd/bhndb/bhndb.coptional bhndb 
bhnd
 dev/bhnd/bhndb/bhndb_bus_if.m  optional bhndb bhnd
 dev/bhnd/bhndb/bhndb_hwdata.c  optional bhndb bhnd
 dev/bhnd/bhndb/bhndb_if.m  optional bhndb bhnd
-dev/bhnd/bhndb/bhndb_pci.c optional bhndb bhnd pci
-dev/bhnd/bhndb/bhndb_pci_hwdata.c  optional bhndb bhnd pci
-dev/bhnd/bhndb/bhndb_pci_sprom.c   optional bhndb bhnd pci
+dev/bhnd/bhndb/bhndb_pci.c optional bhndb_pci bhndb bhnd pci
+dev/bhnd/bhndb/bhndb_pci_hwdata.c  optional bhndb_pci bhndb bhnd pci
+dev/bhnd/bhndb/bhndb_pci_sprom.c   optional bhndb_pci bhndb bhnd pci
 dev/bhnd

svn commit: r328913 - in head/sys: conf i386/i386

2018-02-05 Thread Konstantin Belousov
Author: kib
Date: Tue Feb  6 00:02:30 2018
New Revision: 328913
URL: https://svnweb.freebsd.org/changeset/base/328913

Log:
  Move signal trampolines out of locore.s into separate source file.
  
  Similar to other arches, the move makes the subject of locore.s only
  the kernel startup.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Added:
  head/sys/i386/i386/sigtramp.s
 - copied, changed from r328903, head/sys/i386/i386/locore.s
Modified:
  head/sys/conf/files.i386
  head/sys/i386/i386/locore.s

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Mon Feb  5 23:38:15 2018(r328912)
+++ head/sys/conf/files.i386Tue Feb  6 00:02:30 2018(r328913)
@@ -494,6 +494,7 @@ i386/i386/perfmon.c optional perfmon
 i386/i386/pmap.c   standard
 i386/i386/prof_machdep.c   optional profiling-routine
 i386/i386/ptrace_machdep.c standard
+i386/i386/sigtramp.s   standard
 i386/i386/support.sstandard
 i386/i386/swtch.s  standard
 i386/i386/sys_machdep.cstandard

Modified: head/sys/i386/i386/locore.s
==
--- head/sys/i386/i386/locore.s Mon Feb  5 23:38:15 2018(r328912)
+++ head/sys/i386/i386/locore.s Tue Feb  6 00:02:30 2018(r328913)
@@ -44,7 +44,6 @@
 #include "opt_nfsroot.h"
 #include "opt_pmap.h"
 
-#include 
 #include 
 
 #include 
@@ -292,77 +291,6 @@ begin:
callmi_startup  /* autoconfiguration, mountroot etc */
/* NOTREACHED */
addl$0,%esp /* for db_numargs() again */
-
-/*
- * Signal trampoline, copied to top of user stack
- */
-NON_GPROF_ENTRY(sigcode)
-   calll   *SIGF_HANDLER(%esp)
-   lealSIGF_UC(%esp),%eax  /* get ucontext */
-   pushl   %eax
-   testl   $PSL_VM,UC_EFLAGS(%eax)
-   jne 1f
-   mov UC_GS(%eax),%gs /* restore %gs */
-1:
-   movl$SYS_sigreturn,%eax
-   pushl   %eax/* junk to fake return addr. */
-   int $0x80   /* enter kernel with args */
-   /* on stack */
-1:
-   jmp 1b
-
-#ifdef COMPAT_FREEBSD4
-   ALIGN_TEXT
-freebsd4_sigcode:
-   calll   *SIGF_HANDLER(%esp)
-   lealSIGF_UC4(%esp),%eax /* get ucontext */
-   pushl   %eax
-   testl   $PSL_VM,UC4_EFLAGS(%eax)
-   jne 1f
-   mov UC4_GS(%eax),%gs/* restore %gs */
-1:
-   movl$344,%eax   /* 4.x SYS_sigreturn */
-   pushl   %eax/* junk to fake return addr. */
-   int $0x80   /* enter kernel with args */
-   /* on stack */
-1:
-   jmp 1b
-#endif
-
-#ifdef COMPAT_43
-   ALIGN_TEXT
-osigcode:
-   call*SIGF_HANDLER(%esp) /* call signal handler */
-   lea SIGF_SC(%esp),%eax  /* get sigcontext */
-   pushl   %eax
-   testl   $PSL_VM,SC_PS(%eax)
-   jne 9f
-   mov SC_GS(%eax),%gs /* restore %gs */
-9:
-   movl$103,%eax   /* 3.x SYS_sigreturn */
-   pushl   %eax/* junk to fake return addr. */
-   int $0x80   /* enter kernel with args */
-0: jmp 0b
-#endif /* COMPAT_43 */
-
-   ALIGN_TEXT
-esigcode:
-
-   .data
-   .globl  szsigcode
-szsigcode:
-   .long   esigcode-sigcode
-#ifdef COMPAT_FREEBSD4
-   .globl  szfreebsd4_sigcode
-szfreebsd4_sigcode:
-   .long   esigcode-freebsd4_sigcode
-#endif
-#ifdef COMPAT_43
-   .globl  szosigcode
-szosigcode:
-   .long   esigcode-osigcode
-#endif
-   .text
 
 /**
  *

Copied and modified: head/sys/i386/i386/sigtramp.s (from r328903, 
head/sys/i386/i386/locore.s)
==
--- head/sys/i386/i386/locore.s Mon Feb  5 22:21:51 2018(r328903, copy 
source)
+++ head/sys/i386/i386/sigtramp.s   Tue Feb  6 00:02:30 2018
(r328913)
@@ -39,261 +39,15 @@
  * and many others.
  */
 
-#include "opt_bootp.h"
 #include "opt_compat.h"
-#include "opt_nfsroot.h"
-#include "opt_pmap.h"
 
 #include 
-#include 
-
 #include 
-#include 
 #include 
-#include 
-#include 
 
 #include "assym.s"
 
 /*
- * XXX
- *
- * Note: This version greatly munged to avoid various assembler errors
- * that may be fixed in newer versions of gas. Perhaps newer versions
- * will have more pleasant appearance.
- */
-
-/*
- * PTmap is recursive pagemap at top of virtual address space.
- * Within PTmap, the page directory can be found (third indirection).
- */
-   .globl  PTmap,PTD,PTDpde
-   .setPTmap,(PTDPTDI << PDRSHIFT)
-   .setPTD,PTmap + (PTDP

svn commit: r328914 - in head/sys: kern ufs/ffs

2018-02-05 Thread Kirk McKusick
Author: mckusick
Date: Tue Feb  6 00:19:46 2018
New Revision: 328914
URL: https://svnweb.freebsd.org/changeset/base/328914

Log:
  Occasional cylinder-group check-hash errors were being reported on
  systems running with a heavy filesystem load. Tracking down this
  bug was elusive because there were actually two problems. Sometimes
  the in-memory check hash was wrong and sometimes the check hash
  computed when doing the read was wrong. The occurrence of either
  error caused a check-hash mismatch to be reported.
  
  The first error was that the check hash in the in-memory cylinder
  group was incorrect. This error was caused by the following
  sequence of events:
  
  - We read a cylinder-group buffer and the check hash is valid.
  - We update its cg_time and cg_old_time which makes the in-memory
check-hash value invalid but we do not mark the cylinder group dirty.
  - We do not make any other changes to the cylinder group, so we
never mark it dirty, thus do not write it out, and hence never
update the incorrect check hash for the in-memory buffer.
  - Later, the buffer gets freed, but the page with the old incorrect
check hash is still in the VM cache.
  - Later, we read the cylinder group again, and the first page with
the old check hash is still in the VM cache, but some other pages
are not, so we have to do a read.
  - The read does not actually get the first page from disk, but rather
from the VM cache, resulting in the old check hash in the buffer.
  - The value computed after doing the read does not match causing the
error to be printed.
  
  The fix for this problem is to only set cg_time and cg_old_time as
  the cylinder group is being written to disk. This keeps the in-memory
  check-hash valid unless the cylinder group has had other modifications
  which will require it to be written with a new check hash calculated.
  It also requires that the check hash be recalculated in the in-memory
  cylinder group when it is marked clean after doing a background write.
  
  The second problem was that the check hash computed at the end of the
  read was incorrect because the calculation of the check hash on
  completion of the read was being done too soon.
  
  - When a read completes we had the following sequence:
  
- bufdone()
-- b_ckhashcalc (calculates check hash)
-- bufdone_finish()
--- vfs_vmio_iodone() (replaces bogus pages with the cached ones)
  
  - When we are reading a buffer where one or more pages are already
in memory (but not all pages, or we wouldn't be doing the read),
the I/O is done with bogus_page mapped in for the pages that exist
in the VM cache. This mapping is done to avoid corrupting the
cached pages if there is any I/O overrun. The vfs_vmio_iodone()
function is responsible for replacing the bogus_page(s) with the
cached ones. But we were calculating the check hash before the
bogus_page(s) were replaced. Hence, when we were calculating the
check hash, we were partly reading from bogus_page, which means
we calculated a bad check hash (e.g., because multiple pages have
been mapped to bogus_page, so its contents are indeterminate).
  
  The second fix is to move the check-hash calculation from bufdone()
  to bufdone_finish() after the call to vfs_vmio_iodone() so that it
  computes the check hash over the correct set of pages.
  
  With these two changes, the occasional cylinder-group check-hash
  errors are gone.
  
  Submitted by: David Pfitzner 
  Reviewed by: kib
  Tested by: David Pfitzner

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Tue Feb  6 00:02:30 2018(r328913)
+++ head/sys/kern/vfs_bio.c Tue Feb  6 00:19:46 2018(r328914)
@@ -4075,10 +4075,6 @@ bufdone(struct buf *bp)
runningbufwakeup(bp);
if (bp->b_iocmd == BIO_WRITE)
dropobj = bp->b_bufobj;
-   else if ((bp->b_flags & B_CKHASH) != 0) {
-   KASSERT(buf_mapped(bp), ("biodone: bp %p not mapped", bp));
-   (*bp->b_ckhashcalc)(bp);
-   }
/* call optional completion function if requested */
if (bp->b_iodone != NULL) {
biodone = bp->b_iodone;
@@ -4114,6 +4110,13 @@ bufdone_finish(struct buf *bp)
!(bp->b_ioflags & BIO_ERROR))
bp->b_flags |= B_CACHE;
vfs_vmio_iodone(bp);
+   }
+   if ((bp->b_flags & B_CKHASH) != 0) {
+   KASSERT(bp->b_iocmd == BIO_READ,
+   ("bufdone_finish: b_iocmd %d not BIO_READ", bp->b_iocmd));
+   KASSERT(buf_mapped(bp),
+   ("bufdone_finish: bp %p not mapped", bp));
+   (*bp->b_ckhashcalc)(bp);
}
 
/*

Modified: head/sys/ufs/ffs/ffs_alloc.c
==

svn commit: r328916 - in head/sys: kern vm

2018-02-05 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb  6 04:16:00 2018
New Revision: 328916
URL: https://svnweb.freebsd.org/changeset/base/328916

Log:
  Followup on r302393 by cperciva, improving calculation of boot pages required
  for UMA startup.
  
  o Introduce another stage of UMA startup, which is entered after
vm_page_startup() finishes. After this stage we don't yet enable buckets,
but we can ask VM for pages. Rename stages to meaningful names while here.
New list of stages: BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, BOOT_BUCKETS,
BOOT_RUNNING.
Enabling page alloc earlier allows us to dramatically reduce number of
boot pages required. What is more important number of zones becomes
consistent across different machines, as no MD allocations are done before
the BOOT_PAGEALLOC stage. Now only UMA internal zones actually need to use
startup_alloc(), however that may change, so vm_page_startup() provides
its need for early zones as argument.
  o Introduce uma_startup_count() function, to avoid code duplication. The
functions calculates sizes of zones zone and kegs zone, and calculates how
many pages UMA will need to bootstrap.
It counts not only of zone structures, but also of kegs, slabs and hashes.
  o Hide uma_startup_foo() declarations from public file.
  o Provide several DIAGNOSTIC printfs on boot_pages usage.
  o Bugfix: when calculating zone of zones size use (mp_maxid + 1) instead of
mp_ncpus. Use resulting number not only in the size argument to zone_ctor()
but also as args.size.
  
  Reviewed by:  imp, gallatin (earlier version)
  Differential Revision:https://reviews.freebsd.org/D14054

Modified:
  head/sys/kern/kern_malloc.c
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h
  head/sys/vm/vm_page.c

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Tue Feb  6 02:13:44 2018(r328915)
+++ head/sys/kern/kern_malloc.c Tue Feb  6 04:16:00 2018(r328916)
@@ -96,6 +96,8 @@ __FBSDID("$FreeBSD$");
 dtrace_malloc_probe_func_t dtrace_malloc_probe;
 #endif
 
+extern voiduma_startup2(void);
+
 #if defined(INVARIANTS) || defined(MALLOC_MAKE_FAILURES) ||\
 defined(DEBUG_MEMGUARD) || defined(DEBUG_REDZONE)
 #defineMALLOC_DEBUG1

Modified: head/sys/vm/uma.h
==
--- head/sys/vm/uma.h   Tue Feb  6 02:13:44 2018(r328915)
+++ head/sys/vm/uma.h   Tue Feb  6 04:16:00 2018(r328916)
@@ -431,40 +431,6 @@ typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t 
 typedef void (*uma_free)(void *item, vm_size_t size, uint8_t pflag);
 
 /*
- * Sets up the uma allocator. (Called by vm_mem_init)
- *
- * Arguments:
- * bootmem  A pointer to memory used to bootstrap the system.
- *
- * Returns:
- * Nothing
- *
- * Discussion:
- * This memory is used for zones which allocate things before the
- * backend page supplier can give us pages.  It should be
- * UMA_SLAB_SIZE * boot_pages bytes. (see uma_int.h)
- *
- */
-
-void uma_startup(void *bootmem, int boot_pages);
-
-/*
- * Finishes starting up the allocator.  This should
- * be called when kva is ready for normal allocs.
- *
- * Arguments:
- * None
- *
- * Returns:
- * Nothing
- *
- * Discussion:
- * uma_startup2 is called by kmeminit() to enable us of uma for malloc.
- */
-
-void uma_startup2(void);
-
-/*
  * Reclaims unused memory for all zones
  *
  * Arguments:

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Tue Feb  6 02:13:44 2018(r328915)
+++ head/sys/vm/uma_core.c  Tue Feb  6 04:16:00 2018(r328916)
@@ -149,9 +149,8 @@ static unsigned long uma_kmem_limit = LONG_MAX;
 static volatile unsigned long uma_kmem_total;
 
 /* Is the VM done starting up? */
-static int booted = 0;
-#defineUMA_STARTUP 1
-#defineUMA_STARTUP22
+static enum { BOOT_COLD = 0, BOOT_STRAPPED, BOOT_PAGEALLOC, BOOT_BUCKETS,
+BOOT_RUNNING } booted = BOOT_COLD;
 
 /*
  * This is the handle used to schedule events that need to happen
@@ -226,6 +225,11 @@ enum zfreeskip { SKIP_NONE = 0, SKIP_DTOR, SKIP_FINI }
 
 /* Prototypes.. */
 
+intuma_startup_count(int);
+void   uma_startup(void *, int);
+void   uma_startup1(void);
+void   uma_startup2(void);
+
 static void *noobj_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int);
 static void *page_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int);
 static void *startup_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int);
@@ -1084,6 +1088,11 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int do
 * Check our small startup cache to see if it has pages remaining.
 */
mtx_lock(&uma_boot_pages_mtx);
+#ifdef DIAGNOSTIC
+   if (booted < BOOT_PAGEALLOC)
+

svn commit: r328917 - head/share/man/man9

2018-02-05 Thread Bryan Venteicher
Author: bryanv
Date: Tue Feb  6 04:28:21 2018
New Revision: 328917
URL: https://svnweb.freebsd.org/changeset/base/328917

Log:
  Correct structure name used in bus_map_resource(9) example
  
  Reviewed by:  jhb
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14188

Modified:
  head/share/man/man9/bus_map_resource.9

Modified: head/share/man/man9/bus_map_resource.9
==
--- head/share/man/man9/bus_map_resource.9  Tue Feb  6 04:16:00 2018
(r328916)
+++ head/share/man/man9/bus_map_resource.9  Tue Feb  6 04:28:21 2018
(r328917)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 20, 2016
+.Dd February 5, 2018
 .Dt BUS_MAP_RESOURCE 9
 .Os
 .Sh NAME
@@ -143,16 +143,16 @@ reads the first 32-bit word:
 .Bd -literal
struct resource *r;
struct resource_map map;
-   struct resource_map_args args;
+   struct resource_map_request req;
uint32_t val;
int rid;
 
rid = PCIR_BAR(0);
r = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE |
RF_UNMAPPED);
-   resource_init_map_request(&args);
-   args.memattr = VM_MEMATTR_WRITE_COMBINING;
-   bus_map_resource(dev, SYS_RES_MEMORY, r, &args, &map);
+   resource_init_map_request(&req);
+   req.memattr = VM_MEMATTR_WRITE_COMBINING;
+   bus_map_resource(dev, SYS_RES_MEMORY, r, &req, &map);
val = bus_read_4(&map, 0);
 .Ed
 .Sh SEE ALSO
___
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: r328918 - in head/sys/cam: . ata ctl mmc nvme scsi

2018-02-05 Thread Scott Long
Author: scottl
Date: Tue Feb  6 06:42:25 2018
New Revision: 328918
URL: https://svnweb.freebsd.org/changeset/base/328918

Log:
  Return a C errno for cam_periph_acquire().
  
  There's no compelling reason to return a cam_status type for this
  function and doing so only creates confusion with normal C
  coding practices. It's technically an API change, but the periph API
  isn't widely used. No efffective change to operation.
  
  Reviewed by:  imp, mav, ken
  Sponsored by: Netflix
  Differential Revision:D14063

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_pmp.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam_periph.c
  head/sys/cam/cam_periph.h
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/cam/mmc/mmc_da.c
  head/sys/cam/mmc/mmc_xpt.c
  head/sys/cam/nvme/nvme_da.c
  head/sys/cam/nvme/nvme_xpt.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_enc.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/cam/scsi/scsi_pt.c
  head/sys/cam/scsi/scsi_sa.c
  head/sys/cam/scsi/scsi_sg.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Feb  6 04:28:21 2018(r328917)
+++ head/sys/cam/ata/ata_da.c   Tue Feb  6 06:42:25 2018(r328918)
@@ -911,7 +911,7 @@ adaopen(struct disk *dp)
int error;
 
periph = (struct cam_periph *)dp->d_drv1;
-   if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+   if (cam_periph_acquire(periph) != 0) {
return(ENXIO);
}
 
@@ -1328,7 +1328,7 @@ adaasync(void *callback_arg, u_int32_t code,
softc->state = ADA_STATE_LOGDIR;
else
break;
-   if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+   if (cam_periph_acquire(periph) != 0)
softc->state = ADA_STATE_NORMAL;
else
xpt_schedule(periph, CAM_PRIORITY_DEV);
@@ -1841,7 +1841,7 @@ adaregister(struct cam_periph *periph, void *arg)
 * We'll release this reference once GEOM calls us back (via
 * adadiskgonecb()) telling us that our provider has been freed.
 */
-   if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+   if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
  "registration!\n", __func__);
cam_periph_lock(periph);
@@ -1866,7 +1866,7 @@ adaregister(struct cam_periph *periph, void *arg)
 * Create our sysctl variables, now that we know
 * we have successfully attached.
 */
-   if (cam_periph_acquire(periph) == CAM_REQ_CMP)
+   if (cam_periph_acquire(periph) == 0)
taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task);
 
/*

Modified: head/sys/cam/ata/ata_pmp.c
==
--- head/sys/cam/ata/ata_pmp.c  Tue Feb  6 04:28:21 2018(r328917)
+++ head/sys/cam/ata/ata_pmp.c  Tue Feb  6 06:42:25 2018(r328918)
@@ -315,7 +315,7 @@ pmpasync(void *callback_arg, u_int32_t code,
if (code == AC_SENT_BDR || code == AC_BUS_RESET)
softc->found = 0; /* We have to reset everything. */
if (softc->state == PMP_STATE_NORMAL) {
-   if (cam_periph_acquire(periph) == CAM_REQ_CMP) {
+   if (cam_periph_acquire(periph) == 0) {
if (softc->pm_pid == 0x37261095 ||
softc->pm_pid == 0x38261095)
softc->state = PMP_STATE_PM_QUIRKS_1;
@@ -343,7 +343,7 @@ pmpsysctlinit(void *context, int pending)
char tmpstr[32], tmpstr2[16];
 
periph = (struct cam_periph *)context;
-   if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+   if (cam_periph_acquire(periph) != 0)
return;
 
softc = (struct pmp_softc *)periph->softc;

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Tue Feb  6 04:28:21 2018(r328917)
+++ head/sys/cam/ata/ata_xpt.c  Tue Feb  6 06:42:25 2018(r328918)
@@ -280,7 +280,6 @@ static cam_status
 proberegister(struct cam_periph *periph, void *arg)
 {
union ccb *request_ccb; /* CCB representing the probe request */
-   cam_status status;
probe_softc *softc;
 
request_ccb = (union ccb *)arg;
@@ -304,10 +303,9 @@ proberegister(struct cam_periph *periph, void *arg)
periph->softc = softc;
softc->periph = periph;
softc->action = PROBE_INVALID;
-   status = cam_periph_acquire(periph);
-   if (status != CAM_REQ_CMP) {
-   return (status);
-   }
+   if (cam_periph_acquire(periph) != 0)
+   return (CAM_REQ_C

svn commit: r328919 - head/sys/dev/mps

2018-02-05 Thread Scott Long
Author: scottl
Date: Tue Feb  6 06:55:55 2018
New Revision: 328919
URL: https://svnweb.freebsd.org/changeset/base/328919

Log:
  Fix a case where a request frame can be composed that requires 2 or more
  SGList elements, but there's only enough space in the request frame for
  either 1 element or a chain frame pointer.  Previously, the code would
  hit the wrong case, add the SGList element, but then fail to add the
  chain frame due to lack of space.  Re-arrange the code to catch this case
  earlier and handle it.
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/mps/mps.c

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Tue Feb  6 06:42:25 2018(r328918)
+++ head/sys/dev/mps/mps.c  Tue Feb  6 06:55:55 2018(r328919)
@@ -2609,6 +2609,17 @@ mps_push_sge(struct mps_command *cm, void *sgep, size_
if (cm->cm_sglsize < MPS_SGC_SIZE)
panic("MPS: Need SGE Error Code\n");
 
+   if (segsleft >= 1 && cm->cm_sglsize < len + MPS_SGC_SIZE) {
+   /*
+* 1 or more segment, enough room for only a chain.
+* Hope the previous element wasn't a Simple entry
+* that needed to be marked with
+* MPI2_SGE_FLAGS_LAST_ELEMENT.  Case (4).
+*/
+   if ((error = mps_add_chain(cm)) != 0)
+   return (error);
+   }
+
if (segsleft >= 2 &&
cm->cm_sglsize < len + MPS_SGC_SIZE + MPS_SGE64_SIZE) {
/*
@@ -2631,17 +2642,6 @@ mps_push_sge(struct mps_command *cm, void *sgep, size_
bcopy(sgep, cm->cm_sge, len);
cm->cm_sge = (MPI2_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + len);
return (mps_add_chain(cm));
-   }
-
-   if (segsleft >= 1 && cm->cm_sglsize < len + MPS_SGC_SIZE) {
-   /*
-* 1 or more segment, enough room for only a chain.
-* Hope the previous element wasn't a Simple entry
-* that needed to be marked with
-* MPI2_SGE_FLAGS_LAST_ELEMENT.  Case (4).
-*/
-   if ((error = mps_add_chain(cm)) != 0)
-   return (error);
}
 
 #ifdef INVARIANTS
___
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"