dragonfly.git
2 years 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)

2 years 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.

2 years 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).

2 years 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]
 }

2 years 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.

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

2 years 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.

2 years 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.

2 years 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.

2 years agomandoc(1): Changed OSNAME to match 5.1.
Sascha Wildner [Sat, 30 Sep 2017 21:31:36 +0000 (23:31 +0200)]
mandoc(1): Changed OSNAME to match 5.1.

2 years 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.

2 years 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.

2 years 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
2 years agosbin/mount_hammer: Remove redundant test_volumes() on mount(2) failure
Tomohiro Kusumi [Sat, 30 Sep 2017 11:21:25 +0000 (14:21 +0300)]
sbin/mount_hammer: Remove redundant test_volumes() on mount(2) failure

This code was originally added by 1a607e3e which added signature check
when mount(2) failed, and later modified by several commits including
1e297b34 which copied code from sbin/hammer/ondisk.c. But as mentioned
in 1e297b34, this entire checking wasn't needed (as it's in dmesg),
or it may even show the wrong reason of failure.

The correct way is to just type dmesg, and see what the kernel said,
instead of resorting to wild guess in userspace by reading volume header
*after* mount(2) failure (If you really want this it should be done
*before* mount(2)).

This originally didn't exist till 2009 and that was better.

2 years agosys/vfs/hammer: Check root voume# is 0 on mount(2)
Tomohiro Kusumi [Sat, 30 Sep 2017 11:17:32 +0000 (14:17 +0300)]
sys/vfs/hammer: Check root voume# is 0 on mount(2)

We could check this in addition to the existing conditional to
know the volume is the root volume. /sbin/hammer and /sbin/mount_hammer
do this, so why not.

If failed here, the volume which has just been inserted to the rbtree
(and other volumes already inserted) are going to be removed by
hammer_free_hmp().

2 years agosbin/hammer: Add UUID string on error and blockmap,show
Tomohiro Kusumi [Sat, 30 Sep 2017 10:12:51 +0000 (13:12 +0300)]
sbin/hammer: Add UUID string on error and blockmap,show

to make clear whether ondisk vol_fstype UUID is simply wrong or
due to byte order of the first 8 bytes (4-2-2 part).

2 years agosbin/hammer: Minor cleanup
Tomohiro Kusumi [Sat, 30 Sep 2017 09:29:07 +0000 (12:29 +0300)]
sbin/hammer: Minor cleanup

The prototype was originally brought (copied) from uuid(3).

2 years agotmpfs - Conditionalize atomic adds on mount structure
Matthew Dillon [Sat, 30 Sep 2017 18:06:49 +0000 (11:06 -0700)]
tmpfs - Conditionalize atomic adds on mount structure

* Conditionalize tracking of the total pages allocated to avoid
  the atomic op when the delta change is 0.

Suggested-by: mjg_
2 years ago<sys/param.h>: Fix __DragonFly_version.
Sascha Wildner [Sat, 30 Sep 2017 17:45:42 +0000 (19:45 +0200)]
<sys/param.h>: Fix __DragonFly_version.

Reported-by: zrj
2 years 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.

2 years 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.

2 years ago5.1 commit. v5.1.0
Justin C. Sherrill [Sat, 30 Sep 2017 00:11:33 +0000 (20:11 -0400)]
5.1 commit.

2 years 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)
2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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.

2 years 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.

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

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

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

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

2 years 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.

2 years 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.

2 years 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).

2 years 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
2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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).

2 years 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.

2 years 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
2 years 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>

2 years 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

2 years 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.

2 years 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
2 years 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.

2 years 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.

2 years 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.

2 years 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.

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

2 years 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_
2 years 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.

2 years 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.

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

2 years 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

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

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

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

2 years 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)

2 years 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)
2 years agoipflow: Utilize netisr_domsg_global
Sepherosa Ziehau [Mon, 25 Sep 2017 07:25:20 +0000 (15:25 +0800)]
ipflow: Utilize netisr_domsg_global

2 years 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.

2 years 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

2 years agoipflow: No need to mark it cachealign.
Sepherosa Ziehau [Mon, 25 Sep 2017 06:01:21 +0000 (14:01 +0800)]
ipflow: No need to mark it cachealign.

ipflow is allocated on the owner cpu.

2 years agoipflow: Remove reference counting, which no longer applies.
Sepherosa Ziehau [Mon, 25 Sep 2017 05:58:25 +0000 (13:58 +0800)]
ipflow: Remove reference counting, which no longer applies.

2 years agoipflow: Stringent assertion.
Sepherosa Ziehau [Mon, 25 Sep 2017 05:07:02 +0000 (13:07 +0800)]
ipflow: Stringent assertion.

2 years agoroute: Minor style change.
Sepherosa Ziehau [Mon, 25 Sep 2017 05:05:31 +0000 (13:05 +0800)]
route: Minor style change.

2 years agopolling: Utilize netisr_domsg_global
Sepherosa Ziehau [Mon, 25 Sep 2017 04:47:22 +0000 (12:47 +0800)]
polling: Utilize netisr_domsg_global

2 years agopolling: No need to explicitly align io context and systimer context
Sepherosa Ziehau [Mon, 25 Sep 2017 04:41:37 +0000 (12:41 +0800)]
polling: No need to explicitly align io context and systimer context

2 years agopolling: Adjust comment
Sepherosa Ziehau [Mon, 25 Sep 2017 04:34:07 +0000 (12:34 +0800)]
polling: Adjust comment

2 years agopolling: Don't do direct input in critical section.
Sepherosa Ziehau [Mon, 25 Sep 2017 00:42:56 +0000 (08:42 +0800)]
polling: Don't do direct input in critical section.

2 years agokcollect - Add initial dbm support
Matthew Dillon [Sun, 24 Sep 2017 18:17:03 +0000 (11:17 -0700)]
kcollect - Add initial dbm support

* Fully implement the -b and -d options to allow a dbm file to
  be recorded / appended, and played back.

* Still needs a little fleshing out for scaling info and
  headers.

Submitted-by: htse (Harald Brinkhof)
2 years agosbin/hammer: Fix strncpy(3) length
Tomohiro Kusumi [Sun, 24 Sep 2017 15:22:28 +0000 (18:22 +0300)]
sbin/hammer: Fix strncpy(3) length

The last one is ok, but HAMMER userspace doesn't use strl variants
except for this, then just use strncpy(3) for better portability.

2 years agokernel: Remove no longer used FFS_ROOT option.
Sascha Wildner [Sun, 24 Sep 2017 12:39:15 +0000 (14:39 +0200)]
kernel: Remove no longer used FFS_ROOT option.

Last used in code removed in 8840cec90a57df5e7c0f84c3c3c1e9abea7f2632.

While here, remove some no longer necessary opt_ffs.h #includes.

2 years ago<machine/stdint.h>: Add __suseconds_t for suseconds_t definitions.
Sascha Wildner [Sun, 24 Sep 2017 11:30:30 +0000 (13:30 +0200)]
<machine/stdint.h>: Add __suseconds_t for suseconds_t definitions.

2 years agopolling: Implement direct input support.
Sepherosa Ziehau [Sat, 23 Sep 2017 03:19:26 +0000 (11:19 +0800)]
polling: Implement direct input support.

When "direct input" is enabled by driver, driver's RX polling handler
will run ethernet/ip/tcp processing directly, which avoids cache-miss
on mbufs themselves.  Currently it is enabled on ix(4) by default.

The normal IP forwarding performance is improved by %12, while the fast
IP forwarding performance is improved by 10%.  13.2Mpps is achieved for
dual side IP forwarding!

1 request/connection HTTP/1.1 performance and avg-latency stay same,
but the latency is further stablized:
1K  5.20ms  -> 4.60ms
8K  6.43ms  -> 5.76ms
16K 16.30ms -> 14.90ms

2 years agosbin/hammer: Cleanup header includes
Tomohiro Kusumi [Sat, 23 Sep 2017 20:06:17 +0000 (23:06 +0300)]
sbin/hammer: Cleanup header includes

2 years agosys/vfs/hammer: Use kuuid_compare() instead of bcmp()
Tomohiro Kusumi [Sat, 23 Sep 2017 20:43:52 +0000 (23:43 +0300)]
sys/vfs/hammer: Use kuuid_compare() instead of bcmp()

though kuuid_compare() is probably slower than bcmp() in most cases.
It's not performance critical part anyway.

2 years agohammer2 - Fix bug in hammer2_chain_indkey_dir()
Matthew Dillon [Sun, 24 Sep 2017 04:12:22 +0000 (21:12 -0700)]
hammer2 - Fix bug in hammer2_chain_indkey_dir()

* The shortcut in hammer2_chain_indkey_dir() ignores the
  possibilty that the key breakdown chosen may not result
  in the clearing out of any elements in the parent.  If this
  occurs, an insertion operation following the function
  will assert on too many elements.

* Remove the shotcut.

2 years agoUpdate files for file-5.32 import.
Sascha Wildner [Sat, 23 Sep 2017 19:15:53 +0000 (21:15 +0200)]
Update files for file-5.32 import.

2 years agoMerge branch 'vendor/FILE'
Sascha Wildner [Sat, 23 Sep 2017 19:23:05 +0000 (21:23 +0200)]
Merge branch 'vendor/FILE'

2 years agoRevert "Import file-5.22."
Sascha Wildner [Sat, 23 Sep 2017 19:22:44 +0000 (21:22 +0200)]
Revert "Import file-5.22."

This reverts commit 89a9c80e537ed7238142c9af2cdc03401742a18a.

For some reason the 5.22 upgrade was not git-merged, looks like
copied instead. Caused merge conflicts with 5.32.

2 years agoImport file-5.32.
Sascha Wildner [Sat, 23 Sep 2017 19:13:08 +0000 (21:13 +0200)]
Import file-5.32.

See ChangeLog for details.

2 years agomicrouptime.9 microtime.9: Fix documentation of the get* function versions.
Imre Vadász [Sat, 23 Sep 2017 15:04:38 +0000 (17:04 +0200)]
microuptime.9 microtime.9: Fix documentation of the get* function versions.

The kern.timecounter sysctl tree doesn't exist nowadays, the getmicrotime(),
getnanotime(), getmicrouptime() and getnanouptime() functions always
return the less precise time.

2 years agosbin/newfs_hammer2: Fix typo in newfs_hammer2(8)
Tomohiro Kusumi [Sat, 23 Sep 2017 11:27:20 +0000 (14:27 +0300)]
sbin/newfs_hammer2: Fix typo in newfs_hammer2(8)

of of

2 years agousr.sbin/fstyp: Add initial HAMMER2 support
Tomohiro Kusumi [Fri, 22 Sep 2017 22:17:20 +0000 (01:17 +0300)]
usr.sbin/fstyp: Add initial HAMMER2 support

-l option and multiple/partial volumes are not supported yet.

2 years agosys/vfs/hammer: Add typedef hammer_uuid_t
Tomohiro Kusumi [Thu, 21 Sep 2017 16:06:37 +0000 (19:06 +0300)]
sys/vfs/hammer: Add typedef hammer_uuid_t

Add typedef for uuid_t for better portability,
similar to hammer_crc_t and other hammer_xxx_t.
(Some platforms have char[16] for uuid_t instead of struct value)

No functional changes.

2 years agosbin/hammer: Add uuid.c
Tomohiro Kusumi [Thu, 21 Sep 2017 16:06:16 +0000 (19:06 +0300)]
sbin/hammer: Add uuid.c

Add a simple wrapper over uuid functions for better portability,
similar to sys/vfs/hammer/hammer_crc.h (which helped implement
version 7 CRC).

No functional changes.

2 years agopsm: Drop bpsm%d device files. Instead support non-blocking reads on psm%d.
Imre Vadász [Sat, 23 Sep 2017 11:12:34 +0000 (13:12 +0200)]
psm: Drop bpsm%d device files. Instead support non-blocking reads on psm%d.

The /dev/psm%d vs. /dev/bpsm%d separation doesn't serve any clear purpose
nowadays. Userland can just use fcntl(2) to switch the fd to non-blocking
or blocking mode as needed.

2 years agohammer2 - Fix hammer2 snapshot operation
Matthew Dillon [Fri, 22 Sep 2017 16:27:04 +0000 (09:27 -0700)]
hammer2 - Fix hammer2 snapshot operation

* Bring the hammer2 snapshot code up-to-date with the pfs-create
  code.

* Fix initial inode number assignment for hammer2 snapshot code (it
  was starting at 1024 which obviously won't work).

* Correct hammer2_vop_ncreate() error code - it was not converting
  the hammer2 error code to a system error code.

2 years agopsm: Get rid of PSM_LEVEL_NATIVE, and the psmwrite method used with that.
Imre Vadász [Fri, 22 Sep 2017 15:46:45 +0000 (17:46 +0200)]
psm: Get rid of PSM_LEVEL_NATIVE, and the psmwrite method used with that.

* Nothing in userspace ever uses this feature. This apparently was intended
  to allow implementing the complete mouse packet parsing in userspace.

2 years agopsm: Remove dead unused code: psmpoll(), enable_lordless(), is_a_mouse().
Imre Vadász [Fri, 22 Sep 2017 12:21:52 +0000 (14:21 +0200)]
psm: Remove dead unused code: psmpoll(), enable_lordless(), is_a_mouse().

* The is_a_mouse() check method was already disabled in the original
  FreeBSD commit, which added the psm(4) driver
  (git b3062b5d6a9d9631bf6a1612e27107ea9aa6801d ).

2 years agoinet/inet6: Randomize local port
Sepherosa Ziehau [Fri, 22 Sep 2017 01:09:10 +0000 (09:09 +0800)]
inet/inet6: Randomize local port

Due to avoid lock intruction, this also improves connect(2)
performance a bit.

2 years agoarc4random: Make arc4random context per-cpu.
Sepherosa Ziehau [Thu, 21 Sep 2017 23:35:21 +0000 (07:35 +0800)]
arc4random: Make arc4random context per-cpu.

Critical section is commented out, no consumers from ISRs/ithreads.

2 years agohammer2 - Fix panic related to the accounting for pfs-create
Matthew Dillon [Fri, 22 Sep 2017 05:01:03 +0000 (22:01 -0700)]
hammer2 - Fix panic related to the accounting for pfs-create

* Properly disconnect the inode created by pfs-create from the spmp so it
  can be reassociated with the pmp.

* Do not allow the newly created inode to be emplaced on the spmp's sideq,
  which will cause a duplicate inode structure to be created if the
  pfs is then mounted.

Reported-by: Romick
2 years agohammer2 - Fix flush issues with unmounted PFSs and shutdown panic
Matthew Dillon [Fri, 22 Sep 2017 00:35:56 +0000 (17:35 -0700)]
hammer2 - Fix flush issues with unmounted PFSs and shutdown panic

* Fix flush and shutdown issues when unmounted PFS's are present.
  These PFSs do not get flushed by the filesystem sync code because
  they haven't been mounted, but may still contain modified or
  referenced chains, as well as sideq'd inodes.

* Fix some other cleanup issues when unmounting.  Clean out vchain.pmp
  and fchain.pmp for the spmp during the unmount scan, which fixes a
  hammer2 pfs_memory_*() panic.

Reported-by: yellowrabbit2010