dragonfly.git
4 years agoMerge branch 'vendor/DHCPCD'
Roy Marples [Mon, 13 Apr 2020 16:39:54 +0000 (16:39 +0000)]
Merge branch 'vendor/DHCPCD'

4 years agoupgrade: Update _dhcp home dir to /var/chroot/dhcp if empty
Roy Marples [Mon, 13 Apr 2020 16:38:03 +0000 (16:38 +0000)]
upgrade: Update _dhcp home dir to /var/chroot/dhcp if empty

4 years agopasswd: Give _dhcp a homedirectory of /var/chroot/dhcp
Roy Marples [Mon, 13 Apr 2020 16:35:45 +0000 (16:35 +0000)]
passwd: Give _dhcp a homedirectory of /var/chroot/dhcp

4 years agoUpdate to dhcpcd-9.0.1 with the following changes:
Roy Marples [Mon, 13 Apr 2020 16:30:52 +0000 (16:30 +0000)]
Update to dhcpcd-9.0.1 with the following changes:

* privsep: Improve error when we don't have permission to write lease
* privsep: Fix hooks restarting other daemons

4 years agokernel: GC a few old system calls which are libc functions in DragonFly.
Sascha Wildner [Mon, 13 Apr 2020 10:22:31 +0000 (12:22 +0200)]
kernel: GC a few old system calls which are libc functions in DragonFly.

Namely, getdomainname, setdomainname, and uname, all of which were
deprecated in early FreeBSD but never really phased out. They were
likely never used (as system calls) in DragonFly at all.

For more information on the FreeBSD history, see FreeBSD's r184789.

4 years agoifconfig(8): Do not wrongly use 'create' as hostname
Aaron LI [Sun, 12 Apr 2020 14:12:14 +0000 (22:12 +0800)]
ifconfig(8): Do not wrongly use 'create' as hostname

Do not allow to use the 'create' keyword as a hostname when ifconfig(8)
is invoked for an already existing interface.

Without this commit, ifconfig(8) assumes the 'create' keyword as a
hostname and tries to resolve it when 'ifconfig ifname create' invoked
for an already existing interface.  This can produce some misleading
error messages (e.g., 'create: bad value') or even unexpected results
(e.g., when the hostname resolving succeeds).

With this commit, when an interface is already exists and the 'create'
is the only argument, return an error message.  But when there are some
other arguments, just ignore the 'create' keyword and carry on.

Obtained from FreeBSD:
https://github.com/freebsd/freebsd/commit/e383c28ab5b8d0bdc15281e7522c368d56ac1a76
https://reviews.freebsd.org/D17171

4 years agokernel/sysmouse: Add evdev support
Peeter Must [Sun, 12 Apr 2020 10:07:01 +0000 (13:07 +0300)]
kernel/sysmouse: Add evdev support

Obtained-from: FreeBSD

4 years agodrm/linux: Add put_page()
François Tigeot [Fri, 10 Apr 2020 12:38:08 +0000 (14:38 +0200)]
drm/linux: Add put_page()

4 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Wed, 8 Apr 2020 16:38:15 +0000 (18:38 +0200)]
bsd-family-tree: Sync with FreeBSD.

4 years agocpdup(1): Move version and authors info to cpdup.h and bump version
Aaron LI [Sun, 5 Apr 2020 00:54:16 +0000 (08:54 +0800)]
cpdup(1): Move version and authors info to cpdup.h and bump version

Bump the tool version from 1.20 to 1.21 due to the recent microsecond
timestamp precision support and protocol version bump.

4 years agocpdup(1): Use POSIX-defined timespec fields to be more portable
Aaron LI [Sun, 5 Apr 2020 00:51:56 +0000 (08:51 +0800)]
cpdup(1): Use POSIX-defined timespec fields to be more portable

While we defines 'st_atimespec', 'st_mtimespec' and 'st_ctimespec'
macros in 'struct stat', they are not defined on Linux and maybe other
platforms or C libraries.  Change to check the definitions of
'st_atime', 'st_mtime' and 'st_ctime' macros to check whether we're on a
modern POSIX (>= 2008) platform.

See also: https://github.com/DragonFlyBSD/cpdup/commit/7a715bd5cc6853c3973ce84a5df3c779e47082d1
Credit: https://github.com/ninja-build/ninja/pull/1513

4 years agostat.2: Fix minor identation issue
Aaron LI [Sat, 4 Apr 2020 04:59:10 +0000 (12:59 +0800)]
stat.2: Fix minor identation issue

4 years agoImport dhcpcd-9.0.0 with the following changes:
Roy Marples [Thu, 2 Apr 2020 15:14:14 +0000 (15:14 +0000)]
Import dhcpcd-9.0.0 with the following changes:

 * inet: Allow forcing a host route from an interface without a lease
 * dhcpcd: Don't wait for an address family to complete if not using it

 * INET6: Support a /128 prefix advertised via RA
 * BSD: More address validation from route(4) messages
 * DHCP: Fix a potential segfault on DaD failure
 * IPv4LL: Fix a potential segfault when dropping IPv4LL addresses

 * Decode interface complex interface names eth0.100:2 eth0i100:2.
   This allows us to ignore some virtual interfaces by default
 * ARP: Report L2 header address on conflict for more clarity
 * DHCP: Support jumbo frames (untested)
 * DHCP6: Clean up old lease on failure to confirm/rebind, etc
 * RA: Prefer older routers
 * INET6: Obscure prefixes are now calculated correctly

 * Privilege Separation
 * Default hostname is now a blank string
 * Leases are now dumped over the control socket - you get RA's now as well.
 * Better support for many IPv6 routers
 * RA: Deprecate stale addresses by setting pltime 0
 * DHCP6: Deprecate stale addresses by setting pltime 0

4 years agocsh(1): Local changes for the tcsh upgrade.
Sascha Wildner [Wed, 1 Apr 2020 18:55:58 +0000 (20:55 +0200)]
csh(1): Local changes for the tcsh upgrade.

4 years agoMerge branch 'vendor/TCSH'
Sascha Wildner [Wed, 1 Apr 2020 18:55:08 +0000 (20:55 +0200)]
Merge branch 'vendor/TCSH'

4 years agoVendor branch: upgrade tcsh from 6.19.00 to 6.22.02
Sascha Wildner [Wed, 1 Apr 2020 18:53:41 +0000 (20:53 +0200)]
Vendor branch: upgrade tcsh from 6.19.00 to 6.22.02

4 years agosbin/newfs_msdos: Fix a couple of minor issues with newfs_msdos
Tomohiro Kusumi [Mon, 30 Mar 2020 13:52:54 +0000 (22:52 +0900)]
sbin/newfs_msdos: Fix a couple of minor issues with newfs_msdos

- Do not unnecessarily strdup().
- Check return value of getdiskinfo(), if it failed, bail out.

from freebsd/freebsd@c5c4e23aeb0ac6661e653d907d7826d9ed819934

4 years agosbin/newfs_msdos: Explicitly exit() instead of return in main()
Tomohiro Kusumi [Mon, 30 Mar 2020 13:49:40 +0000 (22:49 +0900)]
sbin/newfs_msdos: Explicitly exit() instead of return in main()

from freebsd/freebsd@7a057d0def567bc80b1ba4101d3823d92cbc979c

4 years agosbin/newfs_msdos: -A is incompatible with -r, not -o
Tomohiro Kusumi [Mon, 30 Mar 2020 13:48:13 +0000 (22:48 +0900)]
sbin/newfs_msdos: -A is incompatible with -r, not -o

from freebsd/freebsd@3da676c080ccd8fbe8aed89aa717642b50fbd9f3

4 years agolt(1): Use 'find -s' instead of 'find | sort'.
Sascha Wildner [Sun, 29 Mar 2020 08:18:45 +0000 (10:18 +0200)]
lt(1): Use 'find -s' instead of 'find | sort'.

This diff of the old behavior vs. new shows the issue:

--- /tmp/t1 2020-03-29 10:09:50.009490000 +0200
+++ /tmp/t2 2020-03-29 10:10:09.909695000 +0200
@@ -48,12 +48,12 @@
     |   |-- SimpleTextOut.h
     |   `-- UgaDraw.h
     |-- Uefi
-    |-- Uefi.h
     |   |-- UefiBaseType.h
     |   |-- UefiGpt.h
     |   |-- UefiInternalFormRepresentation.h
     |   |-- UefiMultiPhase.h
     |   |-- UefiPxe.h
     |   `-- UefiSpec.h
+    |-- Uefi.h
     `-- X64
         `-- ProcessorBind.h

With 'find | sort', lt(1) would incorrectly show the contents of the
'Uefi' directory below the 'Uefi.h' file.

With 'find -s', the 'Uefi.h' file is correctly sorted below 'Uefi'
and its contents.

4 years agokernel: Remove <sys/n{amei,lookup}.h> from all files that don't need it.
Sascha Wildner [Sat, 28 Mar 2020 15:12:56 +0000 (16:12 +0100)]
kernel: Remove <sys/n{amei,lookup}.h> from all files that don't need it.

4 years agokernel/dm: Include <sys/proc.h> for proc0.
Sascha Wildner [Sat, 28 Mar 2020 14:48:55 +0000 (15:48 +0100)]
kernel/dm: Include <sys/proc.h> for proc0.

4 years agoRemove references to math(3) in various manual pages.
Sascha Wildner [Sat, 28 Mar 2020 13:42:45 +0000 (14:42 +0100)]
Remove references to math(3) in various manual pages.

We no longer have a math(3) manual page.

4 years agokernel: Remove <sys/mutex.h> from all files that don't need it (2/2).
Sascha Wildner [Sat, 28 Mar 2020 13:00:49 +0000 (14:00 +0100)]
kernel: Remove <sys/mutex.h> from all files that don't need it (2/2).

98% of these were remains from porting from FreeBSD which could have
been removed after converting to lockmgr(), etc.

Due to an issue in my checking earlier, not everything was cleaned up
correctly.

4 years agokernel: Remove <sys/mutex.h> from all files that don't need it.
Sascha Wildner [Sat, 28 Mar 2020 12:37:38 +0000 (13:37 +0100)]
kernel: Remove <sys/mutex.h> from all files that don't need it.

98% of these were remains from porting from FreeBSD which could have
been removed after converting to lockmgr(), etc.

While here, do the same for <sys/mutex2.h>.

4 years agokernel/iscsi: Include <sys/mutex2.h> in iscsivar.h.
Sascha Wildner [Sat, 28 Mar 2020 01:55:13 +0000 (02:55 +0100)]
kernel/iscsi: Include <sys/mutex2.h> in iscsivar.h.

It uses struct mtx in a struct.

4 years agokernel: Remove <sys/mplock2.h> from all files that do not need it.
Sascha Wildner [Sat, 28 Mar 2020 01:12:03 +0000 (02:12 +0100)]
kernel: Remove <sys/mplock2.h> from all files that do not need it.

4 years ago<sys/mount.h>: Include <sys/mplock2.h> for self sufficiency.
Sascha Wildner [Sat, 28 Mar 2020 01:07:47 +0000 (02:07 +0100)]
<sys/mount.h>: Include <sys/mplock2.h> for self sufficiency.

It uses get_mplock() etc. in some macros it defines, so it should bring
in <sys/mplock2.h> by itself.

4 years agoSync ACPICA with Intel's version 20200326.
Sascha Wildner [Fri, 27 Mar 2020 22:06:32 +0000 (23:06 +0100)]
Sync ACPICA with Intel's version 20200326.

* Code cleanup for early GCC 10.

* Various fixes and improvements in acpiexec, acpixtract and iasl.

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

4 years agoefivar.3: Fix typo.
Sascha Wildner [Wed, 25 Mar 2020 15:10:56 +0000 (16:10 +0100)]
efivar.3: Fix typo.

4 years agoboot/efi: Sync our TianoCore EDK II headers with the edk2-stable202002 tag.
Sascha Wildner [Wed, 25 Mar 2020 05:23:51 +0000 (06:23 +0100)]
boot/efi: Sync our TianoCore EDK II headers with the edk2-stable202002 tag.

Nothing of relevance to us.

4 years agossh-copy-id(1): Fix a printf(1) missing format character warning.
Sascha Wildner [Tue, 24 Mar 2020 15:52:43 +0000 (16:52 +0100)]
ssh-copy-id(1): Fix a printf(1) missing format character warning.

Reported-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com>
4 years agoHook ssh-copy-id into the build and adjust README.DELETED.
Sascha Wildner [Tue, 24 Mar 2020 15:24:01 +0000 (16:24 +0100)]
Hook ssh-copy-id into the build and adjust README.DELETED.

4 years agoMerge branch 'vendor/OPENSSH'
Sascha Wildner [Tue, 24 Mar 2020 15:14:57 +0000 (16:14 +0100)]
Merge branch 'vendor/OPENSSH'

4 years agoImport OpenSSH-8.0p1's ssh-copy-id and manual page on the vendor branch.
Sascha Wildner [Tue, 24 Mar 2020 15:14:20 +0000 (16:14 +0100)]
Import OpenSSH-8.0p1's ssh-copy-id and manual page on the vendor branch.

4 years agoconfig(8): Replace the old "= {" syntax in config.y with just "{".
Sascha Wildner [Mon, 23 Mar 2020 16:17:27 +0000 (17:17 +0100)]
config(8): Replace the old "= {" syntax in config.y with just "{".

According to FreeBSD it was only for compatibility with
6th edition Unix' yacc(1).

4 years agoAdjust iwm.4/iwmfw.4/fstab.5 a bit.
Sascha Wildner [Fri, 20 Mar 2020 14:48:16 +0000 (15:48 +0100)]
Adjust iwm.4/iwmfw.4/fstab.5 a bit.

* iwm.4/iwmfw.4: Mention new devices and firmware.

Reported-by: noob237 (IRC)
* fstab.5: Mention HAMMER2.

Reported-by: daftaupe (IRC)
4 years agosys/vfs/autofs: Make autofs(5) timeout messages include affected process name and PID
Tomohiro Kusumi [Fri, 20 Mar 2020 14:39:06 +0000 (23:39 +0900)]
sys/vfs/autofs: Make autofs(5) timeout messages include affected process name and PID

from freebsd/freebsd@4a10e991b50fa9c8e0ec6af5f8cc81aa63d0e1f3

4 years agodsynth - Fix bug in dequote()
Matthew Dillon [Thu, 19 Mar 2020 00:29:08 +0000 (17:29 -0700)]
dsynth - Fix bug in dequote()

* Fix bug, the buffer was declared on the stack instead of as a
  static.

* Repurpose the static buffer to be a buffer pointer instead,
  removing the 256 char limit.  The limit was messing up the
  :|: delimeter.

4 years agokernel - Generate POLLHUP for fully disconnected socket
Matthew Dillon [Wed, 18 Mar 2020 23:35:39 +0000 (16:35 -0700)]
kernel - Generate POLLHUP for fully disconnected socket

* Properly generate POLLHUP for fully disconnected sockets.

  However, there is still a possible issue.  We do not set POLLHUP
  for half-closed sockets and it is really unclear whether we should
  or not once read data has been exhausted.

4 years agodsynth - Fix escaping, skipped count
Matthew Dillon [Wed, 18 Mar 2020 18:04:58 +0000 (11:04 -0700)]
dsynth - Fix escaping, skipped count

* Fix backslashes in info fields that were causing json to implode.

* Remove parens around (%d) skipped count reporting so the field
  can be sorted.

Reported-by: tuxillo
4 years agodrm/i915: Revert Clean up DDI DDC/AUX CH sanitation
François Tigeot [Wed, 18 Mar 2020 14:06:02 +0000 (15:06 +0100)]
drm/i915: Revert Clean up DDI DDC/AUX CH sanitation

* This reverts Linux commit 0ce140d45a8398b501934ac289aef0eb7f47c596

* It caused phantom screens to be detected on some Skylake machines

Reported-by: Peeter Must
4 years agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 17 Mar 2020 14:24:15 +0000 (15:24 +0100)]
Update the pciconf(8) database.

March 7, 2020 snapshot from https://pci-ids.ucw.cz

4 years agokernel - Fix rare vm_map_entry exhaustion panic (2)
Matthew Dillon [Mon, 16 Mar 2020 18:39:40 +0000 (11:39 -0700)]
kernel - Fix rare vm_map_entry exhaustion panic (2)

* Increase per-cpu fast-cache hysteresis from its absurdly small
  value to a significantly larger value.

* Missing header file update for prior commit

4 years agokernel - Fix rare vm_map_entry exhaustion panic
Matthew Dillon [Mon, 16 Mar 2020 18:24:52 +0000 (11:24 -0700)]
kernel - Fix rare vm_map_entry exhaustion panic

* Fix a rare situation where many processes blocked in zget() on
  the same CPU can cause the kernel's per-cpu vm_map_entry entry
  to be exhusted, causing a panic.

  The situation arises because the zget() operation can wake other
  threads up via the deeper vm_map lock after burning vm_map_entry's
  to expand the space but prior to adding the new structural objects
  to the vm_zone.

* Caused a leaf.dragonflybsd.org panic on concurrent git fork/exec's
  via the web server.

4 years ago<sys/conf.h>: Remove some more dead prototypes.
Sascha Wildner [Sat, 14 Mar 2020 18:15:48 +0000 (19:15 +0100)]
<sys/conf.h>: Remove some more dead prototypes.

4 years agokernel: Remove some get_dev() remains. We no longer have this function.
Sascha Wildner [Sat, 14 Mar 2020 18:14:36 +0000 (19:14 +0100)]
kernel: Remove some get_dev() remains. We no longer have this function.

4 years agokernel: Adjust description for kern.tls_extra
zrj [Sat, 14 Mar 2020 09:20:30 +0000 (11:20 +0200)]
kernel: Adjust description for kern.tls_extra

4 years agokernel: Add handling for R_X86_64_PLT32 (type 4) in kernel linker.
zrj [Thu, 13 Feb 2020 12:07:37 +0000 (14:07 +0200)]
kernel: Add handling for R_X86_64_PLT32 (type 4) in kernel linker.

 Newer binutils can emit R_X86_64_PLT32 for -shared compilations.

Tested-with: binutils234

4 years agokernel/kprintf: Add a tunable for the kern.kprintf_logging sysctl.
Sascha Wildner [Fri, 13 Mar 2020 20:42:59 +0000 (21:42 +0100)]
kernel/kprintf: Add a tunable for the kern.kprintf_logging sysctl.

While here, add one too for security.unprivileged_read_msgbuf and
document the tunables affecting kprintf(9).

4 years agodrm/i915: Update DRIVER_DATE to 20161024
François Tigeot [Thu, 12 Mar 2020 06:16:53 +0000 (07:16 +0100)]
drm/i915: Update DRIVER_DATE to 20161024

4 years agokernel - Rework vfs_timestamp(), adjust default
Matthew Dillon [Wed, 11 Mar 2020 18:57:57 +0000 (11:57 -0700)]
kernel - Rework vfs_timestamp(), adjust default

* Rework the vfs_timestamp() precision mode as follows:

  0 TSP_SEC seconds granularity
  1 TSP_HZ ticks granularity
  2 TSP_USEC ticks granularity modulo microseconds
  3 TSP_NSEC ticks granularity modulo nanoseconds
  4 TSP_USEC_PRECISE precise microseconds (expensive)
  5 TSP_NSEC_PRECISE precise nanoseconds (expensive)

  The default is TSP_USEC (with tick granularity)

* Change numerous bits of code that were calling getmicrotime()
  or calling microtime()/nanotime() explicitly instead of calling
  vfs_timstamp().  procfs and devfs in particular.

Reported-by: mjg
4 years agokernel - Do not use rdtsc() in the spinlock loop when virtualized
Matthew Dillon [Wed, 11 Mar 2020 18:55:57 +0000 (11:55 -0700)]
kernel - Do not use rdtsc() in the spinlock loop when virtualized

* When running as a guest, do not use rdtsc() in the spinlock loop
  as numerous HVM subsystems will trap-out on the instruction.

Reported-by: mjg
4 years agokernel - Allow 8254 timer to be forced, clean-up user/sys/intr/idle
Matthew Dillon [Wed, 11 Mar 2020 18:50:36 +0000 (11:50 -0700)]
kernel - Allow 8254 timer to be forced, clean-up user/sys/intr/idle

* Allows the 8254 timer to be forced on for machines which do not
  support the LAPIC timer during deep-sleep.  Fix an assertion that
  occurs in this situation.

  hw.i8254.intr_disable="0"

* Adjust the statclock to calculate user/sys/intr/idle time
  properly when the clock interrupt occurs from an interrupt
  thread instead of from a hard interrupt.

  Basically when the clock interrupt occurs from an interrupt thread,
  we have to look at curthread->td_preempted instead of curthread.

  In addition RQF_INTPEND will be set across the call due to the way
  processing works and we have to look at the bitmask of interrupt
  sources instead of this bit.

Reported-by: CuteLarva
4 years agoBSD.include.dist: Fix indentation (we use spaces in these files).
Sascha Wildner [Wed, 11 Mar 2020 15:13:49 +0000 (16:13 +0100)]
BSD.include.dist: Fix indentation (we use spaces in these files).

4 years agoworld: Install Linux headers required by Mesa >= 19.3
François Tigeot [Wed, 11 Mar 2020 11:19:45 +0000 (12:19 +0100)]
world: Install Linux headers required by Mesa >= 19.3

Avoiding many patches in dports

4 years agolinux/types.h: Fix compilation with userland C++ programs
François Tigeot [Wed, 11 Mar 2020 11:15:31 +0000 (12:15 +0100)]
linux/types.h: Fix compilation with userland C++ programs

Such as newer Mesa versions

4 years agodrm/linux: Rewrite the tasklet implementation
François Tigeot [Mon, 9 Mar 2020 22:28:12 +0000 (23:28 +0100)]
drm/linux: Rewrite the tasklet implementation

Newer drm/i915 driver versions expect tasklets to run in dedicated
threads and no longer work with synchronous calls.

Thanks to Matthew Dillon for advice on locking issues and how best
to resolve mp races.

4 years agodrm/linux: Add put_pid()
François Tigeot [Sun, 8 Mar 2020 21:12:42 +0000 (22:12 +0100)]
drm/linux: Add put_pid()

4 years agolibkvm: No need to include <sys/proc.h> when <sys/user.h> is included.
Sascha Wildner [Sun, 8 Mar 2020 14:19:35 +0000 (15:19 +0100)]
libkvm: No need to include <sys/proc.h> when <sys/user.h> is included.

4 years agokernel: Include <sys/lock.h> instead of <sys/mutex.h> in linux/kfifo.h.
Sascha Wildner [Sun, 8 Mar 2020 13:34:21 +0000 (14:34 +0100)]
kernel: Include <sys/lock.h> instead of <sys/mutex.h> in linux/kfifo.h.

This should have been changed in 45aa70c6e8cc2435e82aabd4d0d233948c7cb105.

4 years agokernel: Add missing newlines at the end of two files.
Sascha Wildner [Sun, 8 Mar 2020 13:18:39 +0000 (14:18 +0100)]
kernel: Add missing newlines at the end of two files.

4 years agoRevert "Remove unneeded *_if.c from SRCS in kernel module Makefiles that have it."
Sascha Wildner [Sun, 8 Mar 2020 07:18:25 +0000 (08:18 +0100)]
Revert "Remove unneeded *_if.c from SRCS in kernel module Makefiles that have it."

This reverts commit 99bd8089615e30757d8327c0a5afe0b8fe69d337.

Oops, this seems to have broken a few things after all. I'll investigate better.

Reported-by: Peeter Must
4 years agoRemove unneeded *_if.c from SRCS in kernel module Makefiles that have it.
Sascha Wildner [Sun, 8 Mar 2020 05:48:48 +0000 (06:48 +0100)]
Remove unneeded *_if.c from SRCS in kernel module Makefiles that have it.

Those are always compiled into the kernel, per NORMAL_M in kern.pre.mk,
so they don't need to be in a module's SRCS. This removes the few cases
where they were added by mistake.

4 years agodrm/linux: Add disable_irq() and enable_irq()
François Tigeot [Sat, 7 Mar 2020 18:28:17 +0000 (19:28 +0100)]
drm/linux: Add disable_irq() and enable_irq()

4 years agodrm/linux: Add atomic_fetch_xor()
François Tigeot [Sat, 7 Mar 2020 18:13:58 +0000 (19:13 +0100)]
drm/linux: Add atomic_fetch_xor()

4 years agodrm/linux: Add io_mapping_init_wc() and _fini()
François Tigeot [Sat, 7 Mar 2020 18:09:24 +0000 (19:09 +0100)]
drm/linux: Add io_mapping_init_wc() and _fini()

4 years agortld - Use kern.tls_extra
Matthew Dillon [Sat, 7 Mar 2020 17:41:28 +0000 (09:41 -0800)]
rtld - Use kern.tls_extra

* Use kern.tls_extra, if available, to calculate the extra tls
  space to allocate for late library loads.

* If not available, default to 6144 bytes instead of 1280 bytes
  to support greater use of static tls sections in late-loaded
  libraries (read: mesa 19.3).

Reported-by: ftigeot
4 years agokernel - Add sysctl kern.tls_extra
Matthew Dillon [Sat, 7 Mar 2020 17:39:03 +0000 (09:39 -0800)]
kernel - Add sysctl kern.tls_extra

* Add sysctl kern.tls_extra, defaulting to 6144, which rtld will query
  to get the amount of extra tls space to allocate to accomodate late
  library loads.

4 years agodrm/linux: Add wake_up_bit() and wait_on_bit_timeout()
François Tigeot [Fri, 6 Mar 2020 10:13:03 +0000 (11:13 +0100)]
drm/linux: Add wake_up_bit() and wait_on_bit_timeout()

4 years agodrm: Improve linux/timer.h
François Tigeot [Fri, 6 Mar 2020 10:12:39 +0000 (11:12 +0100)]
drm: Improve linux/timer.h

4 years agodrm/linux: Add list_for_each_entry_from()
François Tigeot [Fri, 6 Mar 2020 10:12:08 +0000 (11:12 +0100)]
drm/linux: Add list_for_each_entry_from()

Obtained-from: FreeBSD

4 years agodrm/linux: Add __add_wait_queue_tail()
François Tigeot [Fri, 6 Mar 2020 10:11:50 +0000 (11:11 +0100)]
drm/linux: Add __add_wait_queue_tail()

Obtained-from: FreeBSD

4 years agodrm/linux: Add atomic_set_release()
François Tigeot [Fri, 6 Mar 2020 10:08:55 +0000 (11:08 +0100)]
drm/linux: Add atomic_set_release()

Obtained-from: FreeBSD

4 years agokernel - Add minor VM shortcuts (2)
Matthew Dillon [Thu, 5 Mar 2020 18:40:54 +0000 (10:40 -0800)]
kernel - Add minor VM shortcuts (2)

* Fix bug last commit.  I was trying to shortcut the case where the
  vm_page was not flagged MAPPED or WRITEABLE, but didn't read my
  own code comment above the conditional and issued a vm_page_free()
  without first checking to see if the VM object could be locked.

  This lead to a livelock in the kernel under heavy loads.

* Rejigger the fix to do the shortcut in a slightly different
  place.

4 years agodrm/linux: Add oops_in_progress
François Tigeot [Thu, 5 Mar 2020 08:33:22 +0000 (09:33 +0100)]
drm/linux: Add oops_in_progress

4 years agodrm/linux: Add reboot_notifier functions
François Tigeot [Thu, 5 Mar 2020 08:32:59 +0000 (09:32 +0100)]
drm/linux: Add reboot_notifier functions

4 years agodrm/linux: Add the "noinline" compiler directive
François Tigeot [Thu, 5 Mar 2020 08:31:54 +0000 (09:31 +0100)]
drm/linux: Add the "noinline" compiler directive

4 years agodrm/linux: Add spin_lock_irqsave_nested()
François Tigeot [Thu, 5 Mar 2020 08:31:08 +0000 (09:31 +0100)]
drm/linux: Add spin_lock_irqsave_nested()

4 years agodrm/linux: Implement static_branch_xxx functions
François Tigeot [Thu, 5 Mar 2020 08:24:46 +0000 (09:24 +0100)]
drm/linux: Implement static_branch_xxx functions

4 years agodrm: Add a few linux/gfp.h constants and functions
François Tigeot [Thu, 5 Mar 2020 08:24:04 +0000 (09:24 +0100)]
drm: Add a few linux/gfp.h constants and functions

4 years agodrm/linux: Add the X86_FEATURE_XMM4_1 flag
François Tigeot [Thu, 5 Mar 2020 08:23:26 +0000 (09:23 +0100)]
drm/linux: Add the X86_FEATURE_XMM4_1 flag

4 years agotmpfs - Fix bug last commit
Matthew Dillon [Thu, 5 Mar 2020 01:21:41 +0000 (17:21 -0800)]
tmpfs - Fix bug last commit

* TMPFS_NODE_LOCK -> TMPFS_NODE_UNLOCK

Reported-by: Aaron LI
4 years agokernel - Minor pmap optimizations, minor swap_pager*() optimizations
Matthew Dillon [Wed, 4 Mar 2020 17:23:09 +0000 (09:23 -0800)]
kernel - Minor pmap optimizations, minor swap_pager*() optimizations

* Avoid the atomic_fcmpset_int() in pmap_enter() if the page already
  has the appropriate PG_* bits set.  Because the page is soft-busied,
  this check should not be able to race any clearing of the bits (which
  can only be done when the page is hard-busied).

* swap_pager_freespace*() no longer bothers to acquire the object
  token if the object's swblock_count is 0.

* Misc __read_* optimizations

* Misc __predict* optimizations

4 years agokernel - Add minor VM shortcuts
Matthew Dillon [Wed, 4 Mar 2020 17:17:47 +0000 (09:17 -0800)]
kernel - Add minor VM shortcuts

* Adjust vm_page_hash_elm heuristic to save the full pindex field
  instead of just the lower 32 bits.

* Refactor the hash table and hash lookup to index directly to the
  potential hit rather than masking to the SET size (~3).  This
  improves our chances of finding the requested page without having
  to iterate.

  The hash table is now N + SET sized and the SET iteration runs
  from the potential direct-hit point forwards.

* Minor __predict* code optimizations.

* Shortcut vm_page_alloc() when PG_MAPPED|PG_WRITEABLE are clear
  to avoid unnecessary code paths.

4 years agokernel - Minor optimizations
Matthew Dillon [Wed, 4 Mar 2020 17:16:09 +0000 (09:16 -0800)]
kernel - Minor optimizations

* Minor __predict and __read_mostly/frequently optimizations.

4 years agotmpfs - Fix minor deadlock, refactor tn_links
Matthew Dillon [Wed, 4 Mar 2020 17:10:37 +0000 (09:10 -0800)]
tmpfs - Fix minor deadlock, refactor tn_links

* Fix a minor deadlock.  tmpfs_alloc_vp() can rarely race a vnode
  and leave a dangling lock, causing a later umount to deadlock.

* Refactor tn_links to use atomic ops, mainly to clean-up an
  almost impossible race that can happen at umount time.

4 years agodrm/linux: Add __test_and_set_bit()
François Tigeot [Wed, 4 Mar 2020 16:37:25 +0000 (17:37 +0100)]
drm/linux: Add __test_and_set_bit()

4 years agodrm: Add a few Linux headers
François Tigeot [Wed, 4 Mar 2020 16:29:16 +0000 (17:29 +0100)]
drm: Add a few Linux headers

4 years agokernel - Rename spinlock counter trick API
Matthew Dillon [Wed, 4 Mar 2020 04:06:12 +0000 (20:06 -0800)]
kernel - Rename spinlock counter trick API

* Rename the access side of the API from spin_update_*() to
  spin_access_*() to avoid confusion.

4 years agokernel - Refactor cache_vref() using counter trick
Matthew Dillon [Wed, 4 Mar 2020 03:35:59 +0000 (19:35 -0800)]
kernel - Refactor cache_vref() using counter trick

* Refactor cache_vref() such that it is able to validate that a vnode
  (whos ref count might be 0) is not in VRECLAIM, without acquiring the
  vnode lock.  This is the normal case.

  If cache_vref() is unable to do this, it backs down to the old method
  which was to get a vnode lock, validate that the vnode is not in
  VRECLAIM, then release the lock.

* NOTE: In DragonFlyBSD, holding a vref on a vnode (vref, NOT vhold) will
  prevent the vnode from transitioning to VRECLAIM.

* Use the new feature for nlookup's naccess() tests and for the *stat*()
  series of system calls.

  This significantly increases performance.  However, we are not entirely
  cache-contention free as both the namecache entry and the vnode are still
  referenced, requiring atomic adds.

4 years agokernel - More counter trick spinlock APIs
Matthew Dillon [Wed, 4 Mar 2020 03:34:08 +0000 (19:34 -0800)]
kernel - More counter trick spinlock APIs

* Add spin_update_start_only(), spin_update_check_inprog(), and
  spin_update_end_only().  Same as the non-only versions but do not
  acquire a spin-lock in the (v & 1) case.

4 years agokernel - Fix minor scheduler bugs
Matthew Dillon [Wed, 4 Mar 2020 01:58:43 +0000 (17:58 -0800)]
kernel - Fix minor scheduler bugs

* Fix an issue where the ucount and/or uload could get out of sync,
  giving a cpu a permanent bias one way or the other.

* Fix an issue where the scheduler pull feature (0x01 or 0x04) would
  ignore cpus with non-zero run-queue counts in favor of cpus with
  high uloads (that can be due to processes sleeping < 1 second).

* By default, the scheduler helper's pull feature now runs once a tick.
  This may be changed as testing progresses.

4 years agokernel - Normalize the vx_*() vnode interface
Matthew Dillon [Tue, 3 Mar 2020 21:26:48 +0000 (13:26 -0800)]
kernel - Normalize the vx_*() vnode interface

* The vx_*() vnode interface is used for initial allocations, reclaims,
  and terminations.

  Normalize all use cases to prevent the mixing together of the vx_*()
  API and the vn_*() API.  For example, vx_lock() should not be paired
  with vn_unlock(), and so forth.

* Integrate an update-counter mechanism into the vx_*() API, assert
  reasonability.

* Change vfs_cache.c to use an int update counter instead of a long.
  The vfs_cache code can't quite use the spin-lock update counter API
  yet.

  Use proper atomics for load and store.

* Implement VOP_GETATTR_QUICK, meant to be a 'quick' version of
  VOP_GETATTR() that only retrieves information related to permissions
  and ownership.  This will be fast-pathed in a later commit.

* Implement vx_downgrade() to convert an exclusive vx_lock into an
  exclusive vn_lock (for vnodes).  Adjust all use cases in the
  getnewvnode() path.

* Remove unnecessary locks in tmpfs_getattr() and don't use
  any in tmpfs_getattr_quick().

* Remove unnecessary locks in hammer2_vop_getattr() and don't use
  any in hammer2_vop_getattr_quick()

4 years agokernel - Integrate the counter & 1 trick into the spinlock API
Matthew Dillon [Tue, 3 Mar 2020 18:21:33 +0000 (10:21 -0800)]
kernel - Integrate the counter & 1 trick into the spinlock API

* The counter trick allows read accessors to sample a data structure
  without any further locks or ref-counts, as long as the data structure
  is free-safe.

  It does not necessarily protect pointers within the data structure so e.g.
  ref'ing some sub-structure via a data structure pointer is not safe
  on its own unless the sub-structure is able to provide some sort of
  additional guarantee.

* Our struct spinlock has always been 8 bytes, but only uses 4 bytes for
  the lock.  Ipmlement the new API using the second field.

  Accessor side:
      spin_update_start()
      spin_update_end()

  Modifer side:
      spin_lock_update()
      spin_unlock_update()

* On the acessor side if spin_update_start() detects a change in-progress
  it will obtain a shared spin-lock, else remains unlocked.

  spin_update_end() tells the caller whether it must retry the operation,
  i.e. if a change occurred between start and end.  This can only happen
  if spin_update_start() remained unlocked.

  If the start did a shared lock then no changes are assumed to have occurred
  and spin_update_end() will release the shared spinlock and return 0.

* On the modifier side, spin_lock_update() obtains an exclusive spinlock
  and increments the update counter, making it odd ((spin->update & 1) != 0).

  spin_unlock_update() increments the counter again, making it even but
  different, and releases the exclusive spinlock.

4 years agokernel - syscall path optimizations
Matthew Dillon [Tue, 3 Mar 2020 04:42:22 +0000 (20:42 -0800)]
kernel - syscall path optimizations

* Shortcut checks in dfly_acquire_curproc(), significantly reducing
  system call overhead.

* Move one of the TDF_MP_BATCH_DEMARC test out of dfly_acquire_curproc()
  and into the scheduler clock.

* Add appropriate __predict*() macros to various conditionals in the
  system call path and convert the terminal switch() for syscall to
  a sequence of if()'s.

* Remove SYF_ARGMASK.

4 years agodevelopment.7: Modernize git commands for vendor import recipe
Aaron LI [Tue, 3 Mar 2020 14:04:37 +0000 (22:04 +0800)]
development.7: Modernize git commands for vendor import recipe

Since Git v1.7.2, 'git checkout --orphan' is the proper way to create an
orphan branch for vendor import.  Use the new git commands to simplify
the vendor import recipe.

In addition, polish the recipe a bit.

Credit: https://stackoverflow.com/a/4288660

4 years agorelease.7: Rename MAKE_JOBS to NREL_MAKE_JOBS
Aaron LI [Tue, 3 Mar 2020 09:15:09 +0000 (17:15 +0800)]
release.7: Rename MAKE_JOBS to NREL_MAKE_JOBS

Follow the change made in 834a13062350ab14a8c6aa28e5f9419613c173c2.

4 years agodrm/linux: handle NULL pointers in kmap_to_page()
François Tigeot [Tue, 3 Mar 2020 07:51:13 +0000 (08:51 +0100)]
drm/linux: handle NULL pointers in kmap_to_page()

This prevents i915-related crashes in some rare circumstances.

4 years agopsm.4/vga.4: Clean up a bit.
Sascha Wildner [Tue, 3 Mar 2020 03:09:43 +0000 (04:09 +0100)]
psm.4/vga.4: Clean up a bit.