dragonfly.git
6 years agolib/i18n_module: Fix out of bounds bug.
zrj [Thu, 26 Apr 2018 11:49:16 +0000 (14:49 +0300)]
lib/i18n_module: Fix out of bounds bug.

Taken-from: NetBSD

6 years agogcore(1): Mark as breaking strict aliasing.
zrj [Thu, 26 Apr 2018 10:55:13 +0000 (13:55 +0300)]
gcore(1): Mark as breaking strict aliasing.

IS_ELF(*(Elf_Ehdr *)&exec).

6 years agotip(1): Mark as breaking strict aliasing.
zrj [Thu, 26 Apr 2018 10:49:33 +0000 (13:49 +0300)]
tip(1): Mark as breaking strict aliasing.

The boolean(v) macro uses type-punned pointers.

6 years agogcc50: Fix false positive for -Walloc-size-large-than.
zrj [Thu, 26 Apr 2018 10:38:01 +0000 (13:38 +0300)]
gcc50: Fix false positive for -Walloc-size-large-than.

Backport fix for PR 79132, prevent using alloca(-1).

6 years agogcc47: Fix false positive for -Walloc-size-large-than.
zrj [Thu, 26 Apr 2018 10:35:33 +0000 (13:35 +0300)]
gcc47: Fix false positive for -Walloc-size-large-than.

Backport fix for PR 79132, prevent using alloca(-1).

6 years agompsutil(8): Add missing braces.
Sascha Wildner [Thu, 26 Apr 2018 16:17:33 +0000 (18:17 +0200)]
mpsutil(8): Add missing braces.

Reported-by: zrj
6 years agobsd.sys.mk: Implement WARNS framework for HOST_CCVER.
zrj [Wed, 25 Apr 2018 16:22:13 +0000 (19:22 +0300)]
bsd.sys.mk: Implement WARNS framework for HOST_CCVER.

Previously we were handling just a CCVER only.

6 years agoworld: Mark all build-tools.
zrj [Wed, 25 Apr 2018 16:21:40 +0000 (19:21 +0300)]
world: Mark all build-tools.

6 years agocsh(1): Separate hostprog.
zrj [Wed, 25 Apr 2018 16:20:33 +0000 (19:20 +0300)]
csh(1): Separate hostprog.

6 years agoawk(1): Separate hostprog.
zrj [Wed, 25 Apr 2018 16:20:06 +0000 (19:20 +0300)]
awk(1): Separate hostprog.

6 years agolibmagic(3): Separate hostprog.
zrj [Wed, 25 Apr 2018 16:19:40 +0000 (19:19 +0300)]
libmagic(3): Separate hostprog.

Set WARNS=1 for mkmagic.nx so as not to use -w.

6 years agophantasia(6): Separate hostprog.
zrj [Wed, 25 Apr 2018 16:19:07 +0000 (19:19 +0300)]
phantasia(6): Separate hostprog.

Make substantial effort to reduce dependencies for setup.nx.
While there install monsters file as 640.

6 years agohack(6): Separate hostprog.
zrj [Wed, 25 Apr 2018 16:18:29 +0000 (19:18 +0300)]
hack(6): Separate hostprog.

6 years agoadventure(6): Separate hostprog.
zrj [Wed, 25 Apr 2018 16:18:06 +0000 (19:18 +0300)]
adventure(6): Separate hostprog.

6 years agodrm: Implement parts of the Linux irq subsystem
François Tigeot [Wed, 25 Apr 2018 09:52:23 +0000 (11:52 +0200)]
drm: Implement parts of the Linux irq subsystem

* Allowing to reuse more drm drivers code as-is from Linux

* Also allowing Linux irq functions to return expected status
  codes, increasing general driver robustness

Tested-with: many i915 devices, Radeon HD6450

6 years agokernel/mpr: Remove unused malloc type.
Sascha Wildner [Tue, 24 Apr 2018 20:03:51 +0000 (22:03 +0200)]
kernel/mpr: Remove unused malloc type.

6 years agoRemove <sys/ioctl_compat.h>.
Sascha Wildner [Tue, 24 Apr 2018 20:03:51 +0000 (22:03 +0200)]
Remove <sys/ioctl_compat.h>.

Now that tkusumi's fix for benchmarks/fio for the name and location
change of the IOCTLTRIM ioctl is in DeltaPorts, remove the header
entirely.

Fixes for stty(1) and pstat(8) are from FreeBSD.

Dports-checking: zrj

6 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

6 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.

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

6 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

6 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
  ponging.

* 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).

6 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.

6 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
  performance.

* 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.

6 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.

6 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
  possible.

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

6 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.

6 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.

6 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.

6 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
  backoff.

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

* 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
6 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.

6 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().

6 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.

6 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().

6 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.

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

6 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).

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

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

6 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

6 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
6 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.

6 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
  normalized.

6 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().

6 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.

6 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

6 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.

6 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
  processes.

Suggested-by: mjg
6 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

6 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.

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

6 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

6 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

6 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

6 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

6 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
  kern.maxvnodes).

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

6 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.

6 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

6 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_
6 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.

6 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
now.

This fixes various -Wmissing-include-dirs warnings.

6 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

6 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

6 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.

6 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.

6 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

6 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

6 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

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

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

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

6 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

6 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
  completionsssssssss.

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

6 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_
6 years agoipfw3.8: Some minor adjustments.
Sascha Wildner [Fri, 13 Apr 2018 18:39:32 +0000 (20:39 +0200)]
ipfw3.8: Some minor adjustments.

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

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

6 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.

e.g.
    ipfw3 nat 1 config ip 192.168.1.1 192.168.1.2

A schedule will automatically purge the expired translations.
and its interval can be configure via below sysctl variables.
    net.inet.ip.fw3_nat.udp_timeout
    net.inet.ip.fw3_nat.tcp_timeout
    net.inet.ip.fw3_nat.icmp_timeout

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

6 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

6 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'

6 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

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

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

6 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.

6 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

6 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

6 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).

6 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.

6 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

6 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
  f92f178f07f
- In prepartion to libpcap local adjustments

6 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

- Add BPF_MOD and BPF_XOR
- In prepartion to libpcap local adjustments

6 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.