20 months agovkernel - Remove unneeded -T flag, that was added in 7b21e5e4a2ba4592a.
Imre Vadász [Fri, 28 Dec 2018 14:50:31 +0000 (15:50 +0100)]
vkernel - Remove unneeded -T flag, that was added in 7b21e5e4a2ba4592a.

* Instead the -e hw.tsc_cputimer_enable=0 flag can be used, to set the
  tunable that disables use of the TSC cputimer.

Pointed-out-by: swildner
20 months agokernel: Remove more duplicate includes.
Sascha Wildner [Fri, 28 Dec 2018 13:34:12 +0000 (14:34 +0100)]
kernel: Remove more duplicate includes.

20 months agokernel/ic: Remove an unneeded #ifdef _KERNEL and two duplicate includes.
Sascha Wildner [Fri, 28 Dec 2018 13:27:57 +0000 (14:27 +0100)]
kernel/ic: Remove an unneeded #ifdef _KERNEL and two duplicate includes.

20 months agoOops, fix lagg's type in LINT64.
Sascha Wildner [Fri, 28 Dec 2018 12:50:47 +0000 (13:50 +0100)]
Oops, fix lagg's type in LINT64.

20 months agoAdd lagg(4) to LINT64.
Sascha Wildner [Fri, 28 Dec 2018 12:47:24 +0000 (13:47 +0100)]
Add lagg(4) to LINT64.

While here, adjust LINT64's ident and fix lagg's type in VKERNEL64.

20 months agovkernel - Delete unused/ancient timer/rtc function declarations in clock.h.
Imre Vadász [Fri, 28 Dec 2018 10:50:57 +0000 (11:50 +0100)]
vkernel - Delete unused/ancient timer/rtc function declarations in clock.h.

* Also get rid of tsc_is_broken flag, that is completely unused.

20 months agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Fri, 28 Dec 2018 10:32:37 +0000 (11:32 +0100)]
bsd-family-tree: Sync with FreeBSD.

20 months agokernel/acpi: Bring in FreeBSD's r341632.
Sascha Wildner [Thu, 27 Dec 2018 23:23:14 +0000 (00:23 +0100)]
kernel/acpi: Bring in FreeBSD's r341632.

On specific machines (a Lenovo Ideapad 100-15IBD in this case) would fail
detecting the battery properly after 7bcb6caf98d72e1e5fd653428e604ea1.

See https://lists.freebsd.org/pipermail/svn-src-all/2018-December/173505.html
for further info.

Reported-by: mazocomp on #dragonflybsd.
Taken-from: FreeBSD

20 months agonet - Simplify net/altq TSC timer code, get rid of its TSC calibration code.
Imre Vadász [Thu, 27 Dec 2018 21:41:25 +0000 (22:41 +0100)]
net - Simplify net/altq TSC timer code, get rid of its TSC calibration code.

* There is no use for the custom TSC calibration code in the ALTQ code.
  If our bootup TSC calibration would ever fail, we have bigger problems
  than being a little bit slower in the ALTQ code.

20 months agobufcache.9: Fix bread() prototype.
Sascha Wildner [Thu, 27 Dec 2018 13:05:08 +0000 (14:05 +0100)]
bufcache.9: Fix bread() prototype.

20 months agovkernel.7: Fix a typo and bump date
Aaron LI [Thu, 27 Dec 2018 11:26:36 +0000 (19:26 +0800)]
vkernel.7: Fix a typo and bump date

20 months agokernel - Factor out TSC cputimer into common x86_64 code, use for vkernel.
Imre Vadász [Tue, 25 Dec 2018 15:02:38 +0000 (16:02 +0100)]
kernel - Factor out TSC cputimer into common x86_64 code, use for vkernel.

* This adds a command line flag -T to the vkernel, to force disable use of
  the TSC cputimer.

* By default the TSC will be used as a cputimer for the vkernel when the
  TSC is invariant and mpsync according to the hw.tsc_invariant and
  hw.tsc_mpsync sysctl values of the host.

20 months agokernel - Throw a global lock around udev dictionary ops
Matthew Dillon [Thu, 27 Dec 2018 03:33:23 +0000 (19:33 -0800)]
kernel - Throw a global lock around udev dictionary ops

* Throw a global lockmgr lock around accesses and adjustments to

* Refactor functions that used to access dev->si_dict directly by
  adding two helper functions, udev_get_dict() and udev_put_dict().

* Should fix occassional vn-related panics.

20 months agoiwm - Fix possible null pointer indirection
Matthew Dillon [Wed, 26 Dec 2018 06:17:25 +0000 (22:17 -0800)]
iwm - Fix possible null pointer indirection

* Fix possible null pointer indirection.  No known cases for dfly but
  I would speculate possibly something in the error path could
  trigger a NULL field there.

* Provisional change, may be adjusted in the future.  But harmless.

Taken-from: haiku
Requested-by: waddlespl
20 months agoefirt.9: Yet another prototype fix.
Sascha Wildner [Tue, 25 Dec 2018 10:05:18 +0000 (11:05 +0100)]
efirt.9: Yet another prototype fix.

20 months agoiconvlist.3: Fix prototype in SYNOPSIS.
Sascha Wildner [Sun, 23 Dec 2018 21:37:03 +0000 (22:37 +0100)]
iconvlist.3: Fix prototype in SYNOPSIS.

20 months agobus_space.9: Fix some protoypes in SYNOPSIS.
Sascha Wildner [Sun, 23 Dec 2018 21:25:59 +0000 (22:25 +0100)]
bus_space.9: Fix some protoypes in SYNOPSIS.

20 months agokernel: Add descriptions to the p1003_1b sysctls.
Sascha Wildner [Sun, 23 Dec 2018 20:39:46 +0000 (21:39 +0100)]
kernel: Add descriptions to the p1003_1b sysctls.

While here, clean up a bit.

20 months agokernel: Populate the p1003_1b sysctl tree a bit more.
Sascha Wildner [Sun, 23 Dec 2018 20:36:57 +0000 (21:36 +0100)]
kernel: Populate the p1003_1b sysctl tree a bit more.

20 months agosem_init.3: Mark up SEM_VALUE_MAX.
Sascha Wildner [Sun, 23 Dec 2018 20:09:35 +0000 (21:09 +0100)]
sem_init.3: Mark up SEM_VALUE_MAX.

20 months ago<utmpx.h>: Change struct utmpx's ut_type from uint16_t to short, per POSIX.
Sascha Wildner [Sun, 23 Dec 2018 08:13:58 +0000 (09:13 +0100)]
<utmpx.h>: Change struct utmpx's ut_type from uint16_t to short, per POSIX.

See https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/utmpx.h.html

Our valid ut_types are 0-8 currently, so there should not be any issues.

Also fix a no longer necessary cast in utmp_update.

20 months agokernel/mrsas: Fix a double assignment.
Sascha Wildner [Sun, 23 Dec 2018 06:35:02 +0000 (07:35 +0100)]
kernel/mrsas: Fix a double assignment.

This code is in an ioctl path that is not used in DragonFly.

Taken-from: FreeBSD

20 months agortadvctl(8): Add __printflike and fix warnings.
Sascha Wildner [Fri, 21 Dec 2018 20:21:29 +0000 (21:21 +0100)]
rtadvctl(8): Add __printflike and fix warnings.

20 months agolibc/sysvipc: Fix some style issues (no functional change).
Sascha Wildner [Fri, 21 Dec 2018 14:18:00 +0000 (15:18 +0100)]
libc/sysvipc: Fix some style issues (no functional change).

20 months agolibc/sysvipc: Mark two functions as printf-like and fix resulting errors.
Sascha Wildner [Fri, 21 Dec 2018 14:14:14 +0000 (15:14 +0100)]
libc/sysvipc: Mark two functions as printf-like and fix resulting errors.

21 months agoFix broken links.
Justin C. Sherrill [Thu, 20 Dec 2018 04:46:37 +0000 (23:46 -0500)]
Fix broken links.


21 months agorc.d/varsym: Rewrite following rc.d/sysctl
Aaron LI [Thu, 13 Dec 2018 05:53:54 +0000 (13:53 +0800)]
rc.d/varsym: Rewrite following rc.d/sysctl

* Rewrite this script following the same logic and style of rc.d/sysctl.
  The basic syntax is checked before setting it.

* Clarify the /etc/varsym.conf syntax in the man page.

Reviewed-by: swildner
21 months agorc.d/sysctl: Rewrite to be more robust and clean
Aaron LI [Thu, 13 Dec 2018 05:58:27 +0000 (13:58 +0800)]
rc.d/sysctl: Rewrite to be more robust and clean

* Check the validity of the sysctl config and warn about the invalid

  A common mistake is that users set 'sysctl <mib>=<val>' in
  /etc/sysctl.conf, which generate huge amount of junk/mysterious
  messages on the console.  Now this will be warned.

* Reorganize the logic to be much cleaner.

* Do not bother to check whether the new value is different from the old

* Rename the function for consistency.

21 months agorc.d/mountcritlocal: Clean up
Aaron LI [Fri, 14 Dec 2018 14:57:51 +0000 (22:57 +0800)]
rc.d/mountcritlocal: Clean up

Clean the code a bit and fix the style.

21 months agoefirt.9: Fix prototype.
Sascha Wildner [Wed, 19 Dec 2018 09:04:36 +0000 (10:04 +0100)]
efirt.9: Fix prototype.

21 months agohammer2 - Cleanup 'info' command
Matthew Dillon [Tue, 18 Dec 2018 16:31:56 +0000 (08:31 -0800)]
hammer2 - Cleanup 'info' command

* hammer2 info validates the partition info, but assumed that
  the filesystem would be a disklabel.  Add code to validate
  against GPT slices too by checking the filesystem uuid.

Reported-by: ftigeot
21 months agohammer1 - Fix left-over /va/run/hammer.cleanup files
Matthew Dillon [Mon, 17 Dec 2018 21:46:11 +0000 (13:46 -0800)]
hammer1 - Fix left-over /va/run/hammer.cleanup files

* Fix an incorrect API call by hammer1 to the pidfile_*() functions
  in libutil.  This caused hammer1 to leave its lock files sitting in
  /var/run due to a use-after-free that reared its ugly head after
  the version update.

Reported-by: JustinS
21 months agoefirt.9: Add missing header to the SYNOPSIS.
Sascha Wildner [Sun, 16 Dec 2018 23:15:54 +0000 (00:15 +0100)]
efirt.9: Add missing header to the SYNOPSIS.

21 months agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 16 Dec 2018 21:33:09 +0000 (22:33 +0100)]
Update the pciconf(8) database.

December 11, 2018 snapshot from https://pci-ids.ucw.cz

21 months agoefirt.9: Use .Er for error return values.
Sascha Wildner [Sun, 16 Dec 2018 21:29:41 +0000 (22:29 +0100)]
efirt.9: Use .Er for error return values.

21 months agoatkbdc - Change default to still attach PS2 controller even if FADT says don't
Matthew Dillon [Sun, 16 Dec 2018 21:26:06 +0000 (13:26 -0800)]
atkbdc - Change default to still attach PS2 controller even if FADT says don't

* Temporary workaround, disable commit 131acb0380e93664 by default.
  It can be enabled again with a tunable in /boot/loader.conf:


* Should work around several bug reports of the keyboard not working
  in 5.4.

21 months agoAdd efidev.4 and efirt.9 manual pages from FreeBSD.
Sascha Wildner [Fri, 14 Dec 2018 23:56:19 +0000 (00:56 +0100)]
Add efidev.4 and efirt.9 manual pages from FreeBSD.

21 months agoSync ACPICA with Intel's version 20181213.
Sascha Wildner [Fri, 14 Dec 2018 23:04:38 +0000 (00:04 +0100)]
Sync ACPICA with Intel's version 20181213.

* Fix buffer length issues with the GenericSerialStatus.

* New object evaluation trace mechanism for control methods and data

* _OSI strings sync.

* New options in iasl (-ww) and acpiexec (-eo).

* Various smaller fixes and additions.

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

21 months agokernel/acpi: Fix the ACPI_LV_VERBOSITY1 level's value.
Sascha Wildner [Fri, 14 Dec 2018 21:34:59 +0000 (22:34 +0100)]
kernel/acpi: Fix the ACPI_LV_VERBOSITY1 level's value.

21 months agorc: Let dhcpcd(8) go to background immediately by default
Aaron LI [Fri, 14 Dec 2018 14:08:26 +0000 (22:08 +0800)]
rc: Let dhcpcd(8) go to background immediately by default

Set the default value of "dhcpcd_flags" to be "-b", thus don't let
dhcpcd(8) block the boot, especially when there is no wireless
connection, with the default settings.

21 months agonetwork.subr: Workaround race between wpa_supplicant and dhcpcd
Aaron LI [Wed, 12 Dec 2018 04:06:17 +0000 (12:06 +0800)]
network.subr: Workaround race between wpa_supplicant and dhcpcd

Insert a 1-second delay after starting wpa_supplicant(8) to workaround
the race between it and dhcpcd(8), which can modify the interface's
state and break wpa_supplicant's ongoing SSID scan.

dhclient(8) doesn't have such an issue with wpa_supplicant.

Tested-by: me, Daniel Bilik <ddb@neosystem.org>
21 months agoAllow optional "inet6" keyword in ipv6_ifconfig_<ifname>
Aaron LI [Wed, 12 Dec 2018 14:53:00 +0000 (22:53 +0800)]
Allow optional "inet6" keyword in ipv6_ifconfig_<ifname>

21 months agorc.d/netif: Rework wlan interface configuration
Aaron LI [Wed, 12 Dec 2018 03:52:24 +0000 (11:52 +0800)]
rc.d/netif: Rework wlan interface configuration

* wlan interfaces are more similar to clonable interfaces rather than
  vlan interfaces, so move the relevant code from childif_create() to
  network.subr as wlan_up(), which will be called to create the wlan
  interfaces before setting up them.

  Now, list_net_interfaces() shouldn't list "net.wlan.devices".

* Add the wlan_down() function in network.subr to destroy the wlan

* Meanwhile, fix childif_destroy() to properly destroy the vlan
  interfaces created by childif_create().  Also tweak the order of this
  function in netif_stop().

* The 2-second delay in netif_start() doesn't apply anymore, since the
  DHCP and WPA configurations are now handled in ifconfig_up() called by

This patch is loosely based on FreeBSD's code.  Thanks to them.

21 months agonetwork.subr: Properly bring up/down interfaces
Aaron LI [Wed, 12 Dec 2018 03:29:10 +0000 (11:29 +0800)]
network.subr: Properly bring up/down interfaces

Now that the interface will be properly brought up in ifconfig_up(),
clean up the rc.d/wpa_supplicant script.

21 months agonetwork.subr: Add IPv6 support to ifalias_{up,down}()
Aaron LI [Wed, 12 Dec 2018 03:16:05 +0000 (11:16 +0800)]
network.subr: Add IPv6 support to ifalias_{up,down}()

* Factor out the common parts of ifalias_{up,down}() to be
* Add IPv6 support to ifalias_common().
* Use ifalias_up() in network6_interface_setup().

21 months agorc.d/netif: Rename network_* to netif_* for consistency
Aaron LI [Tue, 11 Dec 2018 13:27:43 +0000 (21:27 +0800)]
rc.d/netif: Rename network_* to netif_* for consistency

Rename network_* subroutines to netif_* for better consistency.  Also
set the rcvar and add netif_enable=YES to rc.conf.

Taken-from: FreeBSD (r272959, r278506)

21 months agonetwork.subr: Clean up list_net_interfaces()
Aaron LI [Tue, 11 Dec 2018 13:16:25 +0000 (21:16 +0800)]
network.subr: Clean up list_net_interfaces()

The rc.d/netif takes care of DHCP/non-DHCP interfaces appropriately, and
thus the interface type filter feature in list_net_interfaces() is no
longer needed since long ago.

21 months agonetwork.subr: Cleanups and minor improvements
Aaron LI [Tue, 11 Dec 2018 06:05:20 +0000 (14:05 +0800)]
network.subr: Cleanups and minor improvements

* Localize variables in all functions.
* Better name several variables (e.g., $i -> $_if).
* Simplify several test and case usages.
* Use the newly added "-n" option for ifconfig(8) in ifexists().
* Improve comments, debug messages, and styles.
* Print a message when calling rtsol(8) to auto configure an interface,
  since it may take several seconds.

21 months agorc: Use SYSCTL{,_N,_W} variables
Aaron LI [Sun, 9 Dec 2018 02:55:55 +0000 (10:55 +0800)]
rc: Use SYSCTL{,_N,_W} variables

With minor cleanups to IO redirections.

21 months agokernel: Remove the FFS_ROOT option. It was a no-op since 4.9.
Sascha Wildner [Tue, 11 Dec 2018 19:58:57 +0000 (20:58 +0100)]
kernel: Remove the FFS_ROOT option. It was a no-op since 4.9.

21 months agohammer2 - stabilization, fix delete-on-reclaim (2)
Matthew Dillon [Tue, 11 Dec 2018 17:26:19 +0000 (09:26 -0800)]
hammer2 - stabilization, fix delete-on-reclaim (2)

* Fix double-delete.  When an inode is finally deleted, the
  HAMMER2_INODE_ISUNLINKED flag must be cleared to avoid a
  double delete later in reclaim.

21 months agodrm: Add missing file uapi/linux/pci.h
François Tigeot [Tue, 11 Dec 2018 06:56:18 +0000 (07:56 +0100)]
drm: Add missing file uapi/linux/pci.h

21 months agohammer2 - stabilization, fix delete-on-reclaim
Matthew Dillon [Mon, 10 Dec 2018 23:35:31 +0000 (15:35 -0800)]
hammer2 - stabilization, fix delete-on-reclaim

* Fix the delete-on-reclaim code which had been commented out
  temporarily during the prior work.  Restore and cleanup the

  This code handles deleting inodes for files which were unlinked
  (nlinks count -> 0) but still had open descriptors.

* Fixes inode leak in df output and on the media.

21 months agodrm: Add the DRM_IOCTL_GET_PCIINFO ioctl
François Tigeot [Mon, 10 Dec 2018 22:06:11 +0000 (23:06 +0100)]
drm: Add the DRM_IOCTL_GET_PCIINFO ioctl

* It provides an easy way to get PCI device information from
  a /dev file descriptor

* The main user will be mesa/libdrm

Obtained-from: OpenBSD

21 months agokernel/netinet6: Fix the kernel build without "options INET6".
Sascha Wildner [Sun, 9 Dec 2018 11:53:33 +0000 (12:53 +0100)]
kernel/netinet6: Fix the kernel build without "options INET6".

21 months agokernel/gif: Include just opt_inet6.h which is all this header needs.
Sascha Wildner [Sun, 9 Dec 2018 11:34:57 +0000 (12:34 +0100)]
kernel/gif: Include just opt_inet6.h which is all this header needs.

21 months agokernel: Remove some useless #ifdefs.
Sascha Wildner [Sun, 9 Dec 2018 10:16:35 +0000 (11:16 +0100)]
kernel: Remove some useless #ifdefs.

21 months agoHAMMER2 - Update DESIGN document
Matthew Dillon [Sun, 9 Dec 2018 04:58:18 +0000 (20:58 -0800)]
HAMMER2 - Update DESIGN document

* Bring the design document up-to-snuff.

21 months agokernel - Fix rare vref() assertion
Matthew Dillon [Sat, 8 Dec 2018 22:34:51 +0000 (14:34 -0800)]
kernel - Fix rare vref() assertion

* The VREF_TERMINATE flag gets cleared when a vnode is reactivated.
  However, concurrent LK_SHARED locks on vnodes can race the v_state
  test.  Thus the code cannot assume that VREF_TERMINATE has been cleared
  when v_state is VS_ACTIVE.

  To avoid the race, we simply unconditionally clear VREF_TERMINATE on
  a successful vget().

* Could be reproduced by running blogbench and synth together, both of
  which generate extreme filesystem-intensive loads.

21 months agobyteorder(3): Remove a VAX comment
François Tigeot [Sat, 8 Dec 2018 14:41:24 +0000 (15:41 +0100)]
byteorder(3): Remove a VAX comment

21 months agoifconfig(8): Add option -n to disable auto module loading
Aaron LI [Tue, 27 Nov 2018 04:05:58 +0000 (12:05 +0800)]
ifconfig(8): Add option -n to disable auto module loading

This option may be used by rc scripts to disable the auto loading of
network modules when try to configure/stop a non-existent interface.
e.g., `ifconfig tap0` will auto load `if_tap.ko` when `tap0` doesn't
exist yet.

Taken-from: FreeBSD (r169873)

21 months agokernel: Use NULL for pointers in DRIVER_MODULE().
Sascha Wildner [Sat, 8 Dec 2018 09:39:12 +0000 (10:39 +0100)]
kernel: Use NULL for pointers in DRIVER_MODULE().

21 months agohammer2 - stabilization, fix hammer2_inode_get()
Matthew Dillon [Sat, 8 Dec 2018 04:26:15 +0000 (20:26 -0800)]
hammer2 - stabilization, fix hammer2_inode_get()

* Fix a lock order reversal in hammer2_inode_get() which can be
  triggered under heavy loads.

21 months agohammer2 - Cleanup
Matthew Dillon [Sat, 8 Dec 2018 02:06:36 +0000 (18:06 -0800)]
hammer2 - Cleanup

* Cleanup a few wrappers, remove struct buf related temporary
  debug code.

* Add some lock assertions.

* Unlimit M_HAMMER2 (for use with HAMMER2_IO_DEBUG)

21 months agohammer2 - Add HAMMER2_IO_DEBUG
Matthew Dillon [Sat, 8 Dec 2018 02:05:16 +0000 (18:05 -0800)]
hammer2 - Add HAMMER2_IO_DEBUG

* Add HAMMER2_IO_DEBUG (default disabled).  This tracks callers
  that use hammer2_io's.  This eats a huge amount of (up to ~20GB)
  of kernel memory.

21 months agokernel - Improve umount operation
Matthew Dillon [Fri, 7 Dec 2018 02:50:07 +0000 (18:50 -0800)]
kernel - Improve umount operation

* Move the cache_inval(), and both cache_unmounting() and
  cache_clearmntcache() into the retry loop.  This ensures that
  the nc_refs test actually has a chance to update during the retry.

  This should significantly improve umount operation, reducing umount
  races against exiting processes still using the filesystem.

* Only issue the allproc scan which matches and clears proc->p_textnch
  on a forced umount.  Otherwise disallow the umount attempt.  We
  may have to reallow this later, but the shutdown code now properly
  clears p_textnch so it should take care of the case for us (which
  is why this code was originally present).

* Properly dispose of p->p_textnch during shutdown/halt/reboot for
  the calling process, proc0, and init.  This is an attempt to allow
  the system to cleanly unmount root.

* Cleanup the warning and error messages to clarify umount failures.

* Only reinstasll the syncer vp on error if umount deinstalled it.

* Add some debugging sysctls (default disabled).

Reported-by: marino
21 months agohammer2 - stabilization
Matthew Dillon [Thu, 6 Dec 2018 06:42:31 +0000 (22:42 -0800)]
hammer2 - stabilization

* Adjust the chain lock a bit to bump lockcnt prior to acquiring
  a non-blocking shared lock, instead of afterwords, which cleans
  up a live-loop case in the chain unlock code.

* Cleanup misc debugging.  Add some inode debugging code (default

* Add some crash-dump (or live) debug utilities for tracking down
  chains, dio's, and inodes.  kgdb's macros are too slow for iterating
  a million chains.

21 months agohammer2 - refactor filesystem sync 7/N
Matthew Dillon [Wed, 5 Dec 2018 18:19:31 +0000 (10:19 -0800)]
hammer2 - refactor filesystem sync 7/N

* Increase default caps for dirty chain and dirty inode counts.  The
  new SYNCQ semantics allow this number to be arbitrarily large, but
  it is still a good idea not to allow it to get out of control.

  NOTE: One advantage of higher caps is that it gives the frontend more
  time to delete temporary files.

* Get rid of the old syncer speedup / write moderation mechanisms.
  Replace with a new VFS_MODIFYING() hook that allows the filesystem
  to implement moderation prior to any vnode locks being held.

  Remove hammer2_pfs_memory_wait() calls from VOP bodies, implement
  the hammer2_pfs_memory_wait() call via VFS_MODIFYING() instead.

* Move the moderation wakeup for the inode count to the syncer, and
  change the parameter to use pmp->sideq_count.

21 months agokernel - Add trigger_syncer(), VFS_MODIFYING()
Matthew Dillon [Wed, 5 Dec 2018 05:49:35 +0000 (21:49 -0800)]
kernel - Add trigger_syncer(), VFS_MODIFYING()

* Add trigger_syncer().  This function asynchronously triggers the
  syncer vnode in the syncer thread for the mount.  It is a NOP if
  there is no syncer thread or syncer vnode.

  Will be used by HAMMER2 to pipeline syncs when heavy filesystem
  activity over-extends internal memory structures.

* Add VFS_MODIFYING().  This is a hook into the filesystem that
  modifying filesystem ops in the kernel will call prior to locking
  any vnodes.  It allows the filesystem to moderate the over-allocation
  of internal structures.  Waiting until after the VOP is called is too
  late, so we need kernel support for this.  Numerous attempts to hack
  moderation code into the H2 VOPs have all failed spectacularly.

  In H2, over-allocation can occur because H2 must retain disconnected
  inodes related to file creation and deletion until the next sync cycle.

21 months agohammer2 - refactor filesystem sync 6/N
Matthew Dillon [Sun, 2 Dec 2018 20:39:48 +0000 (12:39 -0800)]
hammer2 - refactor filesystem sync 6/N

* Dependency tracking.  Add modest cross-dependency grouping.  This code
  does not track dependencies in a graph.  Instead, it simply groups
  dependent inodes together.  This means that dependency groups can get
  rather large when, for example, lots of files are being created or
  deleted in the same directory.

* We retain the excellent dynamic inode reordering code for the syncq.
  When the frontend blocks on an inode that is in the syncq, the inode
  will be reordered to the front of the queue to reduce the frontend
  stall time as much as possible.

* Remove the COPYQ transaction flag and related sequencing.

* Fix flush sequencing for pmp->iroot.  We must flush iroot's chains with
  HAMMER2_XOP_FSSYNC last.  When iroot is dirty, the out-of-order flush
  of iroot that occurs before the final stage must be run without FSSYNC
  set, otherwise iroot's pmp->pfs_iroot_blocksets[] will not be consistent
  because the remaining inodes in the syncq haven't been flushed yet.

* Fix a broken syncer speedup conditional.

21 months agohammer2 - refactor filesystem sync 5/N
Matthew Dillon [Sat, 1 Dec 2018 21:57:35 +0000 (13:57 -0800)]
hammer2 - refactor filesystem sync 5/N

* Dependency ops need one atomic wrapper.  Adjust the use of
  pmp->list_spin for the atomic wrapper.

* Reorder hammer2_inode_depend() call from after hammer2_igetv()
  to before it.  This is because hammer2_igetv() can temporarily
  release the inode lock and the dependency code assumes that does
  not happen.

* Cleanup

* This code is still not 100% because earlier dependency pairs
  that wind up on the sideq can be split if an overlapping dependency
  occurs later that flags PASS2.

21 months agohammer2 - Add 'snapshot-debug' directive
Matthew Dillon [Fri, 16 Nov 2018 06:32:56 +0000 (22:32 -0800)]
hammer2 - Add 'snapshot-debug' directive

* Add the 'snapshot-debug' directive which takes a snapshot without
  first sync'ing the filesystem.  The idea is that the snapshot will
  be taken relative to the most recent filesystem sync (automatic or
  manual), and should still represent a fully consistent filesystem.

21 months agohammer2 - refactor filesystem sync 4/N
Matthew Dillon [Tue, 13 Nov 2018 21:32:33 +0000 (13:32 -0800)]
hammer2 - refactor filesystem sync 4/N

* Save synchronized iroot blockmaps for snapshot code, and use them
  in the snapshot code.

* Improve dependency handling and syncq/sideq flagging for
  dependencies.  Also improve the hammer2_inode_t reordering
  code that allows the frontend to continue operating on dirty
  inodes simultaneous with a filesystem sync.

* Move inode deletion into the filesystem sync code (in addition to
  creation), for the same reason.

* Fix lost ref counts in the snapshot code which were causing umount

* Stabilization pass on volume flush code.  Since flushes stop at
  inode boundaries, we must properly flush the superroot before
  flushing the volume header.  That is, the flush sequence is:

  - flush inodes for PFS  (flushes inode content)
  - flush PFS root inode  (flushes through to inodes)
  - flush superroot inode (flushes through to PFS root)
  - flush volume header   (flushes voulume header to superroot)

  Theoretically this allows the filesystem asynchronously write data
  and inodes flushed by the kernel's buffer cache and vnode code
  concurrent with a filesystem flush without messing up filesystem
  consistency, because these asynchronously flushed inodes are not
  included (or have already been flushed) in the filesystem flush that
  is already underway.

* Filesystem consistency still not perfect (using snapshot-debug
  directive to test during heavy filesystem modification loads,
  directory entries are sometimes desynchronized from their inodes).

21 months agohammer2 - refactor filesystem sync 3/N
Matthew Dillon [Sat, 10 Nov 2018 02:05:14 +0000 (18:05 -0800)]
hammer2 - refactor filesystem sync 3/N

* Attempt to guarantee filesystem consistency at all sync points.

* Pretty severely hacked, and at the moment this can result in
  syncs which never end if the filesystem is busy.

21 months agohammer2 - refactor filesystem sync 2/N
Matthew Dillon [Fri, 9 Nov 2018 01:10:07 +0000 (17:10 -0800)]
hammer2 - refactor filesystem sync 2/N

* Flesh out the flush partitioning code, fixing a number of issues.

* Refactor hammer2_inode_lock() and add hammer2_inode_lock4() to
  interlock against flushes.  This is handled by blocking inode locks
  against SYNCQ, and reordering the inode to the front of the SYNCQ list
  in order to unblock as quickly as possible as the filesystem sync
  progresses.  The result should be relatively few frontend stalls
  during a filesystem sync.

* Disable resource caps for the moment, because synchronous
  operations to prevent resource limits from blowing out break
  the current inode_lock*() code and allow vnode deadlocks to

* To avoid deadlocks, the filesystem sync currently must clear SYNCQ
  before locking the inode & vnode, and if it cannot lock a vnode it
  must continue on with the next inode and then restart.  Retried
  vnodes introduce a short delay to give the frontend time to work
  the blocking operation.

  This is necessary because the kernel locks vnodes before entering the
  H2 frontend, and we cannot safely unlock/relock them to work around
  this.  Nor do we necessarily even have full knowledge on which vnodes
  the current thread has locked.

* Does not yet guarantee complete filesystem consistency on-crash.

21 months agohammer2 - refactor filesystem sync 1/N
Matthew Dillon [Mon, 5 Nov 2018 01:31:07 +0000 (17:31 -0800)]
hammer2 - refactor filesystem sync 1/N

* Change H2 to allow concurrent filesystem sync and modifying
  frontend operations.

* FLUSH transactions no longer block modifying frontend

* Change filesystem sync operation to put all modified
  inodes on the pmp->syncq (which is also combined with
  any inodes on pmp->sideq), and then iterating the
  syncq to flush each inode.

  After this is done, stage 2 will flush the meta-data tree
  leading to each inode.

  This code will also handle delayed inode creation and
  destruction ops, which require modifications to the meta-data
  tree governing the inodes themselves (so we don't want the
  frontend to do it and interfere with the flush).

* Modifying operations against inodes already queued for a
  filesystem sync that is in progress will now reorder the
  inode to the front of the filesystem sync in progress and
  wait for the sync on that inode to complete before proceeding.

  This is handled by blocking in the exclusive inode lock code.

* hammer2_inode_get() does not need to pass 'dip' any more
  because regular inodes are inserted under the iroot (PFS root
  inode) and no longer inserted hierarchically.

* Separate out hammer2_inode_create() into hammer2_inode_create_pfs()
  and hammer2_inode_create_normal().  These two forms are now distinct
  enough that the code is a mess if we try to leave them combined.

21 months agodrm/i915: Add Kaby Lake and Amber Lake PCI IDs
François Tigeot [Tue, 4 Dec 2018 21:54:39 +0000 (22:54 +0100)]
drm/i915: Add Kaby Lake and Amber Lake PCI IDs

Obtained-from: Linux 4.19

21 months agodrm/i915: Add Whiskey Lake PCI IDs
François Tigeot [Tue, 4 Dec 2018 21:27:20 +0000 (22:27 +0100)]
drm/i915: Add Whiskey Lake PCI IDs

Obtained-from: Linux 4.19

21 months agodrm/i915: Add more Coffeelake PCI IDs
François Tigeot [Tue, 4 Dec 2018 20:57:46 +0000 (21:57 +0100)]
drm/i915: Add more Coffeelake PCI IDs

Obtained-from: Linux 4.19

21 months agoRevert "drm/ttm: Remove ttm_bo_unreserve_core()"
François Tigeot [Sat, 24 Nov 2018 13:12:34 +0000 (14:12 +0100)]
Revert "drm/ttm: Remove ttm_bo_unreserve_core()"

This reverts commit 5d4803440754b62fed1abd6d641d1f7a6f7b454e.

The drm/radeon driver has a tendency to lock up more frequently
without ttm_bo_unreserve_core().

Reported-by: Michael Neumann <mneumann@ntecs.de>
21 months agousb.4: Clean up a bit.
Sascha Wildner [Sun, 2 Dec 2018 12:32:35 +0000 (13:32 +0100)]
usb.4: Clean up a bit.

21 months agohier.7: Use .Xr
Sascha Wildner [Sun, 2 Dec 2018 03:24:54 +0000 (04:24 +0100)]
hier.7: Use .Xr

21 months agohier.7: Document some recently added directories.
Sascha Wildner [Sun, 2 Dec 2018 03:06:25 +0000 (04:06 +0100)]
hier.7: Document some recently added directories.

21 months agoRemove an unused include file.
Sascha Wildner [Sun, 2 Dec 2018 02:13:39 +0000 (03:13 +0100)]
Remove an unused include file.

21 months agolibc/locale: Mark up defined values better in the manual pages.
Sascha Wildner [Sat, 1 Dec 2018 20:15:32 +0000 (21:15 +0100)]
libc/locale: Mark up defined values better in the manual pages.

21 months agoInstall input{,-event-types}.h to /usr/include/compat/linux too.
Sascha Wildner [Fri, 30 Nov 2018 20:13:02 +0000 (21:13 +0100)]
Install input{,-event-types}.h to /usr/include/compat/linux too.

It helps preventing excessive patches in ravenport's weston.

It is kind of experimental, but depending on how useful it
proves to be for 3rd party software all in all, we will
eventually remove /usr/include/dev/misc/evdev in the future.

A -I /usr/include/compat is needed to get at these headers using
"#include <linux/input.h>", etc. They were not put in the default
include path to mislead configure scripts and the likes.

We will also evaluate if it is worth exposing further linux
specific headers in this directory.

It might even be that we change the new location again in the

Requested-by: Peeter Must
21 months agokernel: Move some old unused stuff out of the way.
Sascha Wildner [Fri, 30 Nov 2018 16:13:37 +0000 (17:13 +0100)]
kernel: Move some old unused stuff out of the way.

21 months agokernel - Cleanup blist debug code (2)
Matthew Dillon [Thu, 29 Nov 2018 08:17:57 +0000 (00:17 -0800)]
kernel - Cleanup blist debug code (2)

* Conditionalize debugging kprintf() for non-kernel test
  code only.

21 months agokernel - Fix nstopped SMP race during core dump
Matthew Dillon [Thu, 29 Nov 2018 06:56:24 +0000 (22:56 -0800)]
kernel - Fix nstopped SMP race during core dump

* During a process core dump, p->p_nstopped can be adjusted without
  holding p->p_token, resulting in a SMP race which can cause
  p_nstopped to become permanently desynchronized and deadlock the

* Be robust in a p_nstopped handling case in kern_exit, just in case.

21 months agokernel - Cleanup blist debug code
Matthew Dillon [Tue, 27 Nov 2018 01:39:56 +0000 (17:39 -0800)]
kernel - Cleanup blist debug code

* Allow 64-bit fields to be specified in the debug code.  Does not
  affect the kernel.

* Correct two next_skip calculations that were casting to 32 bits.
  These are block numbers and can affect operations when > 2TB of
  swap is configured.

21 months agodrm includes: Rename uapi_xxx to uapi/xxx
François Tigeot [Wed, 28 Nov 2018 20:16:37 +0000 (21:16 +0100)]
drm includes: Rename uapi_xxx to uapi/xxx

Making the include hierarchy 100% compatible with the Linux one.

21 months agonetwork.subr: Handle DHCP in ipv6_ifconfig_<ifname>
Aaron LI [Wed, 28 Nov 2018 04:50:44 +0000 (12:50 +0800)]
network.subr: Handle DHCP in ipv6_ifconfig_<ifname>

Commit 329743def50a061489debcd9682983235c8f5b42 allows to set
'ipv6_ifconfig_<ifname>="DHCP"' to tell dhcpcd(8) to configure DHCPv6
for interface <ifname>.  However, the "DHCP" argument shouldn't be
passed to ifconfig(8).  Handle this case by using 'ifconfig_getargs()'
in 'network6_interface_setup()'.

21 months ago<sys/errno.h>: Remove EUNUSED*.
Levente Kurusa [Tue, 27 Nov 2018 10:48:45 +0000 (11:48 +0100)]
<sys/errno.h>: Remove EUNUSED*.

These values are not used (as their name suggests) and there is no
reason for an application to ever see or use them. This has recently
caused some confusion in the Rust ecosystem, and it looks like a
comment would better serve the intended purpose than making these
values available.

Signed-off-by: Levente Kurusa <lkurusa@acm.org>
21 months agoinitrd: Explicitly say the status when build completes
Aaron LI [Mon, 26 Nov 2018 07:29:56 +0000 (15:29 +0800)]
initrd: Explicitly say the status when build completes

Before this change, the 'all' target that builds the rescue and initrd
will end with a '--- obj ---' line, which may cause an illusion that the
build hasn't finished.  Now, explicitly say that the build has finished.

Suggested-by: swildner
21 months agoPut note about DSA OpenSSH key deprecation, from 5 versions ago, into UPDATING.
Justin C. Sherrill [Mon, 26 Nov 2018 02:45:51 +0000 (21:45 -0500)]
Put note about DSA OpenSSH key deprecation, from 5 versions ago, into UPDATING.
This probably affects nobody at this point, but now I can feel better about
removing it from release notes where it keeps getting reprinted.

21 months agoscript.1: Fix a typo, bump date.
Sascha Wildner [Sun, 25 Nov 2018 17:40:14 +0000 (18:40 +0100)]
script.1: Fix a typo, bump date.

21 months agodrm/ttm: Sync ttm_page_alloc.c with Linux
François Tigeot [Sun, 25 Nov 2018 15:54:27 +0000 (16:54 +0100)]
drm/ttm: Sync ttm_page_alloc.c with Linux

21 months agodrm/linux: Add set_pages_array_xx() functions
François Tigeot [Sun, 25 Nov 2018 15:28:33 +0000 (16:28 +0100)]
drm/linux: Add set_pages_array_xx() functions

21 months agoscript(1): Sync with FreeBSD
Antonio Huete Jimenez [Sun, 25 Nov 2018 11:05:59 +0000 (12:05 +0100)]
script(1): Sync with FreeBSD

- Add -p flag which is used to replay typescripts.
- Add -d flag to avoid sleeps in playbacks.
- Add -F flag which allows recording/playing through pipes.
- Add -r flag to optionally record all.
- A bunch of fixes, mostly.

Note: -f flag from FreeBSD is not available since DragonFly BSD does not
      have filemon(4)

21 months agoMakefile.inc1: Some minor cleanups
Aaron LI [Sat, 24 Nov 2018 11:09:00 +0000 (19:09 +0800)]
Makefile.inc1: Some minor cleanups

No functional change.