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

2017-09-16 Thread Alan Cox
Author: alc
Date: Sun Sep 17 04:15:12 2017
New Revision: 323665
URL: https://svnweb.freebsd.org/changeset/base/323665

Log:
  MFC r321423
Change the interactions of the interface functions with the "meta" and
"leaf" functions for alloc, free, and fill.  After the change, the interface
functions call "meta" unconditionally, and the "meta" functions recur
unconditionally in looping over their descendants. The "meta" functions
start with a validity test, and then a test for the "leaf" case, before
falling into the general recursive case.  This simplifies and shrinks the
code, and, for "free" and "fill" moves panic tests that check the same meta
node repeatedly in a loop to a place that will have each node tested once.
  
Remove irrelevant null checks from blist_free and blist_fill.
  
Make the code that initializes a meta node the same in blist_meta_alloc and
blist_meta_fill.
  
Parenthesize return expressions in blst_meta_fill.

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

Modified: stable/11/sys/kern/subr_blist.c
==
--- stable/11/sys/kern/subr_blist.c Sun Sep 17 03:44:15 2017
(r323664)
+++ stable/11/sys/kern/subr_blist.c Sun Sep 17 04:15:12 2017
(r323665)
@@ -224,12 +224,8 @@ blist_alloc(blist_t bl, daddr_t count)
 * reduce the hint, stopping further iterations.
 */
while (count <= bl->bl_root->bm_bighint) {
-   if (bl->bl_radix == BLIST_BMAP_RADIX)
-   blk = blst_leaf_alloc(bl->bl_root, 0, count,
-   bl->bl_cursor);
-   else
-   blk = blst_meta_alloc(bl->bl_root, 0, count,
-   bl->bl_radix, bl->bl_skip, bl->bl_cursor);
+   blk = blst_meta_alloc(bl->bl_root, 0, count, bl->bl_radix,
+   bl->bl_skip, bl->bl_cursor);
if (blk != SWAPBLK_NONE) {
bl->bl_cursor = blk + count;
return (blk);
@@ -260,13 +256,8 @@ blist_avail(blist_t bl)
 void
 blist_free(blist_t bl, daddr_t blkno, daddr_t count)
 {
-   if (bl) {
-   if (bl->bl_radix == BLIST_BMAP_RADIX)
-   blst_leaf_free(bl->bl_root, blkno, count);
-   else
-   blst_meta_free(bl->bl_root, blkno, count,
-   bl->bl_radix, bl->bl_skip, 0);
-   }
+
+   blst_meta_free(bl->bl_root, blkno, count, bl->bl_radix, bl->bl_skip, 0);
 }
 
 /*
@@ -278,17 +269,9 @@ blist_free(blist_t bl, daddr_t blkno, daddr_t count)
 daddr_t
 blist_fill(blist_t bl, daddr_t blkno, daddr_t count)
 {
-   daddr_t filled;
 
-   if (bl) {
-   if (bl->bl_radix == BLIST_BMAP_RADIX)
-   filled = blst_leaf_fill(bl->bl_root, blkno, count);
-   else
-   filled = blst_meta_fill(bl->bl_root, blkno, count,
-   bl->bl_radix, bl->bl_skip, 0);
-   return (filled);
-   }
-   return (0);
+   return (blst_meta_fill(bl->bl_root, blkno, count, bl->bl_radix,
+   bl->bl_skip, 0));
 }
 
 /*
@@ -449,6 +432,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t c
int child;
bool scan_from_start;
 
+   if (radix == BLIST_BMAP_RADIX)
+   return (blst_leaf_alloc(scan, blk, count, cursor));
if (scan->u.bmu_avail < count) {
/*
 * The meta node's hint must be too large if the allocation
@@ -497,14 +482,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t c
/*
 * The allocation might fit in the i'th subtree.
 */
-   if (next_skip == 1) {
-   r = blst_leaf_alloc([i], blk, count,
-   cursor > blk ? cursor : blk);
-   } else {
-   r = blst_meta_alloc([i], blk, count,
-   radix, next_skip - 1, cursor > blk ?
-   cursor : blk);
-   }
+   r = blst_meta_alloc([i], blk, count, radix,
+   next_skip - 1, cursor > blk ? cursor : blk);
if (r != SWAPBLK_NONE) {
scan->u.bmu_avail -= count;
return (r);
@@ -578,6 +557,10 @@ blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_
daddr_t i, next_skip, v;
int child;
 
+   if (scan->bm_bighint == (daddr_t)-1)
+   panic("freeing invalid range");
+   if (radix == BLIST_BMAP_RADIX)
+   return (blst_leaf_free(scan, freeBlk, count));
next_skip = skip / BLIST_META_RADIX;
 
if (scan->u.bmu_avail == 0) {
@@ -630,17 

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

2017-09-16 Thread Alan Cox
Author: alc
Date: Sun Sep 17 03:44:15 2017
New Revision: 323664
URL: https://svnweb.freebsd.org/changeset/base/323664

Log:
  MFC r321102
Tidy up before making another round of functional changes: Remove end-
of-line whitespace, remove excessive whitespace and blank lines, remove
dead code, follow our standard style for function definitions, and
correct grammatical and factual errors in some of the comments.

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

Modified: stable/11/sys/kern/subr_blist.c
==
--- stable/11/sys/kern/subr_blist.c Sun Sep 17 03:34:36 2017
(r323663)
+++ stable/11/sys/kern/subr_blist.c Sun Sep 17 03:44:15 2017
(r323664)
@@ -28,18 +28,18 @@
  * BLIST.C -   Bitmap allocator/deallocator, using a radix tree with hinting
  *
  * This module implements a general bitmap allocator/deallocator.  The
- * allocator eats around 2 bits per 'block'.  The module does not 
- * try to interpret the meaning of a 'block' other than to return 
+ * allocator eats around 2 bits per 'block'.  The module does not
+ * try to interpret the meaning of a 'block' other than to return
  * SWAPBLK_NONE on an allocation failure.
  *
  * A radix tree is used to maintain the bitmap.  Two radix constants are
  * involved:  One for the bitmaps contained in the leaf nodes (typically
- * 32), and one for the meta nodes (typically 16).  Both meta and leaf
+ * 64), and one for the meta nodes (typically 16).  Both meta and leaf
  * nodes have a hint field.  This field gives us a hint as to the largest
  * free contiguous range of blocks under the node.  It may contain a
- * value that is too high, but will never contain a value that is too 
+ * value that is too high, but will never contain a value that is too
  * low.  When the radix tree is searched, allocation failures in subtrees
- * update the hint. 
+ * update the hint.
  *
  * The radix tree also implements two collapsed states for meta nodes:
  * the ALL-ALLOCATED state and the ALL-FREE state.  If a meta node is
@@ -49,7 +49,7 @@
  *
  * The hinting greatly increases code efficiency for allocations while
  * the general radix structure optimizes both allocations and frees.  The
- * radix tree should be able to operate well no matter how much 
+ * radix tree should be able to operate well no matter how much
  * fragmentation there is and no matter how large a bitmap is used.
  *
  * The blist code wires all necessary memory at creation time.  Neither
@@ -61,18 +61,18 @@
  * linear array.  Each meta node is immediately followed (laid out
  * sequentially in memory) by BLIST_META_RADIX lower level nodes.  This
  * is a recursive structure but one that can be easily scanned through
- * a very simple 'skip' calculation.  In order to support large radixes, 
- * portions of the tree may reside outside our memory allocation.  We 
- * handle this with an early-termination optimization (when bighint is 
- * set to -1) on the scan.  The memory allocation is only large enough 
+ * a very simple 'skip' calculation.  In order to support large radixes,
+ * portions of the tree may reside outside our memory allocation.  We
+ * handle this with an early-termination optimization (when bighint is
+ * set to -1) on the scan.  The memory allocation is only large enough
  * to cover the number of blocks requested at creation time even if it
  * must be encompassed in larger root-node radix.
  *
- * NOTE: the allocator cannot currently allocate more than 
- * BLIST_BMAP_RADIX blocks per call.  It will panic with 'allocation too 
- * large' if you try.  This is an area that could use improvement.  The 
- * radix is large enough that this restriction does not effect the swap 
- * system, though.  Currently only the allocation code is effected by
+ * NOTE: the allocator cannot currently allocate more than
+ * BLIST_BMAP_RADIX blocks per call.  It will panic with 'allocation too
+ * large' if you try.  This is an area that could use improvement.  The
+ * radix is large enough that this restriction does not effect the swap
+ * system, though.  Currently only the allocation code is affected by
  * this algorithmic unfeature.  The freeing code can handle arbitrary
  * ranges.
  *
@@ -91,7 +91,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include  
+#include 
 
 #else
 
@@ -120,16 +120,15 @@ void panic(const char *ctl, ...);
 /*
  * static support functions
  */
-
 static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count,
daddr_t cursor);
 static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count,
daddr_t radix, daddr_t skip, daddr_t cursor);
 static void 

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

2017-09-16 Thread Alan Cox
Author: alc
Date: Sun Sep 17 03:34:36 2017
New Revision: 323663
URL: https://svnweb.freebsd.org/changeset/base/323663

Log:
  MFC r322404
An invalid page can't be dirty.

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

Modified: stable/11/sys/kern/kern_sendfile.c
==
--- stable/11/sys/kern/kern_sendfile.c  Sun Sep 17 03:17:23 2017
(r323662)
+++ stable/11/sys/kern/kern_sendfile.c  Sun Sep 17 03:34:36 2017
(r323663)
@@ -366,7 +366,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
NULL, ) && i < j) {
pmap_zero_page(pa[i]);
pa[i]->valid = VM_PAGE_BITS_ALL;
-   pa[i]->dirty = 0;
+   MPASS(pa[i]->dirty == 0);
vm_page_xunbusy(pa[i]);
i++;
}
___
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: r323662 - in stable/11/sys: kern sparc64/sparc64 vm

2017-09-16 Thread Alan Cox
Author: alc
Date: Sun Sep 17 03:17:23 2017
New Revision: 323662
URL: https://svnweb.freebsd.org/changeset/base/323662

Log:
  MFC r322296
Introduce vm_page_grab_pages(), which is intended to replace loops calling
vm_page_grab() on consecutive page indices.  Besides simplifying the code
in the caller, vm_page_grab_pages() allows for batching optimizations.
For example, the current implementation replaces calls to vm_page_lookup()
on consecutive page indices by cheaper calls to vm_page_next().

Modified:
  stable/11/sys/kern/vfs_bio.c
  stable/11/sys/sparc64/sparc64/pmap.c
  stable/11/sys/vm/vm_glue.c
  stable/11/sys/vm/vm_page.c
  stable/11/sys/vm/vm_page.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/vfs_bio.c
==
--- stable/11/sys/kern/vfs_bio.cSun Sep 17 03:08:00 2017
(r323661)
+++ stable/11/sys/kern/vfs_bio.cSun Sep 17 03:17:23 2017
(r323662)
@@ -2745,7 +2745,7 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
 */
obj = bp->b_bufobj->bo_object;
VM_OBJECT_WLOCK(obj);
-   while (bp->b_npages < desiredpages) {
+   if (bp->b_npages < desiredpages) {
/*
 * We must allocate system pages since blocking
 * here could interfere with paging I/O, no
@@ -2756,14 +2756,12 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
 * deadlocks once allocbuf() is called after
 * pages are vfs_busy_pages().
 */
-   m = vm_page_grab(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages,
-   VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM |
-   VM_ALLOC_WIRED | VM_ALLOC_IGN_SBUSY |
-   VM_ALLOC_COUNT(desiredpages - bp->b_npages));
-   if (m->valid == 0)
-   bp->b_flags &= ~B_CACHE;
-   bp->b_pages[bp->b_npages] = m;
-   ++bp->b_npages;
+   vm_page_grab_pages(obj,
+   OFF_TO_IDX(bp->b_offset) + bp->b_npages,
+   VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY |
+   VM_ALLOC_NOBUSY | VM_ALLOC_WIRED,
+   >b_pages[bp->b_npages], desiredpages - bp->b_npages);
+   bp->b_npages = desiredpages;
}
 
/*

Modified: stable/11/sys/sparc64/sparc64/pmap.c
==
--- stable/11/sys/sparc64/sparc64/pmap.cSun Sep 17 03:08:00 2017
(r323661)
+++ stable/11/sys/sparc64/sparc64/pmap.cSun Sep 17 03:17:23 2017
(r323662)
@@ -1230,7 +1230,6 @@ int
 pmap_pinit(pmap_t pm)
 {
vm_page_t ma[TSB_PAGES];
-   vm_page_t m;
int i;
 
/*
@@ -1253,14 +1252,11 @@ pmap_pinit(pmap_t pm)
CPU_ZERO(>pm_active);
 
VM_OBJECT_WLOCK(pm->pm_tsb_obj);
-   for (i = 0; i < TSB_PAGES; i++) {
-   m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY |
-   VM_ALLOC_WIRED | VM_ALLOC_ZERO);
-   m->valid = VM_PAGE_BITS_ALL;
-   m->md.pmap = pm;
-   ma[i] = m;
-   }
+   vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL |
+   VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO, ma, TSB_PAGES);
VM_OBJECT_WUNLOCK(pm->pm_tsb_obj);
+   for (i = 0; i < TSB_PAGES; i++)
+   ma[i]->md.pmap = pm;
pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES);
 
bzero(>pm_stats, sizeof(pm->pm_stats));

Modified: stable/11/sys/vm/vm_glue.c
==
--- stable/11/sys/vm/vm_glue.c  Sun Sep 17 03:08:00 2017(r323661)
+++ stable/11/sys/vm/vm_glue.c  Sun Sep 17 03:17:23 2017(r323662)
@@ -322,7 +322,7 @@ vm_thread_new(struct thread *td, int pages)
 {
vm_object_t ksobj;
vm_offset_t ks;
-   vm_page_t m, ma[KSTACK_MAX_PAGES];
+   vm_page_t ma[KSTACK_MAX_PAGES];
struct kstack_cache_entry *ks_ce;
int i;
 
@@ -391,15 +391,10 @@ vm_thread_new(struct thread *td, int pages)
 * page of stack.
 */
VM_OBJECT_WLOCK(ksobj);
-   for (i = 0; i < pages; i++) {
-   /*
-* Get a kernel stack page.
-*/
-   m = vm_page_grab(ksobj, i, VM_ALLOC_NOBUSY |
-   VM_ALLOC_NORMAL | VM_ALLOC_WIRED);
-   ma[i] = m;
-   m->valid = VM_PAGE_BITS_ALL;
-   }
+   vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY |
+   VM_ALLOC_WIRED, ma, pages);
+   for (i = 0; i < pages; i++)
+   ma[i]->valid = VM_PAGE_BITS_ALL;
VM_OBJECT_WUNLOCK(ksobj);
pmap_qenter(ks, ma, pages);
return (1);
@@ -573,9 +568,8 @@ vm_thread_swapin(struct thread *td)
pages = td->td_kstack_pages;
ksobj = 

svn commit: r323660 - stable/10/lib/libfetch

2017-09-16 Thread Marius Strobl
Author: marius
Date: Sun Sep 17 01:32:45 2017
New Revision: 323660
URL: https://svnweb.freebsd.org/changeset/base/323660

Log:
  MFC: r322669
  
  In fetch_resolve() if the port number or service name is included
  in the host argument (e. g. "www.freebsd.org:443"), correctly set
  the service pointer accordingly.  Previously, the service pointer
  was set to the separator instead, causing getaddrinfo(3) to fail.

Modified:
  stable/10/lib/libfetch/common.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libfetch/common.c
==
--- stable/10/lib/libfetch/common.c Sun Sep 17 01:32:38 2017
(r323659)
+++ stable/10/lib/libfetch/common.c Sun Sep 17 01:32:45 2017
(r323660)
@@ -291,7 +291,7 @@ fetch_resolve(const char *addr, int port, int af)
goto syserr;
service = sbuf;
} else if (*sep != '\0') {
-   service = sep;
+   service = sep + 1;
} else {
service = NULL;
}
___
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: r323659 - stable/11/lib/libfetch

2017-09-16 Thread Marius Strobl
Author: marius
Date: Sun Sep 17 01:32:38 2017
New Revision: 323659
URL: https://svnweb.freebsd.org/changeset/base/323659

Log:
  MFC: r322669
  
  In fetch_resolve() if the port number or service name is included
  in the host argument (e. g. "www.freebsd.org:443"), correctly set
  the service pointer accordingly.  Previously, the service pointer
  was set to the separator instead, causing getaddrinfo(3) to fail.

Modified:
  stable/11/lib/libfetch/common.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libfetch/common.c
==
--- stable/11/lib/libfetch/common.c Sun Sep 17 01:08:42 2017
(r323658)
+++ stable/11/lib/libfetch/common.c Sun Sep 17 01:32:38 2017
(r323659)
@@ -291,7 +291,7 @@ fetch_resolve(const char *addr, int port, int af)
goto syserr;
service = sbuf;
} else if (*sep != '\0') {
-   service = sep;
+   service = sep + 1;
} else {
service = NULL;
}
___
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: r323658 - svnadmin/conf

2017-09-16 Thread Marius Strobl
Author: marius
Date: Sun Sep 17 01:08:42 2017
New Revision: 323658
URL: https://svnweb.freebsd.org/changeset/base/323658

Log:
  Change the stable/10 branch no longer require explicit re@ approval
  for commits. Committers are asked to please exercise caution when
  merging changes to stable/10 for the duration of the 10.4-RELEASE
  cycle.
  
  Approved by:  re (implicit)

Modified:
  svnadmin/conf/approvers

Modified: svnadmin/conf/approvers
==
--- svnadmin/conf/approvers Sat Sep 16 21:26:06 2017(r323657)
+++ svnadmin/conf/approvers Sun Sep 17 01:08:42 2017(r323658)
@@ -18,7 +18,7 @@
 #
 #^head/re
 #^stable/11/   re
-^stable/10/re
+#^stable/10/   re
 ^release/  re
 ^releng/11.[0-1]/  (security-officer|so)
 ^releng/10.4/  re
___
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: r323290 - head/sys/vm

2017-09-16 Thread Mark Johnston
On Sat, Sep 16, 2017 at 09:01:56PM +0200, Andreas Tobler wrote:
> On 14.09.17 22:32, Mark Johnston wrote:
> > On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:
> >> Hi Mark,
> >>
> >> On 07.09.17 23:43, Mark Johnston wrote:
> >>> Author: markj
> >>> Date: Thu Sep  7 21:43:39 2017
> >>> New Revision: 323290
> >>> URL: https://svnweb.freebsd.org/changeset/base/323290
> >>>
> >>> Log:
> >>> Speed up vm_page_array initialization.
> >>> 
> >>> We currently initialize the vm_page array in three passes: one to zero
> >>> the array, one to initialize the "order" field of each page (necessary
> >>> when inserting them into the vm_phys buddy allocator one-by-one), and
> >>> one to initialize the remaining non-zero fields and individually 
> >>> insert
> >>> each page into the allocator.
> >>> 
> >>> Merge the three passes into one following a suggestion from alc:
> >>> initialize vm_page fields in a single pass, and use 
> >>> vm_phys_free_contig()
> >>> to efficiently insert physical memory segments into the buddy 
> >>> allocator.
> >>> This reduces the initialization time to a third or a quarter of what 
> >>> it
> >>> was before on most systems that I tested.
> >>> 
> >>> Reviewed by:  alc, kib
> >>> MFC after:3 weeks
> >>> Differential Revision:https://reviews.freebsd.org/D12248
> >>>
> >>> Modified:
> >>> head/sys/vm/vm_page.c
> >>> head/sys/vm/vm_phys.c
> >>> head/sys/vm/vm_phys.h
> >>
> >> I just found out that this commit breaks booting my powerpc64 Quad G5.
> >> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].
> >>
> >> Sometimes it hangs earlier when the kbd is not there yet (usb), then I
> >> can't get the process/task where it hangs.
> >>
> >> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)
> >>
> >> Any ideas how to find out what's wrong?
> > 
> > Are you able to break into DDB when the hang occurs? If so, the output
> > of "show page" would be helpful.
> 
> Unfortunately not from the beginning. The keyboard is usb and it gets 
> installed late. Once it survives the loading of the kbd and co, I can 
> enter into ddb. But it is a trial and error. So far I didn't succeed to 
> come that far.
> 
> > Are you running with INVARIANTS configured? If not, please try that.
> 
> The above was w/o INVARIANTS. With invariants the kernel panics 
> immediately after boot, see pic.

Thanks. Could you please try applying the patch at the end of this email
and see if that fixes the issue? I have not yet tried to compile it,
sorry.

> 
> >> The previous revision, r323289 seems stable, at least it survived
> >> several kernel builds.
> > 
> > Could you apply the patch below and capture the first page or so of
> > output from after the kernel starts booting?
> 
> I applied this diff and you see its output on the pic:
> 
> https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg
> 
> I try now to get that far that I have a kbd and capture a 'show page'.

I don't think that's necessary anymore given the information provided in
the picture.

diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index 04066418fcc1..b576474fcd1d 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -287,6 +287,7 @@ boolean_t moea_is_referenced(mmu_t, vm_page_t);
 int moea_ts_referenced(mmu_t, vm_page_t);
 vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 boolean_t moea_page_exists_quick(mmu_t, pmap_t, vm_page_t);
+void moea_page_init(mmu_t, vm_page_t);
 int moea_page_wired_mappings(mmu_t, vm_page_t);
 void moea_pinit(mmu_t, pmap_t);
 void moea_pinit0(mmu_t, pmap_t);
@@ -334,6 +335,7 @@ static mmu_method_t moea_methods[] = {
MMUMETHOD(mmu_ts_referenced,moea_ts_referenced),
MMUMETHOD(mmu_map,  moea_map),
MMUMETHOD(mmu_page_exists_quick,moea_page_exists_quick),
+   MMUMETHOD(mmu_page_init,moea_page_init),
MMUMETHOD(mmu_page_wired_mappings,moea_page_wired_mappings),
MMUMETHOD(mmu_pinit,moea_pinit),
MMUMETHOD(mmu_pinit0,   moea_pinit0),
@@ -1594,6 +1596,15 @@ moea_page_exists_quick(mmu_t mmu, pmap_t pmap, vm_page_t 
m)
return (rv);
 }
 
+void
+moea_page_init(mmu_t mmu __unused, vm_page_t m)
+{
+
+   m->md.mdpg_attrs = 0;
+   m->md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT;
+   LIST_INIT(>md.mdpg_pvoh);
+}
+
 /*
  * Return the number of managed mappings to the given physical page
  * that are wired.
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index c0461ff57453..28c9c79916f1 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -251,6 +251,7 @@ boolean_t moea64_is_referenced(mmu_t, vm_page_t);
 int moea64_ts_referenced(mmu_t, vm_page_t);
 vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t);

svn commit: r323657 - head/sys/netinet

2017-09-16 Thread Michael Tuexen
Author: tuexen
Date: Sat Sep 16 21:26:06 2017
New Revision: 323657
URL: https://svnweb.freebsd.org/changeset/base/323657

Log:
  Remove code not used on any platform currently supported.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp.h
==
--- head/sys/netinet/sctp.h Sat Sep 16 18:12:15 2017(r323656)
+++ head/sys/netinet/sctp.h Sat Sep 16 21:26:06 2017(r323657)
@@ -545,7 +545,6 @@ struct sctp_error_auth_invalid_hmac {
 #define SCTP_PCB_FLAGS_INTERLEAVE_STRMS  0x0010
 #define SCTP_PCB_FLAGS_DO_ASCONF 0x0020
 #define SCTP_PCB_FLAGS_AUTO_ASCONF   0x0040
-#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE  0x0080
 /* socket options */
 #define SCTP_PCB_FLAGS_NODELAY   0x0100
 #define SCTP_PCB_FLAGS_AUTOCLOSE 0x0200

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Sat Sep 16 18:12:15 2017
(r323656)
+++ head/sys/netinet/sctp_constants.h   Sat Sep 16 21:26:06 2017
(r323657)
@@ -555,11 +555,9 @@ __FBSDID("$FreeBSD$");
 #define SCTP_TIMER_TYPE_INPKILL 15
 #define SCTP_TIMER_TYPE_ASOCKILL16
 #define SCTP_TIMER_TYPE_ADDR_WQ 17
-#define SCTP_TIMER_TYPE_ZERO_COPY   18
-#define SCTP_TIMER_TYPE_ZCOPY_SENDQ 19
-#define SCTP_TIMER_TYPE_PRIM_DELETED20
+#define SCTP_TIMER_TYPE_PRIM_DELETED18
 /* add new timers here - and increment LAST */
-#define SCTP_TIMER_TYPE_LAST21
+#define SCTP_TIMER_TYPE_LAST19
 
 #define SCTP_IS_TIMER_TYPE_VALID(t)(((t) > SCTP_TIMER_TYPE_NONE) && \
 ((t) < SCTP_TIMER_TYPE_LAST))

Modified: head/sys/netinet/sctp_os_bsd.h
==
--- head/sys/netinet/sctp_os_bsd.h  Sat Sep 16 18:12:15 2017
(r323656)
+++ head/sys/netinet/sctp_os_bsd.h  Sat Sep 16 21:26:06 2017
(r323657)
@@ -404,11 +404,6 @@ typedef struct rtentry sctp_rtentry_t;
 #define SCTP_RTALLOC(ro, vrf_id, fibnum) \
rtalloc_ign_fib((struct route *)ro, 0UL, fibnum)
 
-/* Future zero copy wakeup/send  function */
-#define SCTP_ZERO_COPY_EVENT(inp, so)
-/* This is re-pulse ourselves for sendbuf */
-#define SCTP_ZERO_COPY_SENDQ_EVENT(inp, so)
-
 /*
  * SCTP protocol specific mbuf flags.
  */

Modified: head/sys/netinet/sctp_pcb.h
==
--- head/sys/netinet/sctp_pcb.h Sat Sep 16 18:12:15 2017(r323656)
+++ head/sys/netinet/sctp_pcb.h Sat Sep 16 21:26:06 2017(r323657)
@@ -314,10 +314,6 @@ struct sctp_pcb {
 */
struct sctp_timer signature_change;
 
-   /* Zero copy full buffer timer */
-   struct sctp_timer zero_copy_timer;
-   /* Zero copy app to transport (sendq) read repulse timer */
-   struct sctp_timer zero_copy_sendq_timer;
uint32_t def_cookie_life;
/* defaults to 0 */
int auto_close_time;

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sat Sep 16 18:12:15 2017(r323656)
+++ head/sys/netinet/sctputil.c Sat Sep 16 21:26:06 2017(r323657)
@@ -1633,22 +1633,6 @@ sctp_timeout_handler(void *t)
 
/* call the handler for the appropriate timer type */
switch (type) {
-   case SCTP_TIMER_TYPE_ZERO_COPY:
-   if (inp == NULL) {
-   break;
-   }
-   if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) {
-   SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket);
-   }
-   break;
-   case SCTP_TIMER_TYPE_ZCOPY_SENDQ:
-   if (inp == NULL) {
-   break;
-   }
-   if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) {
-   SCTP_ZERO_COPY_SENDQ_EVENT(inp, inp->sctp_socket);
-   }
-   break;
case SCTP_TIMER_TYPE_ADDR_WQ:
sctp_handle_addr_wq();
break;
@@ -1962,14 +1946,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s
SCTP_TCB_LOCK_ASSERT(stcb);
}
switch (t_type) {
-   case SCTP_TIMER_TYPE_ZERO_COPY:
-   tmr = >sctp_ep.zero_copy_timer;
-   to_ticks = SCTP_ZERO_COPY_TICK_DELAY;
-   break;
-   case SCTP_TIMER_TYPE_ZCOPY_SENDQ:
-   tmr = >sctp_ep.zero_copy_sendq_timer;
-   to_ticks = SCTP_ZERO_COPY_SENDQ_TICK_DELAY;
-   break;

Re: svn commit: r323290 - head/sys/vm

2017-09-16 Thread Andreas Tobler

On 16.09.17 22:32, Justin Hibbits wrote:



On Sep 16, 2017 14:02, "Andreas Tobler" > wrote:


On 14.09.17 22:32, Mark Johnston wrote:

On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290


Log:
     Speed up vm_page_array initialization.
         We currently initialize the vm_page array in
three passes: one to zero
     the array, one to initialize the "order" field of
each page (necessary
     when inserting them into the vm_phys buddy
allocator one-by-one), and
     one to initialize the remaining non-zero fields and
individually insert
     each page into the allocator.
         Merge the three passes into one following a
suggestion from alc:
     initialize vm_page fields in a single pass, and use
vm_phys_free_contig()
     to efficiently insert physical memory segments into
the buddy allocator.
     This reduces the initialization time to a third or
a quarter of what it
     was before on most systems that I tested.
         Reviewed by:    alc, kib
     MFC after:  3 weeks
     Differential Revision:
https://reviews.freebsd.org/D12248


Modified:
     head/sys/vm/vm_page.c
     head/sys/vm/vm_phys.c
     head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my
powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet
(usb), then I
can't get the process/task where it hangs.

Note, this kernel is compiled with the default gcc
(4.2.1-FreeBSD)

Any ideas how to find out what's wrong?


Are you able to break into DDB when the hang occurs? If so, the
output
of "show page" would be helpful.


Unfortunately not from the beginning. The keyboard is usb and it
gets installed late. Once it survives the loading of the kbd and co,
I can enter into ddb. But it is a trial and error. So far I didn't
succeed to come that far.


What about using dcons? That's saved me many times when I couldn't break 
into ddb from the console.


Might be worth a try, but as you might have seen on the pic, the panic 
happens immediately after printing the banner. At that time no driver is 
available. It might work when I try w/o invariants and have luck and get 
past the fwohci init.


Thx,
Andreas

___
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: r323290 - head/sys/vm

2017-09-16 Thread Justin Hibbits
On Sep 16, 2017 14:02, "Andreas Tobler"  wrote:

On 14.09.17 22:32, Mark Johnston wrote:

> On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:
>
>> Hi Mark,
>>
>> On 07.09.17 23:43, Mark Johnston wrote:
>>
>>> Author: markj
>>> Date: Thu Sep  7 21:43:39 2017
>>> New Revision: 323290
>>> URL: https://svnweb.freebsd.org/changeset/base/323290
>>>
>>> Log:
>>> Speed up vm_page_array initialization.
>>> We currently initialize the vm_page array in three passes: one
>>> to zero
>>> the array, one to initialize the "order" field of each page
>>> (necessary
>>> when inserting them into the vm_phys buddy allocator one-by-one), and
>>> one to initialize the remaining non-zero fields and individually
>>> insert
>>> each page into the allocator.
>>> Merge the three passes into one following a suggestion from alc:
>>> initialize vm_page fields in a single pass, and use
>>> vm_phys_free_contig()
>>> to efficiently insert physical memory segments into the buddy
>>> allocator.
>>> This reduces the initialization time to a third or a quarter of what
>>> it
>>> was before on most systems that I tested.
>>> Reviewed by:alc, kib
>>> MFC after:  3 weeks
>>> Differential Revision:  https://reviews.freebsd.org/D12248
>>>
>>> Modified:
>>> head/sys/vm/vm_page.c
>>> head/sys/vm/vm_phys.c
>>> head/sys/vm/vm_phys.h
>>>
>>
>> I just found out that this commit breaks booting my powerpc64 Quad G5.
>> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].
>>
>> Sometimes it hangs earlier when the kbd is not there yet (usb), then I
>> can't get the process/task where it hangs.
>>
>> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)
>>
>> Any ideas how to find out what's wrong?
>>
>
> Are you able to break into DDB when the hang occurs? If so, the output
> of "show page" would be helpful.
>

Unfortunately not from the beginning. The keyboard is usb and it gets
installed late. Once it survives the loading of the kbd and co, I can enter
into ddb. But it is a trial and error. So far I didn't succeed to come that
far.


What about using dcons? That's saved me many times when I couldn't break
into ddb from the console.



Are you running with INVARIANTS configured? If not, please try that.
>

The above was w/o INVARIANTS. With invariants the kernel panics immediately
after boot, see pic.


The previous revision, r323289 seems stable, at least it survived
>> several kernel builds.
>>
>
> Could you apply the patch below and capture the first page or so of
> output from after the kernel starts booting?
>

I applied this diff and you see its output on the pic:

https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg

I try now to get that far that I have a kbd and capture a 'show page'.

Thanks,
Andreas
___
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: r323290 - head/sys/vm

2017-09-16 Thread Andreas Tobler

On 14.09.17 22:32, Mark Johnston wrote:

On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290

Log:
Speed up vm_page_array initialization.

We currently initialize the vm_page array in three passes: one to zero

the array, one to initialize the "order" field of each page (necessary
when inserting them into the vm_phys buddy allocator one-by-one), and
one to initialize the remaining non-zero fields and individually insert
each page into the allocator.

Merge the three passes into one following a suggestion from alc:

initialize vm_page fields in a single pass, and use vm_phys_free_contig()
to efficiently insert physical memory segments into the buddy allocator.
This reduces the initialization time to a third or a quarter of what it
was before on most systems that I tested.

Reviewed by:	alc, kib

MFC after:  3 weeks
Differential Revision:  https://reviews.freebsd.org/D12248

Modified:
head/sys/vm/vm_page.c
head/sys/vm/vm_phys.c
head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet (usb), then I
can't get the process/task where it hangs.

Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)

Any ideas how to find out what's wrong?


Are you able to break into DDB when the hang occurs? If so, the output
of "show page" would be helpful.


Unfortunately not from the beginning. The keyboard is usb and it gets 
installed late. Once it survives the loading of the kbd and co, I can 
enter into ddb. But it is a trial and error. So far I didn't succeed to 
come that far.



Are you running with INVARIANTS configured? If not, please try that.


The above was w/o INVARIANTS. With invariants the kernel panics 
immediately after boot, see pic.



The previous revision, r323289 seems stable, at least it survived
several kernel builds.


Could you apply the patch below and capture the first page or so of
output from after the kernel starts booting?


I applied this diff and you see its output on the pic:

https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg

I try now to get that far that I have a kbd and capture a 'show page'.

Thanks,
Andreas
___
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: r323656 - head/sys/kern

2017-09-16 Thread Alan Cox
Author: alc
Date: Sat Sep 16 18:12:15 2017
New Revision: 323656
URL: https://svnweb.freebsd.org/changeset/base/323656

Log:
  Modify blst_leaf_alloc to take only the cursor argument.
  
  Modify blst_leaf_alloc to find allocations that cross the boundary between
  one leaf node and the next when those two leaves descend from the same
  meta node.
  
  Update the hint field for leaves so that it represents a bound on how
  large an allocation can begin in that leaf, where it currently represents
  a bound on how large an allocation can be found within the boundaries of
  the leaf.
  
  The first phase of blst_leaf_alloc currently shrinks sequences of
  consecutive 1-bits in mask until each has been shrunken by count-1 bits,
  so that any bits remaining show where an allocation can begin, or until
  all the bits have disappeared, in which case the allocation fails. This
  change amends that so that the high-order bit is copied, as if, when the
  last block was free, it was followed by an endless stream of free
  blocks. It also amends the early stopping condition, so that the shrinking
  of 1-sequences stops early when there are none, or there is only one
  unbounded one remaining.
  
  The search for the first set bit is unchanged, and the code path
  thereafter is mostly unchanged unless the first set bit is in a position
  that makes some of those copied sign bits matter. In that case, we look
  for a next leaf, and at what blocks it can provide, to see if a
  cross-boundary allocation is possible.
  
  The hint is updated on a successful allocation that clears the last bit,
  but it not updated on a failed allocation that leaves the last bit
  set. So, as long as the last block is free, the hint value for the leaf is
  large. As long as the last block is free, and there's a next leaf, a large
  allocation can begin here, perhaps. A stricter rule than this would mean
  that allocations and frees in one leaf could require hint updates to the
  preceding leaf, and this change seeks to leave the freeing code
  unmodified.
  
  Define BLIST_BMAP_MASK, and use it for bit masking in blst_leaf_free and
  blist_leaf_fill, as well as in blst_leaf_alloc.
  
  Correct a panic message in blst_leaf_free.
  
  Submitted by: Doug Moore 
  Reviewed by:  markj (an earlier version)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D11819

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Sat Sep 16 17:52:25 2017(r323655)
+++ head/sys/kern/subr_blist.c  Sat Sep 16 18:12:15 2017(r323656)
@@ -32,14 +32,17 @@
  * try to interpret the meaning of a 'block' other than to return
  * SWAPBLK_NONE on an allocation failure.
  *
- * A radix tree is used to maintain the bitmap.  Two radix constants are
- * involved:  One for the bitmaps contained in the leaf nodes (typically
- * 64), and one for the meta nodes (typically 16).  Both meta and leaf
- * nodes have a hint field.  This field gives us a hint as to the largest
- * free contiguous range of blocks under the node.  It may contain a
- * value that is too high, but will never contain a value that is too
- * low.  When the radix tree is searched, allocation failures in subtrees
- * update the hint.
+ * A radix tree controls access to pieces of the bitmap, and includes
+ * auxiliary information at each interior node about the availabilty of
+ * contiguous free blocks in the subtree rooted at that node.  Two radix
+ * constants are involved: one for the size of the bitmaps contained in the
+ * leaf nodes (BLIST_BMAP_RADIX), and one for the number of descendents of
+ * each of the meta (interior) nodes (BLIST_META_RADIX).  Each subtree is
+ * associated with a range of blocks.  The root of any subtree stores a
+ * hint field that defines an upper bound on the size of the largest
+ * allocation that can begin in the associated block range.  A hint is an
+ * upper bound on a potential allocation, but not necessarily a tight upper
+ * bound.
  *
  * The radix tree also implements two collapsed states for meta nodes:
  * the ALL-ALLOCATED state and the ALL-FREE state.  If a meta node is
@@ -112,7 +115,7 @@ __FBSDID("$FreeBSD$");
 #definebitcount64(x)   __bitcount64((uint64_t)(x))
 #define malloc(a,b,c)  calloc(a, 1)
 #define free(a,b)  free(a)
-#define CTASSERT(expr)
+static __inline int imax(int a, int b) { return (a > b ? a : b); }
 
 #include 
 
@@ -123,8 +126,7 @@ void panic(const char *ctl, ...);
 /*
  * static support functions
  */
-static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count,
-   daddr_t cursor);
+static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count);
 static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_t 

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

2017-09-16 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Sep 16 17:52:25 2017
New Revision: 323655
URL: https://svnweb.freebsd.org/changeset/base/323655

Log:
  Add missing links to the nv man page.
  
  MFC after:1 week

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileSat Sep 16 17:50:24 2017
(r323654)
+++ head/share/man/man9/MakefileSat Sep 16 17:52:25 2017
(r323655)
@@ -1316,13 +1316,18 @@ MLINKS+=nv.9 libnv.9 \
nv.9 nvlist.9 \
nv.9 nvlist_add_binary.9 \
nv.9 nvlist_add_bool.9 \
+   nv.9 nvlist_add_bool_array.9 \
nv.9 nvlist_add_descriptor.9 \
+   nv.9 nvlist_add_descriptor_array.9 \
nv.9 nvlist_add_null.9 \
nv.9 nvlist_add_number.9 \
+   nv.9 nvlist_add_number_array.9 \
nv.9 nvlist_add_nvlist.9 \
+   nv.9 nvlist_add_nvlist_array.9 \
nv.9 nvlist_add_string.9 \
nv.9 nvlist_add_stringf.9 \
nv.9 nvlist_add_stringv.9 \
+   nv.9 nvlist_add_string_array.9 \
nv.9 nvlist_clone.9 \
nv.9 nvlist_create.9 \
nv.9 nvlist_destroy.9 \
@@ -1332,10 +1337,14 @@ MLINKS+=nv.9 libnv.9 \
nv.9 nvlist_exists.9 \
nv.9 nvlist_exists_binary.9 \
nv.9 nvlist_exists_bool.9 \
+   nv.9 nvlist_exists_bool_array.9 \
nv.9 nvlist_exists_descriptor.9 \
+   nv.9 nvlist_exists_descriptor_array.9 \
nv.9 nvlist_exists_null.9 \
nv.9 nvlist_exists_number.9 \
+   nv.9 nvlist_exists_number_array.9 \
nv.9 nvlist_exists_nvlist.9 \
+   nv.9 nvlist_exists_nvlist_array.9 \
nv.9 nvlist_exists_string.9 \
nv.9 nvlist_exists_type.9 \
nv.9 nvlist_fdump.9 \
@@ -1343,23 +1352,36 @@ MLINKS+=nv.9 libnv.9 \
nv.9 nvlist_free.9 \
nv.9 nvlist_free_binary.9 \
nv.9 nvlist_free_bool.9 \
+   nv.9 nvlist_free_bool_array.9 \
nv.9 nvlist_free_descriptor.9 \
+   nv.9 nvlist_free_descriptor_array.9 \
nv.9 nvlist_free_null.9 \
nv.9 nvlist_free_number.9 \
+   nv.9 nvlist_free_number_array.9 \
nv.9 nvlist_free_nvlist.9 \
+   nv.9 nvlist_free_nvlist_array.9 \
nv.9 nvlist_free_string.9 \
+   nv.9 nvlist_free_string_array.9 \
nv.9 nvlist_free_type.9 \
nv.9 nvlist_get_binary.9 \
nv.9 nvlist_get_bool.9 \
+   nv.9 nvlist_get_bool_array.9 \
nv.9 nvlist_get_descriptor.9 \
+   nv.9 nvlist_get_descriptor_array.9 \
nv.9 nvlist_get_number.9 \
+   nv.9 nvlist_get_number_array.9 \
nv.9 nvlist_get_nvlist.9 \
+   nv.9 nvlist_get_nvlist_array.9 \
nv.9 nvlist_get_parent.9 \
nv.9 nvlist_get_string.9 \
+   nv.9 nvlist_get_string_array.9 \
nv.9 nvlist_move_binary.9 \
nv.9 nvlist_move_descriptor.9 \
+   nv.9 nvlist_move_descriptor_array.9 \
nv.9 nvlist_move_nvlist.9 \
+   nv.9 nvlist_move_nvlist_array.9 \
nv.9 nvlist_move_string.9 \
+   nv.9 nvlist_move_string_array.9 \
nv.9 nvlist_next.9 \
nv.9 nvlist_pack.9 \
nv.9 nvlist_recv.9 \
@@ -1368,10 +1390,15 @@ MLINKS+=nv.9 libnv.9 \
nv.9 nvlist_size.9 \
nv.9 nvlist_take_binary.9 \
nv.9 nvlist_take_bool.9 \
+   nv.9 nvlist_take_bool_array.9 \
nv.9 nvlist_take_descriptor.9 \
+   nv.9 nvlist_take_descriptor_array.9 \
nv.9 nvlist_take_number.9 \
+   nv.9 nvlist_take_number_array.9 \
nv.9 nvlist_take_nvlist.9 \
+   nv.9 nvlist_take_nvlist_array.9 \
nv.9 nvlist_take_string.9 \
+   nv.9 nvlist_take_string_array.9 \
nv.9 nvlist_unpack.9 \
nv.9 nvlist_xfer.9
 MLINKS+=osd.9 osd_call.9 \
___
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: r323654 - head/share/man/man9

2017-09-16 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Sep 16 17:50:24 2017
New Revision: 323654
URL: https://svnweb.freebsd.org/changeset/base/323654

Log:
  Fix names of the array functions in the nv man page.
  
  Submitted by: def@
  MFC after:1 week

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

Modified: head/share/man/man9/nv.9
==
--- head/share/man/man9/nv.9Sat Sep 16 16:37:18 2017(r323653)
+++ head/share/man/man9/nv.9Sat Sep 16 17:50:24 2017(r323654)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 15, 2015
+.Dd September 16, 2017
 .Dt NV 9
 .Os
 .Sh NAME
@@ -201,11 +201,11 @@
 .Ft "const bool *"
 .Fn nvlist_get_bool_array "const nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "const uint64_t *"
-.Fn nvlist_get_number "const nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_get_number_array "const nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "const char * const *"
-.Fn nvlist_get_string "const nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_get_string_array "const nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "const nvlist_t * const *"
-.Fn nvlist_get_nvlist "const nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_get_nvlist_array "const nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "const int *"
 .Fn nvlist_get_descriptor_array "const nvlist_t *nvl" "const char *name" 
"size_t *nitems"
 .Ft "const nvlist_t *"
@@ -230,13 +230,13 @@
 .Ft "bool *"
 .Fn nvlist_take_bool_array "nvlist_t *nvl" "const char *name" "size_t *nitems"
 .Ft "uint64_t **"
-.Fn nvlist_take_number "nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_take_number_array "nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "char **"
-.Fn nvlist_take_string "nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_take_string_array "nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "nvlist_t **"
-.Fn nvlist_take_nvlist "nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_take_nvlist_array "nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .Ft "int *"
-.Fn nvlist_take_descriptor "nvlist_t *nvl" "const char *name" "size_t *nitems"
+.Fn nvlist_take_descriptor_array "nvlist_t *nvl" "const char *name" "size_t 
*nitems"
 .\"
 .Ft void
 .Fn nvlist_free "nvlist_t *nvl" "const char *name"
___
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: r323645 - head/sbin/sysctl

2017-09-16 Thread Allan Jude
Author: allanjude
Date: Sat Sep 16 16:23:00 2017
New Revision: 323645
URL: https://svnweb.freebsd.org/changeset/base/323645

Log:
  kern.osreldate is an integer, not a string
  
  PR:   217501
  Submitted by: Yavuz Tanriverdi 
  MFC after:1 week

Modified:
  head/sbin/sysctl/sysctl.8

Modified: head/sbin/sysctl/sysctl.8
==
--- head/sbin/sysctl/sysctl.8   Sat Sep 16 16:17:08 2017(r323644)
+++ head/sbin/sysctl/sysctl.8   Sat Sep 16 16:23:00 2017(r323645)
@@ -214,7 +214,7 @@ String and integer values can be set using
 .It "kern.filedelayinteger yes"
 .It "kern.dirdelay integer yes"
 .It "kern.metadelayinteger yes"
-.It "kern.osreldatestring  no"
+.It "kern.osreldateinteger no"
 .It "kern.bootfile string  yes"
 .It "kern.corefile string  yes"
 .It "kern.logsigexit   integer yes"
___
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: r323642 - in head/sys/modules/i2c: ds1307 ds13rtc ds3231 isl12xx nxprtc s35390a

2017-09-16 Thread Ian Lepore
Author: ian
Date: Sat Sep 16 16:09:05 2017
New Revision: 323642
URL: https://svnweb.freebsd.org/changeset/base/323642

Log:
  Add a missing header file to SRCS to fix out-of-kernel builds.
  
  PR:   222354
  Submitted by: eugen@
  Pointy hat:   ian@

Modified:
  head/sys/modules/i2c/ds1307/Makefile
  head/sys/modules/i2c/ds13rtc/Makefile
  head/sys/modules/i2c/ds3231/Makefile
  head/sys/modules/i2c/isl12xx/Makefile
  head/sys/modules/i2c/nxprtc/Makefile
  head/sys/modules/i2c/s35390a/Makefile

Modified: head/sys/modules/i2c/ds1307/Makefile
==
--- head/sys/modules/i2c/ds1307/MakefileSat Sep 16 15:58:20 2017
(r323641)
+++ head/sys/modules/i2c/ds1307/MakefileSat Sep 16 16:09:05 2017
(r323642)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = ds1307
-SRCS   = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: head/sys/modules/i2c/ds13rtc/Makefile
==
--- head/sys/modules/i2c/ds13rtc/Makefile   Sat Sep 16 15:58:20 2017
(r323641)
+++ head/sys/modules/i2c/ds13rtc/Makefile   Sat Sep 16 16:09:05 2017
(r323642)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = ds13rtc
-SRCS   = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h 
+SRCS   = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: head/sys/modules/i2c/ds3231/Makefile
==
--- head/sys/modules/i2c/ds3231/MakefileSat Sep 16 15:58:20 2017
(r323641)
+++ head/sys/modules/i2c/ds3231/MakefileSat Sep 16 16:09:05 2017
(r323642)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = ds3231
-SRCS   = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: head/sys/modules/i2c/isl12xx/Makefile
==
--- head/sys/modules/i2c/isl12xx/Makefile   Sat Sep 16 15:58:20 2017
(r323641)
+++ head/sys/modules/i2c/isl12xx/Makefile   Sat Sep 16 16:09:05 2017
(r323642)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = isl12xx
-SRCS   = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: head/sys/modules/i2c/nxprtc/Makefile
==
--- head/sys/modules/i2c/nxprtc/MakefileSat Sep 16 15:58:20 2017
(r323641)
+++ head/sys/modules/i2c/nxprtc/MakefileSat Sep 16 16:09:05 2017
(r323642)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = nxprtc
-SRCS   = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: head/sys/modules/i2c/s35390a/Makefile
==
--- head/sys/modules/i2c/s35390a/Makefile   Sat Sep 16 15:58:20 2017
(r323641)
+++ head/sys/modules/i2c/s35390a/Makefile   Sat Sep 16 16:09:05 2017
(r323642)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = s35390a
-SRCS   = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 
___
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: r323641 - head/sys/arm/allwinner

2017-09-16 Thread Emmanuel Vadot
Author: manu
Date: Sat Sep 16 15:58:20 2017
New Revision: 323641
URL: https://svnweb.freebsd.org/changeset/base/323641

Log:
  Allwinner usb phy: Rework resource allocation
  
  The usbphy node for allwinner have two kind of resources, one for the
  phy_ctrl and one per phy. Instead of blindy allocating resources, alloc
  the phy_ctrl and pmu ones separately.
  Also add a configuration struct for all different phy that hold the difference
  between them (number of phys, unknow needed register write etc ...).
  
  While here remove A83T code as upstream and FreeBSD dts don't have
  nodes for USB.
  
  This (plus 323640) re-enable OHCI on Pine64 on the bottom USB port.
  The top USB port is routed to the OHCI0/EHCI0 which is by default in OTG mode.
  While the phy code can handle the re-route to standard OHCI/EHCI we still need
  a driver for musb to probe and configure it in host mode.
  
  EHCI is still buggy on Pine64 (hang the board) so do not enable it for now.
  
  Tested On:Bananapi (A20), BananapiM2 (A31S), OrangePi One (H3) Pine64 
(A64)

Modified:
  head/sys/arm/allwinner/aw_usbphy.c

Modified: head/sys/arm/allwinner/aw_usbphy.c
==
--- head/sys/arm/allwinner/aw_usbphy.c  Sat Sep 16 15:50:31 2017
(r323640)
+++ head/sys/arm/allwinner/aw_usbphy.c  Sat Sep 16 15:58:20 2017
(r323641)
@@ -53,53 +53,90 @@ __FBSDID("$FreeBSD$");
 
 #include "phy_if.h"
 
-#defineUSBPHY_NPHYS4
-#defineUSBPHY_NRES USBPHY_NPHYS
-
 enum awusbphy_type {
AWUSBPHY_TYPE_A10 = 1,
AWUSBPHY_TYPE_A13,
AWUSBPHY_TYPE_A20,
AWUSBPHY_TYPE_A31,
-   AWUSBPHY_TYPE_A83T,
AWUSBPHY_TYPE_H3,
AWUSBPHY_TYPE_A64
 };
 
+struct aw_usbphy_conf {
+   int num_phys;
+   enum awusbphy_type  phy_type;
+   boolpmu_unk1;
+   boolphy0_route;
+};
+
+static const struct aw_usbphy_conf a10_usbphy_conf = {
+   .num_phys = 3,
+   .phy_type = AWUSBPHY_TYPE_A10,
+   .pmu_unk1 = false,
+   .phy0_route = false,
+};
+
+static const struct aw_usbphy_conf a13_usbphy_conf = {
+   .num_phys = 2,
+   .phy_type = AWUSBPHY_TYPE_A13,
+   .pmu_unk1 = false,
+   .phy0_route = false,
+};
+
+static const struct aw_usbphy_conf a20_usbphy_conf = {
+   .num_phys = 3,
+   .phy_type = AWUSBPHY_TYPE_A20,
+   .pmu_unk1 = false,
+   .phy0_route = false,
+};
+
+static const struct aw_usbphy_conf a31_usbphy_conf = {
+   .num_phys = 3,
+   .phy_type = AWUSBPHY_TYPE_A31,
+   .pmu_unk1 = false,
+   .phy0_route = false,
+};
+
+static const struct aw_usbphy_conf h3_usbphy_conf = {
+   .num_phys = 4,
+   .phy_type = AWUSBPHY_TYPE_H3,
+   .pmu_unk1 = true,
+   .phy0_route = false,
+};
+
+static const struct aw_usbphy_conf a64_usbphy_conf = {
+   .num_phys = 2,
+   .phy_type = AWUSBPHY_TYPE_A64,
+   .pmu_unk1 = true,
+   .phy0_route = true,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun4i-a10-usb-phy",AWUSBPHY_TYPE_A10 },
-   { "allwinner,sun5i-a13-usb-phy",AWUSBPHY_TYPE_A13 },
-   { "allwinner,sun6i-a31-usb-phy",AWUSBPHY_TYPE_A31 },
-   { "allwinner,sun7i-a20-usb-phy",AWUSBPHY_TYPE_A20 },
-   { "allwinner,sun8i-a83t-usb-phy",   AWUSBPHY_TYPE_A83T },
-   { "allwinner,sun8i-h3-usb-phy", AWUSBPHY_TYPE_H3 },
-   { "allwinner,sun50i-a64-usb-phy",   AWUSBPHY_TYPE_A64 },
+   { "allwinner,sun4i-a10-usb-phy",(uintptr_t)_usbphy_conf },
+   { "allwinner,sun5i-a13-usb-phy",(uintptr_t)_usbphy_conf },
+   { "allwinner,sun6i-a31-usb-phy",(uintptr_t)_usbphy_conf },
+   { "allwinner,sun7i-a20-usb-phy",(uintptr_t)_usbphy_conf },
+   { "allwinner,sun8i-h3-usb-phy", (uintptr_t)_usbphy_conf },
+   { "allwinner,sun50i-a64-usb-phy",   (uintptr_t)_usbphy_conf },
{ NULL, 0 }
 };
 
 struct awusbphy_softc {
-   struct resource *   res[USBPHY_NRES];
-   regulator_t reg[USBPHY_NPHYS];
+   struct resource *   phy_ctrl;
+   struct resource **  pmu;
+   regulator_t *   reg;
gpio_pin_t  id_det_pin;
int id_det_valid;
gpio_pin_t  vbus_det_pin;
int vbus_det_valid;
-   enum awusbphy_type  phy_type;
+   struct aw_usbphy_conf   *phy_conf;
 };
 
-static struct resource_spec awusbphy_spec[] = {
-   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
-   { SYS_RES_MEMORY,   1,  RF_ACTIVE },
-   { SYS_RES_MEMORY,   2,  RF_ACTIVE | RF_OPTIONAL },
-   { SYS_RES_MEMORY,   3,  RF_ACTIVE | RF_OPTIONAL },
-   { -1, 0 }
-};
+#defineRD4(res, o) bus_read_4(res, (o))
+#defineWR4(res, o, 

svn commit: r323640 - head/sys/arm/allwinner/clkng

2017-09-16 Thread Emmanuel Vadot
Author: manu
Date: Sat Sep 16 15:50:31 2017
New Revision: 323640
URL: https://svnweb.freebsd.org/changeset/base/323640

Log:
  A64 CCUNG: Correct gate and reset for OHCI0/1
  
  Reported by:  jmcneill
  Pointy Hat:   manu

Modified:
  head/sys/arm/allwinner/clkng/ccu_a64.c

Modified: head/sys/arm/allwinner/clkng/ccu_a64.c
==
--- head/sys/arm/allwinner/clkng/ccu_a64.c  Sat Sep 16 14:08:20 2017
(r323639)
+++ head/sys/arm/allwinner/clkng/ccu_a64.c  Sat Sep 16 15:50:31 2017
(r323640)
@@ -66,8 +66,8 @@ static struct aw_ccung_reset a64_ccu_resets[] = {
CCU_RESET(A64_RST_BUS_OTG, 0x2c0, 23)
CCU_RESET(A64_RST_BUS_EHCI0, 0x2c0, 24)
CCU_RESET(A64_RST_BUS_EHCI1, 0x2c0, 25)
-   CCU_RESET(A64_RST_BUS_OHCI0, 0x2c0, 26)
-   CCU_RESET(A64_RST_BUS_OHCI1, 0x2c0, 27)
+   CCU_RESET(A64_RST_BUS_OHCI0, 0x2c0, 28)
+   CCU_RESET(A64_RST_BUS_OHCI1, 0x2c0, 29)
 
CCU_RESET(A64_RST_BUS_VE, 0x2c4, 0)
CCU_RESET(A64_RST_BUS_TCON0, 0x2c4, 3)
@@ -119,8 +119,8 @@ static struct aw_ccung_gate a64_ccu_gates[] = {
CCU_GATE(A64_CLK_BUS_OTG, "bus-otg", "ahb1", 0x60, 23)
CCU_GATE(A64_CLK_BUS_EHCI0, "bus-ehci0", "ahb1", 0x60, 24)
CCU_GATE(A64_CLK_BUS_EHCI1, "bus-ehci1", "ahb2", 0x60, 25)
-   CCU_GATE(A64_CLK_BUS_OHCI0, "bus-ohci0", "ahb1", 0x60, 26)
-   CCU_GATE(A64_CLK_BUS_OHCI1, "bus-ohci1", "ahb2", 0x60, 27)
+   CCU_GATE(A64_CLK_BUS_OHCI0, "bus-ohci0", "ahb1", 0x60, 28)
+   CCU_GATE(A64_CLK_BUS_OHCI1, "bus-ohci1", "ahb2", 0x60, 29)
 
CCU_GATE(A64_CLK_BUS_VE, "bus-ve", "ahb1", 0x64, 0)
CCU_GATE(A64_CLK_BUS_TCON0, "bus-tcon0", "ahb1", 0x64, 3)
___
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: r323639 - head/sys/arm/allwinner

2017-09-16 Thread Emmanuel Vadot
Author: manu
Date: Sat Sep 16 14:08:20 2017
New Revision: 323639
URL: https://svnweb.freebsd.org/changeset/base/323639

Log:
  Allwinner: a10_gpio Fix panic on multiple lock
  
  r323392 introduce gpio_pin_get/gpio_pin_set for a10_gpio driver.
  When called via gpio method they must aquire the device lock while
  when they are called via gpio_pin_configure the lock is already aquire.
  
  Introduce a10_gpio_pin_{s,g}et_locked and call them in pin_gpio_configure
  instead.
  
  Tested On: BananaPi (A20)
  
  Reported by:  Richard Puga rich...@puga.net

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Sat Sep 16 13:49:26 2017
(r323638)
+++ head/sys/arm/allwinner/a10_gpio.c   Sat Sep 16 14:08:20 2017
(r323639)
@@ -197,6 +197,8 @@ struct a10_gpio_softc {
 
 static int a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value);
 static int a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value);
+static int a10_gpio_pin_get_locked(struct a10_gpio_softc *sc, uint32_t pin, 
unsigned int *value);
+static int a10_gpio_pin_set_locked(struct a10_gpio_softc *sc, uint32_t pin, 
unsigned int value);
 
 #defineA10_GPIO_WRITE(_sc, _off, _val) \
 bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val)
@@ -333,15 +335,15 @@ a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint
err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
} else if (flags & GPIO_PIN_OUTPUT) {
if (flags & GPIO_PIN_PRESET_LOW) {
-   a10_gpio_pin_set(sc->sc_dev, pin, 0);
+   a10_gpio_pin_set_locked(sc, pin, 0);
} else if (flags & GPIO_PIN_PRESET_HIGH) {
-   a10_gpio_pin_set(sc->sc_dev, pin, 1);
+   a10_gpio_pin_set_locked(sc, pin, 1);
} else {
/* Read the pin and preset output to current state. */
err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
if (err == 0) {
-   a10_gpio_pin_get(sc->sc_dev, pin, );
-   a10_gpio_pin_set(sc->sc_dev, pin, val); 
+   a10_gpio_pin_get_locked(sc, pin, );
+   a10_gpio_pin_set_locked(sc, pin, val);
}
}
if (err == 0)
@@ -473,49 +475,77 @@ a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint
 }
 
 static int
-a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
+a10_gpio_pin_set_locked(struct a10_gpio_softc *sc, uint32_t pin,
+unsigned int value)
 {
-   struct a10_gpio_softc *sc;
uint32_t bank, data;
 
-   sc = device_get_softc(dev);
+   A10_GPIO_LOCK_ASSERT(sc);
+
if (pin > sc->padconf->npins)
return (EINVAL);
 
bank = sc->padconf->pins[pin].port;
pin = sc->padconf->pins[pin].pin;
 
-   A10_GPIO_LOCK(sc);
data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
if (value)
data |= (1 << pin);
else
data &= ~(1 << pin);
A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data);
-   A10_GPIO_UNLOCK(sc);
 
return (0);
 }
 
 static int
-a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
+a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
 {
struct a10_gpio_softc *sc;
-   uint32_t bank, reg_data;
+   int ret;
 
sc = device_get_softc(dev);
+
+   A10_GPIO_LOCK(sc);
+   ret = a10_gpio_pin_set_locked(sc, pin, value);
+   A10_GPIO_UNLOCK(sc);
+
+   return (ret);
+}
+
+static int
+a10_gpio_pin_get_locked(struct a10_gpio_softc *sc,uint32_t pin,
+unsigned int *val)
+{
+   uint32_t bank, reg_data;
+
+   A10_GPIO_LOCK_ASSERT(sc);
+
if (pin > sc->padconf->npins)
return (EINVAL);
 
bank = sc->padconf->pins[pin].port;
pin = sc->padconf->pins[pin].pin;
 
-   A10_GPIO_LOCK(sc);
reg_data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
-   A10_GPIO_UNLOCK(sc);
*val = (reg_data & (1 << pin)) ? 1 : 0;
 
return (0);
+}
+
+static int
+a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
+{
+   struct a10_gpio_softc *sc;
+   int ret;
+
+   sc = device_get_softc(dev);
+
+   A10_GPIO_LOCK(sc);
+   ret = a10_gpio_pin_get_locked(sc, pin, val);
+   A10_GPIO_UNLOCK(sc);
+
+   return (ret);
 }
 
 static int
___
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: r323638 - stable/11/sys/vm

2017-09-16 Thread Konstantin Belousov
Author: kib
Date: Sat Sep 16 13:49:26 2017
New Revision: 323638
URL: https://svnweb.freebsd.org/changeset/base/323638

Log:
  MFC r323368:
  Add a vm_page_change_lock() helper.

Modified:
  stable/11/sys/vm/vm_object.c
  stable/11/sys/vm/vm_page.c
  stable/11/sys/vm/vm_page.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_object.c
==
--- stable/11/sys/vm/vm_object.cSat Sep 16 05:42:27 2017
(r323637)
+++ stable/11/sys/vm/vm_object.cSat Sep 16 13:49:26 2017
(r323638)
@@ -1910,6 +1910,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t 
 int options)
 {
vm_page_t p, next;
+   struct mtx *mtx;
 
VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT((object->flags & OBJ_UNMANAGED) == 0 ||
@@ -1920,6 +1921,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t 
vm_object_pip_add(object, 1);
 again:
p = vm_page_find_least(object, start);
+   mtx = NULL;
 
/*
 * Here, the variable "p" is either (1) the page with the least pindex
@@ -1936,7 +1938,7 @@ again:
 * however, be invalidated if the option OBJPR_CLEANONLY is
 * not specified.
 */
-   vm_page_lock(p);
+   vm_page_change_lock(p, );
if (vm_page_xbusied(p)) {
VM_OBJECT_WUNLOCK(object);
vm_page_busy_sleep(p, "vmopax", true);
@@ -1950,7 +1952,7 @@ again:
p->valid = 0;
vm_page_undirty(p);
}
-   goto next;
+   continue;
}
if (vm_page_busied(p)) {
VM_OBJECT_WUNLOCK(object);
@@ -1964,14 +1966,14 @@ again:
if ((options & OBJPR_NOTMAPPED) == 0)
pmap_remove_write(p);
if (p->dirty)
-   goto next;
+   continue;
}
if ((options & OBJPR_NOTMAPPED) == 0)
pmap_remove_all(p);
vm_page_free(p);
-next:
-   vm_page_unlock(p);
}
+   if (mtx != NULL)
+   mtx_unlock(mtx);
vm_object_pip_wakeup(object);
 }
 
@@ -1994,7 +1996,7 @@ next:
 void
 vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end)
 {
-   struct mtx *mtx, *new_mtx;
+   struct mtx *mtx;
vm_page_t p, next;
 
VM_OBJECT_ASSERT_LOCKED(object);
@@ -2011,17 +2013,7 @@ vm_object_page_noreuse(vm_object_t object, vm_pindex_t
mtx = NULL;
for (; p != NULL && (p->pindex < end || end == 0); p = next) {
next = TAILQ_NEXT(p, listq);
-
-   /*
-* Avoid releasing and reacquiring the same page lock.
-*/
-   new_mtx = vm_page_lockptr(p);
-   if (mtx != new_mtx) {
-   if (mtx != NULL)
-   mtx_unlock(mtx);
-   mtx = new_mtx;
-   mtx_lock(mtx);
-   }
+   vm_page_change_lock(p, );
vm_page_deactivate_noreuse(p);
}
if (mtx != NULL)

Modified: stable/11/sys/vm/vm_page.c
==
--- stable/11/sys/vm/vm_page.c  Sat Sep 16 05:42:27 2017(r323637)
+++ stable/11/sys/vm/vm_page.c  Sat Sep 16 13:49:26 2017(r323638)
@@ -905,6 +905,23 @@ vm_page_flash(vm_page_t m)
 }
 
 /*
+ * Avoid releasing and reacquiring the same page lock.
+ */
+void
+vm_page_change_lock(vm_page_t m, struct mtx **mtx)
+{
+   struct mtx *mtx1;
+
+   mtx1 = vm_page_lockptr(m);
+   if (*mtx == mtx1)
+   return;
+   if (*mtx != NULL)
+   mtx_unlock(*mtx);
+   *mtx = mtx1;
+   mtx_lock(mtx1);
+}
+
+/*
  * Keep page from being freed by the page daemon
  * much of the same effect as wiring, except much lower
  * overhead and should be used only for *very* temporary
@@ -937,20 +954,11 @@ vm_page_unhold(vm_page_t mem)
 void
 vm_page_unhold_pages(vm_page_t *ma, int count)
 {
-   struct mtx *mtx, *new_mtx;
+   struct mtx *mtx;
 
mtx = NULL;
for (; count != 0; count--) {
-   /*
-* Avoid releasing and reacquiring the same page lock.
-*/
-   new_mtx = vm_page_lockptr(*ma);
-   if (mtx != new_mtx) {
-   if (mtx != NULL)
-   mtx_unlock(mtx);
-   mtx = new_mtx;
-   mtx_lock(mtx);
-   }
+   vm_page_change_lock(*ma, );
vm_page_unhold(*ma);
ma++;
}
@@ -1989,7 +1997,7 @@ 

Re: svn commit: r323177 - in head: sys/compat/cloudabi sys/contrib/cloudabi usr.bin/truss

2017-09-16 Thread Ed Schouten
Hi Jilles,

2017-09-15 12:58 GMT+01:00 Jilles Tjoelker :
> Although this is correct from a functionality point of view (S_IFIFO and
> S_IFSOCK are probably expected to be different in a POSIX context, but
> this is unlikely to break anything that is not already broken), it is a
> partial reversal of previous changes to FreeBSD that created separate
> implementations for pipes (first unnamed pipes in 1996, later fifos in
> 2012 r232055). The main reason for these changes was performance.
>
> Unfortunately, I do not have concrete benchmarks in the CloudABI
> context.

That is important to keep in mind indeed. Thanks for pointing this out!

When I discussed this with some of the other folks working on
CloudABI, we came to the conclusion that this (potential) loss of
performance is acceptable in the nearby future. If it would really
affect us negatively, it should in theory be possible to reimplement
our streaming sockets and pipes with something as simple and fast as
FreeBSD's pipes, but still support file descriptor passing, etc.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
___
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: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys

2017-09-16 Thread Bruce Evans

On Sat, 16 Sep 2017, Alexander Leidinger wrote:

Quoting Bruce Evans  (from Sat, 16 Sep 2017 13:46:37 
+1000 (EST)):



It gives lesser breakage here:
- with an old PCI em, an error that occur every few makeworlds over nfs now
  hang the hardware.  It used to be recovered from afger about 10 seconds.
  This only happened once.  I then applied my old fix which ignores the
  error better so as to recover from it immediately.  This seems to work as
  before.


As I also have an em device which switches into non-working state: what's the 
patch you have for this? I would like to see if your change also helps my 
device to get back into working shape again.


X Index: em_txrx.c
X ===
X --- em_txrx.c (revision 323636)
X +++ em_txrx.c (working copy)
X @@ -640,9 +640,20 @@
X 
X  		/* Make sure bad packets are discarded */

X   if (errors & E1000_RXD_ERR_FRAME_ERR_MASK) {
X +#if 0
X   adapter->dropped_pkts++;
X - /* XXX fixup if common */
X   return (EBADMSG);
X +#else
X + /*
X +  * XXX the above error handling is worse than none.
X +  * First it it drops 'i' packets before the current
X +  * one and doesn't count them.  Then it returns an
X +  * error.  iflib can't really handle this error.
X +  * It just resets, and this usually drops many more
X +  * packets (without counting them) and much time.
X +  */
X + printf("lem: frame error: ignored\n");
X +#endif
X   }
X 
X  		ri->iri_frags[i].irf_flid = 0;


This is for old em.  nfs doesn't seem to notice the dropped packet(s) after
this.

I think the comment "fixup if common" means "this error should actually
be handled if it occurs enough to matter".

I removed the increment of the dropped packet count because with the change
none are dropped directly here.  I think the error is just for this packet
but more than 1 packet might be dropped by returning in the old code, but
debugging code seem to show no more than 1 packet at a time having an error.
I think returning drops good packets after the bad one together with leaving
the state inconsistent, and it takes almost a reset to recover.

X @@ -703,8 +714,12 @@
X 
X  		/* Make sure bad packets are discarded */

X   if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) {
X +#if 0
X   adapter->dropped_pkts++;
X   return EBADMSG;
X +#else
X + printf("em: frame error: ignored\n");
X +#endif
X   }
X 
X  		ri->iri_frags[i].irf_flid = 0;


This is for newer em.  I haven't noticed any problems with that (except it
has 27 usec higher latency).

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"


Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys

2017-09-16 Thread Alexander Leidinger
Quoting Bruce Evans  (from Sat, 16 Sep 2017  
13:46:37 +1000 (EST)):



It gives lesser breakage here:
- with an old PCI em, an error that occur every few makeworlds over nfs now
  hang the hardware.  It used to be recovered from afger about 10 seconds.
  This only happened once.  I then applied my old fix which ignores the
  error better so as to recover from it immediately.  This seems to work as
  before.


As I also have an em device which switches into non-working state:  
what's the patch you have for this? I would like to see if your change  
also helps my device to get back into working shape again.


Bye,
Alexander.


--
http://www.Leidinger.net alexan...@leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.orgnetch...@freebsd.org  : PGP 0x8F31830F9F2772BF


pgp8nG3VSVTOC.pgp
Description: Digitale PGP-Signatur