2 years agoAdd FreeBSD's mpr(4) driver for LSI Fusion-MPT 3/3.5 SAS controllers.
Sascha Wildner [Tue, 24 Apr 2018 18:45:47 +0000 (20:45 +0200)]
Add FreeBSD's mpr(4) driver for LSI Fusion-MPT 3/3.5 SAS controllers.

This commit also includes a userland utility for mps(4) and mpr(4)
(mprutil(8) aka mpsutil(8)).

After porting bug fixing, testing shows that it seems to be stable,
therefore I have added it to our X64_64_GENERIC as well.

Thanks to zrj for testing and to sephe for some porting clues.

Taken-from: FreeBSD

2 years ago<sys/proc.h>: Fix unused macro name (number == bit number) and comment.
Sascha Wildner [Tue, 24 Apr 2018 12:49:10 +0000 (14:49 +0200)]
<sys/proc.h>: Fix unused macro name (number == bit number) and comment.

2 years agoevtranalyze.1: Fix typo.
Sascha Wildner [Tue, 24 Apr 2018 07:14:57 +0000 (09:14 +0200)]
evtranalyze.1: Fix typo.

2 years agox86_64/ioapic: Make sure that legacy IRQ only appears on one CPU.
Sepherosa Ziehau [Mon, 23 Apr 2018 14:15:44 +0000 (22:15 +0800)]
x86_64/ioapic: Make sure that legacy IRQ only appears on one CPU.

The legacy IRQ lookup assumes only one CPU has a given legacy IRQ.

On system w/ large number of IOAPIC, GSI96 could be mapped to IRQ17
on CPU0 (since IRQ96 is used by SYSCALL), while GSI17 is mapped to
IRQ17 on another CPU.  This breaks later IRQ lookup.

Reported-by: Imre Vadasz
Tested-by: Imre Vadasz

2 years agokernel - Remove cache ping-pong on common scheduler operations
Matthew Dillon [Mon, 23 Apr 2018 07:27:21 +0000 (00:27 -0700)]
kernel - Remove cache ping-pong on common scheduler operations

* Reflect dfly_curprocmask and dfly_rdyprocmask bits in the
  scheduler's pcpu structures.  This allows us to reduce global
  atomic ops that are virtually guaranteed to cause cache ping

* sched_yield and token-based yield operations no longer clear
  the bit in the curprocmask, since they are just yielding
  (XXX needs work, a later blocking op then might not pull a
  new process from another cpu).

2 years agokernel - More deterministic systat -pv lock name output
Matthew Dillon [Mon, 23 Apr 2018 07:23:15 +0000 (00:23 -0700)]
kernel - More deterministic systat -pv lock name output

* Update the lock name in the globaldata structure for any
  contended lock that bumps the SMP collision count (basically,
  any lock which contends for more than 1uS).

* Improved systat -pv accuracy at very little cost.

2 years agokernel - Improve lockf performance
Matthew Dillon [Mon, 23 Apr 2018 07:19:46 +0000 (00:19 -0700)]
kernel - Improve lockf performance

* Improve fcntl lockf performance with two small optimizations.
  Together these add a little over 10% in non-contended

* Add a 2-entry-per-cpu range lock allocation cache.  This
  covers the most typical lock/unlock situations.

* Conditionalize the setting of VMAYHAVELOCKS to avoid unnecessary
  atomic ops.

* Remove the clearing of VMAYHAVELOCKS.  The cost in close() is
  basically nothing while the cost in the lockf critical path
  is several branches and an atomic op.

2 years agolibthread_xu - Improve contended mutex code
Matthew Dillon [Mon, 23 Apr 2018 02:29:58 +0000 (19:29 -0700)]
libthread_xu - Improve contended mutex code

* Retry a few times in a loop before using the umtx*() system
  calls to sleep.

  This significantly reduces IPI traffic and improves performance
  when a mutex is heavily contended.

2 years agokernel - Improve namecache performance
Matthew Dillon [Mon, 23 Apr 2018 02:26:58 +0000 (19:26 -0700)]
kernel - Improve namecache performance

* Improve performance for the edge case where a process is
  deleting a large number of files.  In this situation,
  NCF_DESTROYED ncp entries can build up in the hash table
  and slow things down until the system quiets down, then
  the tables get cleaned up.

  Improve by recycling such entries into new entries when

* Refactor the hash calculation again.  The big-prime idea
  actually has some trivially obvious problems, scrap it
  for the moment.

2 years agokernel - Improve kern_dup() performance
Matthew Dillon [Mon, 23 Apr 2018 02:25:23 +0000 (19:25 -0700)]
kernel - Improve kern_dup() performance

* Run the operation with a single exclusive spinlock instead of
  acquiring and releasing it twice.  Improves thread-concurent
  dup() performance.

2 years agokernel - Carefully refactor contended tokens and spinlocks (2)
Matthew Dillon [Mon, 23 Apr 2018 02:24:07 +0000 (19:24 -0700)]
kernel - Carefully refactor contended tokens and spinlocks (2)

* After testing, increasing the exponential cap from 1024 to
  4096 appears to produce better results, so the previous comment
  is wrong.  Adjust the default and the comment.

* Forgot to commit the changes to spinlock.h, fixed.

2 years agokernel - Fix statistics accounting bug in kfree()
Matthew Dillon [Mon, 23 Apr 2018 02:16:24 +0000 (19:16 -0700)]
kernel - Fix statistics accounting bug in kfree()

* kfree() was bumping the statistics counters for the wrong cpu.
  This could lead to kmalloc statistics slowly becoming inaccurate.

* This also fixes some significant cache line bouncing under
  heavy threaded loaded.

2 years agokernel - Carefully refactor contended tokens and spinlocks
Matthew Dillon [Mon, 23 Apr 2018 01:56:14 +0000 (18:56 -0700)]
kernel - Carefully refactor contended tokens and spinlocks

* Carefully put the exponential backoff back in for spinlocks, and
  implement for tokens.  Only applicable to exclusive locks, capped
  via sysctl (mjg).  Tested on dual-socket xeon.

* Exclusive priority for shared locks reduces the shared/exclusive
  starvation that can occur when exclusive locks use exponential

* Exponential backoff significantly improves performance for
  heavily contended exclusive locks by allowing some degree of burst

* Implement TSC windowing for shared locks (and a little for
  exclusive locks too).  This prevents heavily contended exclusive
  locks from completely starving shared locks by using windowing
  to disable the exclusive-priority mechanic for shared locks.

  This allows a few contending shared locks to compete on equal
  ground with exclusive locks.

Suggested-by: mjg
2 years agokernel - Remove performance pessimization with INVARIANTS
Matthew Dillon [Mon, 23 Apr 2018 01:55:03 +0000 (18:55 -0700)]
kernel - Remove performance pessimization with INVARIANTS

* Remove lf_global_counter under INVARIANTS, fixes cache pessimization.
  We want performance scaling to continue to work with INVARIANTS since
  that is how we ship the kernel by default.

2 years agokernel - cleanup kern_descrip.c
Matthew Dillon [Sun, 22 Apr 2018 19:29:55 +0000 (12:29 -0700)]
kernel - cleanup kern_descrip.c

* Cleanup long lines, syntax

* fsetfd_locked() does not have to call fclearcache().

2 years agokernel - Localize [in]activevnodes globals, improve allocvnode
Matthew Dillon [Sun, 22 Apr 2018 19:12:33 +0000 (12:12 -0700)]
kernel - Localize [in]activevnodes globals, improve allocvnode

* Move to globaldata, keep globals as rollup statistics.

* We already solved normal active->inactive->active issues
  in prior work, this change primarily effects vnode termination,
  such as for unlink operations.

* Enhance allocvnode to reuse a convenient reclaimed vnode
  if we can find one on the pcpu's inactive list and lock it
  non-blocking.  This reduces unnecessary vnode count bloating.

2 years agotmpfs - Move dnode lock to improve unlink performance
Matthew Dillon [Sun, 22 Apr 2018 18:57:07 +0000 (11:57 -0700)]
tmpfs - Move dnode lock to improve unlink performance

* Unlock the directory node a little earlier in tmpfs_vop_nremove().

2 years agokernel - Minor rollup cleanup
Matthew Dillon [Sun, 22 Apr 2018 17:41:52 +0000 (10:41 -0700)]
kernel - Minor rollup cleanup

* Collect count and apply once at the end of the loop.

2 years agoLINT64: Fix typo.
Sascha Wildner [Sun, 22 Apr 2018 20:17:21 +0000 (22:17 +0200)]
LINT64: Fix typo.

2 years agokernel - Remove SMP bottlenecks on uidinfo, descriptors, and lockf (2)
Matthew Dillon [Sun, 22 Apr 2018 17:34:22 +0000 (10:34 -0700)]
kernel - Remove SMP bottlenecks on uidinfo, descriptors, and lockf (2)

* Fix lost fp bug, a file pointer would sometimes not get dropped,
  leading to disconnection problems (e.g. sftp).

2 years agorpc: Add support for NO_WCAST_FUNCTION_TYPE make variables.
zrj [Tue, 30 Jan 2018 11:38:27 +0000 (13:38 +0200)]
rpc: Add support for NO_WCAST_FUNCTION_TYPE make variables.

It is unfortunate that <rpc/xdr.h> has the "bool_t xdr_void(void);"
without the XDR* parameter even if it is unused. Since we do not want to
change public symbol interface, suppressing the warning is a better way.

While there, add suppression to acpiexec/inetd for function cast too.

2 years agoworld: Mark utilities that use out of bounds copies.
zrj [Wed, 24 Jan 2018 17:29:16 +0000 (19:29 +0200)]
world: Mark utilities that use out of bounds copies.

2 years agobsd.kern.mk: Handle gcc80 better in buildkernel.
zrj [Mon, 22 Jan 2018 13:24:11 +0000 (15:24 +0200)]
bsd.kern.mk: Handle gcc80 better in buildkernel.

2 years agolibc - Remove incorrect sched_yield() stub
Matthew Dillon [Sun, 22 Apr 2018 00:48:43 +0000 (17:48 -0700)]
libc - Remove incorrect sched_yield() stub

* sched_yield() is a system call, and libthread_xu does not
  override it.  Remove the empty stub so the system call is
  properly called.

* Now sched_yield() is no longer a NOP.

2 years agokernel - Remove SMP bottlenecks on uidinfo, descriptors, and lockf
Matthew Dillon [Sun, 22 Apr 2018 00:30:42 +0000 (17:30 -0700)]
kernel - Remove SMP bottlenecks on uidinfo, descriptors, and lockf

* Use an eventcounter and the per-thread fd cache to fix
  bottlenecks in checkfdclosed().  This will work well for
  the vast majority of applications and test benches.

* Batch holdfp*() operations on kqueue collections when implementing
  poll() and select().  This significant improves performance.
  Full scaling not yet achieved, however.

* Increase copyin item batching from 8 to 32 for select() and poll().

* Give the uidinfo structure a pcpu array to hold the posixlocks
  and openfiles count fields, with a rollup contained in the uidinfo
  structure itself.

  This removes numerous global bottlenecks related to open(),
  close(), dup*(), and lockf operations (posixlocks count).

  ui_openfiles will force a rollup on limit reached to be sure
  that the limit was actually reached.  ui_posixlocks stays fairly
  loose.  Each cpu rolls up generally only when the pcpu count exceeds
  +32 or goes below -32.

* Give the proc structure a pcpu array for the same counts, in order
  to properly support seteuid() and such.

* Replace P_ADVLOCK with a char field proc->p_advlock_flag, and
  remove token operations around the field.

2 years agokernel - Refactor lwkt_token pool hash
Matthew Dillon [Sun, 22 Apr 2018 00:23:23 +0000 (17:23 -0700)]
kernel - Refactor lwkt_token pool hash

* Refactor the lwkt_token pool hash to a better hash algorithm
  using large primes.

2 years agokernel - per-thread fd cache, p_fd lock bypass
Matthew Dillon [Fri, 20 Apr 2018 15:44:32 +0000 (08:44 -0700)]
kernel - per-thread fd cache, p_fd lock bypass

* Implement a per-thread (fd,fp) cache.  Cache hits can keep fp's
  in a held state (avoiding the need to fhold()/fdrop() the ref count),
  and bypasses the p_fd spinlock.  This allows the file pointer structure
  to generally be shared across cpu caches.

* Can cache up to four descriptors in each thread, LRU.  This is the common
  case.  Highly threaded programs tend to focus work on a distinct
  file descriptors in each thread.

* One file descriptor can be cached in up to four threads.  This is
  a significant limitation, though relatively uncommon.  On a cache miss
  the code drops into the normal shared p_fd spinlock lookup.

2 years agosbin/hammer: Drop _X macro for hammer show
Tomohiro Kusumi [Sat, 21 Apr 2018 21:58:36 +0000 (14:58 -0700)]
sbin/hammer: Drop _X macro for hammer show

Also reduce supported indent levels from 17 to 10.

17 levels with 62 fanouts for internal nodes seems way more than
needed even considering max capacity of HAMMER1.

2 years agoFix up UPGRADING.
Sascha Wildner [Sat, 21 Apr 2018 21:39:24 +0000 (23:39 +0200)]

2 years agoRemove IPsec and related code from the system.
Sascha Wildner [Sat, 21 Apr 2018 21:26:37 +0000 (23:26 +0200)]
Remove IPsec and related code from the system.

It was unmaintained ever since we inherited it from FreeBSD 4.8.

In fact, we had two implementations from that time: IPSEC and FAST_IPSEC.
FAST_IPSEC is the implementation to which FreeBSD has moved since, but
it didn't even build in DragonFly.

Fixes for dports have been committed to DeltaPorts.

Requested-by: dillon
Dports-testing-and-fixing: zrj

2 years agokernel: Disable TCP_SIGNATURE in preparation for removing IPSEC.
Sascha Wildner [Tue, 17 Apr 2018 17:10:55 +0000 (19:10 +0200)]
kernel: Disable TCP_SIGNATURE in preparation for removing IPSEC.

Keep the code around until it gets fixed at a later date.

Requested-by: sephe
2 years ago<sys/mbuf.h>: Fix packet tag comments.
Sascha Wildner [Sat, 21 Apr 2018 18:56:40 +0000 (20:56 +0200)]
<sys/mbuf.h>: Fix packet tag comments.

2 years agokernel - Fix duplicate da0 or da* and locked up boot
Matthew Dillon [Sat, 21 Apr 2018 01:18:52 +0000 (18:18 -0700)]
kernel - Fix duplicate da0 or da* and locked up boot

* Fix duplicate da* reporting at boot which usually results in
  the boot locking up.

* The diskinfo was being installed while before CAM's softc->state
  normalized, potentially allowing I/O to occur during the probe
  sequence and causing the probe state to be repeated.

  Delay calling disk_setdiskinfo() until after softc->state is

2 years agosys/vfs/autofs: Use ksnprintf() (sync with NetBSD)
Tomohiro Kusumi [Fri, 20 Apr 2018 15:01:30 +0000 (08:01 -0700)]
sys/vfs/autofs: Use ksnprintf() (sync with NetBSD)

FreeBSD and DragonFly had strcpy()+strcat().
NetBSD changed it to snprintf().

2 years agosys/vfs/autofs: Fix a comment
Tomohiro Kusumi [Fri, 20 Apr 2018 15:00:57 +0000 (08:00 -0700)]
sys/vfs/autofs: Fix a comment

This isn't really a FALLTHROUGH. Not sure why I even originally
added this since this had never existed in FreeBSD too.

2 years agoipfw3nat: remove the state from the proper tree
Bill Yuan [Thu, 19 Apr 2018 19:06:43 +0000 (19:06 +0000)]
ipfw3nat: remove the state from the proper tree

2 years agokernel - Increase vm_object hash table
Matthew Dillon [Fri, 20 Apr 2018 02:32:30 +0000 (19:32 -0700)]
kernel - Increase vm_object hash table

* Increase table from 64 to 256 entries.

* Improve the hash algorithm considerably for better coverage.

2 years agokernel - Implement td_limit reflection of p_limit
Matthew Dillon [Fri, 20 Apr 2018 00:52:53 +0000 (17:52 -0700)]
kernel - Implement td_limit reflection of p_limit

* Reflect proc->p_limit onto thread->td_limit to allow lockless
  rlimits testing.

* Significantly improves performance for rlimits-testing-centric
  operations such as for dup() and dup2().

* Also fixes performance issues across processes when the plimit
  structure is shared across many processes.  In this situation,
  unnecessary locking conflicts developed due to the high level
  of sharing across what would normally be considered distinct

Suggested-by: mjg
2 years agorc.d - Be quiet when check if modules are loaded
Antonio Huete Jimenez [Thu, 19 Apr 2018 23:07:46 +0000 (16:07 -0700)]
rc.d - Be quiet when check if modules are loaded

2 years agokernel - Handle spinlock indefinite wait edge case
Matthew Dillon [Wed, 18 Apr 2018 18:38:30 +0000 (11:38 -0700)]
kernel - Handle spinlock indefinite wait edge case

* The spinlock exclusive priority mechanism can cause an indefinite
  wait situation for shared locks to arise when a large number of cpu
  cores are cycling the same spinlock both shared and exclusive.

  This situation just won't happen for any real workload, but it
  can come up in benchmarks.

* Introduce a quick hack to ensure that this situation does not lead
  to a panic.  The exclusive priority mechanism is ignored once a
  shared spinlock has spun for greater than one second.

2 years agokernel/LINT64: Fix comment.
Sascha Wildner [Wed, 18 Apr 2018 18:12:50 +0000 (20:12 +0200)]
kernel/LINT64: Fix comment.

2 years agoRemove some old tty related code, such as <sgtty.h>, old ioctls etc.
Sascha Wildner [Wed, 18 Apr 2018 16:49:47 +0000 (18:49 +0200)]
Remove some old tty related code, such as <sgtty.h>, old ioctls etc.

It is replaced by POSIX termios on modern systems. Also, remove related
code in libcompat.

<sys/ioctl_compat.h> is now just a few lines. This header will eventually
be removed completely.

Two ports, devel/xxgdb and editors/aee, were still using <sgtty.h> and
have since been fixed. But let's bump __DragonFly_version anyway.

Dports-checking-and-fixing: zrj

2 years agobpf - Add BIOC{S,G}FEEDBACK ioctls
Antonio Huete Jimenez [Wed, 18 Apr 2018 09:39:21 +0000 (02:39 -0700)]
bpf - Add BIOC{S,G}FEEDBACK ioctls

- When set it allows reinjecting packets that were written to the bpf device
  as input to the interface when the output is successful.
- Add an alias to BIOCFEEDBACK which is the name of the
  of the 'set' ioctl in FreeBSD.

Partially-taken-from: NetBSD
Reviewed-by: sephe
Closes: #3126

2 years ago<net/dlt.h> - Remove a comment which is no longer applicable
Antonio Huete Jimenez [Wed, 18 Apr 2018 08:30:33 +0000 (01:30 -0700)]
<net/dlt.h> - Remove a comment which is no longer applicable

2 years ago<net/dlt.h> - Add some more DLTs
Antonio Huete Jimenez [Wed, 18 Apr 2018 08:08:34 +0000 (01:08 -0700)]
<net/dlt.h> - Add some more DLTs

- The DLT_USER* dlts are reserved for private use, they won't be
  used ever by libpcap/tcpdump themselves.
- net/wireshark-qt5 (and probably others) use it

2 years agohammer2 - Add vfs.hammer2.limit_dirty_inodes
Matthew Dillon [Wed, 18 Apr 2018 06:10:02 +0000 (23:10 -0700)]
hammer2 - Add vfs.hammer2.limit_dirty_inodes

* Add vfs.hammer2.limit_dirty_inodes which causes hammer2 to
  immediately begin fsync()ing dirty inodes when the count exceeds
  the limit.  Set a reasonable limit.

* Fixes issues on slower storage when the syncer is unable to
  keep up with the userland frontend, causing the number of
  dirty inodes to increase almost unbounded (limited only by

  Allowing a large number of dirty inodes to accumulate can
  can result in a situation where the clean device buffer
  underpinning the dirty inode is discarded by the kernel before
  the filesystem is able to flush it, forcing additional disk reads
  and slowing things down even more.

* Improve the operation of speedup_syncer() by limiting the
  rate at which we call the function.  It is now called a maximum
  of approximately once per tick (each call speeding up a sync
  by one second).

2 years agokernel - Add dirty vnode management facility
Matthew Dillon [Wed, 18 Apr 2018 06:06:18 +0000 (23:06 -0700)]
kernel - Add dirty vnode management facility

* Keep track of how many vnodes are queued to the syncer, which
  is basically the number of dirty vnodes.  The syncer vnode is
  included so the idle count is usually 1 and not 0.

* vn_syncer_count() returns the count.

* vn_syncer_one() attempts to fsync the next dirty vnode immediately,
  if it can acquire it non-blocking.  The special syncer vnode is
  ignored.  On failure the vnode will be requeued for 1 second,
  so this routine can be cycled.

2 years agoinet6/pim: Return IPPROTO_DONE if the mbuf is freed.
Sepherosa Ziehau [Tue, 17 Apr 2018 13:33:59 +0000 (21:33 +0800)]
inet6/pim: Return IPPROTO_DONE if the mbuf is freed.

This prevents the caller from using the freed mbuf.

Obtained-from: NetBSD via FreeBSD

2 years agokernel - Improve spinlock performance a bit
Matthew Dillon [Tue, 17 Apr 2018 04:27:14 +0000 (21:27 -0700)]
kernel - Improve spinlock performance a bit

* Rearrange indefinite_init() and cpu_pause() in _spin_lock_contested()
  and _spin_lock_shared_contested() to improve performance.

* Fix conditional clearing the SHARED bit to use ovalue intead of
  value.  After review, either can be used but ovalue is more
  appropriate and give us an interlock against SPINLOCK_EXCLWAIT.

Reported-by: mjg_
2 years agokernel: Add -Wmissing-include-dirs to our kernel build.
Sascha Wildner [Mon, 16 Apr 2018 16:03:59 +0000 (18:03 +0200)]
kernel: Add -Wmissing-include-dirs to our kernel build.

2 years agokernel/acpica: Remove ${.OBJDIR}/include from Makefile.inc.
Sascha Wildner [Mon, 16 Apr 2018 16:03:34 +0000 (18:03 +0200)]
kernel/acpica: Remove ${.OBJDIR}/include from Makefile.inc.

This file is included by various module Makefiles, of which only that
of acpica proper needs it. And that already cares about it in the
Makefile. Besides, we build acpica into our standard kernels anyway

This fixes various -Wmissing-include-dirs warnings.

2 years agolvm(8): Use relative path for symlinks and clean up Makefile
Aaron LI [Mon, 16 Apr 2018 06:45:35 +0000 (14:45 +0800)]
lvm(8): Use relative path for symlinks and clean up Makefile

* Use relative path for creating symlinks to the lvm binary

* Remove the unnecessary man page links (which is also broken since the
  wrong variable 'MKLINKS' was used)

* Improve styles a bit

2 years agogcc50: Backport c++11 literal fixes from gcc80.
zrj [Mon, 22 Jan 2018 07:45:18 +0000 (09:45 +0200)]
gcc50: Backport c++11 literal fixes from gcc80.

Fixes: -Wliteral-suffix
C++11 requires a space between literal and string macro

While there, backport 222884 to suppress -Wdeprecated
use of an operand of type 'bool' in 'operator++' is deprecated

2 years agoMakefile.inc1: Add sbin and remove games from btools and ctools path
Aaron LI [Sun, 15 Apr 2018 12:47:05 +0000 (20:47 +0800)]
Makefile.inc1: Add sbin and remove games from btools and ctools path

* Add ${BTOOLSDEST}/sbin and ${CTOOLSDEST}/sbin to ${STRICTTMPPATH} which
  is set as the PATH during the buildworld, although no sbin tools is
  currently used for the buildworld.

* Introduce the variable CTOOLSPATH to hold the ctools path, similar to
  the BTOOLSPATH variable.

* Explain that '/usr/local/bin:/usr/pkg/bin' is appended to STRICTTMPPATH
  to support external compilers.

2 years agodiff: s/.o/.c/ in the Makefile.
Sascha Wildner [Sun, 15 Apr 2018 11:34:32 +0000 (13:34 +0200)]
diff: s/.o/.c/ in the Makefile.

2 years agokern: Unbreak compilation w/o INVARIANTS
Sepherosa Ziehau [Sun, 15 Apr 2018 09:46:42 +0000 (17:46 +0800)]
kern: Unbreak compilation w/o INVARIANTS

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 15 Apr 2018 07:44:09 +0000 (09:44 +0200)]
Update the pciconf(8) database.

April 6, 2018 snapshot from https://pci-ids.ucw.cz

2 years ago<sys/elf_common.h>: Add an Elf_Nhdr definition.
Sascha Wildner [Sat, 14 Apr 2018 09:26:29 +0000 (11:26 +0200)]
<sys/elf_common.h>: Add an Elf_Nhdr definition.

Submitted-by: bserrao
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/3130

2 years agoipfw3: remove legacy macros
Bill Yuan [Fri, 13 Apr 2018 15:36:40 +0000 (15:36 +0000)]
ipfw3: remove legacy macros

2 years agoipfw3: format
Bill Yuan [Fri, 13 Apr 2018 15:29:47 +0000 (15:29 +0000)]
ipfw3: format

2 years agoipfw3: list loaded modules
Bill Yuan [Fri, 13 Apr 2018 15:15:38 +0000 (15:15 +0000)]
ipfw3: list loaded modules

2 years agoipfw3nat: move the implementation back to *.c file
Bill Yuan [Fri, 13 Apr 2018 15:11:46 +0000 (15:11 +0000)]
ipfw3nat: move the implementation back to *.c file

2 years agonvme - Improve likelihood of dump success
Matthew Dillon [Fri, 13 Apr 2018 22:31:52 +0000 (15:31 -0700)]
nvme - Improve likelihood of dump success

* Get rid of blocking locks in the dump path.  This can cause severe
  problems if curthread is the idle thread.

* Set aside a request on every queue for dump operation.  This
  request can be retrieved and returned trivially.

* Add a few functions to support dump requests and polling for

* Remove the unused 'ticks' argument from nvme_wait_request().

2 years agokernel - Improve SPINLOCK, acpi_timer performance under qemu/kvm/VMs
Matthew Dillon [Fri, 13 Apr 2018 04:21:33 +0000 (21:21 -0700)]
kernel - Improve SPINLOCK, acpi_timer performance under qemu/kvm/VMs

* Improve acpi_timer 24-bit performance by reducing use of clock_lock().

* Integrate a delta test into acpi_cputimer.base and remove the
  out-of-band tracking globals.  We can query the timer and calculate
  the return value for deltas less than 1/16 full-range.  Beyond
  that range we need to get the clock_lock() to calculate the high
  24 bits safely and update acpi_cputimer.base.

  On SMP systems, cpu #1 will update acpi_cputimer.base more
  frequently, reducing the chance that multiple cpus will need the
  clock_lock() at the same time.

* Refactor the safe24 code to make it easier to use.

* Improve the regressive SPINLOCK assembly macro, bringing it up to
  modern performance levels.  This fixes unnecessary cache ping-ponging
  during contention.

Suggested-by: mjg_
2 years agoipfw3.8: Some minor adjustments.
Sascha Wildner [Fri, 13 Apr 2018 18:39:32 +0000 (20:39 +0200)]
ipfw3.8: Some minor adjustments.

2 years agoipfw3layer2: misc
Bill Yuan [Fri, 13 Apr 2018 07:09:07 +0000 (07:09 +0000)]
ipfw3layer2: misc

2 years agoipfw3basic: misc
Bill Yuan [Fri, 13 Apr 2018 06:43:39 +0000 (06:43 +0000)]
ipfw3basic: misc

2 years agoipfw3nat: kernel NAT without libalias
Bill Yuan [Fri, 13 Apr 2018 04:25:53 +0000 (04:25 +0000)]
ipfw3nat: kernel NAT without libalias

More than just one address can be configured in each NAT
configuraton and each coming packet will be translated to
one of these addresses randomly.

    ipfw3 nat 1 config ip

A schedule will automatically purge the expired translations.
and its interval can be configure via below sysctl variables.

2 years agoipfw3basic: fix `to me`
Bill Yuan [Fri, 13 Apr 2018 04:24:58 +0000 (04:24 +0000)]
ipfw3basic: fix `to me`

2 years agoipfw3nat: a cleanup callout to purge the expired translations
Bill Yuan [Fri, 13 Apr 2018 02:08:26 +0000 (02:08 +0000)]
ipfw3nat: a cleanup callout to purge the expired translations

sysctl net.inet.ip.fw3_nat.cleanup_interval to configure its interval

2 years agoipfw3nat: show translations
Bill Yuan [Fri, 13 Apr 2018 02:02:48 +0000 (02:02 +0000)]
ipfw3nat: show translations

same as 'show ip nat translations'

2 years agoipfw3nat: release the nat context during fini
Bill Yuan [Fri, 13 Apr 2018 01:54:43 +0000 (01:54 +0000)]
ipfw3nat: release the nat context during fini

2 years agoipfw3nat: flush all configurations
Bill Yuan [Fri, 13 Apr 2018 01:49:26 +0000 (01:49 +0000)]
ipfw3nat: flush all configurations

2 years agoipfw3nat: delete configuration
Bill Yuan [Fri, 13 Apr 2018 01:47:14 +0000 (01:47 +0000)]
ipfw3nat: delete configuration

2 years agokbdmux - Simplify taskqueue handling, and get rid of the 1HZ callout.
Imre Vadász [Tue, 27 Feb 2018 19:50:53 +0000 (20:50 +0100)]
kbdmux - Simplify taskqueue handling, and get rid of the 1HZ callout.

2 years ago[bsd-family-tree] add OpenBSD 6.3, DragonFly 5.2.0
Eitan Adler [Thu, 12 Apr 2018 08:04:53 +0000 (08:04 +0000)]
[bsd-family-tree] add OpenBSD 6.3, DragonFly 5.2.0

2 years agoipfw3nat: sysctl vars for nat state timeouts
Bill Yuan [Wed, 11 Apr 2018 22:42:16 +0000 (22:42 +0000)]
ipfw3nat: sysctl vars for nat state timeouts

2 years agoRevert "libssh: Remove local vis.c from the build."
Sascha Wildner [Wed, 11 Apr 2018 16:10:32 +0000 (18:10 +0200)]
Revert "libssh: Remove local vis.c from the build."

This reverts commit dc312142da731a4dd82f924bf4442734ec45e880.

It needs further thought, our <vis.h> does not have VIS_ALL
(see BROKEN_STRNVIS in lib/libssh/config.h).

2 years agolibssh: Remove local vis.c from the build.
Sascha Wildner [Wed, 11 Apr 2018 12:58:13 +0000 (14:58 +0200)]
libssh: Remove local vis.c from the build.

2 years agocontrib/libpcap - Local adjustments
Antonio Huete Jimenez [Mon, 9 Apr 2018 23:44:43 +0000 (16:44 -0700)]
contrib/libpcap - Local adjustments

- Use system's net/bpf.h instead of libpcap's one.
- Will help fixing net/vde2 and possible other ports that use a
  combination of net/bpf.h and pcap.h as described in f92f178f07f

2 years ago<net/dlt.h> - Add a bunch of DLTs from libpcap
Antonio Huete Jimenez [Mon, 9 Apr 2018 23:40:37 +0000 (16:40 -0700)]
<net/dlt.h> - Add a bunch of DLTs from libpcap

- As done in commit 34b07254ea and for the same reason as in
- In prepartion to libpcap local adjustments

2 years agobpf - Add two new instructions
Antonio Huete Jimenez [Mon, 9 Apr 2018 23:38:48 +0000 (16:38 -0700)]
bpf - Add two new instructions

- In prepartion to libpcap local adjustments

2 years agoSync unvis(1) and vis(1) with NetBSD.
Sascha Wildner [Wed, 11 Apr 2018 08:37:56 +0000 (10:37 +0200)]
Sync unvis(1) and vis(1) with NetBSD.

2 years ago<bus/cam/scsi/scsi_daio.h>: Include <sys/types.h> for off_t.
Sascha Wildner [Tue, 10 Apr 2018 18:45:05 +0000 (20:45 +0200)]
<bus/cam/scsi/scsi_daio.h>: Include <sys/types.h> for off_t.

2 years agovis.3: Use .Er for errno values.
Sascha Wildner [Tue, 10 Apr 2018 18:33:20 +0000 (20:33 +0200)]
vis.3: Use .Er for errno values.

2 years agoMove the IOCTLTRIM ioctl to a better header and rename it to DAIOCTRIM.
Sascha Wildner [Tue, 10 Apr 2018 13:11:49 +0000 (15:11 +0200)]
Move the IOCTLTRIM ioctl to a better header and rename it to DAIOCTRIM.

<sys/ioctl_compat.h> really is only for old tty related stuff.

Also bump __DragonFly_version, because there is one port which uses
IOCTLTRIM currently, i.e. benchmarks/fio. We'll send a patch upstream
that switches it to DAIOCTRIM, and once the updated version has hit
the /usr/dports tree, I will remove IOCTLTRIM from base.

2 years agolibutil: Specify MLINKS a bit more readable.
Sascha Wildner [Tue, 10 Apr 2018 12:31:50 +0000 (14:31 +0200)]
libutil: Specify MLINKS a bit more readable.

2 years ago<vis.h>: Bring back namespace pollution reduction.
Sascha Wildner [Tue, 10 Apr 2018 12:17:44 +0000 (14:17 +0200)]
<vis.h>: Bring back namespace pollution reduction.

2 years agoipfw3nat: when the nat config is already exists
Bill Yuan [Tue, 10 Apr 2018 09:21:53 +0000 (09:21 +0000)]
ipfw3nat: when the nat config is already exists

2 years agosys/vfs/autofs: Use d_xxx_t typedefs for /dev/autofs
Tomohiro Kusumi [Tue, 10 Apr 2018 08:44:58 +0000 (17:44 +0900)]
sys/vfs/autofs: Use d_xxx_t typedefs for /dev/autofs

2 years agoSync err(3) message with 4be4de019f
Tomohiro Kusumi [Tue, 10 Apr 2018 08:03:42 +0000 (17:03 +0900)]
Sync err(3) message with 4be4de019f

2 years agolibc: Move to a format for specifying MLINKS that's less hard on the eyes.
Sascha Wildner [Tue, 10 Apr 2018 07:19:48 +0000 (09:19 +0200)]
libc: Move to a format for specifying MLINKS that's less hard on the eyes.

We do it like this in other places of the tree already and will eventually
move to this everywhere.

2 years agolibc: Sort unvis.3 MLINKS alphabetically, too.
Sascha Wildner [Tue, 10 Apr 2018 05:54:41 +0000 (07:54 +0200)]
libc: Sort unvis.3 MLINKS alphabetically, too.

2 years agolibc: Fix up MLINKS for the recent upgrade of vis.3 and unvis.3.
Sascha Wildner [Tue, 10 Apr 2018 05:51:57 +0000 (07:51 +0200)]
libc: Fix up MLINKS for the recent upgrade of vis.3 and unvis.3.

MLINKS have the format:

MLINKS+=<src> <targ> <src> <targ> ...

2 years agoipfw3nat: show nat config in kernel
Bill Yuan [Mon, 9 Apr 2018 14:33:05 +0000 (14:33 +0000)]
ipfw3nat: show nat config in kernel

2 years agoipfw3nat: show config in userland
Bill Yuan [Mon, 9 Apr 2018 14:26:18 +0000 (14:26 +0000)]
ipfw3nat: show config in userland

2 years agoipfw3nat: func to get new alias
Bill Yuan [Mon, 9 Apr 2018 14:13:58 +0000 (14:13 +0000)]
ipfw3nat: func to get new alias

2 years agoRemove a number of duplicated includes in userland.
Sascha Wildner [Mon, 9 Apr 2018 20:26:14 +0000 (22:26 +0200)]
Remove a number of duplicated includes in userland.

2 years agolibc: Replace vis(3) and unvis(3) files with NetBSD versions
François Tigeot [Mon, 9 Apr 2018 19:54:26 +0000 (21:54 +0200)]
libc: Replace vis(3) and unvis(3) files with NetBSD versions

* Rendering the corresponding APIs compatible with NetBSD and FreeBSD.

* Keep strnvis() as-is, keeping it compatible with previous DragonFly
  versions, OpenBSD and libbsd

* We already had the original OpenBSD version of strnvis(), which
  predates the NetBSD one by more than 10 years

* New userland utilities code partially obtained from FreeBSD.

Reviewed-by: swildner
2 years agoipfw3nat: nat func to replace the src or dst
Bill Yuan [Mon, 9 Apr 2018 13:02:55 +0000 (13:02 +0000)]
ipfw3nat: nat func to replace the src or dst

The `src` will be replaced by `alias` when a packet is leaving the system.
Hence, the packet is from `src` to `dst` before been translated. And after
been translated, the packet is from `alias` to `dst`.

The state for outgoing packet will be stored in the nat_context of current
CPU. But due to the nature of the NAT, the returning packet may be handled
by another CPU. Hence, a state for the returning packet will be prepared and
store into the nat_context of the right CPU.