svn commit: r349223 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-06-19 Thread Cy Schubert
Author: cy
Date: Thu Jun 20 05:01:35 2019
New Revision: 349223
URL: https://svnweb.freebsd.org/changeset/base/349223

Log:
  MFC r349152:
  
  Make ipf_objbytes a constant. ipf_objbytes is a table of internal data
  structures that are saved across reboots by ipfs(8). The table is not
  changed at runtime.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c
==
--- stable/12/sys/contrib/ipfilter/netinet/fil.cThu Jun 20 01:19:08 
2019(r349222)
+++ stable/12/sys/contrib/ipfilter/netinet/fil.cThu Jun 20 05:01:35 
2019(r349223)
@@ -6268,7 +6268,7 @@ ipf_ioctlswitch(softc, unit, data, cmd, mode, uid, ctx
  * Flags:
  * 1 = minimum size, not absolute size
  */
-static int ipf_objbytes[IPFOBJ_COUNT][3] = {
+static const int   ipf_objbytes[IPFOBJ_COUNT][3] = {
{ 1,sizeof(struct frentry), 501 },  /* 0 */
{ 1,sizeof(struct friostat),501 },
{ 0,sizeof(struct fr_info), 501 },
___
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: r349223 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-06-19 Thread Cy Schubert
Author: cy
Date: Thu Jun 20 05:01:35 2019
New Revision: 349223
URL: https://svnweb.freebsd.org/changeset/base/349223

Log:
  MFC r349152:
  
  Make ipf_objbytes a constant. ipf_objbytes is a table of internal data
  structures that are saved across reboots by ipfs(8). The table is not
  changed at runtime.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c
==
--- stable/11/sys/contrib/ipfilter/netinet/fil.cThu Jun 20 01:19:08 
2019(r349222)
+++ stable/11/sys/contrib/ipfilter/netinet/fil.cThu Jun 20 05:01:35 
2019(r349223)
@@ -6268,7 +6268,7 @@ ipf_ioctlswitch(softc, unit, data, cmd, mode, uid, ctx
  * Flags:
  * 1 = minimum size, not absolute size
  */
-static int ipf_objbytes[IPFOBJ_COUNT][3] = {
+static const int   ipf_objbytes[IPFOBJ_COUNT][3] = {
{ 1,sizeof(struct frentry), 501 },  /* 0 */
{ 1,sizeof(struct friostat),501 },
{ 0,sizeof(struct fr_info), 501 },
___
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: r348737 - head/sys/kern

2019-06-19 Thread Alan Somers
On Thu, Jun 6, 2019 at 2:02 PM John Baldwin  wrote:
>
> On 6/6/19 11:21 AM, Ian Lepore wrote:
> > On Thu, 2019-06-06 at 12:04 -0600, Alan Somers wrote:
> >> On Thu, Jun 6, 2019 at 12:01 PM John Baldwin  wrote:
> >>>
> >>> On 6/6/19 10:39 AM, Alan Somers wrote:
>  On Thu, Jun 6, 2019 at 11:35 AM Rodney W. Grimes
>   wrote:
> >
> >> Author: asomers
> >> Date: Thu Jun  6 15:04:50 2019
> >> New Revision: 348737
> >> URL: https://svnweb.freebsd.org/changeset/base/348737
> >>
> >> Log:
> >>   Add a testing facility to manually reclaim a vnode
> >>
> >>   Add the debug.try_reclaim_vnode sysctl. When a pathname is
> >> written to it, it
> >>   will be reclaimed, as long as it isn't already or doomed.
> >> The purpose is to
> >>   gain test coverage for vnode reclamation, which is
> >> otherwise hard to
> >>   achieve.
> >>
> >>   Add the debug.ftry_reclaim_vnode sysctl.  It does the same
> >> thing, except
> >>   that its argument is a file descriptor instead of a
> >> pathname.
> >
> > Should not this all be wrapped in some #ifdef or other
> > protection,
> > is it really a good idea to have this on every single box
> > running
> > FreeBSD?
> 
>  I initially thought so too, but kib thought that it could be
>  useful
>  for debugging problems in the field.  The potential downside is
>  limited, because only root can write to the sysctls, and the
>  worse-case damage is similar to a "umount -f".
> >>>
> >>> A compromise might be to stick this in a kernel module instead of
> >>> in the
> >>> base kernel.  You could still kldload it in the field for debugging
> >>> but
> >>> not necessarily have it directly available out of the box.
> >>>
> >>> --
> >>> John Baldwin
> >>
> >> If we already had such a module, it would make sense to put these
> >> sysctls in there.  But I don't want to create an entire module for
> >> just a few dozen LOC.  Nor do I want to mediate a bike shed.  So
> >> let's
> >> vote.  kib already registered a vote for making them available all of
> >> the time.  rgrimes voted to guard them by INVARIANTS.  Anybody else
> >> who cares can reply to this thread.  I'll count the votes in 24
> >> hours.
> >> -Alan
> >>
> >
> > If our new policy is to remove sysctls that aren't used often "because
> > something bad might happen" (without any requirement for the complainer
> > to elaborate on just what might happen or why it's so much worse than
> > the damage a root user could do with any other sysctl), I think several
> > people could be employed full time doing that removal work.  Or we
> > could all just get on with doing some real work.
>
> What I find a bit different about this case is when it's a debugging
> knob.  For that sort of thing, kernel modules are a pretty decent way
> to inject new functionality into the system that is rarely needed.  A
> while back I had a problem with resume on a laptop seemingly not
> unsticking all of the processes that had been paused via stop_all and had
> a hacky kernel module with a magic sysctl that would try to unstick things.
> That worked better as a module that I only loaded if needed.  Similar for
> a hacky kernel module at a previous job (killsmi.ko) that would write to
> the appropriate ICH register to disable all SMIs when loaded, etc.
>
> --
> John Baldwin

It's been two weeks, and the vote tally is:
* Unconditional: 3
* Module: 2
* Don't care/Get on with bigger problems: 2

Unconditional wins the vote.  Though if rgrimes goes to the trouble of
writing the module, I'll review it.
-Alan
___
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: r349222 - stable/11/sys/vm

2019-06-19 Thread Alexander Motin
Author: mav
Date: Thu Jun 20 01:19:08 2019
New Revision: 349222
URL: https://svnweb.freebsd.org/changeset/base/349222

Log:
  MFC r348764: Allow UMA hash tables to expand faster then 2x in 20 seconds.
  
  ZFS ABD allocates tons of 4KB chunks via UMA, requiring huge hash tables.
  With initial hash table size of only 32 elements it takes ~20 expansions
  or ~400 seconds to adapt to handling 220GB ZFS ARC.  During that time not
  only the hash table is highly inefficient, but also each of those expan-
  sions takes significant time with the lock held, blocking operation.
  
  On my test system with 256GB of RAM and ZFS pool of 28 HDDs this change
  reduces time needed to first time read 240GB from ~300-400s, during which
  system is quite busy and unresponsive, to only ~150s with light CPU load
  and just 5 sub-second CPU spikes to expand the hash table.

Modified:
  stable/11/sys/vm/uma_core.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/uma_core.c
==
--- stable/11/sys/vm/uma_core.c Thu Jun 20 01:18:15 2019(r349221)
+++ stable/11/sys/vm/uma_core.c Thu Jun 20 01:19:08 2019(r349222)
@@ -242,7 +242,7 @@ static void keg_small_init(uma_keg_t keg);
 static void keg_large_init(uma_keg_t keg);
 static void zone_foreach(void (*zfunc)(uma_zone_t));
 static void zone_timeout(uma_zone_t zone);
-static int hash_alloc(struct uma_hash *);
+static int hash_alloc(struct uma_hash *, u_int);
 static int hash_expand(struct uma_hash *, struct uma_hash *);
 static void hash_free(struct uma_hash *hash);
 static void uma_timeout(void *);
@@ -477,6 +477,7 @@ uma_timeout(void *unused)
 static void
 keg_timeout(uma_keg_t keg)
 {
+   u_int slabs;
 
KEG_LOCK(keg);
/*
@@ -487,7 +488,8 @@ keg_timeout(uma_keg_t keg)
 * may be a little aggressive.  Should I allow for two collisions max?
 */
if (keg->uk_flags & UMA_ZONE_HASH &&
-   keg->uk_pages / keg->uk_ppera >= keg->uk_hash.uh_hashsize) {
+   (slabs = keg->uk_pages / keg->uk_ppera) >
+keg->uk_hash.uh_hashsize) {
struct uma_hash newhash;
struct uma_hash oldhash;
int ret;
@@ -498,9 +500,8 @@ keg_timeout(uma_keg_t keg)
 * I have to do everything in stages and check for
 * races.
 */
-   newhash = keg->uk_hash;
KEG_UNLOCK(keg);
-   ret = hash_alloc();
+   ret = hash_alloc(, 1 << fls(slabs));
KEG_LOCK(keg);
if (ret) {
if (hash_expand(>uk_hash, )) {
@@ -535,16 +536,13 @@ zone_timeout(uma_zone_t zone)
  * 1 on success and 0 on failure.
  */
 static int
-hash_alloc(struct uma_hash *hash)
+hash_alloc(struct uma_hash *hash, u_int size)
 {
-   u_int oldsize;
size_t alloc;
 
-   oldsize = hash->uh_hashsize;
-
-   /* We're just going to go to a power of two greater */
-   if (oldsize)  {
-   hash->uh_hashsize = oldsize * 2;
+   KASSERT(powerof2(size), ("hash size must be power of 2"));
+   if (size > UMA_HASH_SIZE_INIT)  {
+   hash->uh_hashsize = size;
alloc = sizeof(hash->uh_slab_hash[0]) * hash->uh_hashsize;
hash->uh_slab_hash = (struct slabhead *)malloc(alloc,
M_UMAHASH, M_NOWAIT);
@@ -1509,7 +1507,7 @@ keg_ctor(void *mem, int size, void *udata, int flags)
}
 
if (keg->uk_flags & UMA_ZONE_HASH)
-   hash_alloc(>uk_hash);
+   hash_alloc(>uk_hash, 0);
 
 #ifdef UMA_DEBUG
printf("UMA: %s(%p) size %d(%d) flags %#x ipers %d ppera %d out %d free 
%d\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: r349221 - stable/12/sys/vm

2019-06-19 Thread Alexander Motin
Author: mav
Date: Thu Jun 20 01:18:15 2019
New Revision: 349221
URL: https://svnweb.freebsd.org/changeset/base/349221

Log:
  MFC r348764: Allow UMA hash tables to expand faster then 2x in 20 seconds.
  
  ZFS ABD allocates tons of 4KB chunks via UMA, requiring huge hash tables.
  With initial hash table size of only 32 elements it takes ~20 expansions
  or ~400 seconds to adapt to handling 220GB ZFS ARC.  During that time not
  only the hash table is highly inefficient, but also each of those expan-
  sions takes significant time with the lock held, blocking operation.
  
  On my test system with 256GB of RAM and ZFS pool of 28 HDDs this change
  reduces time needed to first time read 240GB from ~300-400s, during which
  system is quite busy and unresponsive, to only ~150s with light CPU load
  and just 5 sub-second CPU spikes to expand the hash table.

Modified:
  stable/12/sys/vm/uma_core.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/uma_core.c
==
--- stable/12/sys/vm/uma_core.c Thu Jun 20 01:15:33 2019(r349220)
+++ stable/12/sys/vm/uma_core.c Thu Jun 20 01:18:15 2019(r349221)
@@ -256,7 +256,7 @@ static void keg_small_init(uma_keg_t keg);
 static void keg_large_init(uma_keg_t keg);
 static void zone_foreach(void (*zfunc)(uma_zone_t));
 static void zone_timeout(uma_zone_t zone);
-static int hash_alloc(struct uma_hash *);
+static int hash_alloc(struct uma_hash *, u_int);
 static int hash_expand(struct uma_hash *, struct uma_hash *);
 static void hash_free(struct uma_hash *hash);
 static void uma_timeout(void *);
@@ -571,6 +571,7 @@ zone_domain_update_wss(uma_zone_domain_t zdom)
 static void
 keg_timeout(uma_keg_t keg)
 {
+   u_int slabs;
 
KEG_LOCK(keg);
/*
@@ -581,7 +582,8 @@ keg_timeout(uma_keg_t keg)
 * may be a little aggressive.  Should I allow for two collisions max?
 */
if (keg->uk_flags & UMA_ZONE_HASH &&
-   keg->uk_pages / keg->uk_ppera >= keg->uk_hash.uh_hashsize) {
+   (slabs = keg->uk_pages / keg->uk_ppera) >
+keg->uk_hash.uh_hashsize) {
struct uma_hash newhash;
struct uma_hash oldhash;
int ret;
@@ -592,9 +594,8 @@ keg_timeout(uma_keg_t keg)
 * I have to do everything in stages and check for
 * races.
 */
-   newhash = keg->uk_hash;
KEG_UNLOCK(keg);
-   ret = hash_alloc();
+   ret = hash_alloc(, 1 << fls(slabs));
KEG_LOCK(keg);
if (ret) {
if (hash_expand(>uk_hash, )) {
@@ -635,16 +636,13 @@ zone_timeout(uma_zone_t zone)
  * 1 on success and 0 on failure.
  */
 static int
-hash_alloc(struct uma_hash *hash)
+hash_alloc(struct uma_hash *hash, u_int size)
 {
-   u_int oldsize;
size_t alloc;
 
-   oldsize = hash->uh_hashsize;
-
-   /* We're just going to go to a power of two greater */
-   if (oldsize)  {
-   hash->uh_hashsize = oldsize * 2;
+   KASSERT(powerof2(size), ("hash size must be power of 2"));
+   if (size > UMA_HASH_SIZE_INIT)  {
+   hash->uh_hashsize = size;
alloc = sizeof(hash->uh_slab_hash[0]) * hash->uh_hashsize;
hash->uh_slab_hash = (struct slabhead *)malloc(alloc,
M_UMAHASH, M_NOWAIT);
@@ -1733,7 +1731,7 @@ keg_ctor(void *mem, int size, void *udata, int flags)
}
 
if (keg->uk_flags & UMA_ZONE_HASH)
-   hash_alloc(>uk_hash);
+   hash_alloc(>uk_hash, 0);
 
CTR5(KTR_UMA, "keg_ctor %p zone %s(%p) out %d free %d\n",
keg, zone->uz_name, zone,
___
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: r349220 - in head: share/man/man9 sys/kern sys/sys

2019-06-19 Thread Alexander Motin
Author: mav
Date: Thu Jun 20 01:15:33 2019
New Revision: 349220
URL: https://svnweb.freebsd.org/changeset/base/349220

Log:
  Add wakeup_any(), cheaper wakeup_one() for taskqueue(9).
  
  wakeup_one() and underlying sleepq_signal() spend additional time trying
  to be fair, waking thread with highest priority, sleeping longest time.
  But in case of taskqueue there are many absolutely identical threads, and
  any fairness between them is quite pointless.  It makes even worse, since
  round-robin wakeups not only make previous CPU affinity in scheduler quite
  useless, but also hide from user chance to see CPU bottlenecks, when
  sequential workload with one request at a time looks evenly distributed
  between multiple threads.
  
  This change adds new SLEEPQ_UNFAIR flag to sleepq_signal(), making it wakeup
  thread that went to sleep last, but no longer in context switch (to avoid
  immediate spinning on the thread lock).  On top of that new wakeup_any()
  function is added, equivalent to wakeup_one(), but setting the flag.
  On top of that taskqueue(9) is switchied to wakeup_any() to wakeup its
  threads.
  
  As result, on 72-core Xeon v4 machine sequential ZFS write to 12 ZVOLs
  with 16KB block size spend 34% less time in wakeup_any() and descendants
  then it was spending in wakeup_one(), and total write throughput increased
  by ~10% with the same as before CPU usage.
  
  Reviewed by:  markj, mmacy
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D20669

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/sleep.9
  head/share/man/man9/sleepqueue.9
  head/sys/kern/kern_synch.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/subr_taskqueue.c
  head/sys/sys/queue.h
  head/sys/sys/sleepqueue.h
  head/sys/sys/systm.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileThu Jun 20 00:23:51 2019
(r349219)
+++ head/share/man/man9/MakefileThu Jun 20 01:15:33 2019
(r349220)
@@ -1880,7 +1880,8 @@ MLINKS+=sleep.9 msleep.9 \
sleep.9 tsleep.9 \
sleep.9 tsleep_sbt.9 \
sleep.9 wakeup.9 \
-   sleep.9 wakeup_one.9
+   sleep.9 wakeup_one.9 \
+   sleep.9 wakeup_any.9
 MLINKS+=sleepqueue.9 init_sleepqueues.9 \
sleepqueue.9 sleepq_abort.9 \
sleepqueue.9 sleepq_add.9 \

Modified: head/share/man/man9/sleep.9
==
--- head/share/man/man9/sleep.9 Thu Jun 20 00:23:51 2019(r349219)
+++ head/share/man/man9/sleep.9 Thu Jun 20 01:15:33 2019(r349220)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 4, 2018
+.Dd June 19, 2019
 .Dt SLEEP 9
 .Os
 .Sh NAME
@@ -38,7 +38,9 @@
 .Nm pause_sbt ,
 .Nm tsleep ,
 .Nm tsleep_sbt ,
-.Nm wakeup
+.Nm wakeup ,
+.Nm wakeup_one ,
+.Nm wakeup_any
 .Nd wait for events
 .Sh SYNOPSIS
 .In sys/param.h
@@ -70,6 +72,8 @@
 .Fn wakeup "void *chan"
 .Ft void
 .Fn wakeup_one "void *chan"
+.Ft void
+.Fn wakeup_any "void *chan"
 .Sh DESCRIPTION
 The functions
 .Fn tsleep ,
@@ -79,8 +83,9 @@ The functions
 .Fn pause_sig ,
 .Fn pause_sbt ,
 .Fn wakeup ,
+.Fn wakeup_one ,
 and
-.Fn wakeup_one
+.Fn wakeup_any
 handle event-based thread blocking.
 If a thread must wait for an
 external event, it is put to sleep by
@@ -252,9 +257,10 @@ function is a wrapper around
 .Fn tsleep
 that suspends execution of the current thread for the indicated timeout.
 The thread can not be awakened early by signals or calls to
-.Fn wakeup
+.Fn wakeup ,
+.Fn wakeup_one
 or
-.Fn wakeup_one .
+.Fn wakeup_any .
 The
 .Fn pause_sig
 function is a variant of
@@ -263,8 +269,8 @@ which can be awakened early by signals.
 .Pp
 The
 .Fn wakeup_one
-function makes the first thread in the queue that is sleeping on the
-parameter
+function makes the first highest priority thread in the queue that is
+sleeping on the parameter
 .Fa chan
 runnable.
 This reduces the load when a large number of threads are sleeping on
@@ -292,6 +298,16 @@ to
 pay particular attention to ensure that no other threads wait on the
 same
 .Fa chan .
+.Pp
+The
+.Fn wakeup_any
+function is similar to
+.Fn wakeup_one ,
+except that it makes runnable last thread on the queue (sleeping less),
+ignoring fairness.
+It can be used when threads sleeping on the
+.Fa chan
+are known to be identical and there is no reason to be fair.
 .Pp
 If the timeout given by
 .Fa timo

Modified: head/share/man/man9/sleepqueue.9
==
--- head/share/man/man9/sleepqueue.9Thu Jun 20 00:23:51 2019
(r349219)
+++ head/share/man/man9/sleepqueue.9Thu Jun 20 01:15:33 2019
(r349220)
@@ -22,7 +22,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 22, 2014
+.Dd June 19, 2019
 .Dt SLEEPQUEUE 9
 .Os
 .Sh NAME
@@ -290,7 +290,8 @@ and
 functions.
 The
 .Fn sleepq_signal

svn commit: r349219 - stable/12/share/man/man3

2019-06-19 Thread Mark Johnston
Author: markj
Date: Thu Jun 20 00:23:51 2019
New Revision: 349219
URL: https://svnweb.freebsd.org/changeset/base/349219

Log:
  MFC r349148:
  Add some missing MLINKs for tree(3).

Modified:
  stable/12/share/man/man3/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man3/Makefile
==
--- stable/12/share/man/man3/Makefile   Wed Jun 19 21:36:00 2019
(r349218)
+++ stable/12/share/man/man3/Makefile   Thu Jun 20 00:23:51 2019
(r349219)
@@ -179,8 +179,21 @@ MLINKS+=   tree.3 RB_EMPTY.3 \
tree.3 RB_ENTRY.3 \
tree.3 RB_FIND.3 \
tree.3 RB_FOREACH.3 \
+   tree.3 RB_FOREACH_FROM.3 \
tree.3 RB_FOREACH_REVERSE.3 \
+   tree.3 RB_FOREACH_REVERSE_FROM.3 \
+   tree.3 RB_FOREACH_REVERSE_SAFE.3 \
+   tree.3 RB_FOREACH_SAFE.3 \
tree.3 RB_GENERATE.3 \
+   tree.3 RB_GENERATE_FIND.3 \
+   tree.3 RB_GENERATE_INSERT.3 \
+   tree.3 RB_GENERATE_INSERT_COLOR.3 \
+   tree.3 RB_GENERATE_MINMAX.3 \
+   tree.3 RB_GENERATE_NEXT.3 \
+   tree.3 RB_GENERATE_NFIND.3 \
+   tree.3 RB_GENERATE_PREV.3 \
+   tree.3 RB_GENERATE_REMOVE.3 \
+   tree.3 RB_GENERATE_REMOVE_COLOR.3 \
tree.3 RB_GENERATE_STATIC.3 \
tree.3 RB_HEAD.3 \
tree.3 RB_INIT.3 \
@@ -194,6 +207,15 @@ MLINKS+=   tree.3 RB_EMPTY.3 \
tree.3 RB_PARENT.3 \
tree.3 RB_PREV.3 \
tree.3 RB_PROTOTYPE.3 \
+   tree.3 RB_PROTOTYPE_FIND.3 \
+   tree.3 RB_PROTOTYPE_INSERT.3 \
+   tree.3 RB_PROTOTYPE_INSERT_COLOR.3 \
+   tree.3 RB_PROTOTYPE_MINMAX.3 \
+   tree.3 RB_PROTOTYPE_NEXT.3 \
+   tree.3 RB_PROTOTYPE_NFIND.3 \
+   tree.3 RB_PROTOTYPE_PREV.3 \
+   tree.3 RB_PROTOTYPE_REMOVE.3 \
+   tree.3 RB_PROTOTYPE_REMOVE_COLOR.3 \
tree.3 RB_PROTOTYPE_STATIC.3 \
tree.3 RB_REMOVE.3 \
tree.3 RB_RIGHT.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: r349218 - head/sys/vm

2019-06-19 Thread Mark Johnston
Author: markj
Date: Wed Jun 19 21:36:00 2019
New Revision: 349218
URL: https://svnweb.freebsd.org/changeset/base/349218

Log:
  Group vm_page_activate()'s definition with other related functions.
  
  No functional change intended.
  
  MFC after:3 days

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Wed Jun 19 21:10:13 2019(r349217)
+++ head/sys/vm/vm_page.c   Wed Jun 19 21:36:00 2019(r349218)
@@ -3401,35 +3401,6 @@ vm_page_requeue(vm_page_t m)
 }
 
 /*
- * vm_page_activate:
- *
- * Put the specified page on the active list (if appropriate).
- * Ensure that act_count is at least ACT_INIT but do not otherwise
- * mess with it.
- *
- * The page must be locked.
- */
-void
-vm_page_activate(vm_page_t m)
-{
-
-   vm_page_assert_locked(m);
-
-   if (vm_page_wired(m) || (m->oflags & VPO_UNMANAGED) != 0)
-   return;
-   if (vm_page_queue(m) == PQ_ACTIVE) {
-   if (m->act_count < ACT_INIT)
-   m->act_count = ACT_INIT;
-   return;
-   }
-
-   vm_page_dequeue(m);
-   if (m->act_count < ACT_INIT)
-   m->act_count = ACT_INIT;
-   vm_page_enqueue(m, PQ_ACTIVE);
-}
-
-/*
  * vm_page_free_prep:
  *
  * Prepares the given page to be put on the free list,
@@ -3677,6 +3648,35 @@ vm_page_unwire_noq(vm_page_t m)
return (true);
} else
return (false);
+}
+
+/*
+ * vm_page_activate:
+ *
+ * Put the specified page on the active list (if appropriate).
+ * Ensure that act_count is at least ACT_INIT but do not otherwise
+ * mess with it.
+ *
+ * The page must be locked.
+ */
+void
+vm_page_activate(vm_page_t m)
+{
+
+   vm_page_assert_locked(m);
+
+   if (vm_page_wired(m) || (m->oflags & VPO_UNMANAGED) != 0)
+   return;
+   if (vm_page_queue(m) == PQ_ACTIVE) {
+   if (m->act_count < ACT_INIT)
+   m->act_count = ACT_INIT;
+   return;
+   }
+
+   vm_page_dequeue(m);
+   if (m->act_count < ACT_INIT)
+   m->act_count = ACT_INIT;
+   vm_page_enqueue(m, PQ_ACTIVE);
 }
 
 /*
___
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: r349217 - head/stand/libsa/zfs

2019-06-19 Thread Matt Macy
Author: mmacy
Date: Wed Jun 19 21:10:13 2019
New Revision: 349217
URL: https://svnweb.freebsd.org/changeset/base/349217

Log:
  Tell loader to ignore newer features enabled on the root pool.
  
  There are many new features in ZoF. Most, if not all, do not effect read only 
usage.
  Encryption in particular is enabled at the pool level but used at the dataset 
level.
  The loader obviously will not be able to boot if the boot dataset is 
encrypted, but
  should not care if some other dataset in the root pool is encrypted.
  
  Reviewed by:  allanjude
  MFC after:1 week

Modified:
  head/stand/libsa/zfs/zfsimpl.c

Modified: head/stand/libsa/zfs/zfsimpl.c
==
--- head/stand/libsa/zfs/zfsimpl.c  Wed Jun 19 20:29:02 2019
(r349216)
+++ head/stand/libsa/zfs/zfsimpl.c  Wed Jun 19 21:10:13 2019
(r349217)
@@ -64,6 +64,12 @@ static const char *features_for_read[] = {
"org.illumos:skein",
"org.zfsonlinux:large_dnode",
"com.joyent:multi_vdev_crash_dump",
+   "com.delphix:spacemap_histogram",
+   "com.delphix:zpool_checkpoint",
+   "com.delphix:spacemap_v2",
+   "com.datto:encryption",
+   "org.zfsonlinux:allocation_classes",
+   "com.datto:resilver_defer",
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: r349216 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:29:02 2019
New Revision: 349216
URL: https://svnweb.freebsd.org/changeset/base/349216

Log:
  MFC r348772: Restore ARC MFU/MRU pressure
  
  Submitted by: Slawa Olhovchenkov 
  Sponsored by: Integros [integros.com]

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Wed Jun 
19 20:27:31 2019(r349215)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Wed Jun 
19 20:29:02 2019(r349216)
@@ -1483,14 +1483,14 @@ static kmutex_t l2arc_feed_thr_lock;
 static kcondvar_t l2arc_feed_thr_cv;
 static uint8_t l2arc_thread_exit;
 
-static abd_t *arc_get_data_abd(arc_buf_hdr_t *, uint64_t, void *);
+static abd_t *arc_get_data_abd(arc_buf_hdr_t *, uint64_t, void *, boolean_t);
 static void *arc_get_data_buf(arc_buf_hdr_t *, uint64_t, void *);
-static void arc_get_data_impl(arc_buf_hdr_t *, uint64_t, void *);
+static void arc_get_data_impl(arc_buf_hdr_t *, uint64_t, void *, boolean_t);
 static void arc_free_data_abd(arc_buf_hdr_t *, abd_t *, uint64_t, void *);
 static void arc_free_data_buf(arc_buf_hdr_t *, void *, uint64_t, void *);
 static void arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag);
 static void arc_hdr_free_pabd(arc_buf_hdr_t *);
-static void arc_hdr_alloc_pabd(arc_buf_hdr_t *);
+static void arc_hdr_alloc_pabd(arc_buf_hdr_t *, boolean_t);
 static void arc_access(arc_buf_hdr_t *, kmutex_t *);
 static boolean_t arc_is_overflowing();
 static void arc_buf_watch(arc_buf_t *);
@@ -3214,14 +3214,14 @@ arc_buf_destroy_impl(arc_buf_t *buf)
 }
 
 static void
-arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr)
+arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr, boolean_t do_adapt)
 {
ASSERT3U(HDR_GET_LSIZE(hdr), >, 0);
ASSERT(HDR_HAS_L1HDR(hdr));
ASSERT(!HDR_SHARED_DATA(hdr));
 
ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL);
-   hdr->b_l1hdr.b_pabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr);
+   hdr->b_l1hdr.b_pabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr, 
do_adapt);
hdr->b_l1hdr.b_byteswap = DMU_BSWAP_NUMFUNCS;
ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
 
@@ -3285,7 +3285,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsi
 * the compressed or uncompressed data depending on the block
 * it references and compressed arc enablement.
 */
-   arc_hdr_alloc_pabd(hdr);
+   arc_hdr_alloc_pabd(hdr, B_TRUE);
ASSERT(refcount_is_zero(>b_l1hdr.b_refcnt));
 
return (hdr);
@@ -4850,11 +4850,11 @@ arc_is_overflowing(void)
 }
 
 static abd_t *
-arc_get_data_abd(arc_buf_hdr_t *hdr, uint64_t size, void *tag)
+arc_get_data_abd(arc_buf_hdr_t *hdr, uint64_t size, void *tag, boolean_t 
do_adapt)
 {
arc_buf_contents_t type = arc_buf_type(hdr);
 
-   arc_get_data_impl(hdr, size, tag);
+   arc_get_data_impl(hdr, size, tag, do_adapt);
if (type == ARC_BUFC_METADATA) {
return (abd_alloc(size, B_TRUE));
} else {
@@ -4868,7 +4868,7 @@ arc_get_data_buf(arc_buf_hdr_t *hdr, uint64_t size, vo
 {
arc_buf_contents_t type = arc_buf_type(hdr);
 
-   arc_get_data_impl(hdr, size, tag);
+   arc_get_data_impl(hdr, size, tag, B_TRUE);
if (type == ARC_BUFC_METADATA) {
return (zio_buf_alloc(size));
} else {
@@ -4884,12 +4884,13 @@ arc_get_data_buf(arc_buf_hdr_t *hdr, uint64_t size, vo
  * limit, we'll only signal the reclaim thread and continue on.
  */
 static void
-arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag)
+arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag, boolean_t 
do_adapt)
 {
arc_state_t *state = hdr->b_l1hdr.b_state;
arc_buf_contents_t type = arc_buf_type(hdr);
 
-   arc_adapt(size, state);
+   if (do_adapt)
+   arc_adapt(size, state);
 
/*
 * If arc_size is currently overflowing, and has grown past our
@@ -5636,8 +5637,9 @@ top:
 * do this after we've called arc_access() to
 * avoid hitting an assert in remove_reference().
 */
+   arc_adapt(arc_hdr_size(hdr), hdr->b_l1hdr.b_state);
arc_access(hdr, hash_lock);
-   arc_hdr_alloc_pabd(hdr);
+   arc_hdr_alloc_pabd(hdr, B_FALSE);
}
ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
size = arc_hdr_size(hdr);
@@ -6013,7 +6015,7 @@ arc_release(arc_buf_t *buf, void *tag)
if (arc_can_share(hdr, lastbuf)) {
arc_share_buf(hdr, lastbuf);
} else {
-   

svn commit: r349215 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:27:31 2019
New Revision: 349215
URL: https://svnweb.freebsd.org/changeset/base/349215

Log:
  MFC r348772: Restore ARC MFU/MRU pressure
  
  Submitted by: Slawa Olhovchenkov 
  Sponsored by: Integros [integros.com]

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Wed Jun 
19 20:21:34 2019(r349214)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Wed Jun 
19 20:27:31 2019(r349215)
@@ -1571,14 +1571,14 @@ static kmutex_t l2arc_feed_thr_lock;
 static kcondvar_t l2arc_feed_thr_cv;
 static uint8_t l2arc_thread_exit;
 
-static abd_t *arc_get_data_abd(arc_buf_hdr_t *, uint64_t, void *);
+static abd_t *arc_get_data_abd(arc_buf_hdr_t *, uint64_t, void *, boolean_t);
 static void *arc_get_data_buf(arc_buf_hdr_t *, uint64_t, void *);
-static void arc_get_data_impl(arc_buf_hdr_t *, uint64_t, void *);
+static void arc_get_data_impl(arc_buf_hdr_t *, uint64_t, void *, boolean_t);
 static void arc_free_data_abd(arc_buf_hdr_t *, abd_t *, uint64_t, void *);
 static void arc_free_data_buf(arc_buf_hdr_t *, void *, uint64_t, void *);
 static void arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag);
 static void arc_hdr_free_pabd(arc_buf_hdr_t *);
-static void arc_hdr_alloc_pabd(arc_buf_hdr_t *);
+static void arc_hdr_alloc_pabd(arc_buf_hdr_t *, boolean_t);
 static void arc_access(arc_buf_hdr_t *, kmutex_t *);
 static boolean_t arc_is_overflowing();
 static void arc_buf_watch(arc_buf_t *);
@@ -3364,14 +3364,14 @@ arc_buf_destroy_impl(arc_buf_t *buf)
 }
 
 static void
-arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr)
+arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr, boolean_t do_adapt)
 {
ASSERT3U(HDR_GET_LSIZE(hdr), >, 0);
ASSERT(HDR_HAS_L1HDR(hdr));
ASSERT(!HDR_SHARED_DATA(hdr));
 
ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL);
-   hdr->b_l1hdr.b_pabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr);
+   hdr->b_l1hdr.b_pabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr, 
do_adapt);
hdr->b_l1hdr.b_byteswap = DMU_BSWAP_NUMFUNCS;
ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
 
@@ -3435,7 +3435,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsi
 * the compressed or uncompressed data depending on the block
 * it references and compressed arc enablement.
 */
-   arc_hdr_alloc_pabd(hdr);
+   arc_hdr_alloc_pabd(hdr, B_TRUE);
ASSERT(refcount_is_zero(>b_l1hdr.b_refcnt));
 
return (hdr);
@@ -5156,11 +5156,11 @@ arc_is_overflowing(void)
 }
 
 static abd_t *
-arc_get_data_abd(arc_buf_hdr_t *hdr, uint64_t size, void *tag)
+arc_get_data_abd(arc_buf_hdr_t *hdr, uint64_t size, void *tag, boolean_t 
do_adapt)
 {
arc_buf_contents_t type = arc_buf_type(hdr);
 
-   arc_get_data_impl(hdr, size, tag);
+   arc_get_data_impl(hdr, size, tag, do_adapt);
if (type == ARC_BUFC_METADATA) {
return (abd_alloc(size, B_TRUE));
} else {
@@ -5174,7 +5174,7 @@ arc_get_data_buf(arc_buf_hdr_t *hdr, uint64_t size, vo
 {
arc_buf_contents_t type = arc_buf_type(hdr);
 
-   arc_get_data_impl(hdr, size, tag);
+   arc_get_data_impl(hdr, size, tag, B_TRUE);
if (type == ARC_BUFC_METADATA) {
return (zio_buf_alloc(size));
} else {
@@ -5190,12 +5190,13 @@ arc_get_data_buf(arc_buf_hdr_t *hdr, uint64_t size, vo
  * limit, we'll only signal the reclaim thread and continue on.
  */
 static void
-arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag)
+arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag, boolean_t 
do_adapt)
 {
arc_state_t *state = hdr->b_l1hdr.b_state;
arc_buf_contents_t type = arc_buf_type(hdr);
 
-   arc_adapt(size, state);
+   if (do_adapt)
+   arc_adapt(size, state);
 
/*
 * If arc_size is currently overflowing, and has grown past our
@@ -5946,8 +5947,9 @@ top:
 * do this after we've called arc_access() to
 * avoid hitting an assert in remove_reference().
 */
+   arc_adapt(arc_hdr_size(hdr), hdr->b_l1hdr.b_state);
arc_access(hdr, hash_lock);
-   arc_hdr_alloc_pabd(hdr);
+   arc_hdr_alloc_pabd(hdr, B_FALSE);
}
ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
size = arc_hdr_size(hdr);
@@ -6361,7 +6363,7 @@ arc_release(arc_buf_t *buf, void *tag)
if (arc_can_share(hdr, lastbuf)) {
arc_share_buf(hdr, lastbuf);
} else {
-   

svn commit: r349214 - stable/11/sys/dev/amdgpio

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:21:34 2019
New Revision: 349214
URL: https://svnweb.freebsd.org/changeset/base/349214

Log:
  MFC r348228: amdgpio: fix reading status of input pins

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

Modified: stable/11/sys/dev/amdgpio/amdgpio.c
==
--- stable/11/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:20:02 2019
(r349213)
+++ stable/11/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:21:34 2019
(r349214)
@@ -264,10 +264,17 @@ amdgpio_pin_get(device_t dev, uint32_t pin, unsigned i
reg = AMDGPIO_PIN_REGISTER(pin);
val = amdgpio_read_4(sc, reg);
 
-   if (val & BIT(OUTPUT_VALUE_OFF))
-   *value = GPIO_PIN_HIGH;
-   else
-   *value = GPIO_PIN_LOW;
+   if ((sc->sc_gpio_pins[pin].gp_flags & GPIO_PIN_OUTPUT) != 0) {
+   if (val & BIT(OUTPUT_VALUE_OFF))
+   *value = GPIO_PIN_HIGH;
+   else
+   *value = GPIO_PIN_LOW;
+   } else {
+   if (val & BIT(PIN_STS_OFF))
+   *value = GPIO_PIN_HIGH;
+   else
+   *value = GPIO_PIN_LOW;
+   }
 
dprintf("pin %d value 0x%x\n", pin, *value);
 
___
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: r349213 - stable/12/sys/dev/amdgpio

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:20:02 2019
New Revision: 349213
URL: https://svnweb.freebsd.org/changeset/base/349213

Log:
  MFC r348228: amdgpio: fix reading status of input pins

Modified:
  stable/12/sys/dev/amdgpio/amdgpio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/amdgpio/amdgpio.c
==
--- stable/12/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:18:49 2019
(r349212)
+++ stable/12/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:20:02 2019
(r349213)
@@ -264,10 +264,17 @@ amdgpio_pin_get(device_t dev, uint32_t pin, unsigned i
reg = AMDGPIO_PIN_REGISTER(pin);
val = amdgpio_read_4(sc, reg);
 
-   if (val & BIT(OUTPUT_VALUE_OFF))
-   *value = GPIO_PIN_HIGH;
-   else
-   *value = GPIO_PIN_LOW;
+   if ((sc->sc_gpio_pins[pin].gp_flags & GPIO_PIN_OUTPUT) != 0) {
+   if (val & BIT(OUTPUT_VALUE_OFF))
+   *value = GPIO_PIN_HIGH;
+   else
+   *value = GPIO_PIN_LOW;
+   } else {
+   if (val & BIT(PIN_STS_OFF))
+   *value = GPIO_PIN_HIGH;
+   else
+   *value = GPIO_PIN_LOW;
+   }
 
dprintf("pin %d value 0x%x\n", pin, *value);
 
___
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: r349212 - stable/11/sys/dev/amdgpio

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:18:49 2019
New Revision: 349212
URL: https://svnweb.freebsd.org/changeset/base/349212

Log:
  FC r348227: amdgpio: remove new line symbols from pin names

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

Modified: stable/11/sys/dev/amdgpio/amdgpio.c
==
--- stable/11/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:18:34 2019
(r349211)
+++ stable/11/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:18:49 2019
(r349212)
@@ -383,7 +383,7 @@ amdgpio_attach(device_t dev)
/* Initialize all possible pins to be Invalid */
for (i = 0; i < AMD_GPIO_PINS_MAX ; i++) {
snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,
-   "Unexposed PIN %d\n", i);
+   "Unexposed PIN %d", i);
sc->sc_gpio_pins[i].gp_pin = -1;
sc->sc_gpio_pins[i].gp_caps = 0;
sc->sc_gpio_pins[i].gp_flags = 0;
@@ -393,12 +393,13 @@ amdgpio_attach(device_t dev)
for (i = 0; i < AMD_GPIO_PINS_EXPOSED ; i++) {
pin = kernzp_pins[i].pin_num;
bank = pin/AMD_GPIO_PINS_PER_BANK;
-   snprintf(sc->sc_gpio_pins[pin].gp_name, GPIOMAXNAME, 
"%s%d_%s\n",
+   snprintf(sc->sc_gpio_pins[pin].gp_name, GPIOMAXNAME, "%s%d_%s",
AMD_GPIO_PREFIX, bank, kernzp_pins[i].pin_name);
sc->sc_gpio_pins[pin].gp_pin = pin;
sc->sc_gpio_pins[pin].gp_caps = AMDGPIO_DEFAULT_CAPS;
-   sc->sc_gpio_pins[pin].gp_flags = (amdgpio_is_pin_output(sc, 
pin)?
-   GPIO_PIN_OUTPUT : 
GPIO_PIN_INPUT);
+   sc->sc_gpio_pins[pin].gp_flags =
+   amdgpio_is_pin_output(sc, pin) ?
+   GPIO_PIN_OUTPUT : GPIO_PIN_INPUT;
}
 
sc->sc_busdev = gpiobus_attach_bus(dev);
___
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: r349211 - stable/12/sys/dev/amdgpio

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:18:34 2019
New Revision: 349211
URL: https://svnweb.freebsd.org/changeset/base/349211

Log:
  MFC r348227: amdgpio: remove new line symbols from pin names

Modified:
  stable/12/sys/dev/amdgpio/amdgpio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/amdgpio/amdgpio.c
==
--- stable/12/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:16:42 2019
(r349210)
+++ stable/12/sys/dev/amdgpio/amdgpio.c Wed Jun 19 20:18:34 2019
(r349211)
@@ -383,7 +383,7 @@ amdgpio_attach(device_t dev)
/* Initialize all possible pins to be Invalid */
for (i = 0; i < AMD_GPIO_PINS_MAX ; i++) {
snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,
-   "Unexposed PIN %d\n", i);
+   "Unexposed PIN %d", i);
sc->sc_gpio_pins[i].gp_pin = -1;
sc->sc_gpio_pins[i].gp_caps = 0;
sc->sc_gpio_pins[i].gp_flags = 0;
@@ -393,12 +393,13 @@ amdgpio_attach(device_t dev)
for (i = 0; i < AMD_GPIO_PINS_EXPOSED ; i++) {
pin = kernzp_pins[i].pin_num;
bank = pin/AMD_GPIO_PINS_PER_BANK;
-   snprintf(sc->sc_gpio_pins[pin].gp_name, GPIOMAXNAME, 
"%s%d_%s\n",
+   snprintf(sc->sc_gpio_pins[pin].gp_name, GPIOMAXNAME, "%s%d_%s",
AMD_GPIO_PREFIX, bank, kernzp_pins[i].pin_name);
sc->sc_gpio_pins[pin].gp_pin = pin;
sc->sc_gpio_pins[pin].gp_caps = AMDGPIO_DEFAULT_CAPS;
-   sc->sc_gpio_pins[pin].gp_flags = (amdgpio_is_pin_output(sc, 
pin)?
-   GPIO_PIN_OUTPUT : 
GPIO_PIN_INPUT);
+   sc->sc_gpio_pins[pin].gp_flags =
+   amdgpio_is_pin_output(sc, pin) ?
+   GPIO_PIN_OUTPUT : GPIO_PIN_INPUT;
}
 
sc->sc_busdev = gpiobus_attach_bus(dev);
___
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: r349210 - stable/11/sys/dev/mrsas

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:16:42 2019
New Revision: 349210
URL: https://svnweb.freebsd.org/changeset/base/349210

Log:
  MFC r348159: add mrsas_shutdown method
  
  Sponsored by: Panzura

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

Modified: stable/11/sys/dev/mrsas/mrsas.c
==
--- stable/11/sys/dev/mrsas/mrsas.c Wed Jun 19 20:15:53 2019
(r349209)
+++ stable/11/sys/dev/mrsas/mrsas.c Wed Jun 19 20:16:42 2019
(r349210)
@@ -1182,6 +1182,39 @@ mrsas_detach(device_t dev)
return (0);
 }
 
+static int
+mrsas_shutdown(device_t dev)
+{
+   struct mrsas_softc *sc;
+   int i;
+
+   sc = device_get_softc(dev);
+   sc->remove_in_progress = 1;
+   if (panicstr == NULL) {
+   if (sc->ocr_thread_active)
+   wakeup(>ocr_chan);
+   i = 0;
+   while (sc->reset_in_progress && i < 15) {
+   i++;
+   if ((i % MRSAS_RESET_NOTICE_INTERVAL) == 0) {
+   mrsas_dprint(sc, MRSAS_INFO,
+   "[%2d]waiting for OCR to be finished "
+   "from %s\n", i, __func__);
+   }
+   pause("mr_shutdown", hz);
+   }
+   if (sc->reset_in_progress) {
+   mrsas_dprint(sc, MRSAS_INFO,
+   "gave up waiting for OCR to be finished\n");
+   }
+   }
+
+   mrsas_flush_cache(sc);
+   mrsas_shutdown_ctlr(sc, MR_DCMD_CTRL_SHUTDOWN);
+   mrsas_disable_intr(sc);
+   return (0);
+}
+
 /*
  * mrsas_free_mem: Frees allocated memory
  * input:  Adapter instance soft state
@@ -5028,6 +5061,7 @@ static device_method_t mrsas_methods[] = {
DEVMETHOD(device_probe, mrsas_probe),
DEVMETHOD(device_attach, mrsas_attach),
DEVMETHOD(device_detach, mrsas_detach),
+   DEVMETHOD(device_shutdown, mrsas_shutdown),
DEVMETHOD(device_suspend, mrsas_suspend),
DEVMETHOD(device_resume, mrsas_resume),
DEVMETHOD(bus_print_child, bus_generic_print_child),
___
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: r349209 - stable/12/sys/dev/mrsas

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:15:53 2019
New Revision: 349209
URL: https://svnweb.freebsd.org/changeset/base/349209

Log:
  MFC r348159: add mrsas_shutdown method
  
  Sponsored by: Panzura

Modified:
  stable/12/sys/dev/mrsas/mrsas.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mrsas/mrsas.c
==
--- stable/12/sys/dev/mrsas/mrsas.c Wed Jun 19 20:12:00 2019
(r349208)
+++ stable/12/sys/dev/mrsas/mrsas.c Wed Jun 19 20:15:53 2019
(r349209)
@@ -1182,6 +1182,39 @@ mrsas_detach(device_t dev)
return (0);
 }
 
+static int
+mrsas_shutdown(device_t dev)
+{
+   struct mrsas_softc *sc;
+   int i;
+
+   sc = device_get_softc(dev);
+   sc->remove_in_progress = 1;
+   if (panicstr == NULL) {
+   if (sc->ocr_thread_active)
+   wakeup(>ocr_chan);
+   i = 0;
+   while (sc->reset_in_progress && i < 15) {
+   i++;
+   if ((i % MRSAS_RESET_NOTICE_INTERVAL) == 0) {
+   mrsas_dprint(sc, MRSAS_INFO,
+   "[%2d]waiting for OCR to be finished "
+   "from %s\n", i, __func__);
+   }
+   pause("mr_shutdown", hz);
+   }
+   if (sc->reset_in_progress) {
+   mrsas_dprint(sc, MRSAS_INFO,
+   "gave up waiting for OCR to be finished\n");
+   }
+   }
+
+   mrsas_flush_cache(sc);
+   mrsas_shutdown_ctlr(sc, MR_DCMD_CTRL_SHUTDOWN);
+   mrsas_disable_intr(sc);
+   return (0);
+}
+
 /*
  * mrsas_free_mem: Frees allocated memory
  * input:  Adapter instance soft state
@@ -5028,6 +5061,7 @@ static device_method_t mrsas_methods[] = {
DEVMETHOD(device_probe, mrsas_probe),
DEVMETHOD(device_attach, mrsas_attach),
DEVMETHOD(device_detach, mrsas_detach),
+   DEVMETHOD(device_shutdown, mrsas_shutdown),
DEVMETHOD(device_suspend, mrsas_suspend),
DEVMETHOD(device_resume, mrsas_resume),
DEVMETHOD(bus_print_child, bus_generic_print_child),
___
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: r349208 - in stable/11: share/man/man4 sys/dev/gpio

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:12:00 2019
New Revision: 349208
URL: https://svnweb.freebsd.org/changeset/base/349208

Log:
  MFC r348153-r348155: gpioled: add a new hint for initial state
  
  hint.gpioled.%d.state determines the initial state of the LED when the
  driver takes control over it:
0 - the LED is off
1 - the LED is on
   -1 - the LED is kept as it was
  
  While here, add a module version declaration.

Modified:
  stable/11/share/man/man4/gpioled.4
  stable/11/sys/dev/gpio/gpioled.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/gpioled.4
==
--- stable/11/share/man/man4/gpioled.4  Wed Jun 19 20:09:04 2019
(r349207)
+++ stable/11/share/man/man4/gpioled.4  Wed Jun 19 20:12:00 2019
(r349208)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 14, 2014
+.Dd May 23, 2019
 .Dt GPIOLED 4
 .Os
 .Sh NAME
@@ -71,6 +71,10 @@ to create for
 Which pin on the GPIO interface to map to this instance.
 Please note that this mask should only ever have one bit set
 (any other bits - i.e., pins - will be ignored).
+.It Va hint.gpioled.%d.state
+The initial state of the LED when the driver takes control over it.
+If set to 1 or 0, the LED will be on or off correspondingly.
+If set to -1, the LED will be kept in its original state.
 .El
 .Pp
 On a

Modified: stable/11/sys/dev/gpio/gpioled.c
==
--- stable/11/sys/dev/gpio/gpioled.cWed Jun 19 20:09:04 2019
(r349207)
+++ stable/11/sys/dev/gpio/gpioled.cWed Jun 19 20:12:00 2019
(r349208)
@@ -108,6 +108,8 @@ gpioled_attach(device_t dev)
if (resource_string_value(device_get_name(dev), 
device_get_unit(dev), "name", ))
name = NULL;
+   resource_int_value(device_get_name(dev),
+   device_get_unit(dev), "state", );
 
sc->sc_leddev = led_create_state(gpioled_control, sc, name ? name :
device_get_nameunit(dev), state);
@@ -148,3 +150,4 @@ static driver_t gpioled_driver = {
 
 DRIVER_MODULE(gpioled, gpiobus, gpioled_driver, gpioled_devclass, 0, 0);
 MODULE_DEPEND(gpioled, gpiobus, 1, 1, 1);
+MODULE_VERSION(gpioled, 1);
___
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: r349207 - stable/12/sys/dev/usb

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:09:04 2019
New Revision: 349207
URL: https://svnweb.freebsd.org/changeset/base/349207

Log:
  MFC r348152: Add USB ID for CP2112

Modified:
  stable/12/sys/dev/usb/usbdevs
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/usbdevs
==
--- stable/12/sys/dev/usb/usbdevs   Wed Jun 19 20:05:20 2019
(r349206)
+++ stable/12/sys/dev/usb/usbdevs   Wed Jun 19 20:09:04 2019
(r349207)
@@ -4343,6 +4343,7 @@ product SILABSCP210X_20xea61  CP210x Serial
 product SILABS CP210X_30xea70  CP210x Serial
 product SILABS CP210X_40xea80  CP210x Serial
 product SILABS INFINITY_MIC0xea71  Infinity GPS-MIC-1 Radio Monophone
+product SILABS CP2112  0xea90  CP2112 HID USB-to-SMBus Bridge with GPIO
 product SILABS USBSCOPE50  0xf001  USBscope50
 product SILABS USBWAVE12   0xf002  USBwave12
 product SILABS USBPULSE100 0xf003  USBpulse100
___
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: r349206 - stable/11/sys/dev/usb

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:05:20 2019
New Revision: 349206
URL: https://svnweb.freebsd.org/changeset/base/349206

Log:
  MFC r348152: Add USB ID for CP2112

Modified:
  stable/11/sys/dev/usb/usbdevs
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/usbdevs
==
--- stable/11/sys/dev/usb/usbdevs   Wed Jun 19 20:03:02 2019
(r349205)
+++ stable/11/sys/dev/usb/usbdevs   Wed Jun 19 20:05:20 2019
(r349206)
@@ -4201,6 +4201,7 @@ product SILABSCP210X_20xea61  CP210x Serial
 product SILABS CP210X_30xea70  CP210x Serial
 product SILABS CP210X_40xea80  CP210x Serial
 product SILABS INFINITY_MIC0xea71  Infinity GPS-MIC-1 Radio Monophone
+product SILABS CP2112  0xea90  CP2112 HID USB-to-SMBus Bridge with GPIO
 product SILABS USBSCOPE50  0xf001  USBscope50
 product SILABS USBWAVE12   0xf002  USBwave12
 product SILABS USBPULSE100 0xf003  USBpulse100
___
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: r349205 - stable/11/sys/dev/intpm

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:03:02 2019
New Revision: 349205
URL: https://svnweb.freebsd.org/changeset/base/349205

Log:
  MFC r345411: intpm: change translation of HBA error status to smbus(4) errors
  
  PIIX4_SMBHSTSTAT_ERR can be set for several reasons that, unfortunately,
  cannot be distinguished, but the most typical case is a missing or hung
  slave (SMB_ENOACK).
  
  PIIX4_SMBHSTSTAT_FAIL means failed or killed / aborted transaction, so
  it's previous mapping to SMB_ENOACK was not ideal.
  
  After this change an smb(4) access to a missing slave results in ENXIO
  rather than EIO.  To me, that seems to be more appropriate.

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

Modified: stable/11/sys/dev/intpm/intpm.c
==
--- stable/11/sys/dev/intpm/intpm.c Wed Jun 19 20:01:13 2019
(r349204)
+++ stable/11/sys/dev/intpm/intpm.c Wed Jun 19 20:03:02 2019
(r349205)
@@ -521,12 +521,19 @@ intsmb_error(device_t dev, int status)
 {
int error = 0;
 
+   /*
+* PIIX4_SMBHSTSTAT_ERR can mean either of
+* - SMB_ENOACK ("Unclaimed cycle"),
+* - SMB_ETIMEOUT ("Host device time-out"),
+* - SMB_EINVAL ("Illegal command field").
+* SMB_ENOACK seems to be most typical.
+*/
if (status & PIIX4_SMBHSTSTAT_ERR)
-   error |= SMB_EBUSERR;
+   error |= SMB_ENOACK;
if (status & PIIX4_SMBHSTSTAT_BUSC)
error |= SMB_ECOLLI;
if (status & PIIX4_SMBHSTSTAT_FAIL)
-   error |= SMB_ENOACK;
+   error |= SMB_EABORT;
 
if (error != 0 && bootverbose)
device_printf(dev, "error = %d, status = %#x\n", error, status);
___
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: r349204 - stable/11/cddl/contrib/opensolaris/cmd/zpool

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 20:01:13 2019
New Revision: 349204
URL: https://svnweb.freebsd.org/changeset/base/349204

Log:
  MFC r344360,r344361: zpool.8: document -D flag for zpool status
  
  Also, sort zpool status flags in the same order as in illumos manual.

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8Wed Jun 19 
19:58:43 2019(r349203)
+++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8Wed Jun 19 
20:01:13 2019(r349204)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2018
+.Dd February 20, 2019
 .Dt ZPOOL 8
 .Os
 .Sh NAME
@@ -187,7 +187,7 @@
 .Op Ar device ...
 .Nm
 .Cm status
-.Op Fl vx
+.Op Fl Dvx
 .Op Fl T Cm d Ns | Ns Cm u
 .Op Ar pool
 .Ar ...
@@ -1862,7 +1862,7 @@ section, above, for more information on the available 
 .It Xo
 .Nm
 .Cm status
-.Op Fl vx
+.Op Fl Dvx
 .Op Fl T Cm d Ns | Ns Cm u
 .Op Ar pool
 .Ar ...
@@ -1891,14 +1891,12 @@ done and the estimated time to completion. Both of the
 because the amount of data in the pool and the other workloads on the system
 can change.
 .Bl -tag -width indent
-.It Fl x
-Only display status for pools that are exhibiting errors or are otherwise
-unavailable.
-Warnings about pools not using the latest on-disk format, having non-native
-block size or disabled features will not be included.
-.It Fl v
-Displays verbose data error information, printing out a complete list of all
-data errors since the last complete pool scrub.
+.It Fl D
+Display a histogram of deduplication statistics, showing the allocated
+.Pq physically present on disk
+and referenced
+.Pq logically referenced in the pool
+block counts and sizes by reference count.
 .It Fl T Cm d Ns | Ns Cm u
 Print a timestamp.
 .Pp
@@ -1910,6 +1908,14 @@ Use modifier
 .Cm u
 for unixtime
 .Pq equals Qq Ic date +%s .
+.It Fl v
+Displays verbose data error information, printing out a complete list of all
+data errors since the last complete pool scrub.
+.It Fl x
+Only display status for pools that are exhibiting errors or are otherwise
+unavailable.
+Warnings about pools not using the latest on-disk format, having non-native
+block size or disabled features will not be included.
 .El
 .It Xo
 .Nm
___
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: r349203 - stable/11/cddl/contrib/opensolaris/lib/libzpool/common

2019-06-19 Thread Andriy Gapon
Author: avg
Date: Wed Jun 19 19:58:43 2019
New Revision: 349203
URL: https://svnweb.freebsd.org/changeset/base/349203

Log:
  MFC r344359: fix userland illumos taskq code to pass relative timeout to 
cv_timedwait
  
  Sponsored by: Panzura

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c  Wed Jun 
19 19:19:37 2019(r349202)
+++ stable/11/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c  Wed Jun 
19 19:58:43 2019(r349203)
@@ -79,8 +79,13 @@ again:   if ((t = tq->tq_freelist) != NULL && tq->tq_nal
 * immediately retry the allocation.
 */
tq->tq_maxalloc_wait++;
+#ifdef __FreeBSD__
rv = cv_timedwait(>tq_maxalloc_cv,
+   >tq_lock, hz);
+#else
+   rv = cv_timedwait(>tq_maxalloc_cv,
>tq_lock, ddi_get_lbolt() + hz);
+#endif
tq->tq_maxalloc_wait--;
if (rv > 0)
goto again; /* signaled */
___
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: r349202 - head/share/mk

2019-06-19 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 19 19:19:37 2019
New Revision: 349202
URL: https://svnweb.freebsd.org/changeset/base/349202

Log:
  Follow-up r349065: Fix .TARGET flag ambiguity with PROGS which broke MK_TESTS.
  
  X-MFC-With:   r349065
  Sponsored by: DellEMC

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkWed Jun 19 18:47:44 2019(r349201)
+++ head/share/mk/bsd.sys.mkWed Jun 19 19:19:37 2019(r349202)
@@ -234,7 +234,6 @@ DEBUG_FILES_CFLAGS?= -g
 .if ${MK_WARNS} != "no"
 CFLAGS+=   ${CWARNFLAGS:M*} ${CWARNFLAGS.${COMPILER_TYPE}}
 CFLAGS+=   ${CWARNFLAGS.${.IMPSRC:T}}
-CFLAGS+=   ${CWARNFLAGS.${.TARGET:T}}
 .endif
 
 CFLAGS+=${CFLAGS.${COMPILER_TYPE}}
@@ -245,14 +244,23 @@ AFLAGS+=  ${AFLAGS.${.TARGET:T}}
 ACFLAGS+=  ${ACFLAGS.${.IMPSRC:T}}
 ACFLAGS+=  ${ACFLAGS.${.TARGET:T}}
 CFLAGS+=   ${CFLAGS.${.IMPSRC:T}}
-CFLAGS+=   ${CFLAGS.${.TARGET:T}}
 CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
-CXXFLAGS+= ${CXXFLAGS.${.TARGET:T}}
 
 LDFLAGS+=  ${LDFLAGS.${LINKER_TYPE}}
+
+# Only allow .TARGET when not using PROGS as it has the same syntax
+# per PROG which is ambiguous with this syntax. This is only needed
+# for PROG_VARS vars.
+.if !defined(_RECURSING_PROGS)
+.if ${MK_WARNS} != "no"
+CFLAGS+=   ${CWARNFLAGS.${.TARGET:T}}
+.endif
+CFLAGS+=   ${CFLAGS.${.TARGET:T}}
+CXXFLAGS+= ${CXXFLAGS.${.TARGET:T}}
 LDFLAGS+=  ${LDFLAGS.${.TARGET:T}}
 LDADD+=${LDADD.${.TARGET:T}}
 LIBADD+=   ${LIBADD.${.TARGET:T}}
+.endif
 
 .if defined(SRCTOP)
 # Prevent rebuilding during install to support read-only objdirs.
___
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: r349201 - head/stand/efi/libefi

2019-06-19 Thread Rebecca Cran
Author: bcran
Date: Wed Jun 19 18:47:44 2019
New Revision: 349201
URL: https://svnweb.freebsd.org/changeset/base/349201

Log:
  efinet: Defer exclusively opening the network handles
  
  Don't commit to exclusive access to the network device handle by
  efinet until the loader has decided to load something through the
  network. This allows for the possibility of other users of the
  network device.
  
  Submitted by: scottph
  Reviewed by:  tsoome, emaste
  Tested by:tsoome, bcran
  Differential Revision:https://reviews.freebsd.org/D20642

Modified:
  head/stand/efi/libefi/efinet.c

Modified: head/stand/efi/libefi/efinet.c
==
--- head/stand/efi/libefi/efinet.c  Wed Jun 19 16:44:07 2019
(r349200)
+++ head/stand/efi/libefi/efinet.c  Wed Jun 19 18:47:44 2019
(r349201)
@@ -108,7 +108,25 @@ efinet_match(struct netif *nif, void *machdep_hint)
 static int
 efinet_probe(struct netif *nif, void *machdep_hint)
 {
+   EFI_SIMPLE_NETWORK *net;
+   EFI_HANDLE h;
+   EFI_STATUS status;
 
+   h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
+   /*
+* Open the network device in exclusive mode. Without this
+* we will be racing with the UEFI network stack. It will
+* pull packets off the network leading to lost packets.
+*/
+   status = BS->OpenProtocol(h, _guid, (void **),
+   IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
+   if (status != EFI_SUCCESS) {
+   printf("Unable to open network interface %d for "
+   "exclusive access: %lu\n", nif->nif_unit,
+   EFI_ERROR_CODE(status));
+   return (efi_status_to_errno(status));
+   }
+
return (0);
 }
 
@@ -269,7 +287,6 @@ efinet_dev_init()
struct netif_dif *dif;
struct netif_stats *stats;
EFI_DEVICE_PATH *devpath, *node;
-   EFI_SIMPLE_NETWORK *net;
EFI_HANDLE *handles, *handles2;
EFI_STATUS status;
UINTN sz;
@@ -304,19 +321,6 @@ efinet_dev_init()
if (DevicePathType(node) != MESSAGING_DEVICE_PATH ||
DevicePathSubType(node) != MSG_MAC_ADDR_DP)
continue;
-
-   /*
-* Open the network device in exclusive mode. Without this
-* we will be racing with the UEFI network stack. It will
-* pull packets off the network leading to lost packets.
-*/
-   status = BS->OpenProtocol(handles[i], _guid, (void **),
-   IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
-   if (status != EFI_SUCCESS) {
-   printf("Unable to open network interface %d for "
-   "exclusive access: %lu\n", i,
-   EFI_ERROR_CODE(status));
-   }
 
handles2[nifs] = handles[i];
nifs++;
___
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: r349200 - in releng/12.0: . sys/conf

2019-06-19 Thread Gordon Tetlow
Author: gordon
Date: Wed Jun 19 16:44:07 2019
New Revision: 349200
URL: https://svnweb.freebsd.org/changeset/base/349200

Log:
  Add UPDATING entries for today's release. Bump patch version.
  
  Also fix the previous UPDATING entry. MDS was an SA, not an EN.
  
  Approved by:  so

Modified:
  releng/12.0/UPDATING
  releng/12.0/sys/conf/newvers.sh

Modified: releng/12.0/UPDATING
==
--- releng/12.0/UPDATINGWed Jun 19 16:43:05 2019(r349199)
+++ releng/12.0/UPDATINGWed Jun 19 16:44:07 2019(r349200)
@@ -16,7 +16,15 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
-20190515   p5  FreeBSD-EN-19:07.mds [revised]
+20190619   p6  FreeBSD-EN-19:11.net
+   FreeBSD-SA-19:08.rack
+
+   Fix incorrect locking in networking stack [EN-19:11.net]
+
+   Add ability to limit split map entries to prevent resource exhaustion
+   in non-default RACK TCP stack [SA-19:08.rack]
+
+20190515   p5  FreeBSD-SA-19:07.mds [revised]
 
Fixed error in patch causing panic on i386 architecture. [SA-19:07.mds]
 

Modified: releng/12.0/sys/conf/newvers.sh
==
--- releng/12.0/sys/conf/newvers.sh Wed Jun 19 16:43:05 2019
(r349199)
+++ releng/12.0/sys/conf/newvers.sh Wed Jun 19 16:44:07 2019
(r349200)
@@ -46,7 +46,7 @@
 
 TYPE="FreeBSD"
 REVISION="12.0"
-BRANCH="RELEASE-p5"
+BRANCH="RELEASE-p6"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r349199 - releng/12.0/sys/netinet/tcp_stacks

2019-06-19 Thread Gordon Tetlow
Author: gordon
Date: Wed Jun 19 16:43:05 2019
New Revision: 349199
URL: https://svnweb.freebsd.org/changeset/base/349199

Log:
  Add ability to limit split map entries to prevent resource
  exhaustion in non-default RACK TCP stack.
  
  Approved by:  so
  Security:  FreeBSD-SA-19:08.rack
  Security:  CVE-2019-5599

Modified:
  releng/12.0/sys/netinet/tcp_stacks/rack.c
  releng/12.0/sys/netinet/tcp_stacks/tcp_rack.h

Modified: releng/12.0/sys/netinet/tcp_stacks/rack.c
==
--- releng/12.0/sys/netinet/tcp_stacks/rack.c   Wed Jun 19 16:41:18 2019
(r349198)
+++ releng/12.0/sys/netinet/tcp_stacks/rack.c   Wed Jun 19 16:43:05 2019
(r349199)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2016-2018
+ * Copyright (c) 2016-2019
  * Netflix Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -203,6 +203,7 @@ static int32_t rack_always_send_oldest = 0;
 static int32_t rack_sack_block_limit = 128;
 static int32_t rack_use_sack_filter = 1;
 static int32_t rack_tlp_threshold_use = TLP_USE_TWO_ONE;
+static uint32_t rack_map_split_limit = 0;  /* unlimited by default */
 
 /* Rack specific counters */
 counter_u64_t rack_badfr;
@@ -228,6 +229,8 @@ counter_u64_t rack_to_arm_tlp;
 counter_u64_t rack_to_alloc;
 counter_u64_t rack_to_alloc_hard;
 counter_u64_t rack_to_alloc_emerg;
+counter_u64_t rack_alloc_limited_conns;
+counter_u64_t rack_split_limited;
 
 counter_u64_t rack_sack_proc_all;
 counter_u64_t rack_sack_proc_short;
@@ -261,6 +264,8 @@ static void
 rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack,
 struct tcphdr *th, uint16_t nsegs, uint16_t type, int32_t recovery);
 static struct rack_sendmap *rack_alloc(struct tcp_rack *rack);
+static struct rack_sendmap *rack_alloc_limit(struct tcp_rack *rack,
+uint8_t limit_type);
 static struct rack_sendmap *
 rack_check_recovery_mode(struct tcpcb *tp,
 uint32_t tsused);
@@ -445,6 +450,8 @@ sysctl_rack_clear(SYSCTL_HANDLER_ARGS)
counter_u64_zero(rack_sack_proc_short);
counter_u64_zero(rack_sack_proc_restart);
counter_u64_zero(rack_to_alloc);
+   counter_u64_zero(rack_alloc_limited_conns);
+   counter_u64_zero(rack_split_limited);
counter_u64_zero(rack_find_high);
counter_u64_zero(rack_runt_sacks);
counter_u64_zero(rack_used_tlpmethod);
@@ -622,6 +629,11 @@ rack_init_sysctls()
OID_AUTO, "pktdelay", CTLFLAG_RW,
_pkt_delay, 1,
"Extra RACK time (in ms) besides reordering thresh");
+   SYSCTL_ADD_U32(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "split_limit", CTLFLAG_RW,
+   _map_split_limit, 0,
+   "Is there a limit on the number of map split entries 
(0=unlimited)");
SYSCTL_ADD_S32(_sysctl_ctx,
SYSCTL_CHILDREN(rack_sysctl_root),
OID_AUTO, "inc_var", CTLFLAG_RW,
@@ -757,7 +769,19 @@ rack_init_sysctls()
SYSCTL_CHILDREN(rack_sysctl_root),
OID_AUTO, "allocemerg", CTLFLAG_RD,
_to_alloc_emerg,
-   "Total alocations done from emergency cache");
+   "Total allocations done from emergency cache");
+   rack_alloc_limited_conns = counter_u64_alloc(M_WAITOK);
+   SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "alloc_limited_conns", CTLFLAG_RD,
+   _alloc_limited_conns,
+   "Connections with allocations dropped due to limit");
+   rack_split_limited = counter_u64_alloc(M_WAITOK);
+   SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "split_limited", CTLFLAG_RD,
+   _split_limited,
+   "Split allocations dropped due to limit");
rack_sack_proc_all = counter_u64_alloc(M_WAITOK);
SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
SYSCTL_CHILDREN(rack_sysctl_root),
@@ -1121,10 +1145,11 @@ rack_alloc(struct tcp_rack *rack)
 {
struct rack_sendmap *rsm;
 
-   counter_u64_add(rack_to_alloc, 1);
-   rack->r_ctl.rc_num_maps_alloced++;
rsm = uma_zalloc(rack_zone, M_NOWAIT);
if (rsm) {
+alloc_done:
+   counter_u64_add(rack_to_alloc, 1);
+   rack->r_ctl.rc_num_maps_alloced++;
return (rsm);
}
if (rack->rc_free_cnt) {
@@ -1132,14 +1157,46 @@ rack_alloc(struct tcp_rack *rack)
rsm = TAILQ_FIRST(>r_ctl.rc_free);
TAILQ_REMOVE(>r_ctl.rc_free, rsm, r_next);
rack->rc_free_cnt--;
-   return (rsm);
+   goto alloc_done;
}
return (NULL);
 }
 
+/* wrapper to allocate a sendmap entry, subject to a specific limit */
+static struct rack_sendmap *
+rack_alloc_limit(struct tcp_rack *rack, uint8_t limit_type)
+{
+   

svn commit: r349198 - releng/12.0/sys/net

2019-06-19 Thread Gordon Tetlow
Author: gordon
Date: Wed Jun 19 16:41:18 2019
New Revision: 349198
URL: https://svnweb.freebsd.org/changeset/base/349198

Log:
  Fix incorrect locking in networking stack.
  
  Approved by:  so
  Security: FreeBSD-EN-19:11.net

Modified:
  releng/12.0/sys/net/if.c
  releng/12.0/sys/net/if_var.h

Modified: releng/12.0/sys/net/if.c
==
--- releng/12.0/sys/net/if.cWed Jun 19 16:25:39 2019(r349197)
+++ releng/12.0/sys/net/if.cWed Jun 19 16:41:18 2019(r349198)
@@ -62,6 +62,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -1755,6 +1757,30 @@ if_data_copy(struct ifnet *ifp, struct if_data *ifd)
ifd->ifi_noproto = ifp->if_get_counter(ifp, IFCOUNTER_NOPROTO);
 }
 
+struct ifnet_read_lock {
+   struct mtx mtx; /* lock protecting tracker below */
+   struct epoch_tracker et;
+};
+
+DPCPU_DEFINE_STATIC(struct ifnet_read_lock, ifnet_addr_read_lock);
+DPCPU_DEFINE_STATIC(struct ifnet_read_lock, ifnet_maddr_read_lock);
+
+static void
+ifnet_read_lock_init(void __unused *arg)
+{
+   struct ifnet_read_lock *pifrl;
+   int cpu;
+
+   CPU_FOREACH(cpu) {
+   pifrl = DPCPU_ID_PTR(cpu, ifnet_addr_read_lock);
+   mtx_init(>mtx, "ifnet_addr_read_lock", NULL, MTX_DEF);
+
+   pifrl = DPCPU_ID_PTR(cpu, ifnet_maddr_read_lock);
+   mtx_init(>mtx, "ifnet_maddr_read_lock", NULL, MTX_DEF);
+   }
+}
+SYSINIT(ifnet_read_lock_init, SI_SUB_CPU + 1, SI_ORDER_FIRST, 
_read_lock_init, NULL);
+
 /*
  * Wrapper functions for struct ifnet address list locking macros.  These are
  * used by kernel modules to avoid encoding programming interface or binary
@@ -1764,35 +1790,47 @@ if_data_copy(struct ifnet *ifp, struct if_data *ifd)
 void
 if_addr_rlock(struct ifnet *ifp)
 {
-   MPASS(*(uint64_t *)>if_addr_et == 0);
-   epoch_enter_preempt(net_epoch_preempt, >if_addr_et);
+   struct ifnet_read_lock *pifrl;
+
+   sched_pin();
+   pifrl = DPCPU_PTR(ifnet_addr_read_lock);
+   mtx_lock(>mtx);
+   epoch_enter_preempt(net_epoch_preempt, >et);
 }
 
 void
 if_addr_runlock(struct ifnet *ifp)
 {
-   epoch_exit_preempt(net_epoch_preempt, >if_addr_et);
-#ifdef INVARIANTS
-   bzero(>if_addr_et, sizeof(struct epoch_tracker));
-#endif
+   struct ifnet_read_lock *pifrl;
+
+   pifrl = DPCPU_PTR(ifnet_addr_read_lock);
+
+   epoch_exit_preempt(net_epoch_preempt, >et);
+   mtx_unlock(>mtx);
+   sched_unpin();
 }
 
 void
 if_maddr_rlock(if_t ifp)
 {
+   struct ifnet_read_lock *pifrl;
 
-   MPASS(*(uint64_t *)>if_maddr_et == 0);
-   epoch_enter_preempt(net_epoch_preempt, >if_maddr_et);
+   sched_pin();
+   pifrl = DPCPU_PTR(ifnet_maddr_read_lock);
+   mtx_lock(>mtx);
+   epoch_enter_preempt(net_epoch_preempt, >et);
 }
 
 void
 if_maddr_runlock(if_t ifp)
 {
+   struct ifnet_read_lock *pifrl;
 
-   epoch_exit_preempt(net_epoch_preempt, >if_maddr_et);
-#ifdef INVARIANTS
-   bzero(>if_maddr_et, sizeof(struct epoch_tracker));
-#endif
+   pifrl = DPCPU_PTR(ifnet_maddr_read_lock);
+
+   epoch_exit_preempt(net_epoch_preempt, >et);
+   mtx_unlock(>mtx);
+   sched_unpin();
 }
 
 /*

Modified: releng/12.0/sys/net/if_var.h
==
--- releng/12.0/sys/net/if_var.hWed Jun 19 16:25:39 2019
(r349197)
+++ releng/12.0/sys/net/if_var.hWed Jun 19 16:41:18 2019
(r349198)
@@ -381,8 +381,7 @@ struct ifnet {
 */
struct netdump_methods *if_netdump_methods;
struct epoch_contextif_epoch_ctx;
-   struct epoch_trackerif_addr_et;
-   struct epoch_trackerif_maddr_et;
+   void   *if_unused[4];
 
/*
 * Spare fields to be added before branching a stable branch, so
___
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: r349197 - stable/12/sys/netinet/tcp_stacks

2019-06-19 Thread Jonathan T. Looney
Author: jtl
Date: Wed Jun 19 16:25:39 2019
New Revision: 349197
URL: https://svnweb.freebsd.org/changeset/base/349197

Log:
  MFC r349192:
Add the ability to limit how much the code will fragment the RACK send map
in response to SACKs. The default behavior is unchanged; however, the
limit can be activated by changing the new net.inet.tcp.rack.split_limit
sysctl.
  
  Approved by:  so (gordon)
  Security: CVE-2019-5599

Modified:
  stable/12/sys/netinet/tcp_stacks/rack.c
  stable/12/sys/netinet/tcp_stacks/tcp_rack.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_stacks/rack.c
==
--- stable/12/sys/netinet/tcp_stacks/rack.c Wed Jun 19 16:09:20 2019
(r349196)
+++ stable/12/sys/netinet/tcp_stacks/rack.c Wed Jun 19 16:25:39 2019
(r349197)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2016-2018
- * Netflix Inc.  All rights reserved.
+ * Copyright (c) 2016-2019 Netflix, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -203,6 +202,7 @@ static int32_t rack_always_send_oldest = 0;
 static int32_t rack_sack_block_limit = 128;
 static int32_t rack_use_sack_filter = 1;
 static int32_t rack_tlp_threshold_use = TLP_USE_TWO_ONE;
+static uint32_t rack_map_split_limit = 0;  /* unlimited by default */
 
 /* Rack specific counters */
 counter_u64_t rack_badfr;
@@ -228,6 +228,8 @@ counter_u64_t rack_to_arm_tlp;
 counter_u64_t rack_to_alloc;
 counter_u64_t rack_to_alloc_hard;
 counter_u64_t rack_to_alloc_emerg;
+counter_u64_t rack_alloc_limited_conns;
+counter_u64_t rack_split_limited;
 
 counter_u64_t rack_sack_proc_all;
 counter_u64_t rack_sack_proc_short;
@@ -261,6 +263,8 @@ static void
 rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack,
 struct tcphdr *th, uint16_t nsegs, uint16_t type, int32_t recovery);
 static struct rack_sendmap *rack_alloc(struct tcp_rack *rack);
+static struct rack_sendmap *rack_alloc_limit(struct tcp_rack *rack,
+uint8_t limit_type);
 static struct rack_sendmap *
 rack_check_recovery_mode(struct tcpcb *tp,
 uint32_t tsused);
@@ -445,6 +449,8 @@ sysctl_rack_clear(SYSCTL_HANDLER_ARGS)
counter_u64_zero(rack_sack_proc_short);
counter_u64_zero(rack_sack_proc_restart);
counter_u64_zero(rack_to_alloc);
+   counter_u64_zero(rack_alloc_limited_conns);
+   counter_u64_zero(rack_split_limited);
counter_u64_zero(rack_find_high);
counter_u64_zero(rack_runt_sacks);
counter_u64_zero(rack_used_tlpmethod);
@@ -622,6 +628,11 @@ rack_init_sysctls()
OID_AUTO, "pktdelay", CTLFLAG_RW,
_pkt_delay, 1,
"Extra RACK time (in ms) besides reordering thresh");
+   SYSCTL_ADD_U32(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "split_limit", CTLFLAG_RW,
+   _map_split_limit, 0,
+   "Is there a limit on the number of map split entries 
(0=unlimited)");
SYSCTL_ADD_S32(_sysctl_ctx,
SYSCTL_CHILDREN(rack_sysctl_root),
OID_AUTO, "inc_var", CTLFLAG_RW,
@@ -757,7 +768,19 @@ rack_init_sysctls()
SYSCTL_CHILDREN(rack_sysctl_root),
OID_AUTO, "allocemerg", CTLFLAG_RD,
_to_alloc_emerg,
-   "Total alocations done from emergency cache");
+   "Total allocations done from emergency cache");
+   rack_alloc_limited_conns = counter_u64_alloc(M_WAITOK);
+   SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "alloc_limited_conns", CTLFLAG_RD,
+   _alloc_limited_conns,
+   "Connections with allocations dropped due to limit");
+   rack_split_limited = counter_u64_alloc(M_WAITOK);
+   SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "split_limited", CTLFLAG_RD,
+   _split_limited,
+   "Split allocations dropped due to limit");
rack_sack_proc_all = counter_u64_alloc(M_WAITOK);
SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
SYSCTL_CHILDREN(rack_sysctl_root),
@@ -1121,10 +1144,11 @@ rack_alloc(struct tcp_rack *rack)
 {
struct rack_sendmap *rsm;
 
-   counter_u64_add(rack_to_alloc, 1);
-   rack->r_ctl.rc_num_maps_alloced++;
rsm = uma_zalloc(rack_zone, M_NOWAIT);
if (rsm) {
+alloc_done:
+   counter_u64_add(rack_to_alloc, 1);
+   rack->r_ctl.rc_num_maps_alloced++;
return (rsm);
}
if (rack->rc_free_cnt) {
@@ -1132,14 +1156,46 @@ rack_alloc(struct tcp_rack *rack)
rsm = TAILQ_FIRST(>r_ctl.rc_free);
TAILQ_REMOVE(>r_ctl.rc_free, rsm, r_next);
rack->rc_free_cnt--;
-   return 

svn commit: r349196 - head/usr.sbin/bhyve

2019-06-19 Thread Mark Johnston
Author: markj
Date: Wed Jun 19 16:09:20 2019
New Revision: 349196
URL: https://svnweb.freebsd.org/changeset/base/349196

Log:
  Make zlib encoding messages idempotent.
  
  Otherwise duplicate messages can trigger a reinitialization of the
  compression stream while the update thread is running.  Also ensure
  that the stream is initialized before the update thread may attempt
  to use it.
  
  PR:   238333
  Reviewed by:  cem, rgrimes
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20673

Modified:
  head/usr.sbin/bhyve/rfb.c

Modified: head/usr.sbin/bhyve/rfb.c
==
--- head/usr.sbin/bhyve/rfb.c   Wed Jun 19 15:36:02 2019(r349195)
+++ head/usr.sbin/bhyve/rfb.c   Wed Jun 19 16:09:20 2019(r349196)
@@ -273,8 +273,10 @@ rfb_recv_set_encodings_msg(struct rfb_softc *rc, int c
rc->enc_raw_ok = true;
break;
case RFB_ENCODING_ZLIB:
-   rc->enc_zlib_ok = true;
-   deflateInit(>zstream, Z_BEST_SPEED);
+   if (!rc->enc_zlib_ok) {
+   deflateInit(>zstream, Z_BEST_SPEED);
+   rc->enc_zlib_ok = true;
+   }
break;
case RFB_ENCODING_RESIZE:
rc->enc_resize_ok = true;
___
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: r349195 - in head/sys: geom geom/concat geom/eli geom/journal geom/mirror geom/multipath geom/part geom/raid geom/raid3 geom/stripe kern

2019-06-19 Thread Alexander Motin
Author: mav
Date: Wed Jun 19 15:36:02 2019
New Revision: 349195
URL: https://svnweb.freebsd.org/changeset/base/349195

Log:
  Use sbuf_cat() in GEOM confxml generation.
  
  When it comes to megabytes of text, difference between sbuf_printf() and
  sbuf_cat() becomes substantial.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/geom/concat/g_concat.c
  head/sys/geom/eli/g_eli.c
  head/sys/geom/geom_disk.c
  head/sys/geom/geom_dump.c
  head/sys/geom/geom_int.h
  head/sys/geom/journal/g_journal.c
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/multipath/g_multipath.c
  head/sys/geom/part/g_part_apm.c
  head/sys/geom/part/g_part_bsd64.c
  head/sys/geom/part/g_part_gpt.c
  head/sys/geom/part/g_part_mbr.c
  head/sys/geom/raid/g_raid.c
  head/sys/geom/raid3/g_raid3.c
  head/sys/geom/stripe/g_stripe.c
  head/sys/kern/kern_uuid.c

Modified: head/sys/geom/concat/g_concat.c
==
--- head/sys/geom/concat/g_concat.c Wed Jun 19 15:26:52 2019
(r349194)
+++ head/sys/geom/concat/g_concat.c Wed Jun 19 15:36:02 2019
(r349195)
@@ -1004,24 +1004,24 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent,
sbuf_printf(sb, "%s", indent);
switch (sc->sc_type) {
case G_CONCAT_TYPE_AUTOMATIC:
-   sbuf_printf(sb, "AUTOMATIC");
+   sbuf_cat(sb, "AUTOMATIC");
break;
case G_CONCAT_TYPE_MANUAL:
-   sbuf_printf(sb, "MANUAL");
+   sbuf_cat(sb, "MANUAL");
break;
default:
-   sbuf_printf(sb, "UNKNOWN");
+   sbuf_cat(sb, "UNKNOWN");
break;
}
-   sbuf_printf(sb, "\n");
+   sbuf_cat(sb, "\n");
sbuf_printf(sb, "%sTotal=%u, Online=%u\n",
indent, sc->sc_ndisks, g_concat_nvalid(sc));
sbuf_printf(sb, "%s", indent);
if (sc->sc_provider != NULL && sc->sc_provider->error == 0)
-   sbuf_printf(sb, "UP");
+   sbuf_cat(sb, "UP");
else
-   sbuf_printf(sb, "DOWN");
-   sbuf_printf(sb, "\n");
+   sbuf_cat(sb, "DOWN");
+   sbuf_cat(sb, "\n");
}
 }
 

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Wed Jun 19 15:26:52 2019(r349194)
+++ head/sys/geom/eli/g_eli.c   Wed Jun 19 15:36:02 2019(r349195)
@@ -1328,17 +1328,17 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st
(uintmax_t)sc->sc_ekeys_allocated);
sbuf_printf(sb, "%s", indent);
if (sc->sc_flags == 0)
-   sbuf_printf(sb, "NONE");
+   sbuf_cat(sb, "NONE");
else {
int first = 1;
 
 #define ADD_FLAG(flag, name)   do {\
if (sc->sc_flags & (flag)) {\
if (!first) \
-   sbuf_printf(sb, ", ");  \
+   sbuf_cat(sb, ", "); \
else\
first = 0;  \
-   sbuf_printf(sb, name);  \
+   sbuf_cat(sb, name); \
}   \
 } while (0)
ADD_FLAG(G_ELI_FLAG_SUSPEND, "SUSPEND");
@@ -1358,7 +1358,7 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st
ADD_FLAG(G_ELI_FLAG_AUTORESIZE, "AUTORESIZE");
 #undef  ADD_FLAG
}
-   sbuf_printf(sb, "\n");
+   sbuf_cat(sb, "\n");
 
if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) {
sbuf_printf(sb, "%s%u\n", indent,
@@ -1368,16 +1368,16 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st
sbuf_printf(sb, "%s", indent);
switch (sc->sc_crypto) {
case G_ELI_CRYPTO_HW:
-   sbuf_printf(sb, "hardware");
+   sbuf_cat(sb, "hardware");
break;
case G_ELI_CRYPTO_SW:
-   sbuf_printf(sb, "software");
+   sbuf_cat(sb, "software");
break;
default:
-   sbuf_printf(sb, "UNKNOWN");
+   sbuf_cat(sb, "UNKNOWN");
break;
}
-   sbuf_printf(sb, "\n");
+   sbuf_cat(sb, "\n");
if (sc->sc_flags & G_ELI_FLAG_AUTH) {
sbuf_printf(sb,
"%s%s\n",

Modified: head/sys/geom/geom_disk.c

svn commit: r349194 - releng/11.3/release/pkg_repos

2019-06-19 Thread Glen Barber
Author: gjb
Date: Wed Jun 19 15:26:52 2019
New Revision: 349194
URL: https://svnweb.freebsd.org/changeset/base/349194

Log:
  Update the pkg.conf used to populate the dvd1.iso to use
  the release_3 package set.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/11.3/release/pkg_repos/release-dvd.conf

Modified: releng/11.3/release/pkg_repos/release-dvd.conf
==
--- releng/11.3/release/pkg_repos/release-dvd.conf  Wed Jun 19 14:57:51 
2019(r349193)
+++ releng/11.3/release/pkg_repos/release-dvd.conf  Wed Jun 19 15:26:52 
2019(r349194)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 release: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_3;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",
___
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: r349193 - stable/12/sys/kern

2019-06-19 Thread Ed Maste
Author: emaste
Date: Wed Jun 19 14:57:51 2019
New Revision: 349193
URL: https://svnweb.freebsd.org/changeset/base/349193

Log:
  MFC r347228: makesyscalls: use @generated tag in generated files
  
  Multiple tools use @generated to identify generated files (for example,
  in a review Phabricator will by default hide diffs in generated files).
  Use the @generated tag in makesyscalls.sh as we've done for other
  generated files.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/kern/makesyscalls.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/makesyscalls.sh
==
--- stable/12/sys/kern/makesyscalls.sh  Wed Jun 19 13:55:00 2019
(r349192)
+++ stable/12/sys/kern/makesyscalls.sh  Wed Jun 19 14:57:51 2019
(r349193)
@@ -120,18 +120,21 @@ sed -e '
capenabled_string = \"$capenabled\"
"'
 
+   # Avoid a literal generated file tag here.
+   generated = "@" "generated";
+
split(capenabled_string, capenabled, ",");
 
printf "\n/* The casts are bogus but will do for now. */\n" > 
sysent
printf "struct sysent %s[] = {\n",switchname > sysent
 
printf "/*\n * System call switch table.\n *\n" > syssw
-   printf " * DO NOT EDIT-- this file is automatically 
generated.\n" > syssw
+   printf " * DO NOT EDIT-- this file is automatically " generated 
".\n" > syssw
printf " * $%s$\n", "FreeBSD" > syssw
printf " */\n\n" > syssw
 
printf "/*\n * System call prototypes.\n *\n" > sysarg
-   printf " * DO NOT EDIT-- this file is automatically 
generated.\n" > sysarg
+   printf " * DO NOT EDIT-- this file is automatically " generated 
".\n" > sysarg
printf " * $%s$\n", "FreeBSD" > sysarg
printf " */\n\n" > sysarg
printf "#ifndef %s\n", sysproto_h > sysarg
@@ -165,23 +168,23 @@ sed -e '
printf "\n#ifdef %s\n\n", compat11 > syscompat11
 
printf "/*\n * System call names.\n *\n" > sysnames
-   printf " * DO NOT EDIT-- this file is automatically 
generated.\n" > sysnames
+   printf " * DO NOT EDIT-- this file is automatically " generated 
".\n" > sysnames
printf " * $%s$\n", "FreeBSD" > sysnames
printf " */\n\n" > sysnames
printf "const char *%s[] = {\n", namesname > sysnames
 
printf "/*\n * System call numbers.\n *\n" > syshdr
-   printf " * DO NOT EDIT-- this file is automatically 
generated.\n" > syshdr
+   printf " * DO NOT EDIT-- this file is automatically " generated 
".\n" > syshdr
printf " * $%s$\n", "FreeBSD" > syshdr
printf " */\n\n" > syshdr
 
printf "# FreeBSD system call object files.\n" > sysmk
-   printf "# DO NOT EDIT-- this file is automatically 
generated.\n" > sysmk
+   printf "# DO NOT EDIT-- this file is automatically " generated 
".\n" > sysmk
printf "# $%s$\n", "FreeBSD" > sysmk
printf "MIASM = " > sysmk
 
printf "/*\n * System call argument to DTrace register array 
converstion.\n *\n" > systrace
-   printf " * DO NOT EDIT-- this file is automatically 
generated.\n" > systrace
+   printf " * DO NOT EDIT-- this file is automatically " generated 
".\n" > systrace
printf " * $%s$\n", "FreeBSD" > systrace
printf " * This file is part of the DTrace syscall provider.\n 
*/\n\n" > systrace
printf "static void\nsystrace_args(int sysnum, void *params, 
uint64_t *uarg, int *n_args)\n{\n" > systrace
___
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: r349184 - head/sys/amd64/vmm/intel

2019-06-19 Thread Rodney W. Grimes
> Author: scottl
> Date: Wed Jun 19 06:41:07 2019
> New Revision: 349184
> URL: https://svnweb.freebsd.org/changeset/base/349184
> 
> Log:
>   Implement VT-d capability detection on chipsets that have multiple
>   translation units with differing capabilities
>   
>   From the author via Bugzilla:
>   ---

If you had read the full bug report you would also know:
https://reviews.freebsd.org/D19001
existed and that some code cleanup had occurred since
this bug was created.

The review was pending approval by bhyve maintainer(s).

>   When an attempt is made to passthrough a PCI device to a bhyve VM
>   (causing initialisation of IOMMU) on certain Intel chipsets using
>   VT-d the PCI bus stops working entirely. This issue occurs on the
>   E3-1275 v5 processor on C236 chipset and has also been encountered
>   by others on the forums with different hardware in the Skylake
>   series.
>   
>   The chipset has two VT-d translation units. The issue is caused by
>   an attempt to use the VT-d device-IOTLB capability that is
>   supported by only the first unit for devices attached to the
>   second unit which lacks that capability. Only the capabilities of
>   the first unit are checked and are assumed to be the same for all
>   units.
>   
>   Attached is a patch to rectify this issue by determining which
>   unit is responsible for the device being added to a domain and
>   then checking that unit's device-IOTLB capability. In addition to
>   this a few fixes have been made to other instances where the first
>   unit's capabilities are assumed for all units for domains they
>   share. In these cases a mutual set of capabilities is determined.
>   The patch should hopefully fix any bugs for current/future
>   hardware with multiple translation units supporting different
>   capabilities.
>   
>   A description is on the forums at
>   https://forums.freebsd.org/threads/pci-passthrough-bhyve-usb-xhci.65235
>   The thread includes observations by other users of the bug
>   occurring, and description as well as confirmation of the fix.
>   I'd also like to thank Ordoban for their help.
>   
>   ---
>   Personally tested on a Skylake laptop, Skylake Xeon server, and
>   a Xeon-D-1541, passing through XHCI and NVMe functions.  Passthru
>   is hit-or-miss to the point of being unusable without this
>   patch.
>   
>   PR: 229852
>   Submitted by: cal...@aitchison.org
>   MFC after: 1 week
> 
> Modified:
>   head/sys/amd64/vmm/intel/vtd.c
> 
> Modified: head/sys/amd64/vmm/intel/vtd.c
> ==
> --- head/sys/amd64/vmm/intel/vtd.cWed Jun 19 03:33:00 2019
> (r349183)
> +++ head/sys/amd64/vmm/intel/vtd.cWed Jun 19 06:41:07 2019
> (r349184)
> @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
>   * Architecture Spec, September 2008.
>   */
>  
> +#define VTD_DRHD_INCLUDE_PCI_ALL(Flags)  (((Flags) >> 0) & 0x1)
> +
>  /* Section 10.4 "Register Descriptions" */
>  struct vtdmap {
>   volatile uint32_t   version;
> @@ -116,10 +118,11 @@ struct domain {
>  static SLIST_HEAD(, domain) domhead;
>  
>  #define  DRHD_MAX_UNITS  8
> -static int   drhd_num;
> -static struct vtdmap *vtdmaps[DRHD_MAX_UNITS];
> -static int   max_domains;
> -typedef int  (*drhd_ident_func_t)(void);
> +static ACPI_DMAR_HARDWARE_UNIT   *drhds[DRHD_MAX_UNITS];
> +static int   drhd_num;
> +static struct vtdmap *vtdmaps[DRHD_MAX_UNITS];
> +static int   max_domains;
> +typedef int  (*drhd_ident_func_t)(void);
>  
>  static uint64_t root_table[PAGE_SIZE / sizeof(uint64_t)] __aligned(4096);
>  static uint64_t ctx_tables[256][PAGE_SIZE / sizeof(uint64_t)] 
> __aligned(4096);
> @@ -175,6 +178,69 @@ domain_id(void)
>   return (id);
>  }
>  
> +static struct vtdmap *
> +vtd_device_scope(uint16_t rid)
> +{
> + int i, remaining, pathremaining;
> + char *end, *pathend;
> + struct vtdmap *vtdmap;
> + ACPI_DMAR_HARDWARE_UNIT *drhd;
> + ACPI_DMAR_DEVICE_SCOPE *device_scope;
> + ACPI_DMAR_PCI_PATH *path;
> +
> + for (i = 0; i < drhd_num; i++) {
> + drhd = drhds[i];
> +
> + if (VTD_DRHD_INCLUDE_PCI_ALL(drhd->Flags)) {
> + /*
> +  * From Intel VT-d arch spec, version 3.0:
> +  * If a DRHD structure with INCLUDE_PCI_ALL flag Set is 
> reported
> +  * for a Segment, it must be enumerated by BIOS after 
> all other
> +  * DRHD structures for the same Segment.
> +  */
> + vtdmap = vtdmaps[i];
> + return(vtdmap);
> + }
> +
> + end = (char *)drhd + drhd->Header.Length;
> + remaining = drhd->Header.Length - 
> sizeof(ACPI_DMAR_HARDWARE_UNIT);
> + while (remaining > sizeof(ACPI_DMAR_DEVICE_SCOPE)) {
> + device_scope = 

svn commit: r349192 - head/sys/netinet/tcp_stacks

2019-06-19 Thread Jonathan T. Looney
Author: jtl
Date: Wed Jun 19 13:55:00 2019
New Revision: 349192
URL: https://svnweb.freebsd.org/changeset/base/349192

Log:
  Add the ability to limit how much the code will fragment the RACK send map
  in response to SACKs. The default behavior is unchanged; however, the limit
  can be activated by changing the new net.inet.tcp.rack.split_limit sysctl.
  
  Submitted by: Peter Lei 
  Reported by:  jtl
  Reviewed by:  lstewart (earlier version)
  Security: CVE-2019-5599

Modified:
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_stacks/tcp_rack.h

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Wed Jun 19 13:33:34 2019
(r349191)
+++ head/sys/netinet/tcp_stacks/rack.c  Wed Jun 19 13:55:00 2019
(r349192)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2016-2018 Netflix, Inc.
+ * Copyright (c) 2016-2019 Netflix, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -202,6 +202,7 @@ static int32_t rack_always_send_oldest = 0;
 static int32_t rack_sack_block_limit = 128;
 static int32_t rack_use_sack_filter = 1;
 static int32_t rack_tlp_threshold_use = TLP_USE_TWO_ONE;
+static uint32_t rack_map_split_limit = 0;  /* unlimited by default */
 
 /* Rack specific counters */
 counter_u64_t rack_badfr;
@@ -227,6 +228,8 @@ counter_u64_t rack_to_arm_tlp;
 counter_u64_t rack_to_alloc;
 counter_u64_t rack_to_alloc_hard;
 counter_u64_t rack_to_alloc_emerg;
+counter_u64_t rack_alloc_limited_conns;
+counter_u64_t rack_split_limited;
 
 counter_u64_t rack_sack_proc_all;
 counter_u64_t rack_sack_proc_short;
@@ -260,6 +263,8 @@ static void
 rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack,
 struct tcphdr *th, uint16_t nsegs, uint16_t type, int32_t recovery);
 static struct rack_sendmap *rack_alloc(struct tcp_rack *rack);
+static struct rack_sendmap *rack_alloc_limit(struct tcp_rack *rack,
+uint8_t limit_type);
 static struct rack_sendmap *
 rack_check_recovery_mode(struct tcpcb *tp,
 uint32_t tsused);
@@ -444,6 +449,8 @@ sysctl_rack_clear(SYSCTL_HANDLER_ARGS)
counter_u64_zero(rack_sack_proc_short);
counter_u64_zero(rack_sack_proc_restart);
counter_u64_zero(rack_to_alloc);
+   counter_u64_zero(rack_alloc_limited_conns);
+   counter_u64_zero(rack_split_limited);
counter_u64_zero(rack_find_high);
counter_u64_zero(rack_runt_sacks);
counter_u64_zero(rack_used_tlpmethod);
@@ -621,6 +628,11 @@ rack_init_sysctls()
OID_AUTO, "pktdelay", CTLFLAG_RW,
_pkt_delay, 1,
"Extra RACK time (in ms) besides reordering thresh");
+   SYSCTL_ADD_U32(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "split_limit", CTLFLAG_RW,
+   _map_split_limit, 0,
+   "Is there a limit on the number of map split entries 
(0=unlimited)");
SYSCTL_ADD_S32(_sysctl_ctx,
SYSCTL_CHILDREN(rack_sysctl_root),
OID_AUTO, "inc_var", CTLFLAG_RW,
@@ -756,7 +768,19 @@ rack_init_sysctls()
SYSCTL_CHILDREN(rack_sysctl_root),
OID_AUTO, "allocemerg", CTLFLAG_RD,
_to_alloc_emerg,
-   "Total alocations done from emergency cache");
+   "Total allocations done from emergency cache");
+   rack_alloc_limited_conns = counter_u64_alloc(M_WAITOK);
+   SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "alloc_limited_conns", CTLFLAG_RD,
+   _alloc_limited_conns,
+   "Connections with allocations dropped due to limit");
+   rack_split_limited = counter_u64_alloc(M_WAITOK);
+   SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
+   SYSCTL_CHILDREN(rack_sysctl_root),
+   OID_AUTO, "split_limited", CTLFLAG_RD,
+   _split_limited,
+   "Split allocations dropped due to limit");
rack_sack_proc_all = counter_u64_alloc(M_WAITOK);
SYSCTL_ADD_COUNTER_U64(_sysctl_ctx,
SYSCTL_CHILDREN(rack_sysctl_root),
@@ -1120,10 +1144,11 @@ rack_alloc(struct tcp_rack *rack)
 {
struct rack_sendmap *rsm;
 
-   counter_u64_add(rack_to_alloc, 1);
-   rack->r_ctl.rc_num_maps_alloced++;
rsm = uma_zalloc(rack_zone, M_NOWAIT);
if (rsm) {
+alloc_done:
+   counter_u64_add(rack_to_alloc, 1);
+   rack->r_ctl.rc_num_maps_alloced++;
return (rsm);
}
if (rack->rc_free_cnt) {
@@ -1131,14 +1156,46 @@ rack_alloc(struct tcp_rack *rack)
rsm = TAILQ_FIRST(>r_ctl.rc_free);
TAILQ_REMOVE(>r_ctl.rc_free, rsm, r_next);
rack->rc_free_cnt--;
-   return (rsm);
+   goto alloc_done;
}
return (NULL);
 }
 

Re: svn commit: r349189 - stable/12/usr.bin/vtfontcvt

2019-06-19 Thread Ed Maste
On Wed, 19 Jun 2019 at 05:29, Ed Maste  wrote:
>
> > Author: emaste
> > Date: Wed Jun 19 13:19:36 2019
> > New Revision: 349189
> > URL: https://svnweb.freebsd.org/changeset/base/349189
> >
> > Log:
> >   vtfontcvt: whitespace and other cleanup
> >
> >   MFC r343842: vtfontcvt: whitespace cleanup
> That should be 348342.
Oops, no. 343842 is correct.
___
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: r349191 - stable/11/usr.bin/vtfontcvt

2019-06-19 Thread Ed Maste
Author: emaste
Date: Wed Jun 19 13:33:34 2019
New Revision: 349191
URL: https://svnweb.freebsd.org/changeset/base/349191

Log:
  vtfontcvt: whitespace and other cleanup
  
  MFC r343842: vtfontcvt: whitespace cleanup
  
  MFC r348653: vtfontcvt: use VFNT_MAP_{NORMAL|BOL}_RH symbolic constants
  
  MFC r348656: vtfontcvt: unwrap a line per style(9)
  
  PR:   205707
  Submitted by: Dmitry Wagin

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

Modified: stable/11/usr.bin/vtfontcvt/vtfontcvt.c
==
--- stable/11/usr.bin/vtfontcvt/vtfontcvt.c Wed Jun 19 13:30:50 2019
(r349190)
+++ stable/11/usr.bin/vtfontcvt/vtfontcvt.c Wed Jun 19 13:33:34 2019
(r349191)
@@ -63,10 +63,10 @@ struct glyph {
 TAILQ_HEAD(glyph_list, glyph);
 static SLIST_HEAD(, glyph) glyph_hash[FONTCVT_NHASH];
 static struct glyph_list glyphs[VFNT_MAPS] = {
-TAILQ_HEAD_INITIALIZER(glyphs[0]),
-TAILQ_HEAD_INITIALIZER(glyphs[1]),
-TAILQ_HEAD_INITIALIZER(glyphs[2]),
-TAILQ_HEAD_INITIALIZER(glyphs[3]),
+   TAILQ_HEAD_INITIALIZER(glyphs[0]),
+   TAILQ_HEAD_INITIALIZER(glyphs[1]),
+   TAILQ_HEAD_INITIALIZER(glyphs[2]),
+   TAILQ_HEAD_INITIALIZER(glyphs[3]),
 };
 static unsigned int glyph_total, glyph_count[4], glyph_unique, glyph_dupe;
 
@@ -79,10 +79,10 @@ struct mapping {
 
 TAILQ_HEAD(mapping_list, mapping);
 static struct mapping_list maps[VFNT_MAPS] = {
-TAILQ_HEAD_INITIALIZER(maps[0]),
-TAILQ_HEAD_INITIALIZER(maps[1]),
-TAILQ_HEAD_INITIALIZER(maps[2]),
-TAILQ_HEAD_INITIALIZER(maps[3]),
+   TAILQ_HEAD_INITIALIZER(maps[0]),
+   TAILQ_HEAD_INITIALIZER(maps[1]),
+   TAILQ_HEAD_INITIALIZER(maps[2]),
+   TAILQ_HEAD_INITIALIZER(maps[3]),
 };
 static unsigned int mapping_total, map_count[4], map_folded_count[4],
 mapping_unique, mapping_dupe;
@@ -201,8 +201,7 @@ add_char(unsigned curchar, unsigned map_idx, uint8_t *
return (1);
if (bytes_r != NULL) {
gl = add_glyph(bytes_r, map_idx + 1, 0);
-   if (add_mapping(gl, curchar,
-   map_idx + 1) != 0)
+   if (add_mapping(gl, curchar, map_idx + 1) != 0)
return (1);
}
}
@@ -496,9 +495,9 @@ write_fnt(const char *filename)
 
if (write_glyphs(fp) != 0 ||
write_mappings(fp, VFNT_MAP_NORMAL) != 0 ||
-   write_mappings(fp, 1) != 0 ||
+   write_mappings(fp, VFNT_MAP_NORMAL_RH) != 0 ||
write_mappings(fp, VFNT_MAP_BOLD) != 0 ||
-   write_mappings(fp, 3) != 0) {
+   write_mappings(fp, VFNT_MAP_BOLD_RH) != 0) {
perror(filename);
fclose(fp);
return (1);
___
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: r349190 - head/sys/kern

2019-06-19 Thread Alexander Motin
Author: mav
Date: Wed Jun 19 13:30:50 2019
New Revision: 349190
URL: https://svnweb.freebsd.org/changeset/base/349190

Log:
  Fix typo in r349178.
  
  Reported by:  ae
  MFC after:1 week

Modified:
  head/sys/kern/subr_sbuf.c

Modified: head/sys/kern/subr_sbuf.c
==
--- head/sys/kern/subr_sbuf.c   Wed Jun 19 13:19:36 2019(r349189)
+++ head/sys/kern/subr_sbuf.c   Wed Jun 19 13:30:50 2019(r349190)
@@ -342,7 +342,7 @@ sbuf_setpos(struct sbuf *s, ssize_t pos)
 }
 
 /*
- * Drain into a counter.  Counts amount of data without prodicing output.
+ * Drain into a counter.  Counts amount of data without producing output.
  * Useful for cases like sysctl, where user may first request only size.
  * This allows to avoid pointless allocation/freeing of large buffers.
  */
___
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: r349189 - stable/12/usr.bin/vtfontcvt

2019-06-19 Thread Ed Maste
> Author: emaste
> Date: Wed Jun 19 13:19:36 2019
> New Revision: 349189
> URL: https://svnweb.freebsd.org/changeset/base/349189
>
> Log:
>   vtfontcvt: whitespace and other cleanup
>
>   MFC r343842: vtfontcvt: whitespace cleanup
That should be 348342.
___
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: r349189 - stable/12/usr.bin/vtfontcvt

2019-06-19 Thread Ed Maste
Author: emaste
Date: Wed Jun 19 13:19:36 2019
New Revision: 349189
URL: https://svnweb.freebsd.org/changeset/base/349189

Log:
  vtfontcvt: whitespace and other cleanup
  
  MFC r343842: vtfontcvt: whitespace cleanup
  
  MFC r348653: vtfontcvt: use VFNT_MAP_{NORMAL|BOL}_RH symbolic constants
  
  MFC r348656: vtfontcvt: unwrap a line per style(9)
  
  PR:   205707
  Submitted by: Dmitry Wagin

Modified:
  stable/12/usr.bin/vtfontcvt/vtfontcvt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/vtfontcvt/vtfontcvt.c
==
--- stable/12/usr.bin/vtfontcvt/vtfontcvt.c Wed Jun 19 11:37:43 2019
(r349188)
+++ stable/12/usr.bin/vtfontcvt/vtfontcvt.c Wed Jun 19 13:19:36 2019
(r349189)
@@ -63,10 +63,10 @@ struct glyph {
 TAILQ_HEAD(glyph_list, glyph);
 static SLIST_HEAD(, glyph) glyph_hash[FONTCVT_NHASH];
 static struct glyph_list glyphs[VFNT_MAPS] = {
-TAILQ_HEAD_INITIALIZER(glyphs[0]),
-TAILQ_HEAD_INITIALIZER(glyphs[1]),
-TAILQ_HEAD_INITIALIZER(glyphs[2]),
-TAILQ_HEAD_INITIALIZER(glyphs[3]),
+   TAILQ_HEAD_INITIALIZER(glyphs[0]),
+   TAILQ_HEAD_INITIALIZER(glyphs[1]),
+   TAILQ_HEAD_INITIALIZER(glyphs[2]),
+   TAILQ_HEAD_INITIALIZER(glyphs[3]),
 };
 static unsigned int glyph_total, glyph_count[4], glyph_unique, glyph_dupe;
 
@@ -79,10 +79,10 @@ struct mapping {
 
 TAILQ_HEAD(mapping_list, mapping);
 static struct mapping_list maps[VFNT_MAPS] = {
-TAILQ_HEAD_INITIALIZER(maps[0]),
-TAILQ_HEAD_INITIALIZER(maps[1]),
-TAILQ_HEAD_INITIALIZER(maps[2]),
-TAILQ_HEAD_INITIALIZER(maps[3]),
+   TAILQ_HEAD_INITIALIZER(maps[0]),
+   TAILQ_HEAD_INITIALIZER(maps[1]),
+   TAILQ_HEAD_INITIALIZER(maps[2]),
+   TAILQ_HEAD_INITIALIZER(maps[3]),
 };
 static unsigned int mapping_total, map_count[4], map_folded_count[4],
 mapping_unique, mapping_dupe;
@@ -201,8 +201,7 @@ add_char(unsigned curchar, unsigned map_idx, uint8_t *
return (1);
if (bytes_r != NULL) {
gl = add_glyph(bytes_r, map_idx + 1, 0);
-   if (add_mapping(gl, curchar,
-   map_idx + 1) != 0)
+   if (add_mapping(gl, curchar, map_idx + 1) != 0)
return (1);
}
}
@@ -496,9 +495,9 @@ write_fnt(const char *filename)
 
if (write_glyphs(fp) != 0 ||
write_mappings(fp, VFNT_MAP_NORMAL) != 0 ||
-   write_mappings(fp, 1) != 0 ||
+   write_mappings(fp, VFNT_MAP_NORMAL_RH) != 0 ||
write_mappings(fp, VFNT_MAP_BOLD) != 0 ||
-   write_mappings(fp, 3) != 0) {
+   write_mappings(fp, VFNT_MAP_BOLD_RH) != 0) {
perror(filename);
fclose(fp);
return (1);
___
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: r349188 - head/stand/ofw/libofw

2019-06-19 Thread Leandro Lupori
Author: luporl
Date: Wed Jun 19 11:37:43 2019
New Revision: 349188
URL: https://svnweb.freebsd.org/changeset/base/349188

Log:
  [PPC] Fix loader input with newer QEMU versions
  
  At least since version 4.0.0, QEMU became bug-compatible with PowerVM's
  vty, by inserting a \0 after every \r. As this confuses loader's
  interpreter and as a \0 coming from the console doesn't seem reasonable,
  it's now being filtered at OFW console input.
  
  Reviewed by:  jhibbits
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D20676

Modified:
  head/stand/ofw/libofw/ofw_console.c

Modified: head/stand/ofw/libofw/ofw_console.c
==
--- head/stand/ofw/libofw/ofw_console.c Wed Jun 19 11:22:09 2019
(r349187)
+++ head/stand/ofw/libofw/ofw_console.c Wed Jun 19 11:37:43 2019
(r349188)
@@ -97,7 +97,11 @@ ofw_cons_getchar()
return l;
}
 
-   if (OF_read(stdin, , 1) > 0)
+   /* At least since version 4.0.0, QEMU became bug-compatible
+* with PowerVM's vty, by inserting a \0 after every \r.
+* As this confuses loader's interpreter and as a \0 coming
+* from the console doesn't seem reasonable, it's filtered here. */
+   if (OF_read(stdin, , 1) > 0 && ch != '\0')
return (ch);
 
return (-1);
___
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: r349187 - head/share/misc

2019-06-19 Thread Sevan Janiyan
Author: sevan (doc committer)
Date: Wed Jun 19 11:22:09 2019
New Revision: 349187
URL: https://svnweb.freebsd.org/changeset/base/349187

Log:
  Whitespace

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Wed Jun 19 08:49:24 2019
(r349186)
+++ head/share/misc/bsd-family-tree Wed Jun 19 11:22:09 2019
(r349187)
@@ -372,7 +372,7 @@ FreeBSD 5.2   |  | |  
  | |  | 10.13|   ||OpenBSD 6.1 |
  |  FreeBSD   |   |  |   |||   DragonFly 5.0.0
  |   11.1  FreeBSD|  |   |||   |
- | |10.4  |  |   ||OpenBSD 6.2  DragonFly 5.0.1
+ | |10.4  |  |   ||OpenBSD 6.2 DragonFly 5.0.1
  | |  |  |   |||   |
  | `--.   |  |   | NetBSD  |   DragonFly 5.0.2
  ||   |  |   |  7.1.1  |   |
@@ -381,7 +381,7 @@ FreeBSD 5.2   |  | |  
  ||   |  |   |  7.1.2  `--.|
  ||   |  |   |||
  ||   |  |   `-.  OpenBSD 6.3  |
- ||   |  *--NetBSD |  | DragonFly 5.2.0
+ ||   |  *--NetBSD |  |DragonFly 5.2.0
  ||   |  |   8.0   |  ||
  ||   |  |   | |  |DragonFly 5.2.1
  ||   |  |   | |  ||
___
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: r349186 - head/sys/net

2019-06-19 Thread Marko Zec
Author: zec
Date: Wed Jun 19 08:49:24 2019
New Revision: 349186
URL: https://svnweb.freebsd.org/changeset/base/349186

Log:
  V_ip6_forwarding and V_ipforwarding have been defined in ip6_var.h /
  ip_var.h since at least 2008, so make use of those definitions here.
  
  MFC after:3 days

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Jun 19 08:39:19 2019(r349185)
+++ head/sys/net/iflib.cWed Jun 19 08:49:24 2019(r349186)
@@ -2688,10 +2688,10 @@ iflib_get_ip_forwarding(struct lro_ctrl *lc, bool *v4,
 {
CURVNET_SET(lc->ifp->if_vnet);
 #if defined(INET6)
-   *v6 = VNET(ip6_forwarding);
+   *v6 = V_ip6_forwarding;
 #endif
 #if defined(INET)
-   *v4 = VNET(ipforwarding);
+   *v4 = V_ipforwarding;
 #endif
CURVNET_RESTORE();
 }
___
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: r349185 - head/sys/net

2019-06-19 Thread Marko Zec
Author: zec
Date: Wed Jun 19 08:39:19 2019
New Revision: 349185
URL: https://svnweb.freebsd.org/changeset/base/349185

Log:
  Evaluating htons() at compile time is more efficient than doing ntohs()
  at runtime.  This change removes a dependency on a barrel shifter pass
  before branch resolution, while reducing the instruction stream size
  by 9 bytes on amd64.
  
  MFC after:3 days

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Jun 19 06:41:07 2019(r349184)
+++ head/sys/net/iflib.cWed Jun 19 08:39:19 2019(r349185)
@@ -2705,18 +2705,16 @@ static bool
 iflib_check_lro_possible(struct mbuf *m, bool v4_forwarding, bool 
v6_forwarding)
 {
struct ether_header *eh;
-   uint16_t eh_type;
 
eh = mtod(m, struct ether_header *);
-   eh_type = ntohs(eh->ether_type);
-   switch (eh_type) {
+   switch (eh->ether_type) {
 #if defined(INET6)
-   case ETHERTYPE_IPV6:
-   return !v6_forwarding;
+   case htons(ETHERTYPE_IPV6):
+   return (!v6_forwarding);
 #endif
 #if defined (INET)
-   case ETHERTYPE_IP:
-   return !v4_forwarding;
+   case htons(ETHERTYPE_IP):
+   return (!v4_forwarding);
 #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: r349184 - head/sys/amd64/vmm/intel

2019-06-19 Thread Scott Long
Author: scottl
Date: Wed Jun 19 06:41:07 2019
New Revision: 349184
URL: https://svnweb.freebsd.org/changeset/base/349184

Log:
  Implement VT-d capability detection on chipsets that have multiple
  translation units with differing capabilities
  
  From the author via Bugzilla:
  ---
  When an attempt is made to passthrough a PCI device to a bhyve VM
  (causing initialisation of IOMMU) on certain Intel chipsets using
  VT-d the PCI bus stops working entirely. This issue occurs on the
  E3-1275 v5 processor on C236 chipset and has also been encountered
  by others on the forums with different hardware in the Skylake
  series.
  
  The chipset has two VT-d translation units. The issue is caused by
  an attempt to use the VT-d device-IOTLB capability that is
  supported by only the first unit for devices attached to the
  second unit which lacks that capability. Only the capabilities of
  the first unit are checked and are assumed to be the same for all
  units.
  
  Attached is a patch to rectify this issue by determining which
  unit is responsible for the device being added to a domain and
  then checking that unit's device-IOTLB capability. In addition to
  this a few fixes have been made to other instances where the first
  unit's capabilities are assumed for all units for domains they
  share. In these cases a mutual set of capabilities is determined.
  The patch should hopefully fix any bugs for current/future
  hardware with multiple translation units supporting different
  capabilities.
  
  A description is on the forums at
  https://forums.freebsd.org/threads/pci-passthrough-bhyve-usb-xhci.65235
  The thread includes observations by other users of the bug
  occurring, and description as well as confirmation of the fix.
  I'd also like to thank Ordoban for their help.
  
  ---
  Personally tested on a Skylake laptop, Skylake Xeon server, and
  a Xeon-D-1541, passing through XHCI and NVMe functions.  Passthru
  is hit-or-miss to the point of being unusable without this
  patch.
  
  PR: 229852
  Submitted by: cal...@aitchison.org
  MFC after: 1 week

Modified:
  head/sys/amd64/vmm/intel/vtd.c

Modified: head/sys/amd64/vmm/intel/vtd.c
==
--- head/sys/amd64/vmm/intel/vtd.c  Wed Jun 19 03:33:00 2019
(r349183)
+++ head/sys/amd64/vmm/intel/vtd.c  Wed Jun 19 06:41:07 2019
(r349184)
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
  * Architecture Spec, September 2008.
  */
 
+#define VTD_DRHD_INCLUDE_PCI_ALL(Flags)  (((Flags) >> 0) & 0x1)
+
 /* Section 10.4 "Register Descriptions" */
 struct vtdmap {
volatile uint32_t   version;
@@ -116,10 +118,11 @@ struct domain {
 static SLIST_HEAD(, domain) domhead;
 
 #defineDRHD_MAX_UNITS  8
-static int drhd_num;
-static struct vtdmap   *vtdmaps[DRHD_MAX_UNITS];
-static int max_domains;
-typedef int(*drhd_ident_func_t)(void);
+static ACPI_DMAR_HARDWARE_UNIT *drhds[DRHD_MAX_UNITS];
+static int drhd_num;
+static struct vtdmap   *vtdmaps[DRHD_MAX_UNITS];
+static int max_domains;
+typedef int(*drhd_ident_func_t)(void);
 
 static uint64_t root_table[PAGE_SIZE / sizeof(uint64_t)] __aligned(4096);
 static uint64_t ctx_tables[256][PAGE_SIZE / sizeof(uint64_t)] __aligned(4096);
@@ -175,6 +178,69 @@ domain_id(void)
return (id);
 }
 
+static struct vtdmap *
+vtd_device_scope(uint16_t rid)
+{
+   int i, remaining, pathremaining;
+   char *end, *pathend;
+   struct vtdmap *vtdmap;
+   ACPI_DMAR_HARDWARE_UNIT *drhd;
+   ACPI_DMAR_DEVICE_SCOPE *device_scope;
+   ACPI_DMAR_PCI_PATH *path;
+
+   for (i = 0; i < drhd_num; i++) {
+   drhd = drhds[i];
+
+   if (VTD_DRHD_INCLUDE_PCI_ALL(drhd->Flags)) {
+   /*
+* From Intel VT-d arch spec, version 3.0:
+* If a DRHD structure with INCLUDE_PCI_ALL flag Set is 
reported
+* for a Segment, it must be enumerated by BIOS after 
all other
+* DRHD structures for the same Segment.
+*/
+   vtdmap = vtdmaps[i];
+   return(vtdmap);
+   }
+
+   end = (char *)drhd + drhd->Header.Length;
+   remaining = drhd->Header.Length - 
sizeof(ACPI_DMAR_HARDWARE_UNIT);
+   while (remaining > sizeof(ACPI_DMAR_DEVICE_SCOPE)) {
+   device_scope = (ACPI_DMAR_DEVICE_SCOPE *)(end - 
remaining);
+   remaining -= device_scope->Length;
+
+   switch (device_scope->EntryType){
+   /* 0x01 and 0x02 are PCI device entries */
+   case 0x01:
+   case 0x02:
+   break;
+   default: