4 years agoMerge branch 'vendor/OPENRESOLV'
Aaron LI [Fri, 19 Oct 2018 15:59:51 +0000 (23:59 +0800)]
Merge branch 'vendor/OPENRESOLV'

4 years agoImport openresolv 3.9.0
Aaron LI [Thu, 18 Oct 2018 17:00:16 +0000 (01:00 +0800)]
Import openresolv 3.9.0

Version: 3.9.0
Date: 2016-Dec-30
Homepage: https://roy.marples.name/projects/openresolv

4 years agodrm/linux: Fix potential ww mutex induced panics
François Tigeot [Mon, 15 Oct 2018 20:17:54 +0000 (22:17 +0200)]
drm/linux: Fix potential ww mutex induced panics

ww mutex locking functions can be called with a NULL ctx and were
happily setting both lock->acquired to non-zero and lock->ctx to
NULL, a combination which other parts of our ww mutex implementation
assume is not possible.

Obtained-from: OpenBSD

4 years agokernel - Fix NUMA contention due to assymetric memory
Matthew Dillon [Mon, 15 Oct 2018 03:09:47 +0000 (20:09 -0700)]
kernel - Fix NUMA contention due to assymetric memory

* Fix NUMA contention in situations where memory is associated
  with CPU cores assymetrically.  In particular, with the 2990WX,
  half the cores will have no memory associated with them.

* This was forcing DFly to allocate memory from queues belonging to
  other nearby cores, causing unnecessary SMP contention, as well
  as burn extra time iterating queues.

* Fix by calculating the average number of free pages per-core,
  and then adjust any VM page queue with pages less than the average
  by stealing pages from queues with greater than the average.
  We use a simple iterator to steal pages, so the CPUs with less
  (or zero) direct-attached memory will operate more UMA-like
  (just on 4K boundaries instead of 256-1024 byte boundaries).

* Tested with a 64-thread concurrent compile test.  systat -pv 1
  showed all remaining contention disappear.  Literally, *ZERO*
  contention when we run the test with each thread in its own jail
  with no shared resources.

* NOTE!  This fix is specific to asymetric NUMA configurations
  which are fairly rare in the wild and will not speed up more
  conventional systems.

* Before and after timings on the 2990WX.

  cd /tmp/src
  time make -j 128 nativekernel NO_MODULES=TRUE > /dev/null

  703.915u 167.605s 0:49.97 1744.0%       9993+749k 22188+8io 216pf+0w
  699.550u 171.148s 0:50.87 1711.5%       9994+749k 21066+8io 150pf+0w

  678.406u 108.857s 0:45.66 1724.1%       10105+757k 22188+8io 216pf+0w
  674.805u 115.256s 0:46.67 1692.8%       10077+755k 21066+8io 150pf+0w

  This is a 4.2 second difference on the second run, an over 8%
  improvement which is nothing to sneeze at.

4 years agodrm/radeon: add missing ttm_eu_backoff_reservation to radeon_bo_list_validate
François Tigeot [Fri, 12 Oct 2018 20:50:58 +0000 (22:50 +0200)]
drm/radeon: add missing ttm_eu_backoff_reservation to radeon_bo_list_validate

4 years agodrm/radeon: Finish replacing task queues by Linux work queues
François Tigeot [Thu, 11 Oct 2018 20:40:30 +0000 (22:40 +0200)]
drm/radeon: Finish replacing task queues by Linux work queues

4 years agodrm/radeon: Reduce differences with Linux 3.18
François Tigeot [Thu, 11 Oct 2018 20:38:26 +0000 (22:38 +0200)]
drm/radeon: Reduce differences with Linux 3.18

No functional changes

4 years agodrm/linux: Add a few headers
François Tigeot [Thu, 11 Oct 2018 20:26:42 +0000 (22:26 +0200)]
drm/linux: Add a few headers

4 years agokernel: Clean up syscalls.master a bit more.
Sascha Wildner [Thu, 11 Oct 2018 13:19:43 +0000 (15:19 +0200)]
kernel: Clean up syscalls.master a bit more.

All this and also f29ea48f7a62b011be75119d46acd81bee2dd8ee could have
been cleaned up in d6e8ab2d2508bde32ad7b7daaf86d44ec7330986.

While here, also remove some obsolete comments.

4 years ago<vm/vm_extern.h>: Remove some dead code.
Sascha Wildner [Thu, 11 Oct 2018 13:10:05 +0000 (15:10 +0200)]
<vm/vm_extern.h>: Remove some dead code.

4 years agosyscalls.master: Remove a leftover semicolon.
Sascha Wildner [Thu, 11 Oct 2018 12:48:08 +0000 (14:48 +0200)]
syscalls.master: Remove a leftover semicolon.

4 years agokernel/libc: Remove sigstack() remains.
Sascha Wildner [Thu, 11 Oct 2018 12:44:46 +0000 (14:44 +0200)]
kernel/libc: Remove sigstack() remains.

There is no sigstack() syscall anymore in DragonFly, besides being
obsolete, so remove some remains like the manual page and prototype,
and do some related cleanup.

4 years agodrm: Add linux/interval_tree.h
François Tigeot [Sun, 7 Oct 2018 12:47:03 +0000 (14:47 +0200)]
drm: Add linux/interval_tree.h

4 years agodrm/linux: Add rcu_dereference_protected()
François Tigeot [Sun, 7 Oct 2018 12:27:27 +0000 (14:27 +0200)]
drm/linux: Add rcu_dereference_protected()

4 years agokernel: Add further support for fixed-width integer type sysctls.
Sascha Wildner [Sat, 6 Oct 2018 07:29:28 +0000 (09:29 +0200)]
kernel: Add further support for fixed-width integer type sysctls.

U32 support was added in c48b2bac286ed1aaa6b974adfbc844e82bc65f38.

QUAD and UQUAD are now aliases of S64 and U64.

Taken-from: FreeBSD

4 years agokernel - Refactor tty clist code (2)
Matthew Dillon [Sat, 6 Oct 2018 04:32:48 +0000 (21:32 -0700)]
kernel - Refactor tty clist code (2)

* Fix initialization of high water mark, the last commit accidently
  removed it.

* Fixes issue with slow console output (emacs, alt-x "shell", then
  'ls' or whatever).

Reported-by: tuxillo
4 years agoRemove <sys/clist.h> via 'make upgrade'.
Sascha Wildner [Fri, 5 Oct 2018 06:32:18 +0000 (08:32 +0200)]
Remove <sys/clist.h> via 'make upgrade'.

4 years agokernel - Fix missing tokens in killalllwps()
Matthew Dillon [Thu, 4 Oct 2018 22:28:11 +0000 (15:28 -0700)]
kernel - Fix missing tokens in killalllwps()

* There appears to be at least one code path where killalllwps()
  is being called without the necessary tokens held.

* Just have the routine itself obtain the necessary tokens.

* Might be responsible for extremely rare core-dump stop/wait

4 years agokernel - Refactor tty clist code
Matthew Dillon [Thu, 4 Oct 2018 21:37:12 +0000 (14:37 -0700)]
kernel - Refactor tty clist code

* Remove all the old cruft, completely rewrite the clist code to use
  a single linear buffer and a FIFO mechanism.

* The linear buffer just uses 16-bit elements in order to record
  TTY_QUOTE along with the character.

* Fixes bug in last commit (lack of global locks around global clist
  caches) by removing the cache entirely.

4 years agokernel - Refactor tty_token, fix SMP performance issues
Matthew Dillon [Thu, 4 Oct 2018 17:22:35 +0000 (10:22 -0700)]
kernel - Refactor tty_token, fix SMP performance issues

* Remove most uses of tty_token in favor of per-tty tp->t_token.
  This is particularly important for removing bottlenecks related to PTYs,
  which are used all over the place.  tty_token remains in a few places
  managing overall registration and global list manipulation.

* tty structures are now required to be persistent.  Implement a sepearate
  ttyinit() function.  Continue to allow ttyregister() and ttyunregister()
  calls, but these no longer presume destruction of the structure.

* Refactor ttymalloc() to take a **tty pointer and interlock allocations.
  Allocations are intended to be one-time.  ttymalloc() only requires the
  tty_token for initial allocations.

* Remove all critical section use that was combined with tty_token and
  tp->t_token.  Leave only the tokens.  The critical sections were
  hold-overs going all the way back to pre-SMP days.

* syscons now gets its own token, vga_token.  The ISA VGA code and
  the framebuffer code also now use this token instead of tty_token.

* The keyboard subsystem now uses kbd_token instead of tty_token.

* A few remaining serial-like devices (snp, nmdm) also get their own
  tokens, as well as use the now required tp->t_token.

* Remove use of tty_token in the session management code.  This fixes
  a niggling performance path since sessions almost universally go
  hand-in-hand with fork/exec/exit sequences.  Instead we use the
  already-existing per-hash session token.

4 years agoichwd - Fix typo in TCO2_CNT register #define.
Imre Vadász [Thu, 4 Oct 2018 19:08:28 +0000 (21:08 +0200)]
ichwd - Fix typo in TCO2_CNT register #define.

* The TCO2_CNT isn't actually used in the driver at the moment.

4 years agoioctl.9: nwfs(4) is no longer in our tree.
Sascha Wildner [Thu, 4 Oct 2018 16:44:36 +0000 (18:44 +0200)]
ioctl.9: nwfs(4) is no longer in our tree.

It was removed in 6f25d5554e6df42aa5235bf7e3e8e1cc9da25eec.

4 years agokernel: Remove some old serial drivers.
Sascha Wildner [Thu, 4 Oct 2018 15:51:01 +0000 (17:51 +0200)]
kernel: Remove some old serial drivers.

Namely digi(4), rp(4) and si(4) (the latter along with its userland
utility sicontrol(8)). It is unlikely that these work properly any

In preparation for the upcoming tty_token work by dillon.

Requested-by: dillon
4 years agokernel/lwkt_token: Fix indent.
Sascha Wildner [Thu, 4 Oct 2018 06:44:53 +0000 (08:44 +0200)]
kernel/lwkt_token: Fix indent.

4 years agokernel - Change pool token hash
Matthew Dillon [Thu, 4 Oct 2018 04:17:51 +0000 (21:17 -0700)]
kernel - Change pool token hash

* Change the pool token hash to something less stupid.

* Improve lwkt.tokens_debug_output to also output the address of
  the actual token instead of just its name.  This will help us
  track down pool token collisions a bit better.

4 years agoichsmb - Add additional PCI IDs to ichsmb.
Imre Vadász [Wed, 3 Oct 2018 20:56:19 +0000 (22:56 +0200)]
ichsmb - Add additional PCI IDs to ichsmb.

* This moves from a long switch statement to a lookup table.

Taken-From: FreeBSD

4 years agoSync ACPICA with Intel's version 20181003:
Sascha Wildner [Wed, 3 Oct 2018 16:43:21 +0000 (18:43 +0200)]
Sync ACPICA with Intel's version 20181003:

* Fix a regression that could cause the compiler to fault.

* New remark for excessively long Sleep()s.

For detailed list, please see sys/contrib/dev/acpica/changes.txt.

4 years agokernel - Remove duplicate TRIM, only trim with the 'trim' mount opt
Matthew Dillon [Tue, 2 Oct 2018 04:12:28 +0000 (21:12 -0700)]
kernel - Remove duplicate TRIM, only trim with the 'trim' mount opt

* ffs_blkfree_cg() was improperly issuing a synchronous
  VOP_FREEBLKS() on the underlying device.  This issues a
  BUF_CMD_FREEBLKS stategy op to the underlying device,
  which is executed unconditionally.  This basically runs
  an unconditional TRIM whether the 'trim' mount flag is
  specified or not.

  Remove the VOP_FREEBLKS() call.

* For softupdates operation, ffs_blkfree() handles the
  'trim' mount flag by issuing a BUF_CMD_FREEBLKS and
  sequencing the call to ffs_blkfree_cg() when it completes.

  When 'trim' was enabled, *two* TRIM operations were being
  executed on the underlying device, and prior to our fix,
  if 'trim' was not enabled, *one* TRIM operation would
  still be executed instead of zero.

* In many situations... possibly even most situations,
  trim operations seriously reduce performance due to
  being serialized by AHCI or by the target device.  It
  is not as useful as people often think it should be
  on normal filesystems.

* The removal of the unconditional TRIM significantly improves
  UFS performance, meaning primarily installkernel's
  since DragonFly doesn't use UFS for its main filesystem by
  default any more.

* The 'trim' mount option for UFS will still work as advertised
  when coupled with softupdates.

4 years agonmalloc - Try bigcache in posix_memalign() for big PAGE_SIZE aligned allocs.
Imre Vadász [Mon, 1 Oct 2018 19:14:01 +0000 (21:14 +0200)]
nmalloc - Try bigcache in posix_memalign() for big PAGE_SIZE aligned allocs.

* This improves performance (by reducing the amount of mmap() calls required
  and avoiding some amount of page faults) for applications which frequently
  call posix_memalign() with a 4096 byte alignment for allocations bigger
  than 8KB. Allocations of 8KB and smaller are efficiently handled by the
  SLAB allocator already.

4 years agonmalloc - Cache 4K and 8K allocations in posix_memalign()
Matthew Dillon [Mon, 1 Oct 2018 18:43:13 +0000 (11:43 -0700)]
nmalloc - Cache 4K and 8K allocations in posix_memalign()

* Adjust posix_memalign() to use the slab allocator for 4K and 8K
  allocations same as malloc() does, to improve performance for
  programs using posix_memalign().

4 years agopciconf - Enhance output
Matthew Dillon [Mon, 1 Oct 2018 18:40:23 +0000 (11:40 -0700)]
pciconf - Enhance output

* Add more registers defs from FreeBSD to pcireg.h

* Bring expanded pciconf code in form FreeBSD.  This code
  displays more configuration data for bridges and control
  registers, and fixes a broken bus error reporting conditional.

* Also normalize SLT -> SLOT naming in pcireg.h

4 years agoBump __DragonFly_version for adding wait6() and waitid()
Aaron LI [Mon, 1 Oct 2018 00:51:28 +0000 (08:51 +0800)]
Bump __DragonFly_version for adding wait6() and waitid()

4 years agosystem - Add wait6(), waitid(), and si_pid/si_uid siginfo support
Matthew Dillon [Sun, 30 Sep 2018 19:45:14 +0000 (12:45 -0700)]
system - Add wait6(), waitid(), and si_pid/si_uid siginfo support

* Add the wait6() system call (header definitions taken from FreeBSD).
  This required rearranging kern_wait() a bit.  In particular, we now
  maintain a hold count of 1 on the process during processing instead
  of releasing the hold count early.

* Add waitid() to libc (waitid.c taken from FreeBSD).

* Adjust manual pages (taken from FreeBSD).

* Add siginfo si_pid and si_uid support.  This basically allows a process
  taking a signal to determine where the signal came from.  The fields
  already existed in siginfo but were not implemented.

  Implemented using a non-queued per-process array of signal numbers.
  The last originator sending any given signal is recorded and passed
  through to userland in the siginfo.

* Fixes the 'lightdm' X display manager.  lightdm relies on si_pid
  support.  In addition, note that avoiding long lightdm related
  latencies and timeouts require a softlink from libmozjs-52.so to
  libmozjs-52.so.0 (must be addressed in dports, not addressed in this

Loosely-taken-from: FreeBSD (wait6, waitid support only)
Reviewed-by: swildner
4 years agokernel/virtio: Remove some last traces of virtio_if.m.
Sascha Wildner [Sun, 30 Sep 2018 14:59:53 +0000 (16:59 +0200)]
kernel/virtio: Remove some last traces of virtio_if.m.

It was removed in b817dce2e30a257b86b253a698e63a418758d76d.

4 years agokernel: Bring in a port of FreeBSD's virtio_random(4) driver.
Sascha Wildner [Sun, 30 Sep 2018 14:34:15 +0000 (16:34 +0200)]
kernel: Bring in a port of FreeBSD's virtio_random(4) driver.

Tested-by: Diederik de Groot <info@talon.nl>
4 years agolibstand/hammer1: One more -Wundef fix.
Sascha Wildner [Sat, 29 Sep 2018 21:55:11 +0000 (23:55 +0200)]
libstand/hammer1: One more -Wundef fix.

4 years agolibcrypt: Fix -Wundef (no functional change).
Sascha Wildner [Sat, 29 Sep 2018 21:11:49 +0000 (23:11 +0200)]
libcrypt: Fix -Wundef (no functional change).

4 years agodrm/radeon: drop btc_get_max_clock_from_voltage_dependency_table
François Tigeot [Sat, 29 Sep 2018 19:48:35 +0000 (21:48 +0200)]
drm/radeon: drop btc_get_max_clock_from_voltage_dependency_table

4 years agodrm/radeon/dpm: drop clk/voltage dependency filters for SI
François Tigeot [Sat, 29 Sep 2018 19:33:40 +0000 (21:33 +0200)]
drm/radeon/dpm: drop clk/voltage dependency filters for SI

4 years agodrm/radeon: Pass dma-buf as argument to gem_prime_import_sg_table
François Tigeot [Sat, 29 Sep 2018 19:22:05 +0000 (21:22 +0200)]
drm/radeon: Pass dma-buf as argument to gem_prime_import_sg_table

4 years agoFix the __BSD_VISIBLE check in a few headers.
Sascha Wildner [Sat, 29 Sep 2018 12:58:14 +0000 (14:58 +0200)]
Fix the __BSD_VISIBLE check in a few headers.

#if must be used, not #ifdef.

4 years ago<sys/random.h>: Further cleanup.
Sascha Wildner [Sat, 29 Sep 2018 11:16:27 +0000 (13:16 +0200)]
<sys/random.h>: Further cleanup.

* Remove inclusion of <sys/interrupt.h> which is no longer needed since
  7e071e7abb9f0b54413dda805a4239f7b0eb455e. It can now be moved to

* Remove forward declaration of struct thread which is no longer needed
  since fef8985e09e16aeee4a2014876e2e4b758656ac2.

* Fix a typo in a comment (Reported-by: aly).

4 years ago<sys/random.h>: Clean up some unused prototypes.
Sascha Wildner [Sat, 29 Sep 2018 08:38:45 +0000 (10:38 +0200)]
<sys/random.h>: Clean up some unused prototypes.

4 years agodrm/linux: Implement lockdep_assert_held()
François Tigeot [Fri, 28 Sep 2018 13:27:19 +0000 (15:27 +0200)]
drm/linux: Implement lockdep_assert_held()

4 years agokernel/ppc: Fix -Wundef.
Sascha Wildner [Fri, 28 Sep 2018 12:18:47 +0000 (14:18 +0200)]
kernel/ppc: Fix -Wundef.

4 years agokernel/i915: Fix Makefile (.o -> .c).
Sascha Wildner [Fri, 28 Sep 2018 12:19:59 +0000 (14:19 +0200)]
kernel/i915: Fix Makefile (.o -> .c).

4 years agocalendar(1): Fix -Wundef.
Sascha Wildner [Fri, 28 Sep 2018 08:24:12 +0000 (10:24 +0200)]
calendar(1): Fix -Wundef.

4 years agokernel/netgraph7: Fix some build issues.
Sascha Wildner [Fri, 28 Sep 2018 07:12:33 +0000 (09:12 +0200)]
kernel/netgraph7: Fix some build issues.

Identical to c236fb6ea9212b1768f1e9cd786f7b154616f819.

4 years agoSync ACPICA with Intel's version 20180927:
Sascha Wildner [Fri, 28 Sep 2018 07:03:00 +0000 (09:03 +0200)]
Sync ACPICA with Intel's version 20180927:

* Fix a regression in GPE support seen from the previous
  "Stop unconditionally clearing ACPI IRQs during suspend/resume"

* Update execution of _REG methods to be more conformant to the
  ACPI spec.

* Update Generic Serial Bus implementation.

* In iasl, detect extraneous/reduntant usage of Offset() in Field
  Unit lists.

For detailed list, please see sys/contrib/dev/acpica/changes.txt.

4 years agoevtranalyze(1): Fix -Wundef.
Sascha Wildner [Thu, 27 Sep 2018 16:48:40 +0000 (18:48 +0200)]
evtranalyze(1): Fix -Wundef.

4 years agolibstand/hammer1: Fix -Wundef.
Sascha Wildner [Thu, 27 Sep 2018 16:27:18 +0000 (18:27 +0200)]
libstand/hammer1: Fix -Wundef.

4 years agokernel/vinum: One more -Wundef fix.
Sascha Wildner [Thu, 27 Sep 2018 07:55:32 +0000 (09:55 +0200)]
kernel/vinum: One more -Wundef fix.

4 years agogetty(8): Remove some inactive code (fixes -Wundef).
Sascha Wildner [Thu, 27 Sep 2018 07:53:37 +0000 (09:53 +0200)]
getty(8): Remove some inactive code (fixes -Wundef).

4 years agoliblzma: Fix a typo in config.h (fixes -Wundef).
Sascha Wildner [Thu, 27 Sep 2018 07:48:39 +0000 (09:48 +0200)]
liblzma: Fix a typo in config.h (fixes -Wundef).

It was introduced in 704b9f8fe7aac4fdd017992d93cd909856f2de3e.

4 years agoChange '#if NOT_YET' to '#if 0 /* not yet */' which fixes -Wundef.
Sascha Wildner [Thu, 27 Sep 2018 06:54:51 +0000 (08:54 +0200)]
Change '#if NOT_YET' to '#if 0 /* not yet */' which fixes -Wundef.

4 years agoChange '#if notyet' to '#if 0 /* not yet */' which fixes -Wundef.
Sascha Wildner [Thu, 27 Sep 2018 06:52:01 +0000 (08:52 +0200)]
Change '#if notyet' to '#if 0 /* not yet */' which fixes -Wundef.

4 years agokernel/pf: Provide an NBPF default if the module is built alone.
Sascha Wildner [Thu, 27 Sep 2018 06:45:02 +0000 (08:45 +0200)]
kernel/pf: Provide an NBPF default if the module is built alone.

4 years agolibkvm: Remove some inactive code.
Sascha Wildner [Thu, 27 Sep 2018 06:32:40 +0000 (08:32 +0200)]
libkvm: Remove some inactive code.

4 years agoRevert "drm/ttm: convert to the reservation api"
François Tigeot [Thu, 27 Sep 2018 05:07:37 +0000 (07:07 +0200)]
Revert "drm/ttm: convert to the reservation api"

This reverts commit c05dd8dc1634d5a751604913c322ee97f9510e46.

There is something very wrong with ww mutexes.

4 years agokernel/pf: Add missing use_bpf.h to the Makefile.
Sascha Wildner [Wed, 26 Sep 2018 20:12:08 +0000 (22:12 +0200)]
kernel/pf: Add missing use_bpf.h to the Makefile.

4 years agokernel/dcons: Fix two more -Wundef issues.
Sascha Wildner [Wed, 26 Sep 2018 20:00:39 +0000 (22:00 +0200)]
kernel/dcons: Fix  two more -Wundef issues.

4 years agokernel/ufs: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 19:16:55 +0000 (21:16 +0200)]
kernel/ufs: Fix -Wundef.

4 years agovkernel: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 19:09:52 +0000 (21:09 +0200)]
vkernel: Fix -Wundef.

4 years agokernel/mpr: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 19:10:46 +0000 (21:10 +0200)]
kernel/mpr: Fix -Wundef.

4 years agokernel/ext2fs: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 18:48:03 +0000 (20:48 +0200)]
kernel/ext2fs: Fix -Wundef.

4 years agokernel/drm: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 18:18:45 +0000 (20:18 +0200)]
kernel/drm: Fix -Wundef.

4 years agokernel/ntfs: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 18:00:47 +0000 (20:00 +0200)]
kernel/ntfs: Fix -Wundef.

4 years agokernel/if_mos: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 17:37:23 +0000 (19:37 +0200)]
kernel/if_mos: Fix -Wundef.

I introduced this issue myself in 6a054f0b7d59e39ebfc082d30cdd5d65f7def3ae.

4 years agokernel/vga: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 17:20:23 +0000 (19:20 +0200)]
kernel/vga: Fix -Wundef.

4 years agokernel/vinum: Fix -Wundef.
Sascha Wildner [Wed, 26 Sep 2018 17:05:30 +0000 (19:05 +0200)]
kernel/vinum: Fix -Wundef.

4 years agokernel/dcons: Fix -Wundef.
Sascha Wildner [Tue, 25 Sep 2018 19:24:30 +0000 (21:24 +0200)]
kernel/dcons: Fix -Wundef.

4 years agokernel/vmxnet3: Fix -Wundef.
Sascha Wildner [Tue, 25 Sep 2018 18:41:16 +0000 (20:41 +0200)]
kernel/vmxnet3: Fix -Wundef.

4 years agokernel - Macro additional builtin's (3)
Matthew Dillon [Tue, 25 Sep 2018 17:50:29 +0000 (10:50 -0700)]
kernel - Macro additional builtin's (3)

* Fix SLAB_DEBUG and LINT64 options.

Reported-by: swildner
4 years agokernel - Macro additional builtin's (2)
Matthew Dillon [Tue, 25 Sep 2018 17:24:53 +0000 (10:24 -0700)]
kernel - Macro additional builtin's (2)

* Add _memcpy (currently unused).  Replicate support the same way
  for all the builtins.

4 years agokernel/hpt27xx: Enable some code that should work for us (fixes -Wundef).
Sascha Wildner [Tue, 25 Sep 2018 17:09:18 +0000 (19:09 +0200)]
kernel/hpt27xx: Enable some code that should work for us (fixes -Wundef).

4 years agokernel - Adjust vkernel build for builtin changes
Matthew Dillon [Tue, 25 Sep 2018 16:27:18 +0000 (09:27 -0700)]
kernel - Adjust vkernel build for builtin changes

* Adjust the vkernel build to be compatible with the
  macros changes for bcopy, etc.

* It appears that since e.g. 'bcopy' is a PLT symbol in libc,
  that I cannot simply create a weak '_bcopy' symbol that
  points to it.  So this solution is a bit of a hack.

4 years agokernel - Do not overwrite uap args in system calls
Matthew Dillon [Mon, 24 Sep 2018 17:35:44 +0000 (10:35 -0700)]
kernel - Do not overwrite uap args in system calls

* This was the only case where a uap argument was overwritten.
  Make it use a local variable instead.

* Prep for potential later remapping of syscall arguments
  to the trapframe registers.

4 years agokernel - Macro additional builtin's
Matthew Dillon [Mon, 24 Sep 2018 17:33:25 +0000 (10:33 -0700)]
kernel - Macro additional builtin's

* Macro memcpy, memset, and memmove.  Move from libkern to

* Adjust prototypes, add _xxx versions, adjust a few bits of
  code that need the related function pointers.

* Scrap hacks in zlib.c that converted memset and memmove.

4 years agokernel - Remove lwkt_msg from sysunion in syscall code
Matthew Dillon [Mon, 24 Sep 2018 17:29:32 +0000 (10:29 -0700)]
kernel - Remove lwkt_msg from sysunion in syscall code

* The lmsg field (lwkt_msg) is no longer used in the
  sysunion union, remove it.  Should not result in any
  material changes to code generation.

4 years agokernel - Work around bogus gcc errors
Matthew Dillon [Mon, 24 Sep 2018 17:26:23 +0000 (10:26 -0700)]
kernel - Work around bogus gcc errors

* gcc warns of possibly uninitialized variables when using the
  builtins in two situations where the variables are, in fact,
  initialized for the code path.

* Not really gcc's fault, the code was too complex for its

* Zero the variables to fix the warning.

4 years agokernel - Fix bug in mpt_scsi_tgt_status()
Matthew Dillon [Mon, 24 Sep 2018 17:25:23 +0000 (10:25 -0700)]
kernel - Fix bug in mpt_scsi_tgt_status()

* Function overwrote the 'rsp' pointer instead of zero'ing a
  portion of the rsp target.

4 years agokernel - Optimize kmalloc() + bzero()
Matthew Dillon [Mon, 24 Sep 2018 15:52:07 +0000 (08:52 -0700)]
kernel - Optimize kmalloc() + bzero()

* Optimize the common case where kmalloc is called with constant
  flags of M_ZERO|M_WAITOK (and not M_NULLOK), and size, and
  issue the bzero() independently.  This allows the bzero() to
  be optimized.

Suggested-by: mjg
4 years agokernel - Optimize bcopy, bzero, memset
Matthew Dillon [Sun, 23 Sep 2018 22:42:26 +0000 (15:42 -0700)]
kernel - Optimize bcopy, bzero, memset

* Use __builtin_memset() for bzero() and __builtin_memmove()
  for bcopy().

  - Must use _bcopy in a few places where GCC complains about
    structural punning.  Even casting doesn't help.

  - GCC's __builtin_memset() and __builtin_memmove() has a side
    effect where it assumes that the pointer arguments cannot be
    NULL.  In fact, they can be NULL when the byte count is 0.
    This assumption by GCC causes later unrelated conditionals
    on the pointers against NULL to be improperly optimized-out.

    We had to fix one place where this blew the system up.

* Implement memset() in assembly (remove from libkern).

* Implement memmove() in assembly (remove from libkern).

4 years agokernel - Fix serious bug in virtio
Matthew Dillon [Sun, 23 Sep 2018 19:11:57 +0000 (12:11 -0700)]
kernel - Fix serious bug in virtio

* virtio_blk.c was destroy the buffer cache base global
  in vtblk_write_dump().

Located-by: gcc8, bcopy -> memcpy inline optimization complained.
4 years agokernel - Remove unnecessary cld's
Matthew Dillon [Sun, 23 Sep 2018 18:39:17 +0000 (11:39 -0700)]
kernel - Remove unnecessary cld's

* Remove unnecsesary cld's, ABI requires direction flag to be clear
  on entry.

* Keep the cld prior to the ret for the case where we have to std
  in bcopy().

Suggested-by: mjg
4 years agokernel - Refactor copyinstr and copystr
Matthew Dillon [Sun, 23 Sep 2018 18:35:21 +0000 (11:35 -0700)]
kernel - Refactor copyinstr and copystr

* Replace lodsb/stosb sequence with discrete mov's.  Remove related
  xchgq and cld.

Suggested-by: mjg
4 years agokernel/pfsync: Use the correct macros when checking for bpf or CARP.
Sascha Wildner [Tue, 25 Sep 2018 12:45:59 +0000 (14:45 +0200)]
kernel/pfsync: Use the correct macros when checking for bpf or CARP.

Similar to 5b7f73c4a34bc9105fb3f29fce8161e3b8dce5ea.

Note that pfsync is currently lacking userland support (in ifconfig
at least) so this commit won't affect anyone.

4 years agorc.d/pflog - Be quiet when check if modules are loaded
Aaron LI [Tue, 25 Sep 2018 12:30:58 +0000 (20:30 +0800)]
rc.d/pflog - Be quiet when check if modules are loaded

This rc script was missed from tuxillo's commit (0dfdc028b39).

4 years agokernel/pflog: Fix a recently introduced regression.
Sascha Wildner [Tue, 25 Sep 2018 12:40:43 +0000 (14:40 +0200)]
kernel/pflog: Fix a recently introduced regression.

The recently added #ifdef (in a6ccd68b08eff10c57551f8fe92f39a5b8ae6c48)
used the wrong name (NBPFILTER) and thereby effectively disabled the

Fix it to the right name (NBPF), include the necessary use_bpf.h and
while here, also fix another such case for detaching.

Reported-by: Peeter Must
4 years agokernel/acpi: Some improvements in acpi_eval_osc().
Sascha Wildner [Tue, 25 Sep 2018 07:28:15 +0000 (09:28 +0200)]
kernel/acpi: Some improvements in acpi_eval_osc().

* If ACPI_OSC_QUERY_SUPPORT is set, return the results in the buffer
  that was passed for further processing.

* Rename related flags/masks to better names and update comments in the
  header file.

4 years agokernel/assym: Remove V_FORWARDED_{HITS,INTS,MISSES}.
Sascha Wildner [Mon, 24 Sep 2018 08:03:15 +0000 (10:03 +0200)]
kernel/assym: Remove V_FORWARDED_{HITS,INTS,MISSES}.

All usage was removed in our tree in 2003 and 2005:

V_FORWARDED_{HITS,MISSES} in cb973d1510c62c9b0a2e26530585a2c50672efa3
V_FORWARDED_INTS          in 477d3c1cb94fc723c033f6ad0897a6a3d65046b6

4 years agodrm/ttm: convert to the reservation api
François Tigeot [Sun, 23 Sep 2018 13:41:47 +0000 (15:41 +0200)]
drm/ttm: convert to the reservation api

4 years agodrm/linux: Implement more reservation objects code
François Tigeot [Sun, 23 Sep 2018 13:30:35 +0000 (15:30 +0200)]
drm/linux: Implement more reservation objects code

4 years agodumpon(8): Make error messages clearer
Aaron LI [Sun, 23 Sep 2018 04:26:33 +0000 (12:26 +0800)]
dumpon(8): Make error messages clearer

Before this patch, when a dump device is already configured, dumpon(8)
only complains with 'Device busy', which isn't helpful.  Now, dumpon(8)
will tell whether the dump device is already configured or whether need
to run 'dumpoff' first.

Always show verbose information.  The utility still accepts the '-v'
option for backward compatibility, but don't mention the option in the
man page anymore.

Bugs: https://bugs.dragonflybsd.org/issues/3092

4 years agodumpon(8): Add "dumpoff" variant to be "dumpon off"
Aaron LI [Sat, 22 Sep 2018 12:57:52 +0000 (20:57 +0800)]
dumpon(8): Add "dumpoff" variant to be "dumpon off"

"dumpon off" doesn't seem to be a good command, so let's add the "dumpoff"
variant that just acts as "dumpon off", similar to "swapoff".

Thanks to swildner for the initial patch.

See also: https://bugs.dragonflybsd.org/issues/3092#note-2

4 years agolibc/stdtime: Remove some #ifdef checks for TM_{GMTOFF,ZONE}.
Sascha Wildner [Sat, 22 Sep 2018 18:54:40 +0000 (20:54 +0200)]
libc/stdtime: Remove some #ifdef checks for TM_{GMTOFF,ZONE}.

We don't override those and use the defaults from private.h.

While here, clean up the CFLAGS of zdump(8) and zic(8). Most of this
isn't needed.

4 years agokernel: Remove orphaned externs.
Sascha Wildner [Sat, 22 Sep 2018 10:55:13 +0000 (12:55 +0200)]
kernel: Remove orphaned externs.

4 years agoiwm - Remove unused TX_CMD_NEXT_FRAME_*
Imre Vadász [Fri, 21 Sep 2018 14:00:35 +0000 (16:00 +0200)]
iwm - Remove unused TX_CMD_NEXT_FRAME_*

Taken-From: Linux git b1e06c65fb69c5e3fddcd91987561e225eaa9bfa

4 years agoiwm - Remove unused REPLY_MAX
Imre Vadász [Fri, 21 Sep 2018 13:58:54 +0000 (15:58 +0200)]
iwm - Remove unused REPLY_MAX

Taken-From: Linux git e4eb275ac5cfe71686612d929a9829345b2a4ada

4 years agoiwm - Update alive response handling, add v4 and remove old versions.
Imre Vadász [Fri, 21 Sep 2018 11:43:11 +0000 (13:43 +0200)]
iwm - Update alive response handling, add v4 and remove old versions.