Re: svn commit: r312792 - in head/sys/arm: arm include

2017-01-26 Thread Svatopluk Kraus
Thank you.


On Thu, Jan 26, 2017 at 6:23 AM, Jason A. Harmening  wrote:
> Author: jah
> Date: Thu Jan 26 05:23:33 2017
> New Revision: 312792
> URL: https://svnweb.freebsd.org/changeset/base/312792
>
> Log:
>   Further cleanup of per-CPU armv6 pmap data:
>
>   - Replace pcpu_find(curcpu) with get_pcpu(), which is much
> more direct.
>
>   - Remove armv4 pcpu fields which I added in r286296 but never
> needed to use.
>
>   - armv6 pc_qmap_addr was leftover from the old armv6 pmap
> implementation.  Rename it and put it to use in the new one.
>
>   Noted by: skra
>   Reviewed by:  skra
>   MFC after:1 week
>   Differential Revision:https://reviews.freebsd.org/D9312
>
> Modified:
>   head/sys/arm/arm/pmap-v6.c
>   head/sys/arm/include/pcpu.h
>

[snip]
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312794 - stable/11/sys/kern

2017-01-26 Thread Andriy Gapon
Author: avg
Date: Thu Jan 26 09:46:34 2017
New Revision: 312794
URL: https://svnweb.freebsd.org/changeset/base/312794

Log:
  MFC r312532: don't abort writing of a core dump after EFAULT

Modified:
  stable/11/sys/kern/imgact_elf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/imgact_elf.c
==
--- stable/11/sys/kern/imgact_elf.c Thu Jan 26 07:07:09 2017
(r312793)
+++ stable/11/sys/kern/imgact_elf.c Thu Jan 26 09:46:34 2017
(r312794)
@@ -1160,7 +1160,7 @@ struct coredump_params {
 
 static void cb_put_phdr(vm_map_entry_t, void *);
 static void cb_size_segment(vm_map_entry_t, void *);
-static int core_write(struct coredump_params *, void *, size_t, off_t,
+static int core_write(struct coredump_params *, const void *, size_t, off_t,
 enum uio_seg);
 static void each_writable_segment(struct thread *, segment_callback, void *);
 static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t,
@@ -1202,7 +1202,14 @@ compress_chunk(struct coredump_params *p
 
while (len > 0) {
chunk_len = MIN(len, CORE_BUF_SIZE);
-   copyin(base, buf, chunk_len);
+
+   /*
+* We can get EFAULT error here.
+* In that case zero out the current chunk of the segment.
+*/
+   error = copyin(base, buf, chunk_len);
+   if (error != 0)
+   bzero(buf, chunk_len);
error = gzio_write(p->gzs, buf, chunk_len);
if (error != 0)
break;
@@ -1222,12 +1229,12 @@ core_gz_write(void *base, size_t len, of
 #endif /* GZIO */
 
 static int
-core_write(struct coredump_params *p, void *base, size_t len, off_t offset,
-enum uio_seg seg)
+core_write(struct coredump_params *p, const void *base, size_t len,
+off_t offset, enum uio_seg seg)
 {
 
-   return (vn_rdwr_inchunks(UIO_WRITE, p->vp, base, len, offset,
-   seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED,
+   return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base),
+   len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED,
p->active_cred, p->file_cred, NULL, p->td));
 }
 
@@ -1235,12 +1242,32 @@ static int
 core_output(void *base, size_t len, off_t offset, struct coredump_params *p,
 void *tmpbuf)
 {
+   int error;
 
 #ifdef GZIO
if (p->gzs != NULL)
return (compress_chunk(p, base, tmpbuf, len));
 #endif
-   return (core_write(p, base, len, offset, UIO_USERSPACE));
+   /*
+* EFAULT is a non-fatal error that we can get, for example,
+* if the segment is backed by a file but extends beyond its
+* end.
+*/
+   error = core_write(p, base, len, offset, UIO_USERSPACE);
+   if (error == EFAULT) {
+   log(LOG_WARNING, "Failed to fully fault in a core file segment "
+   "at VA %p with size 0x%zx to be written at offset 0x%jx "
+   "for process %s\n", base, len, offset, curproc->p_comm);
+
+   /*
+* Write a "real" zero byte at the end of the target region
+* in the case this is the last segment.
+* The intermediate space will be implicitly zero-filled.
+*/
+   error = core_write(p, zero_region, 1, offset + len - 1,
+   UIO_SYSSPACE);
+   }
+   return (error);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312795 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:15:41 2017
New Revision: 312795
URL: https://svnweb.freebsd.org/changeset/base/312795

Log:
  MFC r311531 (by mjg):
  Perform a lockless check in tmpfs_itimes.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 09:46:34 2017
(r312794)
+++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:15:41 2017
(r312795)
@@ -1743,19 +1743,22 @@ tmpfs_set_status(struct tmpfs_node *node
 }
 
 /* Sync timestamps */
-static void
-tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc,
+void
+tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
 const struct timespec *mod)
 {
+   struct tmpfs_node *node;
struct timespec now;
 
-   TMPFS_ASSERT_LOCKED(node);
+   ASSERT_VOP_LOCKED(vp, "tmpfs_itimes");
+   node = VP_TO_TMPFS_NODE(vp);
 
if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
TMPFS_NODE_CHANGED)) == 0)
return;
 
vfs_timestamp(&now);
+   TMPFS_NODE_LOCK(node);
if (node->tn_status & TMPFS_NODE_ACCESSED) {
if (acc == NULL)
 acc = &now;
@@ -1770,19 +1773,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n
node->tn_ctime = now;
node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
TMPFS_NODE_CHANGED);
-}
-
-void
-tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
-const struct timespec *mod)
-{
-   struct tmpfs_node *node;
-
-   ASSERT_VOP_LOCKED(vp, "tmpfs_itimes");
-   node = VP_TO_TMPFS_NODE(vp);
-
-   TMPFS_NODE_LOCK(node);
-   tmpfs_itimes_locked(node, acc, mod);
TMPFS_NODE_UNLOCK(node);
 
/* XXX: FIX? The entropy here is desirable, but the harvesting may be 
expensive */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312796 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:18:00 2017
New Revision: 312796
URL: https://svnweb.freebsd.org/changeset/base/312796

Log:
  MFC r311526 (by mjg):
  tmpfs: enable MNTK_EXTENDED_SHARED.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:15:41 2017
(r312795)
+++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:18:00 2017
(r312796)
@@ -257,7 +257,7 @@ tmpfs_mount(struct mount *mp)
 
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
-   mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED;
+   mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
MNT_IUNLOCK(mp);
 
mp->mnt_data = tmp;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312797 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:19:53 2017
New Revision: 312797
URL: https://svnweb.freebsd.org/changeset/base/312797

Log:
  MFC r312124 (by mjg):
  tmpfs: manage tm_pages_used with atomics.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
  stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:18:00 2017
(r312796)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:19:53 2017
(r312797)
@@ -312,12 +312,12 @@ struct tmpfs_mount {
/* Maximum number of memory pages available for use by the file
 * system, set during mount time.  This variable must never be
 * used directly as it may be bigger than the current amount of
-* free memory; in the extreme case, it will hold the SIZE_MAX
+* free memory; in the extreme case, it will hold the ULONG_MAX
 * value. */
-   size_t  tm_pages_max;
+   u_long  tm_pages_max;
 
/* Number of pages in use by the file system. */
-   size_t  tm_pages_used;
+   u_long  tm_pages_used;
 
/* Pointer to the node representing the root directory of this
 * file system. */

Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:18:00 2017
(r312796)
+++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:19:53 2017
(r312797)
@@ -130,7 +130,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou
if (tmpfs_mem_avail() < req_pages)
return (0);
 
-   if (tmp->tm_pages_max != SIZE_MAX &&
+   if (tmp->tm_pages_max != ULONG_MAX &&
tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp))
return (0);
 
@@ -328,9 +328,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp,
case VREG:
uobj = node->tn_reg.tn_aobj;
if (uobj != NULL) {
-   TMPFS_LOCK(tmp);
-   tmp->tm_pages_used -= uobj->size;
-   TMPFS_UNLOCK(tmp);
+   atomic_subtract_long(&tmp->tm_pages_used, uobj->size);
KASSERT((uobj->flags & OBJ_TMPFS) == 0,
("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj));
vm_object_deallocate(uobj);
@@ -1413,9 +1411,7 @@ retry:
uobj->size = newpages;
VM_OBJECT_WUNLOCK(uobj);
 
-   TMPFS_LOCK(tmp);
-   tmp->tm_pages_used += (newpages - oldpages);
-   TMPFS_UNLOCK(tmp);
+   atomic_add_long(&tmp->tm_pages_used, newpages - oldpages);
 
node->tn_size = newsize;
return (0);

Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:18:00 2017
(r312796)
+++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:19:53 2017
(r312797)
@@ -397,7 +397,7 @@ tmpfs_statfs(struct mount *mp, struct st
sbp->f_bsize = PAGE_SIZE;
 
used = tmpfs_pages_used(tmp);
-   if (tmp->tm_pages_max != SIZE_MAX)
+   if (tmp->tm_pages_max != ULONG_MAX)
 sbp->f_blocks = tmp->tm_pages_max;
else
 sbp->f_blocks = used + tmpfs_mem_avail();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312798 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:29:23 2017
New Revision: 312798
URL: https://svnweb.freebsd.org/changeset/base/312798

Log:
  MFC r311531 (by mjg):
  Perform a lockless check in tmpfs_itimes.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:19:53 2017
(r312797)
+++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:29:23 2017
(r312798)
@@ -1745,19 +1745,22 @@ tmpfs_set_status(struct tmpfs_node *node
 }
 
 /* Sync timestamps */
-static void
-tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc,
+void
+tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
 const struct timespec *mod)
 {
+   struct tmpfs_node *node;
struct timespec now;
 
-   TMPFS_ASSERT_LOCKED(node);
+   ASSERT_VOP_LOCKED(vp, "tmpfs_itimes");
+   node = VP_TO_TMPFS_NODE(vp);
 
if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
TMPFS_NODE_CHANGED)) == 0)
return;
 
vfs_timestamp(&now);
+   TMPFS_NODE_LOCK(node);
if (node->tn_status & TMPFS_NODE_ACCESSED) {
if (acc == NULL)
 acc = &now;
@@ -1772,19 +1775,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n
node->tn_ctime = now;
node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
TMPFS_NODE_CHANGED);
-}
-
-void
-tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
-const struct timespec *mod)
-{
-   struct tmpfs_node *node;
-
-   ASSERT_VOP_LOCKED(vp, "tmpfs_itimes");
-   node = VP_TO_TMPFS_NODE(vp);
-
-   TMPFS_NODE_LOCK(node);
-   tmpfs_itimes_locked(node, acc, mod);
TMPFS_NODE_UNLOCK(node);
 
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312799 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:35:04 2017
New Revision: 312799
URL: https://svnweb.freebsd.org/changeset/base/312799

Log:
  MFC r312124 (by mjg):
  tmpfs: manage tm_pages_used with atomics.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs.h
  stable/10/sys/fs/tmpfs/tmpfs_subr.c
  stable/10/sys/fs/tmpfs/tmpfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs.h
==
--- stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:29:23 2017
(r312798)
+++ stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:35:04 2017
(r312799)
@@ -312,12 +312,12 @@ struct tmpfs_mount {
/* Maximum number of memory pages available for use by the file
 * system, set during mount time.  This variable must never be
 * used directly as it may be bigger than the current amount of
-* free memory; in the extreme case, it will hold the SIZE_MAX
+* free memory; in the extreme case, it will hold the ULONG_MAX
 * value. */
-   size_t  tm_pages_max;
+   u_long  tm_pages_max;
 
/* Number of pages in use by the file system. */
-   size_t  tm_pages_used;
+   u_long  tm_pages_used;
 
/* Pointer to the node representing the root directory of this
 * file system. */

Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:29:23 2017
(r312798)
+++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:35:04 2017
(r312799)
@@ -129,7 +129,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou
if (tmpfs_mem_avail() < req_pages)
return (0);
 
-   if (tmp->tm_pages_max != SIZE_MAX &&
+   if (tmp->tm_pages_max != ULONG_MAX &&
tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp))
return (0);
 
@@ -327,9 +327,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp,
case VREG:
uobj = node->tn_reg.tn_aobj;
if (uobj != NULL) {
-   TMPFS_LOCK(tmp);
-   tmp->tm_pages_used -= uobj->size;
-   TMPFS_UNLOCK(tmp);
+   atomic_subtract_long(&tmp->tm_pages_used, uobj->size);
KASSERT((uobj->flags & OBJ_TMPFS) == 0,
("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj));
vm_object_deallocate(uobj);
@@ -1413,9 +1411,7 @@ retry:
uobj->size = newpages;
VM_OBJECT_WUNLOCK(uobj);
 
-   TMPFS_LOCK(tmp);
-   tmp->tm_pages_used += (newpages - oldpages);
-   TMPFS_UNLOCK(tmp);
+   atomic_add_long(&tmp->tm_pages_used, newpages - oldpages);
 
node->tn_size = newsize;
return (0);

Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:29:23 2017
(r312798)
+++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:35:04 2017
(r312799)
@@ -395,7 +395,7 @@ tmpfs_statfs(struct mount *mp, struct st
sbp->f_bsize = PAGE_SIZE;
 
used = tmpfs_pages_used(tmp);
-   if (tmp->tm_pages_max != SIZE_MAX)
+   if (tmp->tm_pages_max != ULONG_MAX)
 sbp->f_blocks = tmp->tm_pages_max;
else
 sbp->f_blocks = used + tmpfs_mem_avail();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312800 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:41:56 2017
New Revision: 312800
URL: https://svnweb.freebsd.org/changeset/base/312800

Log:
  MFC r312407:
  Remove unused union member, fifos on tmpfs are implemented in common code.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:35:04 2017
(r312799)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:41:56 2017
(r312800)
@@ -259,12 +259,6 @@ struct tmpfs_node {
vm_object_t tn_aobj;
 
}tn_reg;
-
-   /* Valid when tn_type = VFIFO */
-   struct tn_fifo {
-   fo_rdwr_t   *tn_fo_read;
-   fo_rdwr_t   *tn_fo_write;
-   }tn_fifo;
}tn_spec;
 };
 LIST_HEAD(tmpfs_node_list, tmpfs_node);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312801 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:43:36 2017
New Revision: 312801
URL: https://svnweb.freebsd.org/changeset/base/312801

Log:
  MFC r312407:
  Remove unused union member, fifos on tmpfs are implemented in common code.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs.h
==
--- stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:41:56 2017
(r312800)
+++ stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:43:36 2017
(r312801)
@@ -259,12 +259,6 @@ struct tmpfs_node {
vm_object_t tn_aobj;
 
}tn_reg;
-
-   /* Valid when tn_type = VFIFO */
-   struct tn_fifo {
-   fo_rdwr_t   *tn_fo_read;
-   fo_rdwr_t   *tn_fo_write;
-   }tn_fifo;
}tn_spec;
 };
 LIST_HEAD(tmpfs_node_list, tmpfs_node);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312802 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:47:05 2017
New Revision: 312802
URL: https://svnweb.freebsd.org/changeset/base/312802

Log:
  MFC r312409:
  Style fixes and comment updates.
  
  MFC r312435:
  Remove mistakenly merged field.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
  stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
  stable/11/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:43:36 2017
(r312801)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:47:05 2017
(r312802)
@@ -80,8 +80,10 @@ struct tmpfs_dirent {
uint32_ttd_hash;
u_int   td_namelen;
 
-   /* Pointer to the node this entry refers to.  In case this field
-* is NULL, the node is a whiteout. */
+   /*
+* Pointer to the node this entry refers to.  In case this field
+* is NULL, the node is a whiteout.
+*/
struct tmpfs_node * td_node;
 
union {
@@ -94,21 +96,24 @@ struct tmpfs_dirent {
} ud;
 };
 
-/* A directory in tmpfs holds a list of directory entries, which in
- * turn point to other files (which can be directories themselves).
+/*
+ * A directory in tmpfs holds a collection of directory entries, which
+ * in turn point to other files (which can be directories themselves).
  *
- * In tmpfs, this list is managed by a RB-Tree, whose head is defined by
- * the struct tmpfs_dir type.
+ * In tmpfs, this collection is managed by a RB-Tree, whose head is
+ * defined by the struct tmpfs_dir type.
  *
  * It is important to notice that directories do not have entries for . and
  * .. as other file systems do.  These can be generated when requested
  * based on information available by other means, such as the pointer to
  * the node itself in the former case or the pointer to the parent directory
  * in the latter case.  This is done to simplify tmpfs's code and, more
- * importantly, to remove redundancy. */
+ * importantly, to remove redundancy.
+ */
 RB_HEAD(tmpfs_dir, tmpfs_dirent);
 
-/* Each entry in a directory has a cookie that identifies it.  Cookies
+/*
+ * Each entry in a directory has a cookie that identifies it.  Cookies
  * supersede offsets within directories because, given how tmpfs stores
  * directories in memory, there is no such thing as an offset.
  *
@@ -139,51 +144,65 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent);
  * a particular type.  The code must be careful to only access those
  * attributes that are actually allowed by the node's type.
  *
- *
  * Below is the key of locks used to protected the fields in the following
  * structures.
- *
+ * (v)  vnode lock in exclusive mode
+ * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and
+ * tn_interlock
+ * (i)  tn_interlock
+ * (m)  tmpfs_mount allnode_lock
+ * (c)  stable after creation
  */
 struct tmpfs_node {
-   /* Doubly-linked list entry which links all existing nodes for a
-* single file system.  This is provided to ease the removal of
-* all nodes during the unmount operation. */
-   LIST_ENTRY(tmpfs_node)  tn_entries;
+   /*
+* Doubly-linked list entry which links all existing nodes for
+* a single file system.  This is provided to ease the removal
+* of all nodes during the unmount operation, and to support
+* the implementation of VOP_VNTOCNP().
+*/
+   LIST_ENTRY(tmpfs_node)  tn_entries; /* (m) */
 
-   /* The node's type.  Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO',
+   /*
+* The node's type.  Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO',
 * 'VLNK', 'VREG' and 'VSOCK' is allowed.  The usage of vnode
 * types instead of a custom enumeration is to make things simpler
-* and faster, as we do not need to convert between two types. */
-   enum vtype  tn_type;
+* and faster, as we do not need to convert between two types.
+*/
+   enum vtype  tn_type;/* (c) */
 
/* Node identifier. */
-   ino_t   tn_id;
+   ino_t   tn_id;  /* (c) */
 
-   /* Node's internal status.  This is used by several file system
+   /*
+* Node's internal status.  This is used by several file system
 * operations to do modifications to the node in a delayed
-* fashion. */
-   int tn_status;
+* fashion.
+*/
+   int tn_status;  /* (vi) */
 #defineTMPFS_NODE_ACCESSED (1 << 1)
 #defineTMPFS_NODE_MODIFIED (1 << 2)
 #defineTMPFS_NODE_CHANGED  (1 << 3)
 
-   /* The node size.  It does not necessarily match the real amount
-* of memory consumed by it. */

svn commit: r312803 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:49:45 2017
New Revision: 312803
URL: https://svnweb.freebsd.org/changeset/base/312803

Log:
  MFC r312409:
  Style fixes and comment updates.
  
  MFC r312435:
  Remove mistakenly merged field.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs.h
  stable/10/sys/fs/tmpfs/tmpfs_subr.c
  stable/10/sys/fs/tmpfs/tmpfs_vfsops.c
  stable/10/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs.h
==
--- stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:47:05 2017
(r312802)
+++ stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:49:45 2017
(r312803)
@@ -80,8 +80,10 @@ struct tmpfs_dirent {
uint32_ttd_hash;
u_int   td_namelen;
 
-   /* Pointer to the node this entry refers to.  In case this field
-* is NULL, the node is a whiteout. */
+   /*
+* Pointer to the node this entry refers to.  In case this field
+* is NULL, the node is a whiteout.
+*/
struct tmpfs_node * td_node;
 
union {
@@ -94,21 +96,24 @@ struct tmpfs_dirent {
} ud;
 };
 
-/* A directory in tmpfs holds a list of directory entries, which in
- * turn point to other files (which can be directories themselves).
+/*
+ * A directory in tmpfs holds a collection of directory entries, which
+ * in turn point to other files (which can be directories themselves).
  *
- * In tmpfs, this list is managed by a RB-Tree, whose head is defined by
- * the struct tmpfs_dir type.
+ * In tmpfs, this collection is managed by a RB-Tree, whose head is
+ * defined by the struct tmpfs_dir type.
  *
  * It is important to notice that directories do not have entries for . and
  * .. as other file systems do.  These can be generated when requested
  * based on information available by other means, such as the pointer to
  * the node itself in the former case or the pointer to the parent directory
  * in the latter case.  This is done to simplify tmpfs's code and, more
- * importantly, to remove redundancy. */
+ * importantly, to remove redundancy.
+ */
 RB_HEAD(tmpfs_dir, tmpfs_dirent);
 
-/* Each entry in a directory has a cookie that identifies it.  Cookies
+/*
+ * Each entry in a directory has a cookie that identifies it.  Cookies
  * supersede offsets within directories because, given how tmpfs stores
  * directories in memory, there is no such thing as an offset.
  *
@@ -139,51 +144,65 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent);
  * a particular type.  The code must be careful to only access those
  * attributes that are actually allowed by the node's type.
  *
- *
  * Below is the key of locks used to protected the fields in the following
  * structures.
- *
+ * (v)  vnode lock in exclusive mode
+ * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and
+ * tn_interlock
+ * (i)  tn_interlock
+ * (m)  tmpfs_mount allnode_lock
+ * (c)  stable after creation
  */
 struct tmpfs_node {
-   /* Doubly-linked list entry which links all existing nodes for a
-* single file system.  This is provided to ease the removal of
-* all nodes during the unmount operation. */
-   LIST_ENTRY(tmpfs_node)  tn_entries;
+   /*
+* Doubly-linked list entry which links all existing nodes for
+* a single file system.  This is provided to ease the removal
+* of all nodes during the unmount operation, and to support
+* the implementation of VOP_VNTOCNP().
+*/
+   LIST_ENTRY(tmpfs_node)  tn_entries; /* (m) */
 
-   /* The node's type.  Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO',
+   /*
+* The node's type.  Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO',
 * 'VLNK', 'VREG' and 'VSOCK' is allowed.  The usage of vnode
 * types instead of a custom enumeration is to make things simpler
-* and faster, as we do not need to convert between two types. */
-   enum vtype  tn_type;
+* and faster, as we do not need to convert between two types.
+*/
+   enum vtype  tn_type;/* (c) */
 
/* Node identifier. */
-   ino_t   tn_id;
+   ino_t   tn_id;  /* (c) */
 
-   /* Node's internal status.  This is used by several file system
+   /*
+* Node's internal status.  This is used by several file system
 * operations to do modifications to the node in a delayed
-* fashion. */
-   int tn_status;
+* fashion.
+*/
+   int tn_status;  /* (vi) */
 #defineTMPFS_NODE_ACCESSED (1 << 1)
 #defineTMPFS_NODE_MODIFIED (1 << 2)
 #defineTMPFS_NODE_CHANGED  (1 << 3)
 
-   /* The node size.  It does not necessarily match the real amount
-* of memory consumed by it. */

svn commit: r312804 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:53:05 2017
New Revision: 312804
URL: https://svnweb.freebsd.org/changeset/base/312804

Log:
  MFC r312410:
  Rework some tmpfs lock assertions.
  
  MFC r312412:
  Protect macro argument.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
  stable/11/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:49:45 2017
(r312803)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:53:05 2017
(r312804)
@@ -307,21 +307,12 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
 
 #ifdef INVARIANTS
 #define TMPFS_ASSERT_LOCKED(node) do { \
-   MPASS(node != NULL);\
-   MPASS(node->tn_vnode != NULL);  \
-   if (!VOP_ISLOCKED(node->tn_vnode) &&\
-   !mtx_owned(TMPFS_NODE_MTX(node)))   \
-   panic("tmpfs: node is not locked: %p", node);   \
-   } while (0)
-#define TMPFS_ASSERT_ELOCKED(node) do {
\
MPASS((node) != NULL);  \
MPASS((node)->tn_vnode != NULL);\
-   mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \
-   ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs");   \
+   ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs assert");\
} while (0)
 #else
 #define TMPFS_ASSERT_LOCKED(node) (void)0
-#define TMPFS_ASSERT_ELOCKED(node) (void)0
 #endif
 
 #define TMPFS_VNODE_ALLOCATING 1

Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:49:45 2017
(r312803)
+++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:53:05 2017
(r312804)
@@ -670,7 +670,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru
struct tmpfs_node *node;
struct tmpfs_node *parent;
 
-   MPASS(VOP_ISLOCKED(dvp));
+   ASSERT_VOP_ELOCKED(dvp, "tmpfs_alloc_file");
MPASS(cnp->cn_flags & HASBUF);
 
tmp = VFS_TO_TMPFS(dvp->v_mount);

Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_vnops.cThu Jan 26 10:49:45 2017
(r312803)
+++ stable/11/sys/fs/tmpfs/tmpfs_vnops.cThu Jan 26 10:53:05 2017
(r312804)
@@ -,7 +,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
 
/* No vnode should be allocated for this entry from this point */
TMPFS_NODE_LOCK(node);
-   TMPFS_ASSERT_ELOCKED(node);
node->tn_links--;
node->tn_dir.tn_parent = NULL;
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED |
@@ -1120,7 +1119,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
TMPFS_NODE_UNLOCK(node);
 
TMPFS_NODE_LOCK(dnode);
-   TMPFS_ASSERT_ELOCKED(dnode);
dnode->tn_links--;
dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED |
TMPFS_NODE_MODIFIED;
@@ -1274,7 +1272,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v
cache_purge(vp);
 
TMPFS_NODE_LOCK(node);
-   TMPFS_ASSERT_ELOCKED(node);
tmpfs_free_vp(vp);
 
/* If the node referenced by this vnode was deleted by the user,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312805 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:55:56 2017
New Revision: 312805
URL: https://svnweb.freebsd.org/changeset/base/312805

Log:
  MFC r312410:
  Rework some tmpfs lock assertions.
  
  MFC r312412:
  Protect macro argument.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs.h
  stable/10/sys/fs/tmpfs/tmpfs_subr.c
  stable/10/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs.h
==
--- stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:53:05 2017
(r312804)
+++ stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:55:56 2017
(r312805)
@@ -307,21 +307,12 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
 
 #ifdef INVARIANTS
 #define TMPFS_ASSERT_LOCKED(node) do { \
-   MPASS(node != NULL);\
-   MPASS(node->tn_vnode != NULL);  \
-   if (!VOP_ISLOCKED(node->tn_vnode) &&\
-   !mtx_owned(TMPFS_NODE_MTX(node)))   \
-   panic("tmpfs: node is not locked: %p", node);   \
-   } while (0)
-#define TMPFS_ASSERT_ELOCKED(node) do {
\
MPASS((node) != NULL);  \
MPASS((node)->tn_vnode != NULL);\
-   mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \
-   ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs");   \
+   ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs assert");\
} while (0)
 #else
 #define TMPFS_ASSERT_LOCKED(node) (void)0
-#define TMPFS_ASSERT_ELOCKED(node) (void)0
 #endif
 
 #define TMPFS_VNODE_ALLOCATING 1

Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:53:05 2017
(r312804)
+++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:55:56 2017
(r312805)
@@ -669,7 +669,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru
struct tmpfs_node *node;
struct tmpfs_node *parent;
 
-   MPASS(VOP_ISLOCKED(dvp));
+   ASSERT_VOP_ELOCKED(dvp, "tmpfs_alloc_file");
MPASS(cnp->cn_flags & HASBUF);
 
tmp = VFS_TO_TMPFS(dvp->v_mount);

Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_vnops.cThu Jan 26 10:53:05 2017
(r312804)
+++ stable/10/sys/fs/tmpfs/tmpfs_vnops.cThu Jan 26 10:55:56 2017
(r312805)
@@ -1107,7 +1107,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
 
/* No vnode should be allocated for this entry from this point */
TMPFS_NODE_LOCK(node);
-   TMPFS_ASSERT_ELOCKED(node);
node->tn_links--;
node->tn_dir.tn_parent = NULL;
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED |
@@ -1116,7 +1115,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
TMPFS_NODE_UNLOCK(node);
 
TMPFS_NODE_LOCK(dnode);
-   TMPFS_ASSERT_ELOCKED(dnode);
dnode->tn_links--;
dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED |
TMPFS_NODE_MODIFIED;
@@ -1270,7 +1268,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v
cache_purge(vp);
 
TMPFS_NODE_LOCK(node);
-   TMPFS_ASSERT_ELOCKED(node);
tmpfs_free_vp(vp);
 
/* If the node referenced by this vnode was deleted by the user,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312806 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 10:58:12 2017
New Revision: 312806
URL: https://svnweb.freebsd.org/changeset/base/312806

Log:
  MFC r312414:
  Rename tmpfs_mount member allnode_lock to include namespace prefix.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
  stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:55:56 2017
(r312805)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:58:12 2017
(r312806)
@@ -150,7 +150,7 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent);
  * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and
  * tn_interlock
  * (i)  tn_interlock
- * (m)  tmpfs_mount allnode_lock
+ * (m)  tmpfs_mount tm_allnode_lock
  * (c)  stable after creation
  */
 struct tmpfs_node {
@@ -368,7 +368,7 @@ struct tmpfs_mount {
struct tmpfs_node_list  tm_nodes_used;
 
/* All node lock to protect the node list and tmp_pages_used. */
-   struct mtx allnode_lock;
+   struct mtx  tm_allnode_lock;
 
/* Zones used to store file system meta data, per tmpfs mount. */
uma_zone_t  tm_dirent_pool;
@@ -377,8 +377,9 @@ struct tmpfs_mount {
/* Read-only status. */
int tm_ronly;
 };
-#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock)
-#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock)
+#defineTMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock)
+#defineTMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock)
+#defineTMPFS_MP_ASSERT_LOCKED(tm) mtx_assert(&(tm)->tm_allnode_lock, 
MA_OWNED)
 
 /*
  * This structure maps a file identifier to a tmpfs node.  Used by the

Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:55:56 2017
(r312805)
+++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:58:12 2017
(r312806)
@@ -219,7 +219,7 @@ tmpfs_mount(struct mount *mp)
tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount),
M_TMPFSMNT, M_WAITOK | M_ZERO);
 
-   mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF);
+   mtx_init(&tmp->tm_allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF);
tmp->tm_nodes_max = nodes_max;
tmp->tm_nodes_inuse = 0;
tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX;
@@ -227,7 +227,7 @@ tmpfs_mount(struct mount *mp)
 
tmp->tm_pages_max = pages;
tmp->tm_pages_used = 0;
-   tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock);
+   tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock);
tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent",
sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
@@ -316,7 +316,7 @@ tmpfs_unmount(struct mount *mp, int mntf
uma_zdestroy(tmp->tm_node_pool);
delete_unrhdr(tmp->tm_ino_unr);
 
-   mtx_destroy(&tmp->allnode_lock);
+   mtx_destroy(&tmp->tm_allnode_lock);
MPASS(tmp->tm_pages_used == 0);
MPASS(tmp->tm_nodes_inuse == 0);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312807 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 11:00:57 2017
New Revision: 312807
URL: https://svnweb.freebsd.org/changeset/base/312807

Log:
  MFC r312414:
  Rename tmpfs_mount member allnode_lock to include namespace prefix.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs.h
  stable/10/sys/fs/tmpfs/tmpfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs.h
==
--- stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 10:58:12 2017
(r312806)
+++ stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 11:00:57 2017
(r312807)
@@ -150,7 +150,7 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent);
  * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and
  * tn_interlock
  * (i)  tn_interlock
- * (m)  tmpfs_mount allnode_lock
+ * (m)  tmpfs_mount tm_allnode_lock
  * (c)  stable after creation
  */
 struct tmpfs_node {
@@ -368,7 +368,7 @@ struct tmpfs_mount {
struct tmpfs_node_list  tm_nodes_used;
 
/* All node lock to protect the node list and tmp_pages_used. */
-   struct mtx allnode_lock;
+   struct mtx  tm_allnode_lock;
 
/* Zones used to store file system meta data, per tmpfs mount. */
uma_zone_t  tm_dirent_pool;
@@ -377,8 +377,9 @@ struct tmpfs_mount {
/* Read-only status. */
int tm_ronly;
 };
-#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock)
-#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock)
+#defineTMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock)
+#defineTMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock)
+#defineTMPFS_MP_ASSERT_LOCKED(tm) mtx_assert(&(tm)->tm_allnode_lock, 
MA_OWNED)
 
 /*
  * This structure maps a file identifier to a tmpfs node.  Used by the

Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 10:58:12 2017
(r312806)
+++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c   Thu Jan 26 11:00:57 2017
(r312807)
@@ -218,7 +218,7 @@ tmpfs_mount(struct mount *mp)
tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount),
M_TMPFSMNT, M_WAITOK | M_ZERO);
 
-   mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF);
+   mtx_init(&tmp->tm_allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF);
tmp->tm_nodes_max = nodes_max;
tmp->tm_nodes_inuse = 0;
tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX;
@@ -226,7 +226,7 @@ tmpfs_mount(struct mount *mp)
 
tmp->tm_pages_max = pages;
tmp->tm_pages_used = 0;
-   tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock);
+   tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock);
tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent",
sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
@@ -314,7 +314,7 @@ tmpfs_unmount(struct mount *mp, int mntf
uma_zdestroy(tmp->tm_node_pool);
delete_unrhdr(tmp->tm_ino_unr);
 
-   mtx_destroy(&tmp->allnode_lock);
+   mtx_destroy(&tmp->tm_allnode_lock);
MPASS(tmp->tm_pages_used == 0);
MPASS(tmp->tm_nodes_inuse == 0);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312808 - stable/11/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 11:03:19 2017
New Revision: 312808
URL: https://svnweb.freebsd.org/changeset/base/312808

Log:
  MFC r312425:
  Make tmpfs directory cursor available outside tmpfs_subr.c.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 11:00:57 2017
(r312807)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 11:03:19 2017
(r312808)
@@ -392,6 +392,11 @@ struct tmpfs_fid {
unsigned long   tf_gen;
 };
 
+struct tmpfs_dir_cursor {
+   struct tmpfs_dirent *tdc_current;
+   struct tmpfs_dirent *tdc_tree;
+};
+
 #ifdef _KERNEL
 /*
  * Prototypes for tmpfs_subr.c.
@@ -436,6 +441,10 @@ void   tmpfs_itimes(struct vnode *, const 
 void   tmpfs_set_status(struct tmpfs_node *node, int status);
 void   tmpfs_update(struct vnode *);
 inttmpfs_truncate(struct vnode *, off_t);
+struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode,
+   struct tmpfs_dir_cursor *dc);
+struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode,
+   struct tmpfs_dir_cursor *dc);
 
 /*
  * Convenience macros to simplify some logical expressions.

Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:00:57 2017
(r312807)
+++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:03:19 2017
(r312808)
@@ -62,11 +62,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct tmpfs_dir_cursor {
-   struct tmpfs_dirent *tdc_current;
-   struct tmpfs_dirent *tdc_tree;
-};
-
 SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system");
 
 static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED;
@@ -725,7 +720,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru
return (0);
 }
 
-static struct tmpfs_dirent *
+struct tmpfs_dirent *
 tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc)
 {
struct tmpfs_dirent *de;
@@ -739,7 +734,7 @@ tmpfs_dir_first(struct tmpfs_node *dnode
return (dc->tdc_current);
 }
 
-static struct tmpfs_dirent *
+struct tmpfs_dirent *
 tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc)
 {
struct tmpfs_dirent *de;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312809 - stable/10/sys/fs/tmpfs

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 11:04:27 2017
New Revision: 312809
URL: https://svnweb.freebsd.org/changeset/base/312809

Log:
  MFC r312425:
  Make tmpfs directory cursor available outside tmpfs_subr.c.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs.h
  stable/10/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs.h
==
--- stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 11:03:19 2017
(r312808)
+++ stable/10/sys/fs/tmpfs/tmpfs.h  Thu Jan 26 11:04:27 2017
(r312809)
@@ -392,6 +392,11 @@ struct tmpfs_fid {
unsigned long   tf_gen;
 };
 
+struct tmpfs_dir_cursor {
+   struct tmpfs_dirent *tdc_current;
+   struct tmpfs_dirent *tdc_tree;
+};
+
 #ifdef _KERNEL
 /*
  * Prototypes for tmpfs_subr.c.
@@ -436,6 +441,10 @@ void   tmpfs_itimes(struct vnode *, const 
 void   tmpfs_set_status(struct tmpfs_node *node, int status);
 void   tmpfs_update(struct vnode *);
 inttmpfs_truncate(struct vnode *, off_t);
+struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode,
+   struct tmpfs_dir_cursor *dc);
+struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode,
+   struct tmpfs_dir_cursor *dc);
 
 /*
  * Convenience macros to simplify some logical expressions.

Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:03:19 2017
(r312808)
+++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:04:27 2017
(r312809)
@@ -61,11 +61,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct tmpfs_dir_cursor {
-   struct tmpfs_dirent *tdc_current;
-   struct tmpfs_dirent *tdc_tree;
-};
-
 SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system");
 
 static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED;
@@ -724,7 +719,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru
return (0);
 }
 
-static struct tmpfs_dirent *
+struct tmpfs_dirent *
 tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc)
 {
struct tmpfs_dirent *de;
@@ -738,7 +733,7 @@ tmpfs_dir_first(struct tmpfs_node *dnode
return (dc->tdc_current);
 }
 
-static struct tmpfs_dirent *
+struct tmpfs_dirent *
 tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc)
 {
struct tmpfs_dirent *de;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312810 - stable/11/share/man/man5

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 11:06:39 2017
New Revision: 312810
URL: https://svnweb.freebsd.org/changeset/base/312810

Log:
  MFC r312423:
  Refresh tmpfs(5) man page.
  
  MFC r312648:
  Editing and clarifications for tmpfs(5).

Modified:
  stable/11/share/man/man5/tmpfs.5
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man5/tmpfs.5
==
--- stable/11/share/man/man5/tmpfs.5Thu Jan 26 11:04:27 2017
(r312809)
+++ stable/11/share/man/man5/tmpfs.5Thu Jan 26 11:06:39 2017
(r312810)
@@ -1,7 +1,12 @@
 .\"-
 .\" Copyright (c) 2007 Xin LI
+.\" Copyright (c) 2017 The FreeBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
+.\" Part of this documentation was written by
+.\" Konstantin Belousov  under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -49,12 +54,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 23, 2012
+.Dd January 17, 2017
 .Dt TMPFS 5
 .Os
 .Sh NAME
 .Nm tmpfs
-.Nd "efficient memory file system"
+.Nd "in-memory file system"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
@@ -72,17 +77,40 @@ tmpfs_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-driver will permit the
-.Fx
-kernel to access
+driver implements an in-memory, or
 .Tn tmpfs
-file systems.
+file system.
+The filesystem stores both file metadata and data in main memory.
+This allows very fast and low latency accesses to the data.
+The data is volatile.
+An umount or system reboot invalidates it.
+These properties make the filesystem's mounts suitable for fast
+scratch storage, like
+.Pa /tmp .
+.Pp
+If the system becomes low on memory and swap is configured (see
+.Xr swapon 8 ),
+the system can transfer file data to swap space, freeing memory
+for other needs.
+Metadata, including the directory content, is never swapped out by the
+current implementation.
+Keep this in mind when planning the mount limits, especially when expecting
+to place many small files on a tmpfs mount.
+.Pp
+When 
+.Xr mmap 2
+is used on a file from a tmpfs mount, the swap VM object managing the 
+file pages is used to implement mapping and avoid double-copying of
+the file data.
+This quirk causes process inspection tools, like
+.Xr procstat 1 ,
+to report anonymous memory mappings instead of file mappings.
 .Sh OPTIONS
 The following options are available when
 mounting
 .Nm
 file systems:
-.Bl -tag -width indent
+.Bl -tag -width "It Cm maxfilesize"
 .It Cm gid
 Specifies the group ID of the root inode of the file system.
 Defaults to the mount point's GID.
@@ -114,11 +142,15 @@ memory file system:
 .Pp
 .Dl "mount -t tmpfs tmpfs /tmp"
 .Sh SEE ALSO
+.Xr procstat 1 ,
 .Xr nmount 2 ,
+.Xr mmap 2 ,
 .Xr unmount 2 ,
 .Xr fstab 5 ,
 .Xr mdmfs 8 ,
-.Xr mount 8
+.Xr mount 8 ,
+.Xr swapinfo 8 ,
+.Xr swapon 8
 .Sh HISTORY
 The
 .Nm
@@ -130,7 +162,7 @@ The
 .Nm
 kernel implementation was written by
 .An Julio M. Merino Vidal Aq Mt j...@netbsd.org
-as a Google SoC project.
+as a Google Summer of Code project.
 .Pp
 .An Rohit Jalan
 and others ported it from
@@ -140,5 +172,3 @@ to
 .Pp
 This manual page was written by
 .An Xin LI Aq Mt delp...@freebsd.org .
-.Sh BUGS
-Some file system mount time options may not be well-supported.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312811 - stable/10/share/man/man5

2017-01-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 26 11:07:36 2017
New Revision: 312811
URL: https://svnweb.freebsd.org/changeset/base/312811

Log:
  MFC r312423:
  Refresh tmpfs(5) man page.
  
  MFC r312648:
  Editing and clarifications for tmpfs(5).

Modified:
  stable/10/share/man/man5/tmpfs.5
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man5/tmpfs.5
==
--- stable/10/share/man/man5/tmpfs.5Thu Jan 26 11:06:39 2017
(r312810)
+++ stable/10/share/man/man5/tmpfs.5Thu Jan 26 11:07:36 2017
(r312811)
@@ -1,7 +1,12 @@
 .\"-
 .\" Copyright (c) 2007 Xin LI
+.\" Copyright (c) 2017 The FreeBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
+.\" Part of this documentation was written by
+.\" Konstantin Belousov  under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -49,12 +54,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 23, 2012
+.Dd January 17, 2017
 .Dt TMPFS 5
 .Os
 .Sh NAME
 .Nm tmpfs
-.Nd "efficient memory file system"
+.Nd "in-memory file system"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
@@ -72,17 +77,40 @@ tmpfs_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-driver will permit the
-.Fx
-kernel to access
+driver implements an in-memory, or
 .Tn tmpfs
-file systems.
+file system.
+The filesystem stores both file metadata and data in main memory.
+This allows very fast and low latency accesses to the data.
+The data is volatile.
+An umount or system reboot invalidates it.
+These properties make the filesystem's mounts suitable for fast
+scratch storage, like
+.Pa /tmp .
+.Pp
+If the system becomes low on memory and swap is configured (see
+.Xr swapon 8 ),
+the system can transfer file data to swap space, freeing memory
+for other needs.
+Metadata, including the directory content, is never swapped out by the
+current implementation.
+Keep this in mind when planning the mount limits, especially when expecting
+to place many small files on a tmpfs mount.
+.Pp
+When 
+.Xr mmap 2
+is used on a file from a tmpfs mount, the swap VM object managing the 
+file pages is used to implement mapping and avoid double-copying of
+the file data.
+This quirk causes process inspection tools, like
+.Xr procstat 1 ,
+to report anonymous memory mappings instead of file mappings.
 .Sh OPTIONS
 The following options are available when
 mounting
 .Nm
 file systems:
-.Bl -tag -width indent
+.Bl -tag -width "It Cm maxfilesize"
 .It Cm gid
 Specifies the group ID of the root inode of the file system.
 Defaults to the mount point's GID.
@@ -114,11 +142,15 @@ memory file system:
 .Pp
 .Dl "mount -t tmpfs tmpfs /tmp"
 .Sh SEE ALSO
+.Xr procstat 1 ,
 .Xr nmount 2 ,
+.Xr mmap 2 ,
 .Xr unmount 2 ,
 .Xr fstab 5 ,
 .Xr mdmfs 8 ,
-.Xr mount 8
+.Xr mount 8 ,
+.Xr swapinfo 8 ,
+.Xr swapon 8
 .Sh HISTORY
 The
 .Nm
@@ -130,7 +162,7 @@ The
 .Nm
 kernel implementation was written by
 .An Julio M. Merino Vidal Aq j...@netbsd.org
-as a Google SoC project.
+as a Google Summer of Code project.
 .Pp
 .An Rohit Jalan
 and others ported it from
@@ -140,5 +172,3 @@ to
 .Pp
 This manual page was written by
 .An Xin LI Aq delp...@freebsd.org .
-.Sh BUGS
-Some file system mount time options may not be well-supported.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312812 - head/sys/arm/mv

2017-01-26 Thread Wojciech Macek
Author: wma
Date: Thu Jan 26 11:14:23 2017
New Revision: 312812
URL: https://svnweb.freebsd.org/changeset/base/312812

Log:
  Add dummy functions for Marvell SoC's not equipped with AHCI
  
  Commit r312747 ("Setup decoding windows for ARMADA38X") resulted
  in build failing for Marvell platforms, which don't have AHCI controller.
  This patch provides a fix by adding dummy functions for such cases.
  
  On the occasion rename register dump routine to decode_win_ahci_dump,
  in order to avoid confusion.
  
  Submitted by:  Marcin Wojtas 
  Obtained from: Semihalf
  Sponsored by:  Stormshield

Modified:
  head/sys/arm/mv/mv_common.c

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Thu Jan 26 11:07:36 2017(r312811)
+++ head/sys/arm/mv/mv_common.c Thu Jan 26 11:14:23 2017(r312812)
@@ -108,7 +108,7 @@ static void decode_win_usb3_dump(u_long)
 static void decode_win_eth_dump(u_long base);
 static void decode_win_idma_dump(u_long base);
 static void decode_win_xor_dump(u_long base);
-static void decode_win_sata_dump(u_long base);
+static void decode_win_ahci_dump(u_long base);
 
 static int fdt_get_ranges(const char *, void *, int, int *, int *);
 #ifdef SOC_MV_ARMADA38X
@@ -141,7 +141,7 @@ static struct soc_node_spec soc_nodes[] 
{ "mrvl,ge", &decode_win_eth_setup, &decode_win_eth_dump },
{ "mrvl,usb-ehci", &decode_win_usb_setup, &decode_win_usb_dump },
{ "marvell,armada-380-xhci", &decode_win_usb3_setup, 
&decode_win_usb3_dump },
-   { "marvell,armada-380-ahci", &decode_win_ahci_setup, 
&decode_win_sata_dump },
+   { "marvell,armada-380-ahci", &decode_win_ahci_setup, 
&decode_win_ahci_dump },
{ "mrvl,sata", &decode_win_sata_setup, NULL },
{ "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump },
{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump },
@@ -2007,6 +2007,10 @@ decode_win_sata_setup(u_long base)
}
 }
 
+#ifdef SOC_MV_ARMADA38X
+/*
+ * Configure AHCI decoding windows
+ */
 static void
 decode_win_ahci_setup(u_long base)
 {
@@ -2046,7 +2050,7 @@ decode_win_ahci_setup(u_long base)
 }
 
 static void
-decode_win_sata_dump(u_long base)
+decode_win_ahci_dump(u_long base)
 {
int i;
 
@@ -2056,6 +2060,22 @@ decode_win_sata_dump(u_long base)
win_sata_sz_read(base,i));
 }
 
+#else
+/*
+ * Provide dummy functions to satisfy the build
+ * for SoC's not equipped with AHCI controller
+ */
+static void
+decode_win_ahci_setup(u_long base)
+{
+}
+
+static void
+decode_win_ahci_dump(u_long base)
+{
+}
+#endif
+
 static int
 decode_win_sata_valid(void)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r312747 - head/sys/arm/mv

2017-01-26 Thread Wojciech Macek
Fixed in https://svnweb.freebsd.org/changeset/base/312812

Regards,
Wojtek

2017-01-26 2:56 GMT+01:00 Ed Maste :

> On 25 January 2017 at 05:31, Wojciech Macek  wrote:
> > Author: wma
> > Date: Wed Jan 25 10:31:16 2017
> > New Revision: 312747
> > URL: https://svnweb.freebsd.org/changeset/base/312747
> >
> > Log:
> >   Setup decoding windows for ARMADA38X
> >
> >   It is necesarry to open memory windows on internal bus for
> >   AHCI driver to work correctly.
>
> Build broken with:
>
> /scratch/tmp/emaste/freebsd/sys/arm/mv/mv_common.c:2019:3: error:
> implicit declaration of function 'win_sata_sz_write' is invalid in C99
> [-Werror,-Wimplicit-function-declaration]
> win_sata_sz_write(base, i, 0);
> ^
> /scratch/tmp/emaste/freebsd/sys/arm/mv/mv_common.c:2024:25: error: use
> of undeclared identifier 'IO_WIN_ATTR_SHIFT'
> cr = (ddr_attr(i) << IO_WIN_ATTR_SHIFT) |
>  ^
> ...
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312813 - in head/sys: arm/mv dev/fdt

2017-01-26 Thread Andrew Turner
Author: andrew
Date: Thu Jan 26 13:04:14 2017
New Revision: 312813
URL: https://svnweb.freebsd.org/changeset/base/312813

Log:
  Make fdt_pm_mask_table internal to the Marvell code, it's unued anywhere
  else.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/mv/mv_common.c
  head/sys/dev/fdt/fdt_common.h

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Thu Jan 26 11:14:23 2017(r312812)
+++ head/sys/arm/mv/mv_common.c Thu Jan 26 13:04:14 2017(r312813)
@@ -149,7 +149,12 @@ static struct soc_node_spec soc_nodes[] 
{ NULL, NULL, NULL },
 };
 
-struct fdt_pm_mask_entry fdt_pm_mask_table[] = {
+struct fdt_pm_mask_entry {
+   char*compat;
+   uint32_tmask;
+};
+
+static struct fdt_pm_mask_entry fdt_pm_mask_table[] = {
{ "mrvl,ge",CPU_PM_CTRL_GE(0) },
{ "mrvl,ge",CPU_PM_CTRL_GE(1) },
{ "mrvl,usb-ehci",  CPU_PM_CTRL_USB(0) },

Modified: head/sys/dev/fdt/fdt_common.h
==
--- head/sys/dev/fdt/fdt_common.h   Thu Jan 26 11:14:23 2017
(r312812)
+++ head/sys/dev/fdt/fdt_common.h   Thu Jan 26 13:04:14 2017
(r312813)
@@ -71,12 +71,6 @@ extern vm_paddr_t fdt_immr_pa;
 extern vm_offset_t fdt_immr_va;
 extern vm_offset_t fdt_immr_size;
 
-struct fdt_pm_mask_entry {
-   char*compat;
-   uint32_tmask;
-};
-extern struct fdt_pm_mask_entry fdt_pm_mask_table[];
-
 #if defined(FDT_DTB_STATIC)
 extern u_char fdt_static_dtb;
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312814 - head/sys/sys

2017-01-26 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 26 13:46:47 2017
New Revision: 312814
URL: https://svnweb.freebsd.org/changeset/base/312814

Log:
  Shoot a couple of style bugs down in the macro declarations.
  
  Submitted by: bde

Modified:
  head/sys/sys/gtaskqueue.h

Modified: head/sys/sys/gtaskqueue.h
==
--- head/sys/sys/gtaskqueue.h   Thu Jan 26 13:04:14 2017(r312813)
+++ head/sys/sys/gtaskqueue.h   Thu Jan 26 13:46:47 2017(r312814)
@@ -80,7 +80,6 @@ int   taskqgroup_adjust(struct taskqgroup 
 #define TASKQGROUP_DECLARE(name)   \
 extern struct taskqgroup *qgroup_##name
 
-
 #ifdef EARLY_AP_STARTUP
 #define TASKQGROUP_DEFINE(name, cnt, stride)   \
\
@@ -94,8 +93,7 @@ taskqgroup_define_##name(void *arg)   

 }  \
\
 SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \
-   taskqgroup_define_##name, NULL) \
-
+   taskqgroup_define_##name, NULL)
 #else /* !EARLY_AP_STARTUP */
 #define TASKQGROUP_DEFINE(name, cnt, stride)   \
\
@@ -117,8 +115,7 @@ taskqgroup_adjust_##name(void *arg) 

 }  \
\
 SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY,   \
-   taskqgroup_adjust_##name, NULL) \
-
+   taskqgroup_adjust_##name, NULL)
 #endif /* EARLY_AP_STARTUP */
 
 TASKQGROUP_DECLARE(net);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312815 - head/sys/kern

2017-01-26 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 26 13:48:45 2017
New Revision: 312815
URL: https://svnweb.freebsd.org/changeset/base/312815

Log:
  A few more style bugs lying around in here.
  
  Submitted by: bde

Modified:
  head/sys/kern/subr_gtaskqueue.c

Modified: head/sys/kern/subr_gtaskqueue.c
==
--- head/sys/kern/subr_gtaskqueue.c Thu Jan 26 13:46:47 2017
(r312814)
+++ head/sys/kern/subr_gtaskqueue.c Thu Jan 26 13:48:45 2017
(r312815)
@@ -630,6 +630,7 @@ taskqgroup_find(struct taskqgroup *qgrou
 
return (idx);
 }
+
 /*
  * smp_started is unusable since it is not set for UP kernels or even for
  * SMP kernels when there is 1 CPU.  This is usually handled by adding a
@@ -643,6 +644,7 @@ taskqgroup_find(struct taskqgroup *qgrou
  * SI_ORDER_ANY and unclearly after the CPUs are started.  It would be
  * simpler for adjustment to pass a flag indicating if it is delayed.
  */ 
+
 static int tqg_smp_started;
 
 static void
@@ -670,7 +672,7 @@ taskqgroup_attach(struct taskqgroup *qgr
qgroup->tqg_queue[qid].tgc_cnt++;
LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list);
gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq;
-   if (irq != -1 && tqg_smp_started ) {
+   if (irq != -1 && tqg_smp_started) {
gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu;
CPU_ZERO(&mask);
CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312816 - head/sys/net

2017-01-26 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 26 13:50:09 2017
New Revision: 312816
URL: https://svnweb.freebsd.org/changeset/base/312816

Log:
  Minor style annoyance.
  
  Submitted by: bde

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cThu Jan 26 13:48:45 2017(r312815)
+++ head/sys/net/iflib.cThu Jan 26 13:50:09 2017(r312816)
@@ -3755,6 +3755,7 @@ iflib_device_register(device_t dev, void
device_printf(dev, "qset structure setup failed %d\n", err);
goto fail_queues;
}
+
/*
 * Group taskqueues aren't properly set up until SMP is started,
 * so we disable interrupts until we can handle them post
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-01-26 Thread David E. O'Brien
Author: obrien
Date: Thu Jan 26 16:36:12 2017
New Revision: 312818
URL: https://svnweb.freebsd.org/changeset/base/312818

Log:
  Correct grammar.

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

Modified: head/share/man/man9/printf.9
==
--- head/share/man/man9/printf.9Thu Jan 26 15:37:53 2017
(r312817)
+++ head/share/man/man9/printf.9Thu Jan 26 16:36:12 2017
(r312818)
@@ -111,7 +111,7 @@ It requires two arguments: a
 pointer and a
 .Vt "char *"
 string.
-The memory pointed to be the pointer is output in hexadecimal one byte at
+The memory pointed to by the pointer is output in hexadecimal one byte at
 a time.
 The string is used as a delimiter between individual bytes.
 If present, a width directive will specify the number of bytes to display.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312819 - stable/10/sys/kern

2017-01-26 Thread Andriy Gapon
Author: avg
Date: Thu Jan 26 16:38:53 2017
New Revision: 312819
URL: https://svnweb.freebsd.org/changeset/base/312819

Log:
  MFC r312532: don't abort writing of a core dump after EFAULT
  
  Note that this change substantially differs from the change in head
  because of an unmerged earlier change that probably can not be merged
  for POLA reasons.

Modified:
  stable/10/sys/kern/imgact_elf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/imgact_elf.c
==
--- stable/10/sys/kern/imgact_elf.c Thu Jan 26 16:36:12 2017
(r312818)
+++ stable/10/sys/kern/imgact_elf.c Thu Jan 26 16:38:53 2017
(r312819)
@@ -1176,9 +1176,31 @@ core_output(struct vnode *vp, void *base
panic("shouldn't be here");
 #endif
} else {
+   /*
+* EFAULT is a non-fatal error that we can get, for example,
+* if the segment is backed by a file but extends beyond its
+* end.
+*/
error = vn_rdwr_inchunks(UIO_WRITE, vp, base, len, offset,
UIO_USERSPACE, IO_UNIT | IO_DIRECT, active_cred, file_cred,
NULL, td);
+   if (error == EFAULT) {
+   log(LOG_WARNING, "Failed to fully fault in a core file "
+   "segment at VA %p with size 0x%zx to be written at "
+   "offset 0x%jx for process %s\n", base, len, offset,
+   curproc->p_comm);
+
+   /*
+* Write a "real" zero byte at the end of the target
+* region in the case this is the last segment.
+* The intermediate space will be implicitly
+* zero-filled.
+*/
+   error = vn_rdwr_inchunks(UIO_WRITE, vp,
+   __DECONST(void *, zero_region), 1, offset + len - 1,
+   UIO_SYSSPACE, IO_UNIT | IO_DIRECT, active_cred,
+   file_cred, NULL, td);
+   }
}
return (error);
 }
@@ -2309,7 +2331,16 @@ compress_core (gzFile file, char *inbuf,
while (len) {
if (inbuf != NULL) {
chunk_len = (len > CORE_BUF_SIZE) ? CORE_BUF_SIZE : len;
-   copyin(inbuf, dest_buf, chunk_len);
+
+   /*
+* We can get EFAULT error here.  In that case zero out
+* the current chunk of the segment.
+*/
+   error = copyin(inbuf, dest_buf, chunk_len);
+   if (error != 0) {
+   bzero(dest_buf, chunk_len);
+   error = 0;
+   }
inbuf += chunk_len;
} else {
chunk_len = len;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r311993 - head/sys/dev/nand

2017-01-26 Thread Ronald Klop

Should this be merged to 11-stable also?
I got a build failure on this with 11/arm.

Ronald.


On Thu, 12 Jan 2017 19:05:12 +0100, Alexander Kabaev   
wrote:



Author: kan
Date: Thu Jan 12 18:05:12 2017
New Revision: 311993
URL: https://svnweb.freebsd.org/changeset/base/311993

Log:
  Fix typo in r311971.
 Reported by:   ohartmann at walstatt.org

Modified:
  head/sys/dev/nand/nand_geom.c

Modified: head/sys/dev/nand/nand_geom.c
==
--- head/sys/dev/nand/nand_geom.c   Thu Jan 12 17:54:55 2017
(r311992)
+++ head/sys/dev/nand/nand_geom.c   Thu Jan 12 18:05:12 2017
(r311993)
@@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip)
snprintf(rdisk->d_ident, sizeof(rdisk->d_ident),
"nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id,
chip->id.dev_id);
-   disk->d_rotation_rate = DISK_RR_NON_ROTATING;
+   rdisk->d_rotation_rate = DISK_RR_NON_ROTATING;
disk_create(rdisk, DISK_VERSION);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312820 - head/sys/modules

2017-01-26 Thread Ed Maste
Author: emaste
Date: Thu Jan 26 17:59:54 2017
New Revision: 312820
URL: https://svnweb.freebsd.org/changeset/base/312820

Log:
  Disconnect netfpga10g module from the build
  
  It only builds with the non-default DEVICE_POLLING option.
  
  Approved by:  bz

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Thu Jan 26 16:38:53 2017(r312819)
+++ head/sys/modules/Makefile   Thu Jan 26 17:59:54 2017(r312820)
@@ -265,7 +265,6 @@ SUBDIR= \
${_nctgpio} \
${_ncv} \
${_ndis} \
-   netfpga10g \
${_netgraph} \
${_nfe} \
nfscl \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312821 - in head/sys/modules: . usb

2017-01-26 Thread Ed Maste
Author: emaste
Date: Thu Jan 26 18:05:31 2017
New Revision: 312821
URL: https://svnweb.freebsd.org/changeset/base/312821

Log:
  mips: exclude modules that fail to build

Modified:
  head/sys/modules/Makefile
  head/sys/modules/usb/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Thu Jan 26 17:59:54 2017(r312820)
+++ head/sys/modules/Makefile   Thu Jan 26 18:05:31 2017(r312821)
@@ -503,13 +503,16 @@ _bce= bce
 _fatm= fatm
 _fxp=  fxp
 _ispfw=ispfw
+_sf=   sf
+_ti=   ti
+_txp=  txp
+
+.if ${MACHINE_CPUARCH} != "mips"
 _mwlfw=mwlfw
 _otusfw=   otusfw
 _ralfw=ralfw
 _rtwnfw=   rtwnfw
-_sf=   sf
-_ti=   ti
-_txp=  txp
+.endif
 .endif
 
 .if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \

Modified: head/sys/modules/usb/Makefile
==
--- head/sys/modules/usb/Makefile   Thu Jan 26 17:59:54 2017
(r312820)
+++ head/sys/modules/usb/Makefile   Thu Jan 26 18:05:31 2017
(r312821)
@@ -70,9 +70,12 @@ _uath=   uath
 _zyd=  zyd
 _kue=  kue
 _run=  run
-_runfw=runfw
 _rsu=  rsu
+
+.if ${MACHINE_CPUARCH} != "mips"
 _rsufw=rsufw
+_runfw=runfw
+.endif
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312822 - head/sys/mips/conf

2017-01-26 Thread Ed Maste
Author: emaste
Date: Thu Jan 26 18:18:35 2017
New Revision: 312822
URL: https://svnweb.freebsd.org/changeset/base/312822

Log:
  Enable modules in the MIPS ERL kernel config
  
  As reported by cperciva[1], modules are beneficial for typical
  Edgerouter Lite use cases.
  
  [1] http://www.daemonology.net/blog/2016-01-10-FreeBSD-EdgeRouter-Lite.html

Modified:
  head/sys/mips/conf/ERL

Modified: head/sys/mips/conf/ERL
==
--- head/sys/mips/conf/ERL  Thu Jan 26 18:05:31 2017(r312821)
+++ head/sys/mips/conf/ERL  Thu Jan 26 18:18:35 2017(r312822)
@@ -24,8 +24,6 @@ ident ERL
 makeoptionsARCH_FLAGS="-march=octeon -mabi=64"
 makeoptionsLDSCRIPT_NAME=ldscript.mips.octeon1
 
-# Don't build any modules yet.
-makeoptionsMODULES_OVERRIDE=""
 makeoptionsKERNLOADADDR=0x8010
 
 # We don't need to build a trampolined version of the kernel.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312823 - in vendor-crypto/openssl/dist: . apps crypto crypto/aes/asm crypto/asn1 crypto/bn crypto/bn/asm crypto/cms crypto/dh crypto/dsa crypto/ec crypto/ecdh crypto/err crypto/evp cry...

2017-01-26 Thread Jung-uk Kim
Author: jkim
Date: Thu Jan 26 18:32:12 2017
New Revision: 312823
URL: https://svnweb.freebsd.org/changeset/base/312823

Log:
  Import OpenSSL 1.0.2k.

Modified:
  vendor-crypto/openssl/dist/CHANGES
  vendor-crypto/openssl/dist/CONTRIBUTING
  vendor-crypto/openssl/dist/Configure
  vendor-crypto/openssl/dist/INSTALL
  vendor-crypto/openssl/dist/Makefile
  vendor-crypto/openssl/dist/Makefile.org
  vendor-crypto/openssl/dist/NEWS
  vendor-crypto/openssl/dist/README
  vendor-crypto/openssl/dist/apps/apps.c
  vendor-crypto/openssl/dist/apps/apps.h
  vendor-crypto/openssl/dist/apps/ca.c
  vendor-crypto/openssl/dist/apps/cms.c
  vendor-crypto/openssl/dist/apps/dgst.c
  vendor-crypto/openssl/dist/apps/dh.c
  vendor-crypto/openssl/dist/apps/dhparam.c
  vendor-crypto/openssl/dist/apps/dsa.c
  vendor-crypto/openssl/dist/apps/dsaparam.c
  vendor-crypto/openssl/dist/apps/ec.c
  vendor-crypto/openssl/dist/apps/ecparam.c
  vendor-crypto/openssl/dist/apps/enc.c
  vendor-crypto/openssl/dist/apps/gendh.c
  vendor-crypto/openssl/dist/apps/gendsa.c
  vendor-crypto/openssl/dist/apps/genpkey.c
  vendor-crypto/openssl/dist/apps/genrsa.c
  vendor-crypto/openssl/dist/apps/pkcs12.c
  vendor-crypto/openssl/dist/apps/pkcs7.c
  vendor-crypto/openssl/dist/apps/pkcs8.c
  vendor-crypto/openssl/dist/apps/pkey.c
  vendor-crypto/openssl/dist/apps/pkeyparam.c
  vendor-crypto/openssl/dist/apps/pkeyutl.c
  vendor-crypto/openssl/dist/apps/prime.c
  vendor-crypto/openssl/dist/apps/rand.c
  vendor-crypto/openssl/dist/apps/req.c
  vendor-crypto/openssl/dist/apps/rsa.c
  vendor-crypto/openssl/dist/apps/rsautl.c
  vendor-crypto/openssl/dist/apps/s_cb.c
  vendor-crypto/openssl/dist/apps/s_client.c
  vendor-crypto/openssl/dist/apps/s_server.c
  vendor-crypto/openssl/dist/apps/smime.c
  vendor-crypto/openssl/dist/apps/speed.c
  vendor-crypto/openssl/dist/apps/spkac.c
  vendor-crypto/openssl/dist/apps/srp.c
  vendor-crypto/openssl/dist/apps/verify.c
  vendor-crypto/openssl/dist/apps/x509.c
  vendor-crypto/openssl/dist/crypto/aes/asm/aes-s390x.pl
  vendor-crypto/openssl/dist/crypto/asn1/p5_pbev2.c
  vendor-crypto/openssl/dist/crypto/asn1/x_crl.c
  vendor-crypto/openssl/dist/crypto/bn/asm/x86_64-mont.pl
  vendor-crypto/openssl/dist/crypto/bn/asm/x86_64-mont5.pl
  vendor-crypto/openssl/dist/crypto/bn/bn_exp.c
  vendor-crypto/openssl/dist/crypto/bn/bn_mul.c
  vendor-crypto/openssl/dist/crypto/bn/bn_prime.c
  vendor-crypto/openssl/dist/crypto/bn/bn_sqr.c
  vendor-crypto/openssl/dist/crypto/cms/cms_kari.c
  vendor-crypto/openssl/dist/crypto/dh/dh_key.c
  vendor-crypto/openssl/dist/crypto/dsa/dsa_pmeth.c
  vendor-crypto/openssl/dist/crypto/ec/ec2_mult.c
  vendor-crypto/openssl/dist/crypto/ecdh/ech_ossl.c
  vendor-crypto/openssl/dist/crypto/err/err.c
  vendor-crypto/openssl/dist/crypto/evp/e_aes.c
  vendor-crypto/openssl/dist/crypto/evp/e_rc4_hmac_md5.c
  vendor-crypto/openssl/dist/crypto/evp/evp.h
  vendor-crypto/openssl/dist/crypto/evp/evp_err.c
  vendor-crypto/openssl/dist/crypto/evp/pmeth_fn.c
  vendor-crypto/openssl/dist/crypto/evp/pmeth_lib.c
  vendor-crypto/openssl/dist/crypto/modes/ctr128.c
  vendor-crypto/openssl/dist/crypto/opensslv.h
  vendor-crypto/openssl/dist/crypto/perlasm/x86_64-xlate.pl
  vendor-crypto/openssl/dist/crypto/rsa/rsa_gen.c
  vendor-crypto/openssl/dist/crypto/rsa/rsa_oaep.c
  vendor-crypto/openssl/dist/crypto/rsa/rsa_pmeth.c
  vendor-crypto/openssl/dist/crypto/s390xcap.c
  vendor-crypto/openssl/dist/crypto/ui/ui_lib.c
  vendor-crypto/openssl/dist/crypto/ui/ui_openssl.c
  vendor-crypto/openssl/dist/doc/apps/ocsp.pod
  vendor-crypto/openssl/dist/doc/crypto/EVP_DigestSignInit.pod
  vendor-crypto/openssl/dist/doc/crypto/EVP_DigestVerifyInit.pod
  vendor-crypto/openssl/dist/doc/crypto/RSA_generate_key.pod
  vendor-crypto/openssl/dist/doc/crypto/X509_NAME_get_index_by_NID.pod
  vendor-crypto/openssl/dist/doc/crypto/X509_NAME_print_ex.pod
  vendor-crypto/openssl/dist/doc/ssl/SSL_CTX_set_session_cache_mode.pod
  vendor-crypto/openssl/dist/doc/ssl/SSL_get_error.pod
  vendor-crypto/openssl/dist/doc/ssl/SSL_read.pod
  vendor-crypto/openssl/dist/doc/ssl/SSL_write.pod
  vendor-crypto/openssl/dist/engines/ccgost/Makefile
  vendor-crypto/openssl/dist/ssl/bad_dtls_test.c
  vendor-crypto/openssl/dist/ssl/s23_pkt.c
  vendor-crypto/openssl/dist/ssl/s2_lib.c
  vendor-crypto/openssl/dist/ssl/s2_pkt.c
  vendor-crypto/openssl/dist/ssl/s3_clnt.c
  vendor-crypto/openssl/dist/ssl/s3_pkt.c
  vendor-crypto/openssl/dist/ssl/s3_srvr.c
  vendor-crypto/openssl/dist/ssl/ssl_cert.c
  vendor-crypto/openssl/dist/ssl/ssl_err.c
  vendor-crypto/openssl/dist/ssl/ssl_lib.c
  vendor-crypto/openssl/dist/ssl/ssl_locl.h
  vendor-crypto/openssl/dist/ssl/ssl_sess.c
  vendor-crypto/openssl/dist/ssl/t1_lib.c
  vendor-crypto/openssl/dist/util/domd
  vendor-crypto/openssl/dist/util/mklink.pl

Modified: vendor-crypto/openssl/dist/CHANGES
==
--- vendor-crypto/openssl/dist/CHANGES  Thu Jan 26 18:18:35 2017  

svn commit: r312824 - vendor-crypto/openssl/1.0.2k

2017-01-26 Thread Jung-uk Kim
Author: jkim
Date: Thu Jan 26 18:33:03 2017
New Revision: 312824
URL: https://svnweb.freebsd.org/changeset/base/312824

Log:
  Tag OpenSSL 1.0.2k.

Added:
  vendor-crypto/openssl/1.0.2k/
 - copied from r312823, vendor-crypto/openssl/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312825 - in head: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/crypto/bn/as...

2017-01-26 Thread Jung-uk Kim
Author: jkim
Date: Thu Jan 26 19:10:29 2017
New Revision: 312825
URL: https://svnweb.freebsd.org/changeset/base/312825

Log:
  Merge OpenSSL 1.0.2k.

Modified:
  head/crypto/openssl/CHANGES
  head/crypto/openssl/CONTRIBUTING
  head/crypto/openssl/Configure
  head/crypto/openssl/INSTALL
  head/crypto/openssl/Makefile
  head/crypto/openssl/Makefile.org
  head/crypto/openssl/NEWS
  head/crypto/openssl/README
  head/crypto/openssl/apps/apps.c
  head/crypto/openssl/apps/apps.h
  head/crypto/openssl/apps/ca.c
  head/crypto/openssl/apps/cms.c
  head/crypto/openssl/apps/dgst.c
  head/crypto/openssl/apps/dh.c
  head/crypto/openssl/apps/dhparam.c
  head/crypto/openssl/apps/dsa.c
  head/crypto/openssl/apps/dsaparam.c
  head/crypto/openssl/apps/ec.c
  head/crypto/openssl/apps/ecparam.c
  head/crypto/openssl/apps/enc.c
  head/crypto/openssl/apps/gendh.c
  head/crypto/openssl/apps/gendsa.c
  head/crypto/openssl/apps/genpkey.c
  head/crypto/openssl/apps/genrsa.c
  head/crypto/openssl/apps/pkcs12.c
  head/crypto/openssl/apps/pkcs7.c
  head/crypto/openssl/apps/pkcs8.c
  head/crypto/openssl/apps/pkey.c
  head/crypto/openssl/apps/pkeyparam.c
  head/crypto/openssl/apps/pkeyutl.c
  head/crypto/openssl/apps/prime.c
  head/crypto/openssl/apps/rand.c
  head/crypto/openssl/apps/req.c
  head/crypto/openssl/apps/rsa.c
  head/crypto/openssl/apps/rsautl.c
  head/crypto/openssl/apps/s_cb.c
  head/crypto/openssl/apps/s_client.c
  head/crypto/openssl/apps/s_server.c
  head/crypto/openssl/apps/smime.c
  head/crypto/openssl/apps/speed.c
  head/crypto/openssl/apps/spkac.c
  head/crypto/openssl/apps/srp.c
  head/crypto/openssl/apps/verify.c
  head/crypto/openssl/apps/x509.c
  head/crypto/openssl/crypto/aes/asm/aes-s390x.pl
  head/crypto/openssl/crypto/asn1/p5_pbev2.c
  head/crypto/openssl/crypto/asn1/x_crl.c
  head/crypto/openssl/crypto/bn/asm/x86_64-mont.pl
  head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl
  head/crypto/openssl/crypto/bn/bn_exp.c
  head/crypto/openssl/crypto/bn/bn_mul.c
  head/crypto/openssl/crypto/bn/bn_prime.c
  head/crypto/openssl/crypto/bn/bn_sqr.c
  head/crypto/openssl/crypto/cms/cms_kari.c
  head/crypto/openssl/crypto/dh/dh_key.c
  head/crypto/openssl/crypto/dsa/dsa_pmeth.c
  head/crypto/openssl/crypto/ec/ec2_mult.c
  head/crypto/openssl/crypto/ecdh/ech_ossl.c
  head/crypto/openssl/crypto/err/err.c
  head/crypto/openssl/crypto/evp/e_aes.c
  head/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c
  head/crypto/openssl/crypto/evp/evp.h
  head/crypto/openssl/crypto/evp/evp_err.c
  head/crypto/openssl/crypto/evp/pmeth_fn.c
  head/crypto/openssl/crypto/evp/pmeth_lib.c
  head/crypto/openssl/crypto/modes/ctr128.c
  head/crypto/openssl/crypto/opensslv.h
  head/crypto/openssl/crypto/perlasm/x86_64-xlate.pl
  head/crypto/openssl/crypto/rsa/rsa_gen.c
  head/crypto/openssl/crypto/rsa/rsa_oaep.c
  head/crypto/openssl/crypto/rsa/rsa_pmeth.c
  head/crypto/openssl/crypto/s390xcap.c
  head/crypto/openssl/crypto/ui/ui_lib.c
  head/crypto/openssl/crypto/ui/ui_openssl.c
  head/crypto/openssl/doc/apps/ocsp.pod
  head/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod
  head/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod
  head/crypto/openssl/doc/crypto/RSA_generate_key.pod
  head/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod
  head/crypto/openssl/doc/crypto/X509_NAME_print_ex.pod
  head/crypto/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod
  head/crypto/openssl/doc/ssl/SSL_get_error.pod
  head/crypto/openssl/doc/ssl/SSL_read.pod
  head/crypto/openssl/doc/ssl/SSL_write.pod
  head/crypto/openssl/engines/ccgost/Makefile
  head/crypto/openssl/ssl/bad_dtls_test.c
  head/crypto/openssl/ssl/s23_pkt.c
  head/crypto/openssl/ssl/s2_lib.c
  head/crypto/openssl/ssl/s2_pkt.c
  head/crypto/openssl/ssl/s3_clnt.c
  head/crypto/openssl/ssl/s3_pkt.c
  head/crypto/openssl/ssl/s3_srvr.c
  head/crypto/openssl/ssl/ssl_cert.c
  head/crypto/openssl/ssl/ssl_err.c
  head/crypto/openssl/ssl/ssl_lib.c
  head/crypto/openssl/ssl/ssl_locl.h
  head/crypto/openssl/ssl/ssl_sess.c
  head/crypto/openssl/ssl/t1_lib.c
  head/crypto/openssl/util/domd
  head/crypto/openssl/util/mklink.pl
  head/secure/lib/libcrypto/Makefile.inc
  head/secure/lib/libcrypto/amd64/x86_64-mont.S
  head/secure/lib/libcrypto/amd64/x86_64-mont5.S
  head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3
  head/secure/lib/libcrypto/man/ASN1_STRING_length.3
  head/secure/lib/libcrypto/man/ASN1_STRING_new.3
  head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3
  head/secure/lib/libcrypto/man/ASN1_TIME_set.3
  head/secure/lib/libcrypto/man/ASN1_generate_nconf.3
  head/secure/lib/libcrypto/man/BIO_ctrl.3
  head/secure/lib/libcrypto/man/BIO_f_base64.3
  head/secure/lib/libcrypto/man/BIO_f_buffer.3
  head/secure/lib/libcrypto/man/BIO_f_cipher.3
  head/secure/lib/libcrypto/man/BIO_f_md.3
  head/secure/lib/libcrypto/man/BIO_f_null.3
  head/secure/lib/libcrypto/man/BIO_f_ssl.3
  head/secure/lib/libcrypto/man/BIO_find_type.3
  head/secure/lib/libcrypto/man/BIO_new.3
  head/secure/lib/libcrypto/man/BIO_new_CM

svn commit: r312826 - in stable/11: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/crypto/...

2017-01-26 Thread Jung-uk Kim
Author: jkim
Date: Thu Jan 26 19:14:14 2017
New Revision: 312826
URL: https://svnweb.freebsd.org/changeset/base/312826

Log:
  MFC:  r312825
  
  Merge OpenSSL 1.0.2k.

Modified:
  stable/11/crypto/openssl/CHANGES
  stable/11/crypto/openssl/CONTRIBUTING
  stable/11/crypto/openssl/Configure
  stable/11/crypto/openssl/INSTALL
  stable/11/crypto/openssl/Makefile
  stable/11/crypto/openssl/Makefile.org
  stable/11/crypto/openssl/NEWS
  stable/11/crypto/openssl/README
  stable/11/crypto/openssl/apps/apps.c
  stable/11/crypto/openssl/apps/apps.h
  stable/11/crypto/openssl/apps/ca.c
  stable/11/crypto/openssl/apps/cms.c
  stable/11/crypto/openssl/apps/dgst.c
  stable/11/crypto/openssl/apps/dh.c
  stable/11/crypto/openssl/apps/dhparam.c
  stable/11/crypto/openssl/apps/dsa.c
  stable/11/crypto/openssl/apps/dsaparam.c
  stable/11/crypto/openssl/apps/ec.c
  stable/11/crypto/openssl/apps/ecparam.c
  stable/11/crypto/openssl/apps/enc.c
  stable/11/crypto/openssl/apps/gendh.c
  stable/11/crypto/openssl/apps/gendsa.c
  stable/11/crypto/openssl/apps/genpkey.c
  stable/11/crypto/openssl/apps/genrsa.c
  stable/11/crypto/openssl/apps/pkcs12.c
  stable/11/crypto/openssl/apps/pkcs7.c
  stable/11/crypto/openssl/apps/pkcs8.c
  stable/11/crypto/openssl/apps/pkey.c
  stable/11/crypto/openssl/apps/pkeyparam.c
  stable/11/crypto/openssl/apps/pkeyutl.c
  stable/11/crypto/openssl/apps/prime.c
  stable/11/crypto/openssl/apps/rand.c
  stable/11/crypto/openssl/apps/req.c
  stable/11/crypto/openssl/apps/rsa.c
  stable/11/crypto/openssl/apps/rsautl.c
  stable/11/crypto/openssl/apps/s_cb.c
  stable/11/crypto/openssl/apps/s_client.c
  stable/11/crypto/openssl/apps/s_server.c
  stable/11/crypto/openssl/apps/smime.c
  stable/11/crypto/openssl/apps/speed.c
  stable/11/crypto/openssl/apps/spkac.c
  stable/11/crypto/openssl/apps/srp.c
  stable/11/crypto/openssl/apps/verify.c
  stable/11/crypto/openssl/apps/x509.c
  stable/11/crypto/openssl/crypto/aes/asm/aes-s390x.pl
  stable/11/crypto/openssl/crypto/asn1/p5_pbev2.c
  stable/11/crypto/openssl/crypto/asn1/x_crl.c
  stable/11/crypto/openssl/crypto/bn/asm/x86_64-mont.pl
  stable/11/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl
  stable/11/crypto/openssl/crypto/bn/bn_exp.c
  stable/11/crypto/openssl/crypto/bn/bn_mul.c
  stable/11/crypto/openssl/crypto/bn/bn_prime.c
  stable/11/crypto/openssl/crypto/bn/bn_sqr.c
  stable/11/crypto/openssl/crypto/cms/cms_kari.c
  stable/11/crypto/openssl/crypto/dh/dh_key.c
  stable/11/crypto/openssl/crypto/dsa/dsa_pmeth.c
  stable/11/crypto/openssl/crypto/ec/ec2_mult.c
  stable/11/crypto/openssl/crypto/ecdh/ech_ossl.c
  stable/11/crypto/openssl/crypto/err/err.c
  stable/11/crypto/openssl/crypto/evp/e_aes.c
  stable/11/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c
  stable/11/crypto/openssl/crypto/evp/evp.h
  stable/11/crypto/openssl/crypto/evp/evp_err.c
  stable/11/crypto/openssl/crypto/evp/pmeth_fn.c
  stable/11/crypto/openssl/crypto/evp/pmeth_lib.c
  stable/11/crypto/openssl/crypto/modes/ctr128.c
  stable/11/crypto/openssl/crypto/opensslv.h
  stable/11/crypto/openssl/crypto/perlasm/x86_64-xlate.pl
  stable/11/crypto/openssl/crypto/rsa/rsa_gen.c
  stable/11/crypto/openssl/crypto/rsa/rsa_oaep.c
  stable/11/crypto/openssl/crypto/rsa/rsa_pmeth.c
  stable/11/crypto/openssl/crypto/s390xcap.c
  stable/11/crypto/openssl/crypto/ui/ui_lib.c
  stable/11/crypto/openssl/crypto/ui/ui_openssl.c
  stable/11/crypto/openssl/doc/apps/ocsp.pod
  stable/11/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod
  stable/11/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod
  stable/11/crypto/openssl/doc/crypto/RSA_generate_key.pod
  stable/11/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod
  stable/11/crypto/openssl/doc/crypto/X509_NAME_print_ex.pod
  stable/11/crypto/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod
  stable/11/crypto/openssl/doc/ssl/SSL_get_error.pod
  stable/11/crypto/openssl/doc/ssl/SSL_read.pod
  stable/11/crypto/openssl/doc/ssl/SSL_write.pod
  stable/11/crypto/openssl/engines/ccgost/Makefile
  stable/11/crypto/openssl/ssl/bad_dtls_test.c
  stable/11/crypto/openssl/ssl/s23_pkt.c
  stable/11/crypto/openssl/ssl/s2_lib.c
  stable/11/crypto/openssl/ssl/s2_pkt.c
  stable/11/crypto/openssl/ssl/s3_clnt.c
  stable/11/crypto/openssl/ssl/s3_pkt.c
  stable/11/crypto/openssl/ssl/s3_srvr.c
  stable/11/crypto/openssl/ssl/ssl_cert.c
  stable/11/crypto/openssl/ssl/ssl_err.c
  stable/11/crypto/openssl/ssl/ssl_lib.c
  stable/11/crypto/openssl/ssl/ssl_locl.h
  stable/11/crypto/openssl/ssl/ssl_sess.c
  stable/11/crypto/openssl/ssl/t1_lib.c
  stable/11/crypto/openssl/util/domd
  stable/11/crypto/openssl/util/mklink.pl
  stable/11/secure/lib/libcrypto/Makefile.inc
  stable/11/secure/lib/libcrypto/amd64/x86_64-mont.S
  stable/11/secure/lib/libcrypto/amd64/x86_64-mont5.S
  stable/11/secure/lib/libcrypto/man/ASN1_OBJECT_new.3
  stable/11/secure/lib/libcrypto/man/ASN1_STRING_length.3
  stable/11/secure/lib/libcrypto/man/ASN1_STRING_new.3
  stable/11/secure/lib/libcrypto/man/ASN1_STRING_print_e

svn commit: r312827 - head/sys/cam

2017-01-26 Thread Scott Long
Author: scottl
Date: Thu Jan 26 20:08:58 2017
New Revision: 312827
URL: https://svnweb.freebsd.org/changeset/base/312827

Log:
  Refactor xpt_print_path, xpt_print, and xpt_path_string.  Implement
  all of them in terms of an sbuf-based back-end, xpt_path_sbuf.  This
  unifies the implementation, but more importantly it stops the output
  fropm being split between 4 or more invocations of printf.  The
  multiple invocations cause interleaving of the messages on the
  console during boot, making the output of disk discovery often
  unintelligible.  This change helps a lot, but more work is needed.
  
  Reviewed by:  ken, mav
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt.h

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Jan 26 19:14:14 2017(r312826)
+++ head/sys/cam/cam_xpt.c  Thu Jan 26 20:08:58 2017(r312827)
@@ -3697,33 +3697,14 @@ xpt_path_comp_dev(struct cam_path *path,
 void
 xpt_print_path(struct cam_path *path)
 {
+   struct sbuf sb;
+   char buffer[XPT_PRINT_LEN];
 
-   if (path == NULL)
-   printf("(nopath): ");
-   else {
-   if (path->periph != NULL)
-   printf("(%s%d:", path->periph->periph_name,
-  path->periph->unit_number);
-   else
-   printf("(noperiph:");
-
-   if (path->bus != NULL)
-   printf("%s%d:%d:", path->bus->sim->sim_name,
-  path->bus->sim->unit_number,
-  path->bus->sim->bus_id);
-   else
-   printf("nobus:");
-
-   if (path->target != NULL)
-   printf("%d:", path->target->target_id);
-   else
-   printf("X:");
-
-   if (path->device != NULL)
-   printf("%jx): ", (uintmax_t)path->device->lun_id);
-   else
-   printf("X): ");
-   }
+   sbuf_new(&sb, buffer, XPT_PRINT_LEN, SBUF_FIXEDLEN);
+   xpt_path_sbuf(path, &sb);
+   sbuf_finish(&sb);
+   printf("%s", sbuf_data(&sb));
+   sbuf_delete(&sb);
 }
 
 void
@@ -3745,49 +3726,66 @@ void
 xpt_print(struct cam_path *path, const char *fmt, ...)
 {
va_list ap;
-   xpt_print_path(path);
+   struct sbuf sb;
+   char buffer[XPT_PRINT_MAXLEN];
+
+   sbuf_new(&sb, buffer, XPT_PRINT_MAXLEN, SBUF_FIXEDLEN);
+
+   xpt_path_sbuf(path, &sb);
va_start(ap, fmt);
-   vprintf(fmt, ap);
+   sbuf_vprintf(&sb, fmt, ap);
va_end(ap);
+
+   sbuf_finish(&sb);
+   printf("%s", sbuf_data(&sb));
+   sbuf_delete(&sb);
 }
 
 int
 xpt_path_string(struct cam_path *path, char *str, size_t str_len)
 {
struct sbuf sb;
+   int len;
 
sbuf_new(&sb, str, str_len, 0);
+   len = xpt_path_sbuf(path, &sb);
+   sbuf_finish(&sb);
+   return (len);
+}
+
+int
+xpt_path_sbuf(struct cam_path *path, struct sbuf *sb)
+{
 
if (path == NULL)
-   sbuf_printf(&sb, "(nopath): ");
+   sbuf_printf(sb, "(nopath): ");
else {
if (path->periph != NULL)
-   sbuf_printf(&sb, "(%s%d:", path->periph->periph_name,
+   sbuf_printf(sb, "(%s%d:", path->periph->periph_name,
path->periph->unit_number);
else
-   sbuf_printf(&sb, "(noperiph:");
+   sbuf_printf(sb, "(noperiph:");
 
if (path->bus != NULL)
-   sbuf_printf(&sb, "%s%d:%d:", path->bus->sim->sim_name,
+   sbuf_printf(sb, "%s%d:%d:", path->bus->sim->sim_name,
path->bus->sim->unit_number,
path->bus->sim->bus_id);
else
-   sbuf_printf(&sb, "nobus:");
+   sbuf_printf(sb, "nobus:");
 
if (path->target != NULL)
-   sbuf_printf(&sb, "%d:", path->target->target_id);
+   sbuf_printf(sb, "%d:", path->target->target_id);
else
-   sbuf_printf(&sb, "X:");
+   sbuf_printf(sb, "X:");
 
if (path->device != NULL)
-   sbuf_printf(&sb, "%jx): ",
+   sbuf_printf(sb, "%jx): ",
(uintmax_t)path->device->lun_id);
else
-   sbuf_printf(&sb, "X): ");
+   sbuf_printf(sb, "X): ");
}
-   sbuf_finish(&sb);
 
-   return(sbuf_len(&sb));
+   return(sbuf_len(sb));
 }
 
 path_id_t

Modified: head/sys/cam/cam_xpt.h
==
--- head/sys/cam/cam_xpt.

svn commit: r312828 - in stable/10: . tests/sys/geom/class/eli tests/sys/geom/class/nop

2017-01-26 Thread Alan Somers
Author: asomers
Date: Thu Jan 26 20:10:31 2017
New Revision: 312828
URL: https://svnweb.freebsd.org/changeset/base/312828

Log:
  MFC r310786, r310803, r310985, r311894
  
  r310786:
  Reduce the runtime of the GELI tests
  
  There is no reduction in test coverage.  On my system runtime is reduced
  from 38m32s to 6m24s.
  
  tests/sys/geom/class/eli/conf.sh
  tests/sys/geom/class/eli/init_a_test.sh
  tests/sys/geom/class/eli/init_test.sh
  tests/sys/geom/class/eli/integrity_copy_test.sh
  tests/sys/geom/class/eli/integrity_data_test.sh
  tests/sys/geom/class/eli/integrity_hmac_test.sh
  tests/sys/geom/class/eli/onetime_a_test.sh
  tests/sys/geom/class/eli/onetime_test.sh
Move the looping code into common functions in conf.sh, and remove
alias ciphers from the list.
  
  tests/sys/geom/class/eli/init_a_test.sh
  tests/sys/geom/class/eli/init_test.sh
  tests/sys/geom/class/eli/integrity_copy_test.sh
  tests/sys/geom/class/eli/integrity_data_test.sh
  tests/sys/geom/class/eli/integrity_hmac_test.sh
  tests/sys/geom/class/eli/onetime_a_test.sh
Move a few commands that don't need to be in the inner loop out.
  
  tests/sys/geom/class/eli/init_test.sh
  tests/sys/geom/class/eli/onetime_a_test.sh
Reduce the sector count
  
  tests/sys/geom/class/eli/Makefile
  tests/sys/geom/class/eli/init_alias_test.sh
Add a test for initializing a GELI device using one of the cipher
aliases, and check that the alias is correctly interpreted.
  
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D8814
  
  r310803:
  ATFify the gnop tests
  
  Also, add test cases for the -p, -P, and -s options to gnop create
  
  Reviewed by:  ngie
  MFC after:4 weeks
  Differential Revision:https://reviews.freebsd.org/D8892
  
  r310985:
  Update ObsoleteFiles.inc for r310803
  
  MFC after:26 days
  X-MFC-with:   310803
  
  r311894:
  Fix typo from change 310985 in ObsoleteFiles.inc
  
  MFC after:16 days
  X-MFC-With:   310803
  Sponsored by: Spectra Logic Corp

Added:
  stable/10/tests/sys/geom/class/eli/init_alias_test.sh
 - copied unchanged from r310786, 
head/tests/sys/geom/class/eli/init_alias_test.sh
  stable/10/tests/sys/geom/class/nop/nop_test.sh
 - copied unchanged from r310803, head/tests/sys/geom/class/nop/nop_test.sh
Deleted:
  stable/10/tests/sys/geom/class/nop/1_test.sh
  stable/10/tests/sys/geom/class/nop/2_test.sh
  stable/10/tests/sys/geom/class/nop/conf.sh
Modified:
  stable/10/ObsoleteFiles.inc
  stable/10/tests/sys/geom/class/eli/Makefile
  stable/10/tests/sys/geom/class/eli/conf.sh
  stable/10/tests/sys/geom/class/eli/init_a_test.sh
  stable/10/tests/sys/geom/class/eli/init_test.sh
  stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh
  stable/10/tests/sys/geom/class/eli/integrity_data_test.sh
  stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh
  stable/10/tests/sys/geom/class/eli/onetime_a_test.sh
  stable/10/tests/sys/geom/class/eli/onetime_test.sh
  stable/10/tests/sys/geom/class/nop/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/ObsoleteFiles.inc
==
--- stable/10/ObsoleteFiles.inc Thu Jan 26 20:08:58 2017(r312827)
+++ stable/10/ObsoleteFiles.inc Thu Jan 26 20:10:31 2017(r312828)
@@ -38,6 +38,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20161229: Three files from gnop tests consolidated into one
+OLD_FILES+=usr/tests/sys/geom/class/nop/1_test
+OLD_FILES+=usr/tests/sys/geom/class/nop/2_test
+OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh
 # 20161121: Hyper-V manuals only apply to amd64 and i386.
 .if ${TARGET_ARCH} != "amd64" && ${TARGET_ARCH} != "i386"
 OLD_FILES+=usr/share/man/man4/hv_kvp.4.gz

Modified: stable/10/tests/sys/geom/class/eli/Makefile
==
--- stable/10/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:08:58 2017
(r312827)
+++ stable/10/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:10:31 2017
(r312828)
@@ -9,6 +9,7 @@ TAP_TESTS_SH+= detach_l_test
 TAP_TESTS_SH+= init_B_test
 TAP_TESTS_SH+= init_J_test
 TAP_TESTS_SH+= init_a_test
+TAP_TESTS_SH+= init_alias_test
 TAP_TESTS_SH+= init_i_P_test
 TAP_TESTS_SH+= init_test
 TAP_TESTS_SH+= integrity_copy_test

Modified: stable/10/tests/sys/geom/class/eli/conf.sh
==
--- stable/10/tests/sys/geom/class/eli/conf.sh  Thu Jan 26 20:08:58 2017
(r312827)
+++ stable/10/tests/sys/geom/class/eli/conf.sh  Thu Jan 26 20:10:31 2017
(r312828)
@@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do
: $(( no += 1 ))
 done
 
+# Execute `func` for each combination of cipher, sectorsize, and hmac algo
+# `func` usage should be:
+# func   
+for_each_geli_config() {
+   func=$1
+
+   for cipher in aes-xts:12

svn commit: r312829 - in stable/11: . tests/sys/geom/class/eli tests/sys/geom/class/nop

2017-01-26 Thread Alan Somers
Author: asomers
Date: Thu Jan 26 20:15:14 2017
New Revision: 312829
URL: https://svnweb.freebsd.org/changeset/base/312829

Log:
  MFC r310786, r310803, r310985, r311894
  
  r310786:
  Reduce the runtime of the GELI tests
  
  There is no reduction in test coverage.  On my system runtime is reduced
  from 38m32s to 6m24s.
  
  tests/sys/geom/class/eli/conf.sh
  tests/sys/geom/class/eli/init_a_test.sh
  tests/sys/geom/class/eli/init_test.sh
  tests/sys/geom/class/eli/integrity_copy_test.sh
  tests/sys/geom/class/eli/integrity_data_test.sh
  tests/sys/geom/class/eli/integrity_hmac_test.sh
  tests/sys/geom/class/eli/onetime_a_test.sh
  tests/sys/geom/class/eli/onetime_test.sh
Move the looping code into common functions in conf.sh, and remove
alias ciphers from the list.
  
  tests/sys/geom/class/eli/init_a_test.sh
  tests/sys/geom/class/eli/init_test.sh
  tests/sys/geom/class/eli/integrity_copy_test.sh
  tests/sys/geom/class/eli/integrity_data_test.sh
  tests/sys/geom/class/eli/integrity_hmac_test.sh
  tests/sys/geom/class/eli/onetime_a_test.sh
Move a few commands that don't need to be in the inner loop out.
  
  tests/sys/geom/class/eli/init_test.sh
  tests/sys/geom/class/eli/onetime_a_test.sh
Reduce the sector count
  
  tests/sys/geom/class/eli/Makefile
  tests/sys/geom/class/eli/init_alias_test.sh
Add a test for initializing a GELI device using one of the cipher
aliases, and check that the alias is correctly interpreted.
  
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D8814
  
  r310803:
  ATFify the gnop tests
  
  Also, add test cases for the -p, -P, and -s options to gnop create
  
  Reviewed by:  ngie
  MFC after:4 weeks
  Differential Revision:https://reviews.freebsd.org/D8892
  
  r310985:
  Update ObsoleteFiles.inc for r310803
  
  MFC after:26 days
  X-MFC-with:   310803
  
  r311894:
  Fix typo from change 310985 in ObsoleteFiles.inc
  
  MFC after:16 days
  X-MFC-With:   310803
  Sponsored by: Spectra Logic Corp

Added:
  stable/11/tests/sys/geom/class/eli/init_alias_test.sh
 - copied unchanged from r310786, 
head/tests/sys/geom/class/eli/init_alias_test.sh
  stable/11/tests/sys/geom/class/nop/nop_test.sh
 - copied unchanged from r310803, head/tests/sys/geom/class/nop/nop_test.sh
Deleted:
  stable/11/tests/sys/geom/class/nop/1_test.sh
  stable/11/tests/sys/geom/class/nop/2_test.sh
  stable/11/tests/sys/geom/class/nop/conf.sh
Modified:
  stable/11/ObsoleteFiles.inc
  stable/11/tests/sys/geom/class/eli/Makefile
  stable/11/tests/sys/geom/class/eli/conf.sh
  stable/11/tests/sys/geom/class/eli/init_a_test.sh
  stable/11/tests/sys/geom/class/eli/init_test.sh
  stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh
  stable/11/tests/sys/geom/class/eli/integrity_data_test.sh
  stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh
  stable/11/tests/sys/geom/class/eli/onetime_a_test.sh
  stable/11/tests/sys/geom/class/eli/onetime_test.sh
  stable/11/tests/sys/geom/class/nop/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Thu Jan 26 20:10:31 2017(r312828)
+++ stable/11/ObsoleteFiles.inc Thu Jan 26 20:15:14 2017(r312829)
@@ -40,6 +40,10 @@
 
 # 20170112: sysdecode_getfsstat_flags() renamed to sysdecode_getfsstat_mode()
 OLD_FILES+=usr/share/man/man3/sysdecode_getfsstat_flags.3.gz
+# 20161229: Three files from gnop tests consolidated into one
+OLD_FILES+=usr/tests/sys/geom/class/nop/1_test
+OLD_FILES+=usr/tests/sys/geom/class/nop/2_test
+OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh
 # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1.
 OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h

Modified: stable/11/tests/sys/geom/class/eli/Makefile
==
--- stable/11/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:10:31 2017
(r312828)
+++ stable/11/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:15:14 2017
(r312829)
@@ -11,6 +11,7 @@ TAP_TESTS_SH+= detach_l_test
 TAP_TESTS_SH+= init_B_test
 TAP_TESTS_SH+= init_J_test
 TAP_TESTS_SH+= init_a_test
+TAP_TESTS_SH+= init_alias_test
 TAP_TESTS_SH+= init_i_P_test
 TAP_TESTS_SH+= init_test
 TAP_TESTS_SH+= integrity_copy_test

Modified: stable/11/tests/sys/geom/class/eli/conf.sh
==
--- stable/11/tests/sys/geom/class/eli/conf.sh  Thu Jan 26 20:10:31 2017
(r312828)
+++ stable/11/tests/sys/geom/class/eli/conf.sh  Thu Jan 26 20:15:14 2017
(r312829)
@@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do
: $(( no += 1 ))
 done
 
+# Execute `func` for each combination 

svn commit: r312830 - head/sys/cam

2017-01-26 Thread Scott Long
Author: scottl
Date: Thu Jan 26 20:18:03 2017
New Revision: 312830
URL: https://svnweb.freebsd.org/changeset/base/312830

Log:
  Fix a development mis-merge from r312827
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Jan 26 20:15:14 2017(r312829)
+++ head/sys/cam/cam_xpt.c  Thu Jan 26 20:18:03 2017(r312830)
@@ -3727,9 +3727,9 @@ xpt_print(struct cam_path *path, const c
 {
va_list ap;
struct sbuf sb;
-   char buffer[XPT_PRINT_MAXLEN];
+   char buffer[XPT_PRINT_LEN];
 
-   sbuf_new(&sb, buffer, XPT_PRINT_MAXLEN, SBUF_FIXEDLEN);
+   sbuf_new(&sb, buffer, XPT_PRINT_LEN, SBUF_FIXEDLEN);
 
xpt_path_sbuf(path, &sb);
va_start(ap, fmt);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312831 - in head/contrib/llvm: include/llvm/Analysis lib/Analysis

2017-01-26 Thread Dimitry Andric
Author: dim
Date: Thu Jan 26 20:18:28 2017
New Revision: 312831
URL: https://svnweb.freebsd.org/changeset/base/312831

Log:
  Revert r312765 for now, since it causes assertions when building
  lang/spidermonkey24.
  
  Reported by:  antoine
  PR:   215649

Modified:
  head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h
  head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
  head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp
  head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp

Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h
==
--- head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h   Thu Jan 26 
20:18:03 2017(r312830)
+++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h   Thu Jan 26 
20:18:28 2017(r312831)
@@ -495,29 +495,10 @@ namespace llvm {
 
 /// The typedef for ExprValueMap.
 ///
-typedef std::pair ValueOffsetPair;
-typedef DenseMap> 
ExprValueMapType;
+typedef DenseMap> ExprValueMapType;
 
 /// ExprValueMap -- This map records the original values from which
 /// the SCEV expr is generated from.
-///
-/// We want to represent the mapping as SCEV -> ValueOffsetPair instead
-/// of SCEV -> Value:
-/// Suppose we know S1 expands to V1, and
-///  S1 = S2 + C_a
-///  S3 = S2 + C_b
-/// where C_a and C_b are different SCEVConstants. Then we'd like to
-/// expand S3 as V1 - C_a + C_b instead of expanding S2 literally.
-/// It is helpful when S2 is a complex SCEV expr.
-///
-/// In order to do that, we represent ExprValueMap as a mapping from
-/// SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and
-/// S2->{V1, C_a} into the map when we create SCEV for V1. When S3
-/// is expanded, it will first expand S2 to V1 - C_a because of
-/// S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b.
-///
-/// Note: S->{V, Offset} in the ExprValueMap means S can be expanded
-/// to V - Offset.
 ExprValueMapType ExprValueMap;
 
 /// The typedef for ValueExprMap.
@@ -1200,7 +1181,7 @@ namespace llvm {
 bool containsAddRecurrence(const SCEV *S);
 
 /// Return the Value set from which the SCEV expr is generated.
-SetVector *getSCEVValues(const SCEV *S);
+SetVector *getSCEVValues(const SCEV *S);
 
 /// Erase Value from ValueExprMap and ExprValueMap.
 void eraseValueFromMap(Value *V);

Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
==
--- head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h   Thu Jan 
26 20:18:03 2017(r312830)
+++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h   Thu Jan 
26 20:18:28 2017(r312831)
@@ -325,8 +325,7 @@ namespace llvm {
   PointerType *PTy, Type *Ty, Value *V);
 
 /// \brief Find a previous Value in ExprValueMap for expand.
-ScalarEvolution::ValueOffsetPair
-FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt);
+Value *FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt);
 
 Value *expand(const SCEV *S);
 

Modified: head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp
==
--- head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp  Thu Jan 26 20:18:03 
2017(r312830)
+++ head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp  Thu Jan 26 20:18:28 
2017(r312831)
@@ -3378,28 +3378,8 @@ bool ScalarEvolution::containsAddRecurre
   return F.FoundOne;
 }
 
-/// Try to split a SCEVAddExpr into a pair of {SCEV, ConstantInt}.
-/// If \p S is a SCEVAddExpr and is composed of a sub SCEV S' and an
-/// offset I, then return {S', I}, else return {\p S, nullptr}.
-static std::pair splitAddExpr(const SCEV *S) {
-  const auto *Add = dyn_cast(S);
-  if (!Add)
-return {S, nullptr};
-
-  if (Add->getNumOperands() != 2)
-return {S, nullptr};
-
-  auto *ConstOp = dyn_cast(Add->getOperand(0));
-  if (!ConstOp)
-return {S, nullptr};
-
-  return {Add->getOperand(1), ConstOp->getValue()};
-}
-
-/// Return the ValueOffsetPair set for \p S. \p S can be represented
-/// by the value and offset from any ValueOffsetPair in the set.
-SetVector *
-ScalarEvolution::getSCEVValues(const SCEV *S) {
+/// Return the Value set from S.
+SetVector *ScalarEvolution::getSCEVValues(const SCEV *S) {
   ExprValueMapType::iterator SI = ExprValueMap.find_as(S);
   if (SI == ExprValueMap.end())
 return nullptr;
@@ -3407,31 +3387,24 @@ ScalarEvolution::getSCEVValues(const SCE
   if (VerifySCEVMap) {
 // Check there is no dangling Value in the set returned.
 for (const auto &VE : SI->second)
-  assert(ValueExprMap.count(VE.first));
+  assert(ValueExprMap.count(VE));
   }
 #endif
   return &SI->second;
 }
 
-/// Era

svn commit: r312833 - head/sys/mips/conf

2017-01-26 Thread Kurt Lidl
Author: lidl
Date: Thu Jan 26 20:45:04 2017
New Revision: 312833
URL: https://svnweb.freebsd.org/changeset/base/312833

Log:
  Remove 'options NO_SWAPPING' from ERL configuration file

Modified:
  head/sys/mips/conf/ERL

Modified: head/sys/mips/conf/ERL
==
--- head/sys/mips/conf/ERL  Thu Jan 26 20:39:43 2017(r312832)
+++ head/sys/mips/conf/ERL  Thu Jan 26 20:45:04 2017(r312833)
@@ -88,7 +88,6 @@ options   MAC # TrustedBSD MAC 
Framewor
 #options   KDTRACE_FRAME   # Ensure frames are compiled in
 #options   KDTRACE_HOOKS   # Kernel DTrace hooks
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel
-optionsNO_SWAPPING # Disable support for paging
 optionsTMPFS   # Temporary file system
 
 # Debugging for use in -current
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312832 - in head/contrib/llvm: include/llvm/Analysis lib/Analysis lib/Transforms/Scalar

2017-01-26 Thread Dimitry Andric
Author: dim
Date: Thu Jan 26 20:39:43 2017
New Revision: 312832
URL: https://svnweb.freebsd.org/changeset/base/312832

Log:
  Pull in r278160 from upstream llvm trunk (by Wei Mi):
  
Recommit "Use ValueOffsetPair to enhance value reuse during SCEV
expansion".
  
The fix for PR28705 will be committed consecutively.
  
In D12090, the ExprValueMap was added to reuse existing value during
SCEV expansion. However, const folding and sext/zext distribution can
make the reuse still difficult.
  
A simplified case is: suppose we know S1 expands to V1 in
ExprValueMap, and
  S1 = S2 + C_a
  S3 = S2 + C_b
where C_a and C_b are different SCEVConstants. Then we'd like to
expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is
helpful when S2 is a complex SCEV expr and S2 has no entry in
ExprValueMap, which is usually caused by the fact that S3 is
generated from S1 after const folding.
  
In order to do that, we represent ExprValueMap as a mapping from SCEV
to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a}
into the ExprValueMap when we create SCEV for V1. When S3 is
expanded, it will first expand S2 to V1 - C_a because of S2->{V1,
C_a} in the map, then expand S3 to V1 - C_a + C_b.
  
Differential Revision: https://reviews.llvm.org/D21313
  
  Pull in r278161 from upstream llvm trunk (by Wei Mi):
  
Fix the runtime error caused by "Use ValueOffsetPair to enhance value
reuse during SCEV expansion".
  
The patch is to fix the bug in PR28705. It was caused by setting
wrong return value for SCEVExpander::findExistingExpansion. The
return values of findExistingExpansion have different meanings when
the function is used in different ways so it is easy to make mistake.
The fix creates two new interfaces to replace
SCEVExpander::findExistingExpansion, and specifies where each
interface is expected to be used.
  
Differential Revision: https://reviews.llvm.org/D22942
  
  Pull in r281439 from upstream llvm trunk (by Wei Mi):
  
Create a getelementptr instead of sub expr for ValueOffsetPair if the
value is a pointer.
  
This patch is to fix PR30213. When expanding an expr based on
ValueOffsetPair, if the value is of pointer type, we can only create
a getelementptr instead of sub expr.
  
Differential Revision: https://reviews.llvm.org/D24088
  
  This should fix assertion failures when building OpenCV >= 3.1, and also
  allow building lang/spidermonkey24 without any further assertions.
  
  PR:   215649
  MFC after:1 week

Modified:
  head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h
  head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
  head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp
  head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
  head/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h
==
--- head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h   Thu Jan 26 
20:18:28 2017(r312831)
+++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h   Thu Jan 26 
20:39:43 2017(r312832)
@@ -495,10 +495,29 @@ namespace llvm {
 
 /// The typedef for ExprValueMap.
 ///
-typedef DenseMap> ExprValueMapType;
+typedef std::pair ValueOffsetPair;
+typedef DenseMap> 
ExprValueMapType;
 
 /// ExprValueMap -- This map records the original values from which
 /// the SCEV expr is generated from.
+///
+/// We want to represent the mapping as SCEV -> ValueOffsetPair instead
+/// of SCEV -> Value:
+/// Suppose we know S1 expands to V1, and
+///  S1 = S2 + C_a
+///  S3 = S2 + C_b
+/// where C_a and C_b are different SCEVConstants. Then we'd like to
+/// expand S3 as V1 - C_a + C_b instead of expanding S2 literally.
+/// It is helpful when S2 is a complex SCEV expr.
+///
+/// In order to do that, we represent ExprValueMap as a mapping from
+/// SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and
+/// S2->{V1, C_a} into the map when we create SCEV for V1. When S3
+/// is expanded, it will first expand S2 to V1 - C_a because of
+/// S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b.
+///
+/// Note: S->{V, Offset} in the ExprValueMap means S can be expanded
+/// to V - Offset.
 ExprValueMapType ExprValueMap;
 
 /// The typedef for ValueExprMap.
@@ -1181,7 +1200,7 @@ namespace llvm {
 bool containsAddRecurrence(const SCEV *S);
 
 /// Return the Value set from which the SCEV expr is generated.
-SetVector *getSCEVValues(const SCEV *S);
+SetVector *getSCEVValues(const SCEV *S);
 
 /// Erase Value from ValueExprMap and ExprValueMap.
 void eraseValueFromMap(Value *V);

Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvol

svn commit: r312834 - stable/11/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:49:19 2017
New Revision: 312834
URL: https://svnweb.freebsd.org/changeset/base/312834

Log:
  MFC r310778, r310782: Improve use of I/O's private area.
  
   - Since I/Os are allocates from per-port pools, make allocations store
  pointer to CTL softc there, and use it where needed instead of global.
   - Created bunch of helper macros to access LUN, port and CTL softc.

Modified:
  stable/11/sys/cam/ctl/ctl.c
  stable/11/sys/cam/ctl/ctl_backend_block.c
  stable/11/sys/cam/ctl/ctl_backend_ramdisk.c
  stable/11/sys/cam/ctl/ctl_error.c
  stable/11/sys/cam/ctl/ctl_io.h
  stable/11/sys/cam/ctl/ctl_tpc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==
--- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:45:04 2017(r312833)
+++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:49:19 2017(r312834)
@@ -437,7 +437,6 @@ static int ctl_alloc_lun(struct ctl_soft
 struct ctl_be_lun *be_lun);
 static int ctl_free_lun(struct ctl_lun *lun);
 static void ctl_create_lun(struct ctl_be_lun *be_lun);
-static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr);
 
 static int ctl_do_mode_select(union ctl_io *io);
 static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun,
@@ -448,7 +447,7 @@ static int ctl_pro_preempt(struct ctl_so
   struct scsi_per_res_out_parms* param);
 static void ctl_pro_preempt_other(struct ctl_lun *lun,
  union ctl_ha_msg *msg);
-static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg);
+static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io);
 static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len);
@@ -567,13 +566,12 @@ static struct ctl_frontend ha_frontend =
 static void
 ctl_ha_datamove(union ctl_io *io)
 {
-   struct ctl_lun *lun;
+   struct ctl_lun *lun = CTL_LUN(io);
struct ctl_sg_entry *sgl;
union ctl_ha_msg msg;
uint32_t sg_entries_sent;
int do_sg_copy, i, j;
 
-   lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
memset(&msg.dt, 0, sizeof(msg.dt));
msg.hdr.msg_type = CTL_MSG_DATAMOVE;
msg.hdr.original_sc = io->io_hdr.original_sc;
@@ -1803,7 +1801,8 @@ ctl_init(void)
args.mda_si_drv1 = softc;
error = make_dev_s(&args, &softc->dev, "cam/ctl");
if (error != 0) {
-   free(control_softc, M_DEVBUF);
+   free(softc, M_DEVBUF);
+   control_softc = NULL;
return (error);
}
 
@@ -1815,7 +1814,7 @@ ctl_init(void)
if (softc->sysctl_tree == NULL) {
printf("%s: unable to allocate sysctl tree\n", __func__);
destroy_dev(softc->dev);
-   free(control_softc, M_DEVBUF);
+   free(softc, M_DEVBUF);
control_softc = NULL;
return (ENOMEM);
}
@@ -1963,7 +1962,7 @@ ctl_shutdown(void)
 
sysctl_ctx_free(&softc->sysctl_ctx);
 
-   free(control_softc, M_DEVBUF);
+   free(softc, M_DEVBUF);
control_softc = NULL;
 }
 
@@ -2205,18 +2204,16 @@ ctl_create_iid(struct ctl_port *port, in
 static void
 ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio)
 {
-   struct ctl_softc *softc = control_softc;
+   struct ctl_softc *softc = CTL_SOFTC(ctsio);
+   struct ctl_port *port = CTL_PORT(ctsio);
union ctl_ha_msg msg_info;
-   struct ctl_port *port;
struct ctl_lun *lun;
const struct ctl_cmd_entry *entry;
uint32_t targ_lun;
 
targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun;
-   mtx_lock(&softc->ctl_lock);
 
/* Make sure that we know about this port. */
-   port = ctl_io_port(&ctsio->io_hdr);
if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) {
ctl_set_internal_failure(ctsio, /*sks_valid*/ 0,
 /*retry_count*/ 1);
@@ -2224,6 +2221,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc
}
 
/* Make sure that we know about this LUN. */
+   mtx_lock(&softc->ctl_lock);
if (targ_lun >= CTL_MAX_LUNS ||
(lun = softc->ctl_luns[targ_lun]) == NULL) {
mtx_unlock(&softc->ctl_lock);
@@ -2256,8 +2254,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc
goto badjuju;
}
 
-   ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun;
-   ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun;
+   CTL_LUN(ctsio) = lun;
+   CTL_BACKEND_LUN(ctsio) = lun->be_lun;
 
/*
 * Every I/O goes into the OOA queue for a
@@ -3625,13 +3623,6 @@ ctl_encode_lun(uint32_t decoded)
return u

svn commit: r312835 - stable/10/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:50:01 2017
New Revision: 312835
URL: https://svnweb.freebsd.org/changeset/base/312835

Log:
  MFC r310778, r310782: Improve use of I/O's private area.
  
   - Since I/Os are allocates from per-port pools, make allocations store
  pointer to CTL softc there, and use it where needed instead of global.
   - Created bunch of helper macros to access LUN, port and CTL softc.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
  stable/10/sys/cam/ctl/ctl_error.c
  stable/10/sys/cam/ctl/ctl_io.h
  stable/10/sys/cam/ctl/ctl_tpc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:49:19 2017(r312834)
+++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:50:01 2017(r312835)
@@ -439,7 +439,6 @@ static int ctl_alloc_lun(struct ctl_soft
 struct ctl_be_lun *be_lun);
 static int ctl_free_lun(struct ctl_lun *lun);
 static void ctl_create_lun(struct ctl_be_lun *be_lun);
-static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr);
 
 static int ctl_do_mode_select(union ctl_io *io);
 static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun,
@@ -450,7 +449,7 @@ static int ctl_pro_preempt(struct ctl_so
   struct scsi_per_res_out_parms* param);
 static void ctl_pro_preempt_other(struct ctl_lun *lun,
  union ctl_ha_msg *msg);
-static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg);
+static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io);
 static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len);
@@ -569,13 +568,12 @@ static struct ctl_frontend ha_frontend =
 static void
 ctl_ha_datamove(union ctl_io *io)
 {
-   struct ctl_lun *lun;
+   struct ctl_lun *lun = CTL_LUN(io);
struct ctl_sg_entry *sgl;
union ctl_ha_msg msg;
uint32_t sg_entries_sent;
int do_sg_copy, i, j;
 
-   lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
memset(&msg.dt, 0, sizeof(msg.dt));
msg.hdr.msg_type = CTL_MSG_DATAMOVE;
msg.hdr.original_sc = io->io_hdr.original_sc;
@@ -1805,7 +1803,8 @@ ctl_init(void)
args.mda_si_drv1 = softc;
error = make_dev_s(&args, &softc->dev, "cam/ctl");
if (error != 0) {
-   free(control_softc, M_DEVBUF);
+   free(softc, M_DEVBUF);
+   control_softc = NULL;
return (error);
}
 
@@ -1817,7 +1816,7 @@ ctl_init(void)
if (softc->sysctl_tree == NULL) {
printf("%s: unable to allocate sysctl tree\n", __func__);
destroy_dev(softc->dev);
-   free(control_softc, M_DEVBUF);
+   free(softc, M_DEVBUF);
control_softc = NULL;
return (ENOMEM);
}
@@ -1967,7 +1966,7 @@ ctl_shutdown(void)
 
sysctl_ctx_free(&softc->sysctl_ctx);
 
-   free(control_softc, M_DEVBUF);
+   free(softc, M_DEVBUF);
control_softc = NULL;
 }
 
@@ -2209,18 +2208,16 @@ ctl_create_iid(struct ctl_port *port, in
 static void
 ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio)
 {
-   struct ctl_softc *softc = control_softc;
+   struct ctl_softc *softc = CTL_SOFTC(ctsio);
+   struct ctl_port *port = CTL_PORT(ctsio);
union ctl_ha_msg msg_info;
-   struct ctl_port *port;
struct ctl_lun *lun;
const struct ctl_cmd_entry *entry;
uint32_t targ_lun;
 
targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun;
-   mtx_lock(&softc->ctl_lock);
 
/* Make sure that we know about this port. */
-   port = ctl_io_port(&ctsio->io_hdr);
if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) {
ctl_set_internal_failure(ctsio, /*sks_valid*/ 0,
 /*retry_count*/ 1);
@@ -2228,6 +2225,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc
}
 
/* Make sure that we know about this LUN. */
+   mtx_lock(&softc->ctl_lock);
if (targ_lun >= CTL_MAX_LUNS ||
(lun = softc->ctl_luns[targ_lun]) == NULL) {
mtx_unlock(&softc->ctl_lock);
@@ -2260,8 +2258,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc
goto badjuju;
}
 
-   ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun;
-   ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun;
+   CTL_LUN(ctsio) = lun;
+   CTL_BACKEND_LUN(ctsio) = lun->be_lun;
 
/*
 * Every I/O goes into the OOA queue for a
@@ -3616,13 +3614,6 @@ ctl_encode_lun(uint32_t decoded)
return u

svn commit: r312836 - stable/11/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:51:18 2017
New Revision: 312836
URL: https://svnweb.freebsd.org/changeset/base/312836

Log:
  MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small.

Modified:
  stable/11/sys/cam/ctl/ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==
--- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:50:01 2017(r312835)
+++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:51:18 2017(r312836)
@@ -2779,32 +2779,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
break;
}
case CTL_GETSTATS: {
-   struct ctl_stats *stats;
+   struct ctl_stats *stats = (struct ctl_stats *)addr;
int i;
 
-   stats = (struct ctl_stats *)addr;
-
-   if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) >
-stats->alloc_len) {
-   stats->status = CTL_SS_NEED_MORE_SPACE;
-   stats->num_luns = softc->num_luns;
-   break;
-   }
/*
 * XXX KDM no locking here.  If the LUN list changes,
 * things can blow up.
 */
i = 0;
+   stats->status = CTL_SS_OK;
+   stats->fill_len = 0;
STAILQ_FOREACH(lun, &softc->lun_list, links) {
+   if (stats->fill_len + sizeof(lun->stats) >
+   stats->alloc_len) {
+   stats->status = CTL_SS_NEED_MORE_SPACE;
+   break;
+   }
retval = copyout(&lun->stats, &stats->lun_stats[i++],
 sizeof(lun->stats));
if (retval != 0)
break;
+   stats->fill_len += sizeof(lun->stats);
}
stats->num_luns = softc->num_luns;
-   stats->fill_len = sizeof(struct ctl_lun_io_stats) *
-softc->num_luns;
-   stats->status = CTL_SS_OK;
 #ifdef CTL_TIME_IO
stats->flags = CTL_STATS_FLAG_TIME_VALID;
 #else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312837 - stable/10/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:51:50 2017
New Revision: 312837
URL: https://svnweb.freebsd.org/changeset/base/312837

Log:
  MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:51:18 2017(r312836)
+++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:51:50 2017(r312837)
@@ -2770,32 +2770,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
break;
}
case CTL_GETSTATS: {
-   struct ctl_stats *stats;
+   struct ctl_stats *stats = (struct ctl_stats *)addr;
int i;
 
-   stats = (struct ctl_stats *)addr;
-
-   if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) >
-stats->alloc_len) {
-   stats->status = CTL_SS_NEED_MORE_SPACE;
-   stats->num_luns = softc->num_luns;
-   break;
-   }
/*
 * XXX KDM no locking here.  If the LUN list changes,
 * things can blow up.
 */
i = 0;
+   stats->status = CTL_SS_OK;
+   stats->fill_len = 0;
STAILQ_FOREACH(lun, &softc->lun_list, links) {
+   if (stats->fill_len + sizeof(lun->stats) >
+   stats->alloc_len) {
+   stats->status = CTL_SS_NEED_MORE_SPACE;
+   break;
+   }
retval = copyout(&lun->stats, &stats->lun_stats[i++],
 sizeof(lun->stats));
if (retval != 0)
break;
+   stats->fill_len += sizeof(lun->stats);
}
stats->num_luns = softc->num_luns;
-   stats->fill_len = sizeof(struct ctl_lun_io_stats) *
-softc->num_luns;
-   stats->status = CTL_SS_OK;
 #ifdef CTL_TIME_IO
stats->flags = CTL_STATS_FLAG_TIME_VALID;
 #else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312838 - stable/11/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:57:19 2017
New Revision: 312838
URL: https://svnweb.freebsd.org/changeset/base/312838

Log:
  MFC r311787: Allocate memory for prevent flags only for removable LUs.
  
  This array takes 64KB of RAM now, that was more then half of struct ctl_lun
  size.  If at some point we support more ports, this may need another tune.

Modified:
  stable/11/sys/cam/ctl/ctl.c
  stable/11/sys/cam/ctl/ctl_private.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==
--- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:51:50 2017(r312837)
+++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:57:19 2017(r312838)
@@ -4585,6 +4585,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
lun->ie_reported = 1;
callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0);
ctl_tpc_lun_init(lun);
+   if (lun->flags & CTL_LUN_REMOVABLE) {
+   lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4,
+   M_CTL, M_WAITOK);
+   }
 
/*
 * Initialize the mode and log page index.
@@ -4666,6 +4670,7 @@ ctl_free_lun(struct ctl_lun *lun)
for (i = 0; i < CTL_MAX_PORTS; i++)
free(lun->pr_keys[i], M_CTL);
free(lun->write_buffer, M_CTL);
+   free(lun->prevent, M_CTL);
if (lun->flags & CTL_LUN_MALLOCED)
free(lun, M_CTL);
 
@@ -5276,7 +5281,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts
 
cdb = (struct scsi_prevent *)ctsio->cdb;
 
-   if ((lun->flags & CTL_LUN_REMOVABLE) == 0) {
+   if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) {
ctl_set_invalid_opcode(ctsio);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
@@ -11872,8 +11877,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un
ctl_clear_mask(lun->have_ca, i);
 #endif
lun->prevent_count = 0;
-   for (i = 0; i < CTL_MAX_INITIATORS; i++)
-   ctl_clear_mask(lun->prevent, i);
+   if (lun->prevent) {
+   for (i = 0; i < CTL_MAX_INITIATORS; i++)
+   ctl_clear_mask(lun->prevent, i);
+   }
mtx_unlock(&lun->lun_lock);
 
return (0);
@@ -12019,7 +12026,7 @@ ctl_i_t_nexus_reset(union ctl_io *io)
 #endif
if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == 
initidx))
lun->flags &= ~CTL_LUN_RESERVED;
-   if (ctl_is_set(lun->prevent, initidx)) {
+   if (lun->prevent && ctl_is_set(lun->prevent, initidx)) {
ctl_clear_mask(lun->prevent, initidx);
lun->prevent_count--;
}

Modified: stable/11/sys/cam/ctl/ctl_private.h
==
--- stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:51:50 2017
(r312837)
+++ stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:19 2017
(r312838)
@@ -412,7 +412,7 @@ struct ctl_lun {
uint32_tpr_res_idx;
uint8_t pr_res_type;
int prevent_count;
-   uint32_tprevent[(CTL_MAX_INITIATORS+31)/32];
+   uint32_t*prevent;
uint8_t *write_buffer;
struct ctl_devid*lun_devid;
TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312839 - stable/10/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:57:48 2017
New Revision: 312839
URL: https://svnweb.freebsd.org/changeset/base/312839

Log:
  MFC r311787: Allocate memory for prevent flags only for removable LUs.
  
  This array takes 64KB of RAM now, that was more then half of struct ctl_lun
  size.  If at some point we support more ports, this may need another tune.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_private.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:57:19 2017(r312838)
+++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:57:48 2017(r312839)
@@ -4576,6 +4576,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
lun->ie_reported = 1;
callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0);
ctl_tpc_lun_init(lun);
+   if (lun->flags & CTL_LUN_REMOVABLE) {
+   lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4,
+   M_CTL, M_WAITOK);
+   }
 
/*
 * Initialize the mode and log page index.
@@ -4657,6 +4661,7 @@ ctl_free_lun(struct ctl_lun *lun)
for (i = 0; i < CTL_MAX_PORTS; i++)
free(lun->pr_keys[i], M_CTL);
free(lun->write_buffer, M_CTL);
+   free(lun->prevent, M_CTL);
if (lun->flags & CTL_LUN_MALLOCED)
free(lun, M_CTL);
 
@@ -5267,7 +5272,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts
 
cdb = (struct scsi_prevent *)ctsio->cdb;
 
-   if ((lun->flags & CTL_LUN_REMOVABLE) == 0) {
+   if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) {
ctl_set_invalid_opcode(ctsio);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
@@ -11863,8 +11868,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un
ctl_clear_mask(lun->have_ca, i);
 #endif
lun->prevent_count = 0;
-   for (i = 0; i < CTL_MAX_INITIATORS; i++)
-   ctl_clear_mask(lun->prevent, i);
+   if (lun->prevent) {
+   for (i = 0; i < CTL_MAX_INITIATORS; i++)
+   ctl_clear_mask(lun->prevent, i);
+   }
mtx_unlock(&lun->lun_lock);
 
return (0);
@@ -12010,7 +12017,7 @@ ctl_i_t_nexus_reset(union ctl_io *io)
 #endif
if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == 
initidx))
lun->flags &= ~CTL_LUN_RESERVED;
-   if (ctl_is_set(lun->prevent, initidx)) {
+   if (lun->prevent && ctl_is_set(lun->prevent, initidx)) {
ctl_clear_mask(lun->prevent, initidx);
lun->prevent_count--;
}

Modified: stable/10/sys/cam/ctl/ctl_private.h
==
--- stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:19 2017
(r312838)
+++ stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:48 2017
(r312839)
@@ -412,7 +412,7 @@ struct ctl_lun {
uint32_tpr_res_idx;
uint8_t pr_res_type;
int prevent_count;
-   uint32_tprevent[(CTL_MAX_INITIATORS+31)/32];
+   uint32_t*prevent;
uint8_t *write_buffer;
struct ctl_devid*lun_devid;
TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312840 - in stable/11: sys/cam/ctl usr.bin/ctlstat

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 20:59:36 2017
New Revision: 312840
URL: https://svnweb.freebsd.org/changeset/base/312840

Log:
  MFC r311804: Rewrite CTL statistics in more simple and scalable way.
  
  Instead of collecting statistics for each combination of ports and logical
  units, that consumed ~45KB per LU with present number of ports, collect
  separate statistics for every port and every logical unit separately, that
  consume only 176 bytes per each single LU/port.  This reduces struct
  ctl_lun size down to just 6KB.
  
  Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should
  allow handling of very large quantities.
  
  Old API is still enabled in stable branches for compatibility reasons.

Modified:
  stable/11/sys/cam/ctl/ctl.c
  stable/11/sys/cam/ctl/ctl_backend.h
  stable/11/sys/cam/ctl/ctl_frontend.c
  stable/11/sys/cam/ctl/ctl_frontend.h
  stable/11/sys/cam/ctl/ctl_ioctl.h
  stable/11/sys/cam/ctl/ctl_private.h
  stable/11/usr.bin/ctlstat/ctlstat.8
  stable/11/usr.bin/ctlstat/ctlstat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==
--- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:57:48 2017(r312839)
+++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:59:36 2017(r312840)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2003-2009 Silicon Graphics International Corp.
  * Copyright (c) 2012 The FreeBSD Foundation
- * Copyright (c) 2015 Alexander Motin 
+ * Copyright (c) 2014-2017 Alexander Motin 
  * All rights reserved.
  *
  * Portions of this software were developed by Edward Tomasz Napierala
@@ -2567,6 +2567,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
  struct thread *td)
 {
struct ctl_softc *softc = dev->si_drv1;
+   struct ctl_port *port;
struct ctl_lun *lun;
int retval;
 
@@ -2778,6 +2779,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 #endif /* CTL_IO_DELAY */
break;
}
+#ifdef CTL_LEGACY_STATS
case CTL_GETSTATS: {
struct ctl_stats *stats = (struct ctl_stats *)addr;
int i;
@@ -2790,26 +2792,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
stats->status = CTL_SS_OK;
stats->fill_len = 0;
STAILQ_FOREACH(lun, &softc->lun_list, links) {
-   if (stats->fill_len + sizeof(lun->stats) >
+   if (stats->fill_len + sizeof(lun->legacy_stats) >
stats->alloc_len) {
stats->status = CTL_SS_NEED_MORE_SPACE;
break;
}
-   retval = copyout(&lun->stats, &stats->lun_stats[i++],
-sizeof(lun->stats));
+   retval = copyout(&lun->legacy_stats, 
&stats->lun_stats[i++],
+sizeof(lun->legacy_stats));
if (retval != 0)
break;
-   stats->fill_len += sizeof(lun->stats);
+   stats->fill_len += sizeof(lun->legacy_stats);
}
stats->num_luns = softc->num_luns;
-#ifdef CTL_TIME_IO
-   stats->flags = CTL_STATS_FLAG_TIME_VALID;
-#else
stats->flags = CTL_STATS_FLAG_NONE;
+#ifdef CTL_TIME_IO
+   stats->flags |= CTL_STATS_FLAG_TIME_VALID;
 #endif
getnanouptime(&stats->timestamp);
break;
}
+#endif /* CTL_LEGACY_STATS */
case CTL_ERROR_INJECT: {
struct ctl_error_desc *err_desc, *new_err_desc;
 
@@ -3397,6 +3399,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
ctl_isc_announce_port(port);
break;
}
+   case CTL_GET_LUN_STATS: {
+   struct ctl_get_io_stats *stats = (struct ctl_get_io_stats 
*)addr;
+   int i;
+
+   /*
+* XXX KDM no locking here.  If the LUN list changes,
+* things can blow up.
+*/
+   i = 0;
+   stats->status = CTL_SS_OK;
+   stats->fill_len = 0;
+   STAILQ_FOREACH(lun, &softc->lun_list, links) {
+   if (lun->lun < stats->first_item)
+   continue;
+   if (stats->fill_len + sizeof(lun->stats) >
+   stats->alloc_len) {
+   stats->status = CTL_SS_NEED_MORE_SPACE;
+   break;
+   }
+   retval = copyout(&lun->stats, &stats->stats[i++],
+sizeof(lun->stats));
+   if (retval != 0)
+   break;
+   stats->fill_len += sizeof(lun->stats);
+   }
+   stats->num_items

svn commit: r312841 - in stable/10: sys/cam/ctl usr.bin/ctlstat

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:00:49 2017
New Revision: 312841
URL: https://svnweb.freebsd.org/changeset/base/312841

Log:
  MFC r311804: Rewrite CTL statistics in more simple and scalable way.
  
  Instead of collecting statistics for each combination of ports and logical
  units, that consumed ~45KB per LU with present number of ports, collect
  separate statistics for every port and every logical unit separately, that
  consume only 176 bytes per each single LU/port.  This reduces struct
  ctl_lun size down to just 6KB.
  
  Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should
  allow handling of very large quantities.
  
  Old API is still enabled in stable branches for compatibility reasons.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend.h
  stable/10/sys/cam/ctl/ctl_frontend.c
  stable/10/sys/cam/ctl/ctl_frontend.h
  stable/10/sys/cam/ctl/ctl_ioctl.h
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/usr.bin/ctlstat/ctlstat.8
  stable/10/usr.bin/ctlstat/ctlstat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:59:36 2017(r312840)
+++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:00:49 2017(r312841)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2003-2009 Silicon Graphics International Corp.
  * Copyright (c) 2012 The FreeBSD Foundation
- * Copyright (c) 2015 Alexander Motin 
+ * Copyright (c) 2014-2017 Alexander Motin 
  * All rights reserved.
  *
  * Portions of this software were developed by Edward Tomasz Napierala
@@ -2558,6 +2558,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
  struct thread *td)
 {
struct ctl_softc *softc = dev->si_drv1;
+   struct ctl_port *port;
struct ctl_lun *lun;
int retval;
 
@@ -2769,6 +2770,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 #endif /* CTL_IO_DELAY */
break;
}
+#ifdef CTL_LEGACY_STATS
case CTL_GETSTATS: {
struct ctl_stats *stats = (struct ctl_stats *)addr;
int i;
@@ -2781,26 +2783,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
stats->status = CTL_SS_OK;
stats->fill_len = 0;
STAILQ_FOREACH(lun, &softc->lun_list, links) {
-   if (stats->fill_len + sizeof(lun->stats) >
+   if (stats->fill_len + sizeof(lun->legacy_stats) >
stats->alloc_len) {
stats->status = CTL_SS_NEED_MORE_SPACE;
break;
}
-   retval = copyout(&lun->stats, &stats->lun_stats[i++],
-sizeof(lun->stats));
+   retval = copyout(&lun->legacy_stats, 
&stats->lun_stats[i++],
+sizeof(lun->legacy_stats));
if (retval != 0)
break;
-   stats->fill_len += sizeof(lun->stats);
+   stats->fill_len += sizeof(lun->legacy_stats);
}
stats->num_luns = softc->num_luns;
-#ifdef CTL_TIME_IO
-   stats->flags = CTL_STATS_FLAG_TIME_VALID;
-#else
stats->flags = CTL_STATS_FLAG_NONE;
+#ifdef CTL_TIME_IO
+   stats->flags |= CTL_STATS_FLAG_TIME_VALID;
 #endif
getnanouptime(&stats->timestamp);
break;
}
+#endif /* CTL_LEGACY_STATS */
case CTL_ERROR_INJECT: {
struct ctl_error_desc *err_desc, *new_err_desc;
 
@@ -3388,6 +3390,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
ctl_isc_announce_port(port);
break;
}
+   case CTL_GET_LUN_STATS: {
+   struct ctl_get_io_stats *stats = (struct ctl_get_io_stats 
*)addr;
+   int i;
+
+   /*
+* XXX KDM no locking here.  If the LUN list changes,
+* things can blow up.
+*/
+   i = 0;
+   stats->status = CTL_SS_OK;
+   stats->fill_len = 0;
+   STAILQ_FOREACH(lun, &softc->lun_list, links) {
+   if (lun->lun < stats->first_item)
+   continue;
+   if (stats->fill_len + sizeof(lun->stats) >
+   stats->alloc_len) {
+   stats->status = CTL_SS_NEED_MORE_SPACE;
+   break;
+   }
+   retval = copyout(&lun->stats, &stats->stats[i++],
+sizeof(lun->stats));
+   if (retval != 0)
+   break;
+   stats->fill_len += sizeof(lun->stats);
+   }
+   stats->num_items

svn commit: r312842 - stable/11/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:01:38 2017
New Revision: 312842
URL: https://svnweb.freebsd.org/changeset/base/312842

Log:
  MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787.

Modified:
  stable/11/sys/cam/ctl/ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==
--- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 21:00:49 2017(r312841)
+++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 21:01:38 2017(r312842)
@@ -4593,6 +4593,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
printf("ctl: requested LUN ID %d is already "
   "in use\n", be_lun->req_lun_id);
}
+fail:
+   free(lun->lun_devid, M_CTL);
if (lun->flags & CTL_LUN_MALLOCED)
free(lun, M_CTL);
be_lun->lun_config_status(be_lun->be_lun,
@@ -4605,14 +4607,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
if (lun_number == -1) {
mtx_unlock(&ctl_softc->ctl_lock);
printf("ctl: can't allocate LUN, out of LUNs\n");
-   if (lun->flags & CTL_LUN_MALLOCED)
-   free(lun, M_CTL);
-   be_lun->lun_config_status(be_lun->be_lun,
- CTL_LUN_CONFIG_FAILURE);
-   return (ENOSPC);
+   goto fail;
}
}
ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number);
+   mtx_unlock(&ctl_softc->ctl_lock);
 
mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF);
lun->lun = lun_number;
@@ -4664,22 +4663,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
ctl_init_page_index(lun);
ctl_init_log_page_index(lun);
 
-   /*
-* Now, before we insert this lun on the lun list, set the lun
-* inventory changed UA for all other luns.
-*/
-   STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) {
-   mtx_lock(&nlun->lun_lock);
-   ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE);
-   mtx_unlock(&nlun->lun_lock);
-   }
-
-   STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links);
-
-   ctl_softc->ctl_luns[lun_number] = lun;
-
-   ctl_softc->num_luns++;
-
/* Setup statistics gathering */
 #ifdef CTL_LEGACY_STATS
lun->legacy_stats.device_type = be_lun->lun_type;
@@ -4692,6 +4675,19 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 #endif /* CTL_LEGACY_STATS */
lun->stats.item = lun_number;
 
+   /*
+* Now, before we insert this lun on the lun list, set the lun
+* inventory changed UA for all other luns.
+*/
+   mtx_lock(&ctl_softc->ctl_lock);
+   STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) {
+   mtx_lock(&nlun->lun_lock);
+   ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE);
+   mtx_unlock(&nlun->lun_lock);
+   }
+   STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links);
+   ctl_softc->ctl_luns[lun_number] = lun;
+   ctl_softc->num_luns++;
mtx_unlock(&ctl_softc->ctl_lock);
 
lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312844 - in stable/11/sys/cam: . ctl scsi

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:06:59 2017
New Revision: 312844
URL: https://svnweb.freebsd.org/changeset/base/312844

Log:
  MFC r312026: Improve CAM_CDB_POINTER support.

Modified:
  stable/11/sys/cam/cam_ccb.h
  stable/11/sys/cam/cam_periph.c
  stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c
  stable/11/sys/cam/ctl/scsi_ctl.c
  stable/11/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_ccb.h
==
--- stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:02:06 2017(r312843)
+++ stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017(r312844)
@@ -780,6 +780,13 @@ struct ccb_accept_tio {
struct scsi_sense_data sense_data;
 };
 
+static __inline uint8_t *
+atio_cdb_ptr(struct ccb_accept_tio *ccb)
+{
+   return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
+   ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes);
+}
+
 /* Release SIM Queue */
 struct ccb_relsim {
struct ccb_hdr ccb_h;

Modified: stable/11/sys/cam/cam_periph.c
==
--- stable/11/sys/cam/cam_periph.c  Thu Jan 26 21:02:06 2017
(r312843)
+++ stable/11/sys/cam/cam_periph.c  Thu Jan 26 21:06:59 2017
(r312844)
@@ -1925,10 +1925,7 @@ cam_periph_devctl_notify(union ccb *ccb)
 
if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
sbuf_printf(&sb, "CDB=\"");
-   if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0)
-   scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb);
-   else
-   scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb);
+   scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb);
sbuf_printf(&sb, "\" ");
} else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
sbuf_printf(&sb, "ACB=\"");

Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:02:06 
2017(r312843)
+++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:06:59 
2017(r312844)
@@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c
   __func__, csio->cdb_len, sizeof(io->scsiio.cdb));
}
io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb));
-   bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb,
- io->scsiio.cdb_len);
+   bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len);
 
ccb->ccb_h.status |= CAM_SIM_QUEUED;
err = ctl_queue(io);

Modified: stable/11/sys/cam/ctl/scsi_ctl.c
==
--- stable/11/sys/cam/ctl/scsi_ctl.cThu Jan 26 21:02:06 2017
(r312843)
+++ stable/11/sys/cam/ctl/scsi_ctl.cThu Jan 26 21:06:59 2017
(r312844)
@@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un
  && (csio->sglist_cnt != 0))) {
printf("%s: tag %04x cdb %02x flags %#x dxfer_len "
   "%d sg %u\n", __func__, atio->tag_id,
-  atio->cdb_io.cdb_bytes[0], flags, dxfer_len,
+  atio_cdb_ptr(atio)[0], flags, dxfer_len,
   csio->sglist_cnt);
printf("%s: tag %04x io status %#x\n", __func__,
   atio->tag_id, io->io_hdr.status);
@@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio *
 {
uint64_t lba;
uint32_t num_blocks, nbc;
-   uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)?
-   atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes;
+   uint8_t *cmdbyt = atio_cdb_ptr(atio);
 
nbc = offset >> 9;  /* ASSUMING 512 BYTE BLOCKS */
 
@@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni
   __func__, atio->cdb_len, sizeof(io->scsiio.cdb));
}
io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb));
-   bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb,
- io->scsiio.cdb_len);
+   bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len);
 
 #ifdef CTLFEDEBUG
printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__,
@@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni
printf("%s: tag %04x no status or "
   "len cdb = %02x\n", __func__,
   atio->tag_id,
-   atio->cdb_io.cdb_bytes[0]);
+  atio_cdb_ptr(atio)[0]);
printf("%s: tag %04x io status %#x\n",

svn commit: r312845 - in stable/10/sys/cam: . ctl scsi

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:07:46 2017
New Revision: 312845
URL: https://svnweb.freebsd.org/changeset/base/312845

Log:
  MFC r312026: Improve CAM_CDB_POINTER support.

Modified:
  stable/10/sys/cam/cam_ccb.h
  stable/10/sys/cam/cam_periph.c
  stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
  stable/10/sys/cam/ctl/scsi_ctl.c
  stable/10/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/cam_ccb.h
==
--- stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017(r312844)
+++ stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:07:46 2017(r312845)
@@ -760,6 +760,13 @@ struct ccb_accept_tio {
struct scsi_sense_data sense_data;
 };
 
+static __inline uint8_t *
+atio_cdb_ptr(struct ccb_accept_tio *ccb)
+{
+   return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
+   ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes);
+}
+
 /* Release SIM Queue */
 struct ccb_relsim {
struct ccb_hdr ccb_h;

Modified: stable/10/sys/cam/cam_periph.c
==
--- stable/10/sys/cam/cam_periph.c  Thu Jan 26 21:06:59 2017
(r312844)
+++ stable/10/sys/cam/cam_periph.c  Thu Jan 26 21:07:46 2017
(r312845)
@@ -1909,10 +1909,7 @@ cam_periph_devctl_notify(union ccb *ccb)
 
if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
sbuf_printf(&sb, "CDB=\"");
-   if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0)
-   scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb);
-   else
-   scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb);
+   scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb);
sbuf_printf(&sb, "\" ");
} else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
sbuf_printf(&sb, "ACB=\"");

Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:06:59 
2017(r312844)
+++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:07:46 
2017(r312845)
@@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c
   __func__, csio->cdb_len, sizeof(io->scsiio.cdb));
}
io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb));
-   bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb,
- io->scsiio.cdb_len);
+   bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len);
 
ccb->ccb_h.status |= CAM_SIM_QUEUED;
err = ctl_queue(io);

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==
--- stable/10/sys/cam/ctl/scsi_ctl.cThu Jan 26 21:06:59 2017
(r312844)
+++ stable/10/sys/cam/ctl/scsi_ctl.cThu Jan 26 21:07:46 2017
(r312845)
@@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un
  && (csio->sglist_cnt != 0))) {
printf("%s: tag %04x cdb %02x flags %#x dxfer_len "
   "%d sg %u\n", __func__, atio->tag_id,
-  atio->cdb_io.cdb_bytes[0], flags, dxfer_len,
+  atio_cdb_ptr(atio)[0], flags, dxfer_len,
   csio->sglist_cnt);
printf("%s: tag %04x io status %#x\n", __func__,
   atio->tag_id, io->io_hdr.status);
@@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio *
 {
uint64_t lba;
uint32_t num_blocks, nbc;
-   uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)?
-   atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes;
+   uint8_t *cmdbyt = atio_cdb_ptr(atio);
 
nbc = offset >> 9;  /* ASSUMING 512 BYTE BLOCKS */
 
@@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni
   __func__, atio->cdb_len, sizeof(io->scsiio.cdb));
}
io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb));
-   bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb,
- io->scsiio.cdb_len);
+   bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len);
 
 #ifdef CTLFEDEBUG
printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__,
@@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni
printf("%s: tag %04x no status or "
   "len cdb = %02x\n", __func__,
   atio->tag_id,
-   atio->cdb_io.cdb_bytes[0]);
+  atio_cdb_ptr(atio)[0]);
printf("%s: tag %04x io status %#x\n",

svn commit: r312846 - stable/11/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:08:27 2017
New Revision: 312846
URL: https://svnweb.freebsd.org/changeset/base/312846

Log:
  MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io().

Modified:
  stable/11/sys/cam/ctl/ctl_util.c
  stable/11/sys/cam/ctl/ctl_util.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl_util.c
==
--- stable/11/sys/cam/ctl/ctl_util.cThu Jan 26 21:07:46 2017
(r312845)
+++ stable/11/sys/cam/ctl/ctl_util.cThu Jan 26 21:08:27 2017
(r312846)
@@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io)
free(io);
 }
 
-#endif /* !_KERNEL */
 void
 ctl_scsi_zero_io(union ctl_io *io)
 {
@@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io)
return;
 
pool_ref = io->io_hdr.pool;
-
memset(io, 0, sizeof(*io));
-
io->io_hdr.pool = pool_ref;
 }
+#endif /* !_KERNEL */
 
 const char *
 ctl_scsi_task_string(struct ctl_taskio *taskio)

Modified: stable/11/sys/cam/ctl/ctl_util.h
==
--- stable/11/sys/cam/ctl/ctl_util.hThu Jan 26 21:07:46 2017
(r312845)
+++ stable/11/sys/cam/ctl/ctl_util.hThu Jan 26 21:08:27 2017
(r312846)
@@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i
 #ifndef _KERNEL
 union ctl_io *ctl_scsi_alloc_io(uint32_t initid);
 void ctl_scsi_free_io(union ctl_io *io);
-#endif /* !_KERNEL */
 void ctl_scsi_zero_io(union ctl_io *io);
+#else
+#definectl_scsi_zero_io(io)ctl_zero_io(io)
+#endif /* !_KERNEL */
 const char *ctl_scsi_task_string(struct ctl_taskio *taskio);
 void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb);
 void ctl_io_error_sbuf(union ctl_io *io,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312847 - stable/10/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:08:58 2017
New Revision: 312847
URL: https://svnweb.freebsd.org/changeset/base/312847

Log:
  MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io().

Modified:
  stable/10/sys/cam/ctl/ctl_util.c
  stable/10/sys/cam/ctl/ctl_util.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_util.c
==
--- stable/10/sys/cam/ctl/ctl_util.cThu Jan 26 21:08:27 2017
(r312846)
+++ stable/10/sys/cam/ctl/ctl_util.cThu Jan 26 21:08:58 2017
(r312847)
@@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io)
free(io);
 }
 
-#endif /* !_KERNEL */
 void
 ctl_scsi_zero_io(union ctl_io *io)
 {
@@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io)
return;
 
pool_ref = io->io_hdr.pool;
-
memset(io, 0, sizeof(*io));
-
io->io_hdr.pool = pool_ref;
 }
+#endif /* !_KERNEL */
 
 const char *
 ctl_scsi_task_string(struct ctl_taskio *taskio)

Modified: stable/10/sys/cam/ctl/ctl_util.h
==
--- stable/10/sys/cam/ctl/ctl_util.hThu Jan 26 21:08:27 2017
(r312846)
+++ stable/10/sys/cam/ctl/ctl_util.hThu Jan 26 21:08:58 2017
(r312847)
@@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i
 #ifndef _KERNEL
 union ctl_io *ctl_scsi_alloc_io(uint32_t initid);
 void ctl_scsi_free_io(union ctl_io *io);
-#endif /* !_KERNEL */
 void ctl_scsi_zero_io(union ctl_io *io);
+#else
+#definectl_scsi_zero_io(io)ctl_zero_io(io)
+#endif /* !_KERNEL */
 const char *ctl_scsi_task_string(struct ctl_taskio *taskio);
 void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb);
 void ctl_io_error_sbuf(union ctl_io *io,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312843 - stable/10/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:02:06 2017
New Revision: 312843
URL: https://svnweb.freebsd.org/changeset/base/312843

Log:
  MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:01:38 2017(r312842)
+++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:02:06 2017(r312843)
@@ -4584,6 +4584,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
printf("ctl: requested LUN ID %d is already "
   "in use\n", be_lun->req_lun_id);
}
+fail:
+   free(lun->lun_devid, M_CTL);
if (lun->flags & CTL_LUN_MALLOCED)
free(lun, M_CTL);
be_lun->lun_config_status(be_lun->be_lun,
@@ -4596,14 +4598,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
if (lun_number == -1) {
mtx_unlock(&ctl_softc->ctl_lock);
printf("ctl: can't allocate LUN, out of LUNs\n");
-   if (lun->flags & CTL_LUN_MALLOCED)
-   free(lun, M_CTL);
-   be_lun->lun_config_status(be_lun->be_lun,
- CTL_LUN_CONFIG_FAILURE);
-   return (ENOSPC);
+   goto fail;
}
}
ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number);
+   mtx_unlock(&ctl_softc->ctl_lock);
 
mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF);
lun->lun = lun_number;
@@ -4655,22 +4654,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
ctl_init_page_index(lun);
ctl_init_log_page_index(lun);
 
-   /*
-* Now, before we insert this lun on the lun list, set the lun
-* inventory changed UA for all other luns.
-*/
-   STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) {
-   mtx_lock(&nlun->lun_lock);
-   ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE);
-   mtx_unlock(&nlun->lun_lock);
-   }
-
-   STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links);
-
-   ctl_softc->ctl_luns[lun_number] = lun;
-
-   ctl_softc->num_luns++;
-
/* Setup statistics gathering */
 #ifdef CTL_LEGACY_STATS
lun->legacy_stats.device_type = be_lun->lun_type;
@@ -4683,6 +4666,19 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 #endif /* CTL_LEGACY_STATS */
lun->stats.item = lun_number;
 
+   /*
+* Now, before we insert this lun on the lun list, set the lun
+* inventory changed UA for all other luns.
+*/
+   mtx_lock(&ctl_softc->ctl_lock);
+   STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) {
+   mtx_lock(&nlun->lun_lock);
+   ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE);
+   mtx_unlock(&nlun->lun_lock);
+   }
+   STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links);
+   ctl_softc->ctl_luns[lun_number] = lun;
+   ctl_softc->num_luns++;
mtx_unlock(&ctl_softc->ctl_lock);
 
lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312848 - stable/11/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:21:26 2017
New Revision: 312848
URL: https://svnweb.freebsd.org/changeset/base/312848

Log:
  MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends.

Modified:
  stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c
  stable/11/sys/cam/ctl/ctl_frontend_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:08:58 
2017(r312847)
+++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:21:26 
2017(r312848)
@@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io)
int ctl_watermark, cam_watermark;
int i, j;
 
-
-   cam_sg_offset = 0;
-   cam_sg_start = 0;
-
ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
 
/*
@@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io)
 
cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
cam_sg_count = ccb->csio.sglist_cnt;
+   cam_sg_start = cam_sg_count;
+   cam_sg_offset = 0;
 
for (i = 0, len_seen = 0; i < cam_sg_count; i++) {
if ((len_seen + cam_sglist[i].ds_len) >=
@@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io)
 
io->scsiio.ext_data_filled += len_copied;
 
+   /*
+* Report write underflow as error, since CTL and backends don't
+* really support it.
+*/
+   if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT &&
+   j < ctl_sg_count) {
+   io->io_hdr.port_status = 43;
+   } else
+
if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) {
io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL;
io->io_hdr.flags |= CTL_FLAG_STATUS_SENT;
+   ccb->csio.resid = ccb->csio.dxfer_len -
+   io->scsiio.ext_data_filled;
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
ccb->ccb_h.status |= CAM_REQ_CMP;
xpt_done(ccb);
@@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io)
/*
 * Translate CTL status to CAM status.
 */
+   if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
+   ccb->csio.resid = ccb->csio.dxfer_len -
+   io->scsiio.ext_data_filled;
+   }
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
switch (io->io_hdr.status & CTL_STATUS_MASK) {
case CTL_SUCCESS:

Modified: stable/11/sys/cam/ctl/ctl_frontend_ioctl.c
==
--- stable/11/sys/cam/ctl/ctl_frontend_ioctl.c  Thu Jan 26 21:08:58 2017
(r312847)
+++ stable/11/sys/cam/ctl/ctl_frontend_ioctl.c  Thu Jan 26 21:21:26 2017
(r312848)
@@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
int ext_sglist_malloced;
int i, j;
 
-   ext_sglist_malloced = 0;
-   ext_sg_start = 0;
-   ext_offset = 0;
-
CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n"));
 
/*
 * If this flag is set, fake the data transfer.
 */
if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) {
+   ext_sglist_malloced = 0;
ctsio->ext_data_filled = ctsio->ext_data_len;
goto bailout;
}
@@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
int len_seen;
 
ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist);
-
ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL,
   M_WAITOK);
ext_sglist_malloced = 1;
@@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
goto bailout;
}
ext_sg_entries = ctsio->ext_sg_entries;
+   ext_sg_start = ext_sg_entries;
+   ext_offset = 0;
len_seen = 0;
for (i = 0; i < ext_sg_entries; i++) {
if ((len_seen + ext_sglist[i].len) >=
@@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
}
} else {
ext_sglist = &ext_entry;
+   ext_sglist_malloced = 0;
ext_sglist->addr = ctsio->ext_data_ptr;
ext_sglist->len = ctsio->ext_data_len;
ext_sg_entries = 1;
@@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
kern_sg_entries = 1;
}
 
-
kern_watermark = 0;
ext_watermark = ext_offset;
len_copied = 0;
@@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
 "kern_data_len = %d\n", ctsio->ext_data_len,
 ctsio->kern_data_len));
 
+   /*
+* Report write underflow as error, since CTL and backends don't
+* really suppor

svn commit: r312849 - stable/10/sys/cam/ctl

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:21:59 2017
New Revision: 312849
URL: https://svnweb.freebsd.org/changeset/base/312849

Log:
  MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
  stable/10/sys/cam/ctl/ctl_frontend_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:21:26 
2017(r312848)
+++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.cThu Jan 26 21:21:59 
2017(r312849)
@@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io)
int ctl_watermark, cam_watermark;
int i, j;
 
-
-   cam_sg_offset = 0;
-   cam_sg_start = 0;
-
ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
 
/*
@@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io)
 
cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
cam_sg_count = ccb->csio.sglist_cnt;
+   cam_sg_start = cam_sg_count;
+   cam_sg_offset = 0;
 
for (i = 0, len_seen = 0; i < cam_sg_count; i++) {
if ((len_seen + cam_sglist[i].ds_len) >=
@@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io)
 
io->scsiio.ext_data_filled += len_copied;
 
+   /*
+* Report write underflow as error, since CTL and backends don't
+* really support it.
+*/
+   if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT &&
+   j < ctl_sg_count) {
+   io->io_hdr.port_status = 43;
+   } else
+
if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) {
io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL;
io->io_hdr.flags |= CTL_FLAG_STATUS_SENT;
+   ccb->csio.resid = ccb->csio.dxfer_len -
+   io->scsiio.ext_data_filled;
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
ccb->ccb_h.status |= CAM_REQ_CMP;
xpt_done(ccb);
@@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io)
/*
 * Translate CTL status to CAM status.
 */
+   if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
+   ccb->csio.resid = ccb->csio.dxfer_len -
+   io->scsiio.ext_data_filled;
+   }
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
switch (io->io_hdr.status & CTL_STATUS_MASK) {
case CTL_SUCCESS:

Modified: stable/10/sys/cam/ctl/ctl_frontend_ioctl.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_ioctl.c  Thu Jan 26 21:21:26 2017
(r312848)
+++ stable/10/sys/cam/ctl/ctl_frontend_ioctl.c  Thu Jan 26 21:21:59 2017
(r312849)
@@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
int ext_sglist_malloced;
int i, j;
 
-   ext_sglist_malloced = 0;
-   ext_sg_start = 0;
-   ext_offset = 0;
-
CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n"));
 
/*
 * If this flag is set, fake the data transfer.
 */
if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) {
+   ext_sglist_malloced = 0;
ctsio->ext_data_filled = ctsio->ext_data_len;
goto bailout;
}
@@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
int len_seen;
 
ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist);
-
ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL,
   M_WAITOK);
ext_sglist_malloced = 1;
@@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
goto bailout;
}
ext_sg_entries = ctsio->ext_sg_entries;
+   ext_sg_start = ext_sg_entries;
+   ext_offset = 0;
len_seen = 0;
for (i = 0; i < ext_sg_entries; i++) {
if ((len_seen + ext_sglist[i].len) >=
@@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
}
} else {
ext_sglist = &ext_entry;
+   ext_sglist_malloced = 0;
ext_sglist->addr = ctsio->ext_data_ptr;
ext_sglist->len = ctsio->ext_data_len;
ext_sg_entries = 1;
@@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
kern_sg_entries = 1;
}
 
-
kern_watermark = 0;
ext_watermark = ext_offset;
len_copied = 0;
@@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
 "kern_data_len = %d\n", ctsio->ext_data_len,
 ctsio->kern_data_len));
 
+   /*
+* Report write underflow as error, since CTL and backends don't
+* really suppor

svn commit: r312850 - in stable/10/sys: cam dev/arcmsr dev/iir dev/isci dev/ppbus

2017-01-26 Thread Alexander Motin
Author: mav
Date: Thu Jan 26 21:35:58 2017
New Revision: 312850
URL: https://svnweb.freebsd.org/changeset/base/312850

Log:
  MFC r296891 (by imp):
  Make sure we check for CAM_CDB_POINTER for all drivers. Also, for the
  drivers I've touched, filter out CAM_CDB_PHYS.
  
  Differential Revision: https://reviews.freebsd.org/D5585

Modified:
  stable/10/sys/cam/cam_ccb.h
  stable/10/sys/dev/arcmsr/arcmsr.c
  stable/10/sys/dev/iir/iir.c
  stable/10/sys/dev/isci/isci_controller.c
  stable/10/sys/dev/isci/isci_io_request.c
  stable/10/sys/dev/ppbus/vpo.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/cam_ccb.h
==
--- stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:21:59 2017(r312849)
+++ stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:35:58 2017(r312850)
@@ -727,6 +727,13 @@ struct ccb_scsiio {
u_int  init_id; /* initiator id of who selected */
 };
 
+static __inline uint8_t *
+scsiio_cdb_ptr(struct ccb_scsiio *ccb)
+{
+   return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
+   ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes);
+}
+
 /*
  * ATA I/O Request CCB used for the XPT_ATA_IO function code.
  */

Modified: stable/10/sys/dev/arcmsr/arcmsr.c
==
--- stable/10/sys/dev/arcmsr/arcmsr.c   Thu Jan 26 21:21:59 2017
(r312849)
+++ stable/10/sys/dev/arcmsr/arcmsr.c   Thu Jan 26 21:35:58 2017
(r312850)
@@ -872,7 +872,7 @@ static void arcmsr_srb_timeout(void *arg
ARCMSR_LOCK_ACQUIRE(&acb->isr_lock);
if(srb->srb_state == ARCMSR_SRB_START)
{
-   cmd = srb->pccb->csio.cdb_io.cdb_bytes[0];
+   cmd = scsiio_cdb_ptr(&srb->pccb->csio)[0];
srb->srb_state = ARCMSR_SRB_TIMEOUT;
srb->pccb->ccb_h.status |= CAM_CMD_TIMEOUT;
arcmsr_srb_complete(srb, 1);
@@ -997,7 +997,7 @@ static void arcmsr_build_srb(struct Comm
arcmsr_cdb->LUN = pccb->ccb_h.target_lun;
arcmsr_cdb->Function = 1;
arcmsr_cdb->CdbLength = (u_int8_t)pcsio->cdb_len;
-   bcopy(pcsio->cdb_io.cdb_bytes, arcmsr_cdb->Cdb, pcsio->cdb_len);
+   bcopy(scsiio_cdb_ptr(pcsio), arcmsr_cdb->Cdb, pcsio->cdb_len);
if(nseg != 0) {
struct AdapterControlBlock *acb = srb->acb;
bus_dmasync_op_t op;
@@ -2453,10 +2453,11 @@ static int arcmsr_iop_message_xfer(struc
struct CMD_MESSAGE_FIELD *pcmdmessagefld;
int retvalue = 0, transfer_len = 0;
char *buffer;
-   u_int32_t controlcode = (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[5] << 
24 |
-   (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[6] << 
16 |
-   (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[7] << 
8  |
-   (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[8];
+   uint8_t *ptr = scsiio_cdb_ptr(&pccb->csio);
+   u_int32_t controlcode = (u_int32_t ) ptr[5] << 24 |
+   (u_int32_t ) ptr[6] << 16 |
+   (u_int32_t ) ptr[7] << 8  |
+   (u_int32_t ) ptr[8];
/* 4 bytes: Areca io control code */
if ((pccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) {
buffer = pccb->csio.data_ptr;
@@ -2683,7 +2684,7 @@ static void arcmsr_execute_srb(void *arg
if(acb->devstate[target][lun] == ARECA_RAID_GONE) {
u_int8_t block_cmd, cmd;
 
-   cmd = pccb->csio.cdb_io.cdb_bytes[0];
+   cmd = scsiio_cdb_ptr(&pccb->csio)[0];
block_cmd = cmd & 0x0f;
if(block_cmd == 0x08 || block_cmd == 0x0a) {
printf("arcmsr%d:block 'read/write' command "
@@ -2800,7 +2801,7 @@ static void arcmsr_handle_virtual_comman
return;
}
pccb->ccb_h.status |= CAM_REQ_CMP;
-   switch (pccb->csio.cdb_io.cdb_bytes[0]) {
+   switch (scsiio_cdb_ptr(&pccb->csio)[0]) {
case INQUIRY: {
unsigned char inqdata[36];
char *buffer = pccb->csio.data_ptr;
@@ -2853,6 +2854,12 @@ static void arcmsr_action(struct cam_sim
int target = pccb->ccb_h.target_id;
int error;
 
+   if (pccb->ccb_h.flags & CAM_CDB_PHYS) {
+   pccb->ccb_h.status = CAM_REQ_INVALID;
+   xpt_done(pccb);
+   return;
+   }
+
if(target == 16) {
/* virtual device for iop message transfer */
arcmsr_handle_virtual_command(acb, pccb);

Modified: stable/10/sys/dev/iir/iir.c
==
--- stable/10/sys/dev/i

Re: svn commit: r312770 - in head/sys: net netinet netinet6

2017-01-26 Thread Gleb Smirnoff
On Thu, Jan 26, 2017 at 02:03:05PM +1100, Bruce Evans wrote:
B> On Thu, 26 Jan 2017, Konstantin Belousov wrote:
B> 
B> > On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote:
B> >>   Thanks, Luiz!
B> >>
B> >>   One stylistic nit that I missed in review:
B> >>
B> >> L>  static int
B> >> L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td)
B> >> L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct 
thread *td)
B> >> L>  {
B> >> L>const struct ifreq *ifr = (struct ifreq *)data;
B> >> L>const struct sockaddr_in *addr = (const struct sockaddr_in *)
B> >> L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if
B> >> L>in_ifadown(&ia->ia_ifa, 1);
B> >> L>
B> >> L>if (ia->ia_ifa.ifa_carp)
B> >> L> -  (*carp_detach_p)(&ia->ia_ifa);
B> >> L> +  (*carp_detach_p)(&ia->ia_ifa,
B> >> L> +  (cmd == SIOCDIFADDR) ? false : true);
B> >>
B> >> Can we change the very last line to:
B> >>
B> >>   (cmd == SIOCAIFADDR) ? true : false);
B> 
B> That is not stylistic, but invert the result.  Perhaps you meant to
B> reverse the test to avoid negative logic for the result.

It uses different ioctl value, so it doesn't invert result. Instead
of !SIOCDIFADDR I want more explicit SIOCAIFADDR.

-- 
Totus tuus, Glebius.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312851 - stable/10/secure/lib/libcrypto

2017-01-26 Thread Jung-uk Kim
Author: jkim
Date: Thu Jan 26 23:29:30 2017
New Revision: 312851
URL: https://svnweb.freebsd.org/changeset/base/312851

Log:
  Disable assembly sources when compiler/assembler cannot compile certain
  instructions.
  
  Note this is a direct commit because head and stable/11 has OpenSSL 1.0.2
  branch.  However, it is based on r304320.
  
  Requested by: julian

Added:
  stable/10/secure/lib/libcrypto/opensslconf-arm.h.in
 - copied, changed from r312850, 
stable/10/secure/lib/libcrypto/opensslconf-arm.h
  stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in
 - copied, changed from r312850, 
stable/10/secure/lib/libcrypto/opensslconf-ia64.h
  stable/10/secure/lib/libcrypto/opensslconf-mips.h.in
 - copied, changed from r312850, 
stable/10/secure/lib/libcrypto/opensslconf-mips.h
  stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in
 - copied, changed from r312850, 
stable/10/secure/lib/libcrypto/opensslconf-powerpc.h
  stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in
 - copied, changed from r312850, 
stable/10/secure/lib/libcrypto/opensslconf-sparc64.h
  stable/10/secure/lib/libcrypto/opensslconf-x86.h.in
 - copied, changed from r312850, 
stable/10/secure/lib/libcrypto/opensslconf-x86.h
Deleted:
  stable/10/secure/lib/libcrypto/opensslconf-arm.h
  stable/10/secure/lib/libcrypto/opensslconf-ia64.h
  stable/10/secure/lib/libcrypto/opensslconf-mips.h
  stable/10/secure/lib/libcrypto/opensslconf-powerpc.h
  stable/10/secure/lib/libcrypto/opensslconf-sparc64.h
  stable/10/secure/lib/libcrypto/opensslconf-x86.h
Modified:
  stable/10/secure/lib/libcrypto/Makefile
  stable/10/secure/lib/libcrypto/Makefile.asm
  stable/10/secure/lib/libcrypto/Makefile.inc

Modified: stable/10/secure/lib/libcrypto/Makefile
==
--- stable/10/secure/lib/libcrypto/Makefile Thu Jan 26 21:35:58 2017
(r312850)
+++ stable/10/secure/lib/libcrypto/Makefile Thu Jan 26 23:29:30 2017
(r312851)
@@ -22,9 +22,9 @@ MAN+= config.5 des_modes.7
 # base sources
 SRCS=  cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \
o_fips.c o_init.c o_str.c o_time.c uid.c
-.if ${MACHINE_CPUARCH} == "amd64"
+.if defined(ASM_amd64)
 SRCS+= x86_64cpuid.S
-.elif ${MACHINE_CPUARCH} == "i386"
+.elif defined(ASM_i386)
 SRCS+= x86cpuid.S
 .else
 SRCS+= mem_clr.c
@@ -33,10 +33,10 @@ INCS+=  crypto.h ebcdic.h opensslv.h ossl
 
 # aes
 SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c
-.if ${MACHINE_CPUARCH} == "amd64"
+.if defined(ASM_amd64)
 SRCS+= aes-x86_64.S aesni-sha1-x86_64.S aesni-x86_64.S bsaes-x86_64.S \
vpaes-x86_64.S
-.elif ${MACHINE_CPUARCH} == "i386"
+.elif defined(ASM_i386)
 SRCS+= aes-586.S aesni-x86.S vpaes-x86.S
 .else
 SRCS+= aes_cbc.c aes_core.c
@@ -60,7 +60,7 @@ INCS+=asn1.h asn1_mac.h asn1t.h
 
 # bf
 SRCS+= bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c
-.if ${MACHINE_CPUARCH} == "i386"
+.if defined(ASM_i386)
 .if ${MACHINE_CPU:Mi686}
 SRCS+= bf-686.S
 .else
@@ -82,10 +82,10 @@ SRCS+=  bn_add.c bn_blind.c bn_const.c bn
bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_kron.c bn_lib.c bn_mod.c \
bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c \
bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c bn_word.c bn_x931p.c
-.if ${MACHINE_CPUARCH} == "amd64"
+.if defined(ASM_amd64)
 SRCS+= modexp512-x86_64.S x86_64-gcc.c x86_64-gf2m.S x86_64-mont.S \
x86_64-mont5.S
-.elif ${MACHINE_CPUARCH} == "i386"
+.elif defined(ASM_i386)
 SRCS+= bn-586.S co-586.S x86-gf2m.S x86-mont.S
 .else
 SRCS+= bn_asm.c
@@ -98,9 +98,9 @@ INCS+=buffer.h
 
 # camellia
 SRCS+= cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c cmll_utl.c
-.if ${MACHINE_CPUARCH} == "amd64"
+.if defined(ASM_amd64)
 SRCS+= cmll_misc.c cmll-x86_64.S
-.elif ${MACHINE_CPUARCH} == "i386"
+.elif defined(ASM_i386)
 SRCS+= cmll-x86.S
 .else
 SRCS+= camellia.c cmll_cbc.c cmll_misc.c
@@ -134,7 +134,7 @@ SRCS+=  cbc_cksm.c cbc_enc.c cfb64ede.c c
des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \
fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \
rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c
-.if ${MACHINE_CPUARCH} == "i386"
+.if defined(ASM_i386)
 SRCS+= crypt586.S des-586.S
 .else
 SRCS+= des_enc.c fcrypt_b.c
@@ -215,9 +215,9 @@ INCS+=  md4.h
 
 # md5
 SRCS+= md5_dgst.c md5_one.c
-.if ${MACHINE_CPUARCH} == "amd64"
+.if defined(ASM_amd64)
 SRCS+= md5-x86_64.S
-.elif ${MACHINE_CPUARCH} == "i386"
+.elif defined(ASM_i386)
 SRCS+= md5-586.S
 .endif
 INCS+= md5.h
@@ -228,9 +228,9 @@ INCS+=  mdc2.h
 
 # modes
 SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c xts128.c
-.if ${MACHINE_CPUARCH} == "amd64" 
+.if defined(ASM_amd64)
 SRCS+= ghash-x86_64.S
-.elif ${MACHINE_CPUARCH} == "i386"
+.elif defined(ASM_i386)
 SRCS+= ghash-x86.S
 .endif
 INCS+= modes.h
@@ -274,9 +274,9 @@ INCS+=  rc2

svn commit: r312852 - head/sys/cam

2017-01-26 Thread Jung-uk Kim
Author: jkim
Date: Fri Jan 27 00:17:07 2017
New Revision: 312852
URL: https://svnweb.freebsd.org/changeset/base/312852

Log:
  Fix libcam build.  It was broken with r312827.

Modified:
  head/sys/cam/cam_xpt.h

Modified: head/sys/cam/cam_xpt.h
==
--- head/sys/cam/cam_xpt.h  Thu Jan 26 23:29:30 2017(r312851)
+++ head/sys/cam/cam_xpt.h  Fri Jan 27 00:17:07 2017(r312852)
@@ -32,8 +32,10 @@
 #ifndef _CAM_CAM_XPT_H
 #define _CAM_CAM_XPT_H 1
 
+#ifdef _KERNEL
 #include 
 #include "opt_printf.h"
+#endif
 
 /* Forward Declarations */
 union ccb;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312853 - head/sys/dev/ath

2017-01-26 Thread Adrian Chadd
Author: adrian
Date: Fri Jan 27 01:17:00 2017
New Revision: 312853
URL: https://svnweb.freebsd.org/changeset/base/312853

Log:
  [ath] fix "doing stuff before wakeup" warning; add comments for ACK/CTS 
handling during DFS/PASSIVE channels
  
  * Although the hardware is awake, the power state handling doesn't think so.
So just explicitly wake it up early in setup so ath_hal calls don't 
complain.
  
  * We shouldn't be transmitting or ACKing frames during DFS CAC or on passive
channels before we hear a beacon.  So, start laying down comments in the
places where this work has to be done.
  
  Note:
  
  * The main bit missing from finishing this particular bit of work is a state
call to transition a VAP from passive to non-passive when a beacon is heard.
CAC is easy, it's an interface state.  So, I'll go and add a method to 
control
that soon.

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Fri Jan 27 00:17:07 2017(r312852)
+++ head/sys/dev/ath/if_ath.c   Fri Jan 27 01:17:00 2017(r312853)
@@ -634,6 +634,17 @@ ath_attach(u_int16_t devid, struct ath_s
 #endif
 
/*
+* Force the chip awake during setup, just to keep
+* the HAL/driver power tracking happy.
+*
+* There are some methods (eg ath_hal_setmac())
+* that poke the hardware.
+*/
+   ATH_LOCK(sc);
+   ath_power_setpower(sc, HAL_PM_AWAKE, 1);
+   ATH_UNLOCK(sc);
+
+   /*
 * Setup the DMA/EDMA functions based on the current
 * hardware support.
 *
@@ -1010,6 +1021,28 @@ ath_attach(u_int16_t devid, struct ath_s
sc->sc_rx_lnamixer = ath_hal_hasrxlnamixer(ah);
sc->sc_hasdivcomb = ath_hal_hasdivantcomb(ah);
 
+   /*
+* Some WB335 cards do not support antenna diversity. Since
+* we use a hardcoded value for AR9565 instead of using the
+* EEPROM/OTP data, remove the combining feature from
+* the HW capabilities bitmap.
+*/
+   /*
+* XXX TODO: check reference driver and ath9k for what to do
+* here for WB335.  I think we have to actually disable the
+* LNA div processing in the HAL and instead use the hard
+* coded values; and then use BT diversity.
+*
+* .. but also need to setup MCI too for WB335..
+*/
+#if 0
+   if (sc->sc_pci_devinfo & (ATH9K_PCI_AR9565_1ANT | 
ATH9K_PCI_AR9565_2ANT)) {
+   device_printf(sc->sc_dev, "%s: WB335: disabling LNA mixer 
diversity\n",
+   __func__);
+   sc->sc_dolnadiv = 0;
+   }
+#endif
+
if (ath_hal_hasfastframes(ah))
ic->ic_caps |= IEEE80211_C_FF;
wmodes = ath_hal_getwirelessmodes(ah);
@@ -1351,6 +1384,7 @@ bad2:
ath_desc_free(sc);
ath_txdma_teardown(sc);
ath_rxdma_teardown(sc);
+
 bad:
if (ah)
ath_hal_detach(ah);
@@ -3611,6 +3645,8 @@ ath_mode_init(struct ath_softc *sc)
struct ath_hal *ah = sc->sc_ah;
u_int32_t rfilt;
 
+   /* XXX power state? */
+
/* configure rx filter */
rfilt = ath_calcrxfilter(sc);
ath_hal_setrxfilter(ah, rfilt);
@@ -5654,6 +5690,56 @@ ath_newstate(struct ieee80211vap *vap, e
 */
IEEE80211_LOCK_ASSERT(ic);
 
+   /*
+* XXX TODO: if nstate is _S_CAC, then we should disable
+* ACK processing until CAC is completed.
+*/
+
+   /*
+* XXX TODO: if we're on a passive channel, then we should
+* not allow any ACKs or self-generated frames until we hear
+* a beacon.  Unfortunately there isn't a notification from
+* net80211 so perhaps we could slot that particular check
+* into the mgmt receive path and just ensure that we clear
+* it on RX of beacons in passive mode (and only clear it
+* once, obviously.)
+*/
+
+   /*
+* XXX TODO: net80211 should be tracking whether channels
+* have heard beacons and are thus considered "OK" for
+* transmitting - and then inform the driver about this
+* state change.  That way if we hear an AP go quiet
+* (and nothing else is beaconing on a channel) the
+* channel can go back to being passive until another
+* beacon is heard.
+*/
+
+   /*
+* XXX TODO: if nstate is _S_CAC, then we should disable
+* ACK processing until CAC is completed.
+*/
+
+   /*
+* XXX TODO: if we're on a passive channel, then we should
+* not allow any ACKs or self-generated frames until we hear
+* a beacon.  Unfortunately there isn't a notification from
+* net80211 so perhaps we could slot that particular check
+* into the mgmt receive path and just ensure that we clear
+* it on RX of beacons in passi

svn commit: r312854 - head/sys/net80211

2017-01-26 Thread Adrian Chadd
Author: adrian
Date: Fri Jan 27 01:24:24 2017
New Revision: 312854
URL: https://svnweb.freebsd.org/changeset/base/312854

Log:
  [net80211] prepare configuration checks for VHT, fragment-offload and 
seqno-offload.
  
  * allocate an ext bit for fragment offload.  Some NICs (like the ath10k
hardware in native wifi or 802.3 mode) support doing packet fragmentation
in firmware/hardware, so we don't have to do it here.
  
  * allocate an ext bit for VHT and start using it.

Modified:
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Fri Jan 27 01:17:00 2017
(r312853)
+++ head/sys/net80211/ieee80211_var.h   Fri Jan 27 01:24:24 2017
(r312854)
@@ -93,10 +93,13 @@
  * says that VHT is supported - and then this macro can be
  * changed.
  */
-#defineIEEE80211_CONF_VHT(ic)  ((ic)->ic_vhtcaps != 0)
+#defineIEEE80211_CONF_VHT(ic)  \
+   ((ic)->ic_flags_ext & IEEE80211_FEXT_VHT)
 
 #defineIEEE80211_CONF_SEQNO_OFFLOAD(ic)\
((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD)
+#defineIEEE80211_CONF_FRAG_OFFLOAD(ic) \
+   ((ic)->ic_flags_ext & IEEE80211_FEXT_FRAG_OFFLOAD)
 
 /*
  * 802.11 control state is split into a common portion that maps
@@ -633,11 +636,14 @@ MALLOC_DECLARE(M_80211_VAP);
 #defineIEEE80211_FEXT_UNIQMAC   0x0004 /* CONF: user or 
computed mac */
 #defineIEEE80211_FEXT_SCAN_OFFLOAD 0x0008  /* CONF: scan 
is fully offloaded */
 #defineIEEE80211_FEXT_SEQNO_OFFLOAD0x0010  /* CONF: driver 
does seqno insertion/allocation */
+#defineIEEE80211_FEXT_FRAG_OFFLOAD 0x0020  /* CONF: 
hardware does 802.11 fragmentation + assignment */
+#defineIEEE80211_FEXT_VHT  0x0040  /* CONF: VHT support */
 
 #defineIEEE80211_FEXT_BITS \
"\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \
"\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \
-   
"\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD"
+   
"\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" \
+   "\26VHT"
 
 /* ic_flags_ht/iv_flags_ht */
 #defineIEEE80211_FHT_NONHT_PR   0x0001 /* STATUS: non-HT sta 
present */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312855 - in head: . gnu/usr.bin/binutils/ld share/mk tools/build/options usr.bin/clang/lld

2017-01-26 Thread Ed Maste
Author: emaste
Date: Fri Jan 27 01:59:12 2017
New Revision: 312855
URL: https://svnweb.freebsd.org/changeset/base/312855

Log:
  Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC
  
  Reported by:  Dan McGregor 

Added:
  head/tools/build/options/WITHOUT_LLD_IS_LD
 - copied unchanged from r312854, head/tools/build/options/WITHOUT_LLD_AS_LD
  head/tools/build/options/WITH_LLD_IS_LD
 - copied unchanged from r312854, head/tools/build/options/WITH_LLD_AS_LD
Deleted:
  head/tools/build/options/WITHOUT_LLD_AS_LD
  head/tools/build/options/WITH_LLD_AS_LD
Modified:
  head/Makefile.inc1
  head/UPDATING
  head/gnu/usr.bin/binutils/ld/Makefile
  head/share/mk/src.opts.mk
  head/usr.bin/clang/lld/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Jan 27 01:24:24 2017(r312854)
+++ head/Makefile.inc1  Fri Jan 27 01:59:12 2017(r312855)
@@ -516,7 +516,7 @@ TMAKE=  MAKEOBJDIRPREFIX=${OBJTREE} \
 # cross-tools stage
 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
-   MK_GDB=no MK_TESTS=no MK_LLD_AS_LD=no
+   MK_GDB=no MK_TESTS=no MK_LLD_IS_LD=no
 
 # kernel-tools stage
 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \

Modified: head/UPDATING
==
--- head/UPDATING   Fri Jan 27 01:24:24 2017(r312854)
+++ head/UPDATING   Fri Jan 27 01:59:12 2017(r312855)
@@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
 
 ** SPECIAL WARNING: **
 
+20170127:
+   The WITH_LLD_AS_LD / WITHOUT_LLD_AS_LD build knobs have been renamed
+   WITH_LLD_IS_LD / WITHOUT_LLD_IS_LD, for consistency with CLANG_IS_CC.
+
 20170112:
The EM_MULTIQUEUE kernel configuration option is deprecated now that
the em(4) driver conforms to iflib specifications.

Modified: head/gnu/usr.bin/binutils/ld/Makefile
==
--- head/gnu/usr.bin/binutils/ld/Makefile   Fri Jan 27 01:24:24 2017
(r312854)
+++ head/gnu/usr.bin/binutils/ld/Makefile   Fri Jan 27 01:59:12 2017
(r312855)
@@ -49,7 +49,7 @@ CLEANFILES+=  ldemul-list.h stringify.sed
 
 FILES= ${LDSCRIPTS:S|^|ldscripts/|}
 FILESDIR=  ${SCRIPTDIR}
-.if ${MK_LLD_AS_LD} == "no"
+.if ${MK_LLD_IS_LD} == "no"
 LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld
 .endif
 

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Fri Jan 27 01:24:24 2017(r312854)
+++ head/share/mk/src.opts.mk   Fri Jan 27 01:59:12 2017(r312855)
@@ -251,9 +251,9 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
 __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
 .endif
 .if ${__T} == "aarch64"
-__DEFAULT_YES_OPTIONS+=LLD_AS_LD
+__DEFAULT_YES_OPTIONS+=LLD_IS_LD
 .else
-__DEFAULT_NO_OPTIONS+=LLD_AS_LD
+__DEFAULT_NO_OPTIONS+=LLD_IS_LD
 .endif
 .if ${__T} == "aarch64" || ${__T} == "amd64"
 __DEFAULT_YES_OPTIONS+=LLD LLDB

Copied: head/tools/build/options/WITHOUT_LLD_IS_LD (from r312854, 
head/tools/build/options/WITHOUT_LLD_AS_LD)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITHOUT_LLD_IS_LD  Fri Jan 27 01:59:12 2017
(r312855, copy of r312854, head/tools/build/options/WITHOUT_LLD_AS_LD)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to use GNU binutils ld as the system linker, instead of LLVM's LLD.

Copied: head/tools/build/options/WITH_LLD_IS_LD (from r312854, 
head/tools/build/options/WITH_LLD_AS_LD)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITH_LLD_IS_LD Fri Jan 27 01:59:12 2017
(r312855, copy of r312854, head/tools/build/options/WITH_LLD_AS_LD)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to use LLVM's LLD as the system linker, instead of GNU binutils ld.

Modified: head/usr.bin/clang/lld/Makefile
==
--- head/usr.bin/clang/lld/Makefile Fri Jan 27 01:24:24 2017
(r312854)
+++ head/usr.bin/clang/lld/Makefile Fri Jan 27 01:59:12 2017
(r312855)
@@ -8,7 +8,7 @@ LLD_SRCS=   ${LLVM_SRCS}/tools/lld
 PACKAGE=   lld
 PROG_CXX=  ld.lld
 MAN=
-.if ${MK_LLD_AS_LD} != "no"
+.if ${MK_LLD_IS_LD} != "no"
 SYMLINKS=  ${PROG_CXX} ${BINDIR}/ld
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312856 - stable/11/usr.bin/netstat

2017-01-26 Thread Marcelo Araujo
Author: araujo
Date: Fri Jan 27 02:35:05 2017
New Revision: 312856
URL: https://svnweb.freebsd.org/changeset/base/312856

Log:
  MFC r310698:
  
  Print hostcache usage counts with TCP statistics.
  
  PR:   196252
  Submitted by: Anton Yuzhaninov 
  MFC after:3 weeks.

Modified:
  stable/11/usr.bin/netstat/inet.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/netstat/inet.c
==
--- stable/11/usr.bin/netstat/inet.cFri Jan 27 01:59:12 2017
(r312855)
+++ stable/11/usr.bin/netstat/inet.cFri Jan 27 02:35:05 2017
(r312856)
@@ -750,6 +750,12 @@ tcp_stats(u_long off, const char *name, 
"{N:/ignored RSTs in the window%s}\n");
p(tcps_connects, "\t{:connections-established/%ju} "
"{N:/connection%s established (including accepts)}\n");
+   p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} "
+   "{N:/time%s used RTT from hostcache}\n");
+   p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} "
+   "{N:/time%s used RTT variance from hostcache}\n");
+   p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} "
+   "{N:/time%s used slow-start threshold from hostcache}\n");
p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} "
"{N:/connection%s closed (including} "
"{:connection-drops/%ju} {N:/drop%s})\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312857 - head

2017-01-26 Thread Ed Maste
Author: emaste
Date: Fri Jan 27 03:43:18 2017
New Revision: 312857
URL: https://svnweb.freebsd.org/changeset/base/312857

Log:
  Use cross-NM (XNM) in compat32 build
  
  An attempt to build mips64 using external toolchain failed as it tried
  to use the host amd64 nm.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/Makefile.libcompat

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Fri Jan 27 02:35:05 2017(r312856)
+++ head/Makefile.libcompat Fri Jan 27 03:43:18 2017(r312857)
@@ -50,6 +50,8 @@ LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsm
 LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
 .endif
 
+LIB32WMAKEFLAGS+= NM="${XNM}"
+
 
 LIB32CFLAGS=   -DCOMPAT_32BIT
 LIB32DTRACE=   ${DTRACE} -32
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312858 - stable/11/sys/dev/nand

2017-01-26 Thread Alexander Kabaev
Author: kan
Date: Fri Jan 27 03:44:50 2017
New Revision: 312858
URL: https://svnweb.freebsd.org/changeset/base/312858

Log:
  MFC r311993: Fix typo in r311971 and now in r312405 too.

Modified:
  stable/11/sys/dev/nand/nand_geom.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/nand/nand_geom.c
==
--- stable/11/sys/dev/nand/nand_geom.c  Fri Jan 27 03:43:18 2017
(r312857)
+++ stable/11/sys/dev/nand/nand_geom.c  Fri Jan 27 03:44:50 2017
(r312858)
@@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip)
snprintf(rdisk->d_ident, sizeof(rdisk->d_ident),
"nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id,
chip->id.dev_id);
-   disk->d_rotation_rate = DISK_RR_NON_ROTATING;
+   rdisk->d_rotation_rate = DISK_RR_NON_ROTATING;
 
disk_create(rdisk, DISK_VERSION);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312859 - head/sys/arm/ti/am335x

2017-01-26 Thread Ian Lepore
Author: ian
Date: Fri Jan 27 04:08:24 2017
New Revision: 312859
URL: https://svnweb.freebsd.org/changeset/base/312859

Log:
  Configure the timer capture pin to input mode in the timer control
  register, in addition to configuring it as input with the pinmux driver.
  
  There was a control register bit commented as "no desc in datasheet".  A
  later revision of the manual reveals the bit to be an input/output control
  for the timer pin.  In addition to configuring capture or pulse mode, you
  apparently have to separately configure the pin direction in the timer
  control register.
  
  Before this change, the timer block was apparently driving a signal onto a
  pad configured by pinmux as input.  Capture mode still accidentally worked
  for me during testing because I was using a very strong signal source that
  just out-muscled the weaker drive from the misconfigured pin.

Modified:
  head/sys/arm/ti/am335x/am335x_dmtpps.c
  head/sys/arm/ti/am335x/am335x_dmtreg.h

Modified: head/sys/arm/ti/am335x/am335x_dmtpps.c
==
--- head/sys/arm/ti/am335x/am335x_dmtpps.c  Fri Jan 27 03:44:50 2017
(r312858)
+++ head/sys/arm/ti/am335x/am335x_dmtpps.c  Fri Jan 27 04:08:24 2017
(r312859)
@@ -463,6 +463,14 @@ dmtpps_attach(device_t dev)
sc->tmr_num = ti_hwmods_get_unit(dev, "timer");
snprintf(sc->tmr_name, sizeof(sc->tmr_name), "DMTimer%d", sc->tmr_num);
 
+   /*
+* Configure the timer pulse/capture pin to input/capture mode.  This is
+* required in addition to configuring the pin as input with the pinmux
+* controller (which was done via fdt data or tunable at probe time).
+*/
+   sc->tclr = DMT_TCLR_GPO_CFG;
+   DMTIMER_WRITE4(sc, DMT_TCLR, sc->tclr);
+
/* Set up timecounter hardware, start it. */
DMTIMER_WRITE4(sc, DMT_TSICR, DMT_TSICR_RESET);
while (DMTIMER_READ4(sc, DMT_TIOCP_CFG) & DMT_TIOCP_RESET)

Modified: head/sys/arm/ti/am335x/am335x_dmtreg.h
==
--- head/sys/arm/ti/am335x/am335x_dmtreg.h  Fri Jan 27 03:44:50 2017
(r312858)
+++ head/sys/arm/ti/am335x/am335x_dmtreg.h  Fri Jan 27 04:08:24 2017
(r312859)
@@ -62,7 +62,7 @@
 #define  DMT_TCLR_TRGMODE_BOTH   (2 << 10) /* Trigger on match + 
ovflow */
 #define  DMT_TCLR_PWM_PTOGGLE(1 << 12) /* PWM toggles */
 #define  DMT_TCLR_CAP_MODE_2ND   (1 << 13) /* Capture second event 
mode */
-#define  DMT_TCLR_GPO_CFG(1 << 14) /* (no descr in 
datasheet) */
+#define  DMT_TCLR_GPO_CFG(1 << 14) /* Tmr pin conf, 0=out, 
1=in */
 #defineDMT_TCRR0x3C/* Counter Register */
 #defineDMT_TLDR0x40/* Load Reg */
 #defineDMT_TTGR0x44/* Trigger Reg */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312860 - stable/11/sys/sys

2017-01-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jan 27 04:52:27 2017
New Revision: 312860
URL: https://svnweb.freebsd.org/changeset/base/312860

Log:
  MFC r312538:
  Addition of clang nullability qualifiers.
  
  For consistency with the qualifiers added in r310977, define a new
  qualifier _Null_unspecified which is also defined in clang 3.7+.
  
  Add two new macros:
  __NULLABILITY_PRAGMA_PUSH
  __NULLABILITY_PRAGMA_POP
  
  These are for use in headers when we want avoid noisy warnings if
  some pointers are left without nullability annotations.
  
  These are added with way ahead of their first use to teach the GCC
  ports headers of their existance before their first use.

Modified:
  stable/11/sys/sys/cdefs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/cdefs.h
==
--- stable/11/sys/sys/cdefs.h   Fri Jan 27 04:08:24 2017(r312859)
+++ stable/11/sys/sys/cdefs.h   Fri Jan 27 04:52:27 2017(r312860)
@@ -793,6 +793,13 @@
 #if !(defined(__clang__) && __has_feature(nullability))
 #define_Nonnull
 #define_Nullable
+#define_Null_unspecified
+#define__NULLABILITY_PRAGMA_PUSH
+#define__NULLABILITY_PRAGMA_POP
+#else
+#define__NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push")  
\
+   _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
+#define__NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
 #endif
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312861 - stable/11/sys/geom/multipath

2017-01-26 Thread Alexander Motin
Author: mav
Date: Fri Jan 27 05:58:53 2017
New Revision: 312861
URL: https://svnweb.freebsd.org/changeset/base/312861

Log:
  MFC r312533: Report disk addition errors on `add` or `create` subcommand.

Modified:
  stable/11/sys/geom/multipath/g_multipath.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/multipath/g_multipath.c
==
--- stable/11/sys/geom/multipath/g_multipath.c  Fri Jan 27 04:52:27 2017
(r312860)
+++ stable/11/sys/geom/multipath/g_multipath.c  Fri Jan 27 05:58:53 2017
(r312861)
@@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req
struct g_provider *pp;
const char *mpname;
static const char devpf[6] = "/dev/";
+   int error;
 
g_topology_assert();
 
@@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req
return;
}
 
-   /*
-* Now add
-*/
-   (void) g_multipath_add_disk(gp, pp);
+   error = g_multipath_add_disk(gp, pp);
+   if (error != 0)
+   gctl_error(req, "Provider addition error: %d", error);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312862 - stable/10/sys/geom/multipath

2017-01-26 Thread Alexander Motin
Author: mav
Date: Fri Jan 27 05:59:26 2017
New Revision: 312862
URL: https://svnweb.freebsd.org/changeset/base/312862

Log:
  MFC r312533: Report disk addition errors on `add` or `create` subcommand.

Modified:
  stable/10/sys/geom/multipath/g_multipath.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/multipath/g_multipath.c
==
--- stable/10/sys/geom/multipath/g_multipath.c  Fri Jan 27 05:58:53 2017
(r312861)
+++ stable/10/sys/geom/multipath/g_multipath.c  Fri Jan 27 05:59:26 2017
(r312862)
@@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req
struct g_provider *pp;
const char *mpname;
static const char devpf[6] = "/dev/";
+   int error;
 
g_topology_assert();
 
@@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req
return;
}
 
-   /*
-* Now add
-*/
-   (void) g_multipath_add_disk(gp, pp);
+   error = g_multipath_add_disk(gp, pp);
+   if (error != 0)
+   gctl_error(req, "Provider addition error: %d", error);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r312770 - in head/sys: net netinet netinet6

2017-01-26 Thread Bruce Evans

On Thu, 26 Jan 2017, Gleb Smirnoff wrote:


On Thu, Jan 26, 2017 at 02:03:05PM +1100, Bruce Evans wrote:
B> On Thu, 26 Jan 2017, Konstantin Belousov wrote:
B>
B> > On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote:
B> >>   Thanks, Luiz!
B> >>
B> >>   One stylistic nit that I missed in review:
B> >>
B> >> L>  static int
B> >> L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td)
B> >> L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct 
thread *td)
B> >> L>  {
B> >> L>const struct ifreq *ifr = (struct ifreq *)data;
B> >> L>const struct sockaddr_in *addr = (const struct sockaddr_in *)
B> >> L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if
B> >> L>in_ifadown(&ia->ia_ifa, 1);
B> >> L>
B> >> L>if (ia->ia_ifa.ifa_carp)
B> >> L> -  (*carp_detach_p)(&ia->ia_ifa);
B> >> L> +  (*carp_detach_p)(&ia->ia_ifa,
B> >> L> +  (cmd == SIOCDIFADDR) ? false : true);
B> >>
B> >> Can we change the very last line to:
B> >>
B> >>  (cmd == SIOCAIFADDR) ? true : false);
B>
B> That is not stylistic, but invert the result.  Perhaps you meant to
B> reverse the test to avoid negative logic for the result.

It uses different ioctl value, so it doesn't invert result. Instead
of !SIOCDIFADDR I want more explicit SIOCAIFADDR.


Oops.  So it is non-stylistic in a different way.  cmd can only be
SIOCDIFADDR, or one or both of SIOCAIFADDR.  Than is unclear.  Assuming
that the original code is correct and that all 3 cases can occur,
inversion would break all 3 cases, while the non-stylistic change breaks
only the O_SIOCAIFADDR case.

Since there can be more than 2 cases and it isn't clear that there are
at most 3, any boolean test on 1 of the cases is going to be unclear.
Positive logic will be clearer, but that requires comparison with 2
cases.  The current code use negative logic to select these 2 cases as
the complement of the other case.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312863 - stable/10/crypto/openssl/crypto/evp

2017-01-26 Thread Xin LI
Author: delphij
Date: Fri Jan 27 07:45:06 2017
New Revision: 312863
URL: https://svnweb.freebsd.org/changeset/base/312863

Log:
  Backport OpenSSL commit 56336b6c7a75ed28067cadedd8ac46572348bc2f:
  
  crypto/evp: harden RC4_MD5 cipher.
  
  Originally a crash in 32-bit build was reported CHACHA20-POLY1305
  cipher. The crash is triggered by truncated packet and is result
  of excessive hashing to the edge of accessible memory (or bogus
  MAC value is produced if x86 MD5 assembly module is involved). Since
  hash operation is read-only it is not considered to be exploitable
  beyond a DoS condition.
  
  Thanks to Robert Święcki for report.
  
  This is a direct commit to stable/10.
  
  Security: CVE-2017-3731

Modified:
  stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c

Modified: stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c
==
--- stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.cFri Jan 27 
05:59:26 2017(r312862)
+++ stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.cFri Jan 27 
07:45:06 2017(r312863)
@@ -267,6 +267,8 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_
 len = p[arg - 2] << 8 | p[arg - 1];
 
 if (!ctx->encrypt) {
+if (len < MD5_DIGEST_LENGTH)
+return -1;
 len -= MD5_DIGEST_LENGTH;
 p[arg - 2] = len >> 8;
 p[arg - 1] = len;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"