dragonfly.git
12 months agoLINT64: Sort vmx a bit better. v5.0.0
Sascha Wildner [Sun, 15 Oct 2017 11:07:04 +0000 (13:07 +0200)]
LINT64: Sort vmx a bit better.

12 months agoRevert "libthread_xu - Wakeup all waiters"
Matthew Dillon [Sun, 15 Oct 2017 07:44:06 +0000 (00:44 -0700)]
Revert "libthread_xu - Wakeup all waiters"

This reverts commit 4e7c9dfbd0ad1f7bb5ec7c5f6eb6d6a1c44c404a.

* Didn't intend to push this.

12 months agolibthread_xu - Wakeup all waiters
Matthew Dillon [Sun, 15 Oct 2017 07:13:42 +0000 (00:13 -0700)]
libthread_xu - Wakeup all waiters

* For now punt on trying to wakeup an optimized numbers of waiters.
  Wake up all waiters and let them sort it out.

* This may fix specific count races in threaded programs using
  pthread mutexes.

12 months agohammer2 - Handle error on rename in media out of space case
Matthew Dillon [Sat, 14 Oct 2017 22:28:12 +0000 (15:28 -0700)]
hammer2 - Handle error on rename in media out of space case

* Process the error code from hammer2_chain_delete() in
  hammer2_xop_nrename() to ensure that we do not try to reattach
  the chain under another parent.

Reported-by: arcade (Bug #3055)
12 months agosshd - Disable tunneled clear text passwords by default
Matthew Dillon [Sat, 14 Oct 2017 21:18:39 +0000 (14:18 -0700)]
sshd - Disable tunneled clear text passwords by default

* Reapply 1cb3a32c13b and c866a462b3.  sshd on DragonFlyBSD defaults
  to disabling cleartext passwords by default.

Reminded-by: ivadasz
12 months agocpdup(1): Some improvements.
Sascha Wildner [Sat, 14 Oct 2017 19:06:14 +0000 (21:06 +0200)]
cpdup(1): Some improvements.

* Make cpdup retry failed rmdirs after chflags. It already does this
  for remove().

* When deciding whether to copy a file, cpdup should ignore the
  UF_ARCHIVE file flag. If that flag is supported by the destination
  file system but it's cleared on a source file, then multiple
  invocations of cpdup would all copy the source file because its
  flags wouldn't match. OTOH, if the destination filesystem doesn't
  support UF_ARCHIVE, then there's no point in cpdup setting it.

Submitted-by: Will Andrews <will@firepipe.net>
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/2987
               https://bugs.dragonflybsd.org/issues/2988
               https://bugs.dragonflybsd.org/issues/3067

12 months agohammer2 - Slightly reduce LZ4 output buffer limit
Matthew Dillon [Sat, 14 Oct 2017 17:59:30 +0000 (10:59 -0700)]
hammer2 - Slightly reduce LZ4 output buffer limit

* LZ4_compress_limitedOutput() appears to be able to overrun the
  supplied buffer.

* Slightly reduce the LZ4 output buffer limit from a 4-byte alignment
  to an 8-byte alignment to try to fix the problem.

12 months agoFix additional cases of seg-faults on crypt(3) failure
Lubos Boucek [Fri, 13 Oct 2017 21:33:01 +0000 (21:33 +0000)]
Fix additional cases of seg-faults on crypt(3) failure

* On failure, crypt(3) returns NULL, which is then used as a
  strcmp(3) argument

opieftpd.c and opiesu.c are not actually used anywhere.

12 months agosystat.1: Update man page: sync to current program & improve markup a bit
Thomas Nikolajsen [Wed, 11 Oct 2017 23:03:46 +0000 (01:03 +0200)]
systat.1: Update man page: sync to current program & improve markup a bit

    Substantial changes has happened, especially for vmstat display.

12 months agorc.8: Clarify foo.sh behavior.
Sascha Wildner [Sat, 14 Oct 2017 08:48:04 +0000 (10:48 +0200)]
rc.8: Clarify foo.sh behavior.

Improve wording a bit. See NetBSD's revision 1.38.

Reported-by: Aaron LI <aly@aaronly.me>
12 months agodisklabel64: Fix an error message
Aaron LI [Fri, 13 Oct 2017 04:26:29 +0000 (12:26 +0800)]
disklabel64: Fix an error message

12 months agoifconfig(8): Add 'lscan'. Like 'scan', but displays long SSIDs.
Sascha Wildner [Sat, 14 Oct 2017 08:38:45 +0000 (10:38 +0200)]
ifconfig(8): Add 'lscan'. Like 'scan', but displays long SSIDs.

Submitted-by: Max Herrgard <herrgard@gmail.com>
12 months agomkinitrd - Add missing /var/db
Matthew Dillon [Sat, 14 Oct 2017 06:14:31 +0000 (23:14 -0700)]
mkinitrd - Add missing /var/db

* dhclient also needs /var/db to exist, make sure it does.

Reported-by: amonk
12 months agomkinitrd - Add missing /var/empty
Matthew Dillon [Sat, 14 Oct 2017 05:39:31 +0000 (22:39 -0700)]
mkinitrd - Add missing /var/empty

* /var/empty is required by dhclient, which will SIGHUP itself
  without it.

Reported-by: amonk
12 months agoImport OpenSSH-7.6p1
Matthew Dillon [Fri, 13 Oct 2017 01:33:48 +0000 (18:33 -0700)]
Import OpenSSH-7.6p1

* Adjust build to match import

12 months agoImport OpenSSH-7.6p1
Matthew Dillon [Fri, 13 Oct 2017 01:32:28 +0000 (18:32 -0700)]
Import OpenSSH-7.6p1

* Import OpeNSSH-7.6p1.  Couldn't really merge from the vendor branch
  so just brought it in.

* Adjustments for WARNS issues

12 months ago<netdb.h>: Adjust comment a bit.
Sascha Wildner [Thu, 12 Oct 2017 08:16:06 +0000 (10:16 +0200)]
<netdb.h>: Adjust comment a bit.

12 months agolibc/net: Add NI_NUMERICSCOPE flag for getnameinfo().
Sascha Wildner [Thu, 12 Oct 2017 08:13:31 +0000 (10:13 +0200)]
libc/net: Add NI_NUMERICSCOPE flag for getnameinfo().

Code to handle it is already present in getnameinfo() but we
were missing the flag so far.

See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html

12 months agokernel: Simplify various redundant conditions.
Sascha Wildner [Wed, 11 Oct 2017 14:55:23 +0000 (16:55 +0200)]
kernel: Simplify various redundant conditions.

Found-by: cppcheck
One was reported by dcb in <https://bugs.dragonflybsd.org/issues/3078>.

12 months agokernel/atkbdc: Fix a prototype.
Sascha Wildner [Wed, 11 Oct 2017 20:05:26 +0000 (22:05 +0200)]
kernel/atkbdc: Fix a prototype.

12 months agokernel/cam: Add some missing parameter names.
Sascha Wildner [Wed, 11 Oct 2017 20:04:43 +0000 (22:04 +0200)]
kernel/cam: Add some missing parameter names.

Just like the rest of the file.

12 months ago<vfs/hammer2/hammer2.h>: Fix parameter names in two prototypes.
Sascha Wildner [Wed, 11 Oct 2017 17:31:25 +0000 (19:31 +0200)]
<vfs/hammer2/hammer2.h>: Fix parameter names in two prototypes.

Discussed-with: dillon

12 months agolibc - Bring in s_ceill.c v1.2 from OpenBSD (2)
Matthew Dillon [Tue, 10 Oct 2017 22:38:08 +0000 (15:38 -0700)]
libc - Bring in s_ceill.c v1.2 from OpenBSD (2)

* Note, correction, v1.3 from OpenBSD, not v1.2

* Restore a cast that we need to compile with our higher WARNS level.

Reported-by: marino, xenu
12 months agokernel/mrsas: Simplify redundant conditions and remove never used variable
Lubos Boucek [Mon, 2 Oct 2017 02:16:10 +0000 (02:16 +0000)]
kernel/mrsas: Simplify redundant conditions and remove never used variable

Reported-by: dcb
12 months agolibc - Bring in s_ceill.c v1.2 from OpenBSD
Matthew Dillon [Tue, 10 Oct 2017 02:17:32 +0000 (19:17 -0700)]
libc - Bring in s_ceill.c v1.2 from OpenBSD

fix a case where ceill() returns 1.0L: in the x86 extended precision format
the fraction part has no implicit bit.

Reported-by: xenu
Taken-from: OpenBSD

12 months agohammer2.8/pthread_attr_setaffinity_np.3: Fix mdoc issues.
Sascha Wildner [Sun, 8 Oct 2017 07:47:58 +0000 (09:47 +0200)]
hammer2.8/pthread_attr_setaffinity_np.3: Fix mdoc issues.

12 months agodisklabel64.8: Add HAMMER2 fstype info.
Thomas Nikolajsen [Sat, 7 Oct 2017 14:14:52 +0000 (16:14 +0200)]
disklabel64.8: Add HAMMER2 fstype info.

12 months agoperiodic.conf.5: Add hammer2 variables.
Thomas Nikolajsen [Sat, 7 Oct 2017 14:09:36 +0000 (16:09 +0200)]
periodic.conf.5: Add hammer2 variables.

    Add description for periodic HAMMER2 script variables: 161.clean_hammer2.
    While here add HAMMER man pages to SEE ALSO section.

12 months agoetc/periodic/daily/161.clean-hammer2: Fix typo
Thomas Nikolajsen [Sat, 7 Oct 2017 13:53:37 +0000 (15:53 +0200)]
etc/periodic/daily/161.clean-hammer2: Fix typo

    pfslist variable for HAMMER, not HAMMER2 was used.
    This will typically have no effect, as pfslist is typically empty.

12 months agoperiodic.conf: Fix typo in comment
Thomas Nikolajsen [Sat, 7 Oct 2017 13:19:41 +0000 (15:19 +0200)]
periodic.conf: Fix typo in comment

12 months agomount_hammer2(8): Add man page.
Thomas Nikolajsen [Sat, 7 Oct 2017 13:13:11 +0000 (15:13 +0200)]
mount_hammer2(8): Add man page.

12 months agoBring in vmx(4) (VMware virtual network driver, aka vmxnet3).
Sascha Wildner [Wed, 4 Oct 2017 17:01:17 +0000 (19:01 +0200)]
Bring in vmx(4) (VMware virtual network driver, aka vmxnet3).

Some features are still disabled, namely LRO, TSO, VLAN_HWFILTER,
and MSI-X support. That being said, it works and seems stable.

Tested-by: swildner (VMware Player 7.1.4 build-3848939)
            tuxillo (VMware ESXi 6.5.0 (Build 4887370))
Taken-from: FreeBSD (in turn based on OpenBSD's driver)

12 months agokernel - Refuse to swapoff under certain conditions
Matthew Dillon [Fri, 6 Oct 2017 05:59:40 +0000 (22:59 -0700)]
kernel - Refuse to swapoff under certain conditions

* Both tmpfs and vn can't handle swapoff's method of bringing pages
  back in from the swap partition being decomissioned.

* Fixing this properly is fairly involved. The normal swapoff procedure
  is to page swap into the related VM object, but tmpfs and vn use their
  VM objects ONLY to track swap blocks and not for vm_page manipulation,
  so that just won't work.  In addition, the swap code may associate
  a swap block with a VM object before issuing the write I/O to page
  out the data, and the swapoff code's asynchronous pagein might cause
  problems.

  For now, just make sure that swapoff refuses to remove the partition
  under these conditions, so it doesn't blow up tmpfs or vn.

12 months agotmpfs - Fix bug in call to vinitvmio()
Matthew Dillon [Fri, 6 Oct 2017 01:57:33 +0000 (18:57 -0700)]
tmpfs - Fix bug in call to vinitvmio()

* TMPFS_BLKMASK was being passed to vinitvmio() instead of
  TMPFS_BLKSIZE.  It is unclear if this caused any particular
  issue other than an occasional console warning.  Fixed.

12 months agokernel - Change index fields from unsigned to signed
Matthew Dillon [Thu, 5 Oct 2017 20:46:54 +0000 (13:46 -0700)]
kernel - Change index fields from unsigned to signed

* We use a signed trick for (j), fix the code so it actually works.

* The chipset field used to index (i) cannot exceed 1024 anyway.

Reported-by: lubos Bug #3020
12 months agoFix seg-faults on crypt(3) failure
Lubos Boucek [Sat, 23 Sep 2017 07:12:28 +0000 (07:12 +0000)]
Fix seg-faults on crypt(3) failure

12 months agoImprove kdump.1 and ktrace.1
Lubos Boucek [Fri, 22 Sep 2017 22:27:18 +0000 (22:27 +0000)]
Improve kdump.1 and ktrace.1

12 months agonologin(8): Sync with FreeBSD; Symlink as /usr/sbin/nologin
Aaron LI [Wed, 27 Sep 2017 10:24:05 +0000 (18:24 +0800)]
nologin(8): Sync with FreeBSD; Symlink as /usr/sbin/nologin

* Sync "nologin.c" with FreeBSD.  Login attempts are logged into syslog.
* Create symlink "/usr/sbin/nologin" to "/sbin/nologin".  FreeBSD
  (and Linux) installs "nologin" at  "/usr/sbin/nologin", and the users
  created by DPorts/packages also use "/usr/sbin/nologin" (see
  "/usr/dports/UIDs").
* Statically link "nologin" as done by FreeBSD.

12 months agosocket: Limit the number of accepted sockets that kevent reports.
Sepherosa Ziehau [Thu, 5 Oct 2017 06:06:11 +0000 (14:06 +0800)]
socket: Limit the number of accepted sockets that kevent reports.

By default it is limited to 32.  It can be changed through:
sysctl kern.ipc.soavailconn=X

This change does _not_ affect userland using accept(2) in the following
way:
    for (;;) {
        s = accept();
        if (s < 0 && errno == EAGAIN)
            break;
        /* Processing accepted socket. */
    }

This change only affects optimized userland using kevent.data to avoid
extra accept(2) syscall:
    for (i = 0; i < kevent.data; ++i) {
        s = accept();
        /* Processing accepted socket. */
    }

The above logic is applied by nginx.  However, due to the cost of the
"Processing accepted socket" parts, this kinda of loop can increase
latency and destablize latency.

The comparison w/ 30K concurrent connections, 1 request/connection.

 1K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
---------+--------------+----------+-----------+----------
no limit | 210279.88tps |  59.19ms |    4.60ms |  69.02ms
---------+--------------+----------+-----------+----------
32 limit | 217599.01tps |  32.00ms |    2.35ms |  35.59ms

========

 8K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
---------+--------------+----------+-----------+----------
no limit | 180627.61tps |  70.53ms |    4.95ms |  80.61ms
---------+--------------+----------+-----------+----------
32 limit | 186324.41tps |  37.41ms |    4.81ms |  48.69ms

========

16K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
---------+--------------+----------+-----------+----------
no limit | 138667.84tps |  95.93ms |   14.90ms | 135.47ms
---------+--------------+----------+-----------+----------
32 limit | 138778.11tps |  60.90ms |   11.80ms |  92.07ms

This change significantly reduces average latency and .99 latency,
and performance is improved slightly.

12 months agokernel - Fix GCC reordering problem with td_critcount
Matthew Dillon [Tue, 3 Oct 2017 01:42:34 +0000 (18:42 -0700)]
kernel - Fix GCC reordering problem with td_critcount

* Wrap all ++td->td_critcount and --td->td_critcount use cases
  with an inline which executes cpu_ccfence() before and after,
  to guarantee that GCC does not try to reorder the operation around
  critical memory changes.

* This fixes a race in lockmgr() and possibly a few other places
  too.

12 months agokernel - Fix rare lockmgr() state transition (2)
Matthew Dillon [Sun, 1 Oct 2017 18:18:49 +0000 (11:18 -0700)]
kernel - Fix rare lockmgr() state transition (2)

* Fix two lock timeout cases for LK_EXCLUPGRADE and LK_UPGRADE, and
  fix a bug in undo_upreq().

* A tsleep failure (such as the LK_TIMELOCK case via
  vm_map_lock_read_to()) was not properly backing-out a LKC_UPREQ,
  resulting in a situation where the lock becomes exclusively owned
  by nobody and deadlocks against all-comers.  Fix by properly
  calling undo_upreq().

* Fix a bug in undo_upreq() itself.  When undoing a granted UPREQ,
  the lockholder must be set prior to releasing the now-granted
  exclusive lock in order to avoid an assertion panic.

* While we are at it, replace a weird cmpset count,count with a
  fetchadd(count, 0).

12 months agosbin/hammer: Fix compile-time warning by some Linux distros
Tomohiro Kusumi [Sun, 1 Oct 2017 12:37:54 +0000 (15:37 +0300)]
sbin/hammer: Fix compile-time warning by some Linux distros

--
test_dupkey.c: In function 'main':
test_dupkey.c:54:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

12 months agoFix some minor issues in several manual pages.
Sascha Wildner [Sun, 1 Oct 2017 10:09:02 +0000 (12:09 +0200)]
Fix some minor issues in several manual pages.

12 months agoX86_64_GENERIC: Fix indent.
Sascha Wildner [Sun, 1 Oct 2017 09:35:59 +0000 (11:35 +0200)]
X86_64_GENERIC: Fix indent.

12 months agokernel - Improve tsleep/wakeup queue collisions (3)
Matthew Dillon [Sun, 1 Oct 2017 01:17:55 +0000 (18:17 -0700)]
kernel - Improve tsleep/wakeup queue collisions (3)

* Doh, fix variable declaration.

12 months agokernel - Improve tsleep/wakeup queue collisions (2)
Matthew Dillon [Sun, 1 Oct 2017 01:11:08 +0000 (18:11 -0700)]
kernel - Improve tsleep/wakeup queue collisions (2)

* Fix SMP race.  When testing ident0 against -1 or the ident value
  as stored in a remote cpu's structure, ident0 must be loaded from memory
  once to avoid a cross-over race.

12 months agokernel - Fix rare lockmgr() state transition
Matthew Dillon [Sat, 30 Sep 2017 22:12:30 +0000 (15:12 -0700)]
kernel - Fix rare lockmgr() state transition

* When lockmgr() is releasing the last count on an exclusive lock
  with an upgrade request pending, and the atomic op fails, the
  code fails to properly retry.  Fixed by properly retrying.

* This situation should not be possible to even get into, hence 'rare'.
  It requires UPREQ to be set while the lock is being held exclusively,
  which should never be possible because there is no shared lock holder
  in that case who might attempt to upgrade.

  I checked race conditions when multiple shared holders attempt
  to upgrade but all that happens is that one will release and
  acquire a normal exclusive lock instead.

12 months agoFix some Xr punctuation issues in several manual pages.
Sascha Wildner [Sat, 30 Sep 2017 21:18:41 +0000 (23:18 +0200)]
Fix some Xr punctuation issues in several manual pages.

12 months agoUse standard section name 'AUTHORS' in several manual pages.
Sascha Wildner [Sat, 30 Sep 2017 21:12:11 +0000 (23:12 +0200)]
Use standard section name 'AUTHORS' in several manual pages.

12 months agoChanged OSNAME to match 5.0. v5.0.0rc2
Justin C. Sherrill [Sat, 30 Sep 2017 21:24:32 +0000 (17:24 -0400)]
Changed OSNAME to match 5.0.

12 months agoRevert "Update drm/radeon to Linux 4.7.10 as much as possible..."
Imre Vadász [Sat, 30 Sep 2017 19:08:51 +0000 (21:08 +0200)]
Revert "Update drm/radeon to Linux 4.7.10 as much as possible..."

This caused severe issues on some modern radeon models (e.g. Kaveri APUs).
Not reverting the 62dc643ef61b347c4c2e60ad9ea68dd766741c90 commit, it's just
a 2 character diff that was conflicting with this change.

This reverts commit a7a95252afec8bfcc34ee5b8725136b17b77043f.

Tested-By: ivadasz
Reported-By: several people on #dragonflybsd
12 months ago<sys/param.h>: Fix __DragonFly_version.
Sascha Wildner [Sat, 30 Sep 2017 17:47:14 +0000 (19:47 +0200)]
<sys/param.h>: Fix __DragonFly_version.

Reported-by: zrj
12 months agoUpdate UPDATING a bit for the disabling of FFS_ROOT.
Sascha Wildner [Sat, 30 Sep 2017 17:29:42 +0000 (19:29 +0200)]
Update UPDATING a bit for the disabling of FFS_ROOT.

12 months agorc.conf.5: Improve moused_type description a bit more.
Sascha Wildner [Sat, 30 Sep 2017 14:47:04 +0000 (16:47 +0200)]
rc.conf.5: Improve moused_type description a bit more.

12 months ago5.0 branching. v5.0.0rc1
Justin C. Sherrill [Sat, 30 Sep 2017 00:10:43 +0000 (20:10 -0400)]
5.0 branching.

12 months agorc.conf.5: Improve wording of the moused_type variable description.
Sascha Wildner [Fri, 29 Sep 2017 19:03:36 +0000 (21:03 +0200)]
rc.conf.5: Improve wording of the moused_type variable description.

Especially, point out that the default is 'auto' and if that is
what the user wants, they need not set it explicitly in their
/etc/rc.conf.

Reported-by: htse (Harald Brinkhof)
12 months agoarp: Allocate context memory on owner cpu.
Sepherosa Ziehau [Fri, 29 Sep 2017 06:38:35 +0000 (14:38 +0800)]
arp: Allocate context memory on owner cpu.

12 months agosyncache: Timer queue iteration is MPsafe; no need to use marker.
Sepherosa Ziehau [Fri, 29 Sep 2017 01:30:46 +0000 (09:30 +0800)]
syncache: Timer queue iteration is MPsafe; no need to use marker.

12 months agosyncache: Move local variables close their usage.
Sepherosa Ziehau [Fri, 29 Sep 2017 01:03:46 +0000 (09:03 +0800)]
syncache: Move local variables close their usage.

12 months agosyncache: inpcb will never be NULL.
Sepherosa Ziehau [Fri, 29 Sep 2017 01:02:03 +0000 (09:02 +0800)]
syncache: inpcb will never be NULL.

12 months agosyncache: Resurrect net.inet.tcp.syncache.count
Sepherosa Ziehau [Fri, 29 Sep 2017 00:11:18 +0000 (08:11 +0800)]
syncache: Resurrect net.inet.tcp.syncache.count

12 months agosyncache: Allocate syncache context on the owner cpu.
Sepherosa Ziehau [Thu, 28 Sep 2017 23:38:19 +0000 (07:38 +0800)]
syncache: Allocate syncache context on the owner cpu.

12 months agosyncache: Group timeout queue related fields together.
Sepherosa Ziehau [Thu, 28 Sep 2017 23:10:19 +0000 (07:10 +0800)]
syncache: Group timeout queue related fields together.

12 months agosyncache: Simplify timer message
Sepherosa Ziehau [Thu, 28 Sep 2017 22:44:50 +0000 (06:44 +0800)]
syncache: Simplify timer message

12 months agosyncache: Remove unnecessary struct field
Sepherosa Ziehau [Thu, 28 Sep 2017 22:15:32 +0000 (06:15 +0800)]
syncache: Remove unnecessary struct field

12 months agosyncache: Staticize syncache_lookup
Sepherosa Ziehau [Thu, 28 Sep 2017 21:59:58 +0000 (05:59 +0800)]
syncache: Staticize syncache_lookup

12 months agosyncache: Stringent assertion.
Sepherosa Ziehau [Thu, 28 Sep 2017 21:51:34 +0000 (05:51 +0800)]
syncache: Stringent assertion.

12 months agokern: Allocate sleep hash on owner cpu.
Sepherosa Ziehau [Thu, 28 Sep 2017 19:37:56 +0000 (03:37 +0800)]
kern: Allocate sleep hash on owner cpu.

12 months agovkernel - Print mmap() failures in megabytes
Matthew Dillon [Fri, 29 Sep 2017 00:43:20 +0000 (17:43 -0700)]
vkernel - Print mmap() failures in megabytes

* Print mmap() failures for vkd* drives in megabytes instead
  of bytes.

12 months agokernel - Add poor-man's AMD TOPOEXT support
Matthew Dillon [Fri, 29 Sep 2017 00:41:32 +0000 (17:41 -0700)]
kernel - Add poor-man's AMD TOPOEXT support

* Add a poor-man's TOPOEXT support which should properly detect
  the Ryzen topology.  I don't know about EPYC, though.  And it
  might muff the topology for older AMD cpus (also don't know).

12 months agokernel - Improve tsleep/wakeup queue collisions
Matthew Dillon [Fri, 29 Sep 2017 00:34:47 +0000 (17:34 -0700)]
kernel - Improve tsleep/wakeup queue collisions

* Expand the per-cpu array of TAILQs into an array of structures for
  tsleep/wakeup operation.

  The new structure stores up to four idents using a 4-way set-associative
  algorithm (-1 in ident0 handles overflows), allowing the originating cpu
  for a wakeup() to implement a second-level filter after the global array's
  cpumask.

* This filter prevents nearly all possible spurious IPIs that used to occur
  due to ident hash collisions, even when the hash table size is forced to
  be relatively small.  The code isn't the best in the world, but the IPIs
  it saves probably blow away the added overhead.

Testing-by: sephe, dillon
12 months agosound - Don't need to use swi_taskq to call KNOTE from the interrupt.
Imre Vadász [Thu, 28 Sep 2017 22:15:08 +0000 (00:15 +0200)]
sound - Don't need to use swi_taskq to call KNOTE from the interrupt.

* Also the dsp_read_filterops and dsp_write_filterops kqueue filters can
  be flagged FILTEROP_MPSAFE.

12 months agokernel - Restrict kill(-1, ...) to the reaper group as well
Matthew Dillon [Thu, 28 Sep 2017 19:55:19 +0000 (12:55 -0700)]
kernel - Restrict kill(-1, ...) to the reaper group as well

* When kill(-1, ...) is issued to 'all processes', restrict the list
  of processes signaled to the sender's reaper group or any sub-group
  of that group.

* This works around issues found when testing low maxproc limits.
  At least one (and probably several) third party programs do not
  properly handle errors when [v]fork() returns -1 and may try to
  signal the returned 'pid', which being -1 crowbars the entire system.

* Fixes issue when a cmake running under synth hits a fork failure
  and tries to signal the whole system.  With this change, the cmake
  winds up only crowbaring its own chroot due to synthexec's use of
  the reaper feature.

* Adjust the kill.2 manual page to reflect the change.

12 months agomandoc(1): Move the config.h to the build directory.
Sascha Wildner [Thu, 28 Sep 2017 18:15:03 +0000 (20:15 +0200)]
mandoc(1): Move the config.h to the build directory.

Next mandoc upgrade will remove it on the vendor branch as well.

12 months agoipfw: Add interface network filter.
Sepherosa Ziehau [Thu, 28 Sep 2017 07:14:49 +0000 (15:14 +0800)]
ipfw: Add interface network filter.

This eases src/dst matching if the IP address is assigned to the interface
dynamically, e.g. by DHCP.

12 months agouipc: Use sendmsg_oncpu, if possible.
Sepherosa Ziehau [Thu, 28 Sep 2017 01:42:04 +0000 (09:42 +0800)]
uipc: Use sendmsg_oncpu, if possible.

This further reduces unnecessary IPIs (5500/s -> 5000/s).

12 months agocallout: Embed thread in per-cpu callout context.
Sepherosa Ziehau [Wed, 27 Sep 2017 23:20:26 +0000 (07:20 +0800)]
callout: Embed thread in per-cpu callout context.

12 months agokern: Enhance wakeup hash construction to reduce hash collision.
Sepherosa Ziehau [Wed, 27 Sep 2017 23:18:37 +0000 (07:18 +0800)]
kern: Enhance wakeup hash construction to reduce hash collision.

With-input-from: dillon
Tested-by: dillon
12 months agoRemove libmandoc.
Sascha Wildner [Thu, 28 Sep 2017 06:22:34 +0000 (08:22 +0200)]
Remove libmandoc.

Maintaining it separately, along with its manual pages and headers,
is more maintenance burden than it has real value.

Nothing but mandoc(1) needs it, so just include the source files in
the mandoc(1) build for now.

In-discussion-with: Lubos Boucek <bouceklubos@gmail.com>

12 months agokern: Add read-only sysctl for sleep queue table size
Sepherosa Ziehau [Wed, 27 Sep 2017 19:29:44 +0000 (03:29 +0800)]
kern: Add read-only sysctl for sleep queue table size

12 months agokernel - Fix cpu_rotator in lwkt_alloc_thread()
Matthew Dillon [Thu, 28 Sep 2017 02:40:13 +0000 (19:40 -0700)]
kernel - Fix cpu_rotator in lwkt_alloc_thread()

* The cpu and rotator are signed.  Use an unsigned modulo to ensure
  that the resulting cpu is properly ranged.

12 months agoppp - Fix seg-fault on crypt failure
Matthew Dillon [Wed, 27 Sep 2017 21:51:48 +0000 (14:51 -0700)]
ppp - Fix seg-fault on crypt failure

* Fix an issue where the program seg-faults if crypt() returns
  NULL.  Return 0 (failure for this routine) in case of NULL

Submitted-by: lubos
12 months agocallout: Allocate per-cpu callout context on the owner cpu.
Sepherosa Ziehau [Wed, 27 Sep 2017 07:01:25 +0000 (15:01 +0800)]
callout: Allocate per-cpu callout context on the owner cpu.

Thread is not embedded in the per-cpu callout context.

12 months agocallout: Allocate wheel on owner cpu.
Sepherosa Ziehau [Wed, 27 Sep 2017 06:47:23 +0000 (14:47 +0800)]
callout: Allocate wheel on owner cpu.

12 months agoRevert "callout: Allocate callout wheel/thread on the owner cpu."
Sepherosa Ziehau [Wed, 27 Sep 2017 06:43:22 +0000 (14:43 +0800)]
Revert "callout: Allocate callout wheel/thread on the owner cpu."

This reverts commit 8def3b58c71a8b3527e2cc9aed97c1467dc0a74c.

It causes large amount of unnecessary IPIs to the last CPU during
some TCP related tests.  Needs more investigation.

12 months agoipfw: Add interface IP filter.
Sepherosa Ziehau [Wed, 27 Sep 2017 07:50:24 +0000 (15:50 +0800)]
ipfw: Add interface IP filter.

This eases src/dst matching if the IP address is assigned to the interface
dynamically, e.g. by DHCP.

12 months agoipfw(8): Fix comment
Sepherosa Ziehau [Wed, 27 Sep 2017 06:20:52 +0000 (14:20 +0800)]
ipfw(8): Fix comment

12 months agokernel - Fix rare allproc scan vs p_ucred race
Matthew Dillon [Wed, 27 Sep 2017 04:31:04 +0000 (21:31 -0700)]
kernel - Fix rare allproc scan vs p_ucred race

* This race can occur because p->p_ucred can change out from under
  an allproc scan when the allproc scan is filtering based on
  credentials.

* Access p->p_ucred via the per-process spinlock (p->p_spin).  Also
  maintain a  cache of the last ucred during the loop in order to
  avoid having to spin-lock every process.

* Add missing spinlock around p->p_ucred = NULL in exit1().  This
  is also only applicable to races against allproc scans since
  p_token is held during exit1().

Reported-by: mjg_
12 months agokernel - Fix unnecessary ucred duplication
Matthew Dillon [Wed, 27 Sep 2017 04:28:12 +0000 (21:28 -0700)]
kernel - Fix unnecessary ucred duplication

* Fix unnecessary ucred replication.  This is not a memory leak, but it
  is annoying.

* Replicated ucreds can build-up in the system (up to maxvnodes) due to
  to unlinked files.

* Fix by flagging unlinked files in np->n_flag and immediately recycling
  the related vnode in the inactive code if it has been flagged for
  removal.

12 months agocallout: Allocate callout wheel/thread on the owner cpu.
Sepherosa Ziehau [Tue, 26 Sep 2017 04:46:39 +0000 (12:46 +0800)]
callout: Allocate callout wheel/thread on the owner cpu.

12 months agocallout: Minor style changes
Sepherosa Ziehau [Tue, 26 Sep 2017 04:30:02 +0000 (12:30 +0800)]
callout: Minor style changes

12 months agopktgen: Allow building w/o INVARIANTS
Sepherosa Ziehau [Tue, 26 Sep 2017 00:49:01 +0000 (08:49 +0800)]
pktgen: Allow building w/o INVARIANTS

12 months agoethernet: Restructure vlan check.
Sepherosa Ziehau [Mon, 25 Sep 2017 23:40:33 +0000 (07:40 +0800)]
ethernet: Restructure vlan check.

12 months agoipflow: Use netisr APIs
Sepherosa Ziehau [Mon, 25 Sep 2017 23:14:06 +0000 (07:14 +0800)]
ipflow: Use netisr APIs

12 months agoipflow: Remove compat macro
Sepherosa Ziehau [Mon, 25 Sep 2017 22:17:38 +0000 (06:17 +0800)]
ipflow: Remove compat macro

12 months agosbin/hammer: Use uuid_compare(3) instead of bcmp(3)
Tomohiro Kusumi [Mon, 25 Sep 2017 20:19:48 +0000 (23:19 +0300)]
sbin/hammer: Use uuid_compare(3) instead of bcmp(3)

(missed ones from 118205ce)

12 months agokcollect - Final dbm support code
Matthew Dillon [Mon, 25 Sep 2017 21:12:59 +0000 (14:12 -0700)]
kcollect - Final dbm support code

* Fix time conversion issues and memory leaks

* Code cleanup

* Documentation cleanup (from swildner)

Submitted-by: htse (Harald Brinkhof)
12 months agoipflow: Utilize netisr_domsg_global
Sepherosa Ziehau [Mon, 25 Sep 2017 07:25:20 +0000 (15:25 +0800)]
ipflow: Utilize netisr_domsg_global

12 months agoipflow: Allocate ipflow context on its owner cpu.
Sepherosa Ziehau [Mon, 25 Sep 2017 06:51:41 +0000 (14:51 +0800)]
ipflow: Allocate ipflow context on its owner cpu.

12 months agoipflow: Use INTWAIT | NULLOK for kmalloc
Sepherosa Ziehau [Mon, 25 Sep 2017 06:02:33 +0000 (14:02 +0800)]
ipflow: Use INTWAIT | NULLOK for kmalloc