dragonfly.git
4 years agodrm/linux: Add io_schedule_timeout()
François Tigeot [Mon, 17 Jun 2019 14:20:21 +0000 (16:20 +0200)]
drm/linux: Add io_schedule_timeout()

4 years agoBump __DragonFly_version for libopie removal.
zrj [Mon, 17 Jun 2019 06:45:42 +0000 (09:45 +0300)]
Bump __DragonFly_version for libopie removal.

While there, add entry to UPDATING.

4 years agokernel: Unbundle libressl headers from src-sys.tar.bz2
zrj [Mon, 17 Jun 2019 06:35:29 +0000 (09:35 +0300)]
kernel: Unbundle libressl headers from src-sys.tar.bz2

This reverts commit cebb579b84f544c775170301fea06cc74fb71ded.

No longer needed.

4 years agokernel: Separate md5 from userland.
zrj [Mon, 17 Jun 2019 06:34:32 +0000 (09:34 +0300)]
kernel: Separate md5 from userland.

There are no good reasons to include userland header. Passing raw ctx
structure from kernel to userland or vice versa is a bug.

Requested-by: swildner
4 years agokernel: Make <sys/md4.h> and <sys/md5.h> exclusive to kernel only.
zrj [Mon, 17 Jun 2019 06:33:12 +0000 (09:33 +0300)]
kernel: Make <sys/md4.h> and <sys/md5.h> exclusive to kernel only.

With libmd removal this is now possible. Poison the sys/ headers.

While there, minor cleanup in md4c.c that is only used in smb.

4 years agoworld: Remove libmd from the base.
zrj [Mon, 17 Jun 2019 06:30:06 +0000 (09:30 +0300)]
world: Remove libmd from the base.

Everything in base has been converted to use pure LibreSSL hash API.
The libmd now is moved to dports security/libmd for compatibility.

Also remove lone rmd160.h header that was added directly to include/.

4 years agolib: Update dependencies.
zrj [Mon, 17 Jun 2019 06:28:42 +0000 (09:28 +0300)]
lib: Update dependencies.

No libraries depend on libmd, it can now be build in standard order.

4 years agoworld: Remove OPIE from base.
zrj [Mon, 17 Jun 2019 06:25:13 +0000 (09:25 +0300)]
world: Remove OPIE from base.

The OPIE has been deprecated since
ed5666c1699a23a9ae3c0aca97dabaae71e26431

4 years agodrm/linux: Restore wait_event*() functionality
François Tigeot [Mon, 17 Jun 2019 13:31:05 +0000 (15:31 +0200)]
drm/linux: Restore wait_event*() functionality

* Our wait_event* routines do not (yet) use Linux wait queues.
  Threads using them still have to be woken up with a different mechanism.

* Restore the wakeup*() calls directly using wait_queue_head_t pointers

* While there, also properly set the current Linux thread states in the
  wait_event*() routines

Issue with the previous commit reported by zrj.

4 years agodrm/linux: Rework wait queues
François Tigeot [Sun, 16 Jun 2019 20:37:26 +0000 (22:37 +0200)]
drm/linux: Rework wait queues

* Make the implementation much closer to the Linux one

* Do not directly try to wake up threads, but use an indirect function
  call to do it, allowing drivers to override the default function

* Implement the expected default_wake_function() and
  autoremove_wake_function() routines

4 years agodrm/linux: Add LIST_HEAD_INIT()
François Tigeot [Sun, 16 Jun 2019 19:36:27 +0000 (21:36 +0200)]
drm/linux: Add LIST_HEAD_INIT()

Obtained from: NetBSD

4 years agoShorten some paths in various Makefiles.
Sascha Wildner [Sun, 16 Jun 2019 05:26:40 +0000 (07:26 +0200)]
Shorten some paths in various Makefiles.

4 years agorconfig(8): Update usage in program and manpage
Aaron LI [Sun, 16 Jun 2019 03:49:17 +0000 (11:49 +0800)]
rconfig(8): Update usage in program and manpage

Clarify the different usages between client and server modes.

4 years agorconfig(8): Allow '.', '-' and '+' in tag names
Aaron LI [Sun, 16 Jun 2019 02:50:58 +0000 (10:50 +0800)]
rconfig(8): Allow '.', '-' and '+' in tag names

Originally, tag name only allows alphabets, digits and underscore.  This
commit also allows tag names to have dot (.), minus (-) and plus (+)
symbols.

Bug-report: #2977

4 years agolibkvm - Increase static buffer for devname()
Matthew Dillon [Sun, 16 Jun 2019 02:24:46 +0000 (19:24 -0700)]
libkvm - Increase static buffer for devname()

* For now increase the internal static buffer for devname
  to MAXPATHLEN (aka 1024).  This may eventually be replaced
  with SPECNAMELEN.

* This change is not exposed externally and it, or later changes,
  should not break anything.

Requested-by: aly
4 years agolibkvm - Increase ksw_devname from [32] to [64]
Matthew Dillon [Sun, 16 Jun 2019 02:03:20 +0000 (19:03 -0700)]
libkvm - Increase ksw_devname from [32] to [64]

* Increase ksw_devname to 64 chars.  This will help it fit longer
  crypto name paths, plus drive serial numbers can be longer as well.

Requested-by: aly
4 years agokernel - Fix SMAP/SMEP caught user mode access part 2/2.
Matthew Dillon [Sat, 15 Jun 2019 22:04:04 +0000 (15:04 -0700)]
kernel - Fix SMAP/SMEP caught user mode access part 2/2.

* Finish implementing SMAP exception handling support by
  properly detecting it in trap() and generating a panic().
  Otherwise the cpu just locks up in a page-fault loop without
  any indication as to why on the console.

* To properly support SMAP, make sure AC is cleared on system calls
  (it is already cleared on any interrupt or exception by the frame
  push code but I missed the syscall entry code).

4 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sat, 15 Jun 2019 20:37:25 +0000 (22:37 +0200)]
Update the pciconf(8) database.

June 12, 2019 snapshot from https://pci-ids.ucw.cz

4 years agokernel - Fix SMAP/SMEP caught user mode access part 1/2.
Matthew Dillon [Sat, 15 Jun 2019 19:07:59 +0000 (12:07 -0700)]
kernel - Fix SMAP/SMEP caught user mode access part 1/2.

* Fix improper user mode access in hammer, caught by SMAP/SMEP.

Reported-by: Tim Darby
4 years agoterminfo: Build and install st, st-16color and st-256color
Aaron LI [Sat, 15 Jun 2019 11:51:21 +0000 (19:51 +0800)]
terminfo: Build and install st, st-16color and st-256color

Support the st (simple terminal) from the suckless project:
https://st.suckless.org/

Submitted-by: daftaupe
Bug-report: #3159

4 years agoUse NULL instead of 0 for the third argument in fts_open()
Aaron LI [Sat, 15 Jun 2019 10:55:11 +0000 (18:55 +0800)]
Use NULL instead of 0 for the third argument in fts_open()

Bug-report: #3138

4 years agoMakefile: Require explicit target
Aaron LI [Sat, 15 Jun 2019 08:29:40 +0000 (16:29 +0800)]
Makefile: Require explicit target

Explicit target (e.g., buildworld, buildkernel) is required, otherwise
fail with an error.

Obtained-from: FreeBSD
Bug-report: #3158

4 years agolibstand/hammer1: Fix vol_name to be vol_label
Aaron LI [Sat, 15 Jun 2019 05:49:38 +0000 (13:49 +0800)]
libstand/hammer1: Fix vol_name to be vol_label

The 'vol_name' field in 'struct hammer_volume_ondisk' was changed to
'vol_label' in commit 6c39d27aedd299180e0b77179a8690d90d1e6e6d .

This fix enables libstand/hammer1.c to be build with -DTESTING.

Reported-by: daftaupe
Bug-report: #3185

4 years agou4b/audio: Fix panic by kfree(NULL)
Aaron LI [Sat, 15 Jun 2019 05:18:36 +0000 (13:18 +0800)]
u4b/audio: Fix panic by kfree(NULL)

DragonFly's kfree(9) doesn't allow a NULL pointer, while FreeBSD's
free(9) allows.

Reported-by: tse
Bug-report: #3192

4 years agoiostat - Fix column count bug
Matthew Dillon [Fri, 14 Jun 2019 05:24:46 +0000 (22:24 -0700)]
iostat - Fix column count bug

* The maxshowdevs parameter was improperly conditionalized in the
  list iteration, causing the list to be truncated early in some cases.

* Remove md*, pass*, and sg* by default, they are not usually
  interesting.

* Display more columns by default if stdout is a terminal and is wide
  enough.

4 years agolibdevstat - Fix a bug in DS_SELECT_REMOVE
Matthew Dillon [Fri, 14 Jun 2019 02:59:08 +0000 (19:59 -0700)]
libdevstat - Fix a bug in DS_SELECT_REMOVE

* An improper decrement cut the list scan short, causing wildcard
  removals to not select all matching devices.

* This only really effects e.g. systat -vm and similar utilities.

4 years agokernel - Fix gdb / tracing
Matthew Dillon [Thu, 13 Jun 2019 17:38:28 +0000 (10:38 -0700)]
kernel - Fix gdb / tracing

* The tstop fix broke gdb / tracing.  Get gdb / tracing working
  again.

4 years agoUse some standard type names better.
Sascha Wildner [Wed, 12 Jun 2019 21:09:07 +0000 (23:09 +0200)]
Use some standard type names better.

struct sigaltstack -> stack_t
struct __siginfo   -> siginfo_t
struct __sigset    -> sigset_t

No functional change.

4 years ago<sys/signal.h>: Adjust the type of stack_t's ss_sp from char * to void *.
Sascha Wildner [Wed, 12 Jun 2019 20:34:10 +0000 (22:34 +0200)]
<sys/signal.h>: Adjust the type of stack_t's ss_sp from char * to void *.

4 years agodrm/linux: Fix schedule_timeout()
François Tigeot [Wed, 12 Jun 2019 19:48:53 +0000 (21:48 +0200)]
drm/linux: Fix schedule_timeout()

Interruptible sleeps were returning wrong values.

4 years agomtree: Indent with spaces.
Sascha Wildner [Tue, 11 Jun 2019 20:51:46 +0000 (22:51 +0200)]
mtree: Indent with spaces.

4 years agolibc: Add missing #include "un-namespace.h" in a few files.
Sascha Wildner [Wed, 12 Jun 2019 07:47:41 +0000 (09:47 +0200)]
libc: Add missing #include "un-namespace.h" in a few files.

4 years agolibc/pwcache: Remove some old RCS related stuff.
Sascha Wildner [Wed, 12 Jun 2019 07:46:09 +0000 (09:46 +0200)]
libc/pwcache: Remove some old RCS related stuff.

4 years ago<sys/param.h>: Fix _DragonFly_version.
Sascha Wildner [Wed, 12 Jun 2019 06:27:21 +0000 (08:27 +0200)]
<sys/param.h>: Fix _DragonFly_version.

4 years agoChanges for DragonFly 5.7.
Justin C. Sherrill [Wed, 12 Jun 2019 01:26:44 +0000 (21:26 -0400)]
Changes for DragonFly 5.7.

4 years agolibc: Use quotation marks around {un-,}namespace.h (private header).
Sascha Wildner [Tue, 11 Jun 2019 19:12:21 +0000 (21:12 +0200)]
libc: Use quotation marks around {un-,}namespace.h (private header).

4 years agoworld - Makme shm_open() more compatible with expectations
Matthew Dillon [Tue, 11 Jun 2019 19:04:49 +0000 (12:04 -0700)]
world - Makme shm_open() more compatible with expectations

* Create a tmpfs mount in /var/run/shm and also create /var/run/shm/tmp
  under it, both modes 1777, to support shm_open().  No longer base
  shm_open() at the root directory.

* shm_open() and shm_unlink() now access files relative to /var/run/shm.

  This fixes numerous ports and removes the need for numerous
  port patches.

* Rejigger libraries using namespace.h/un-namespace.h to add _unlink() and
  _unlinkat() into the mix.

4 years agoinstaller - Default to HAMMER2 (2)
Matthew Dillon [Tue, 11 Jun 2019 04:20:11 +0000 (21:20 -0700)]
installer - Default to HAMMER2 (2)

* Fix comments.

Reported-by: noob237
4 years agoinstaller - Default to HAMMER2
Matthew Dillon [Tue, 11 Jun 2019 00:53:46 +0000 (17:53 -0700)]
installer - Default to HAMMER2

* Change the installer default from HAMMER1 to HAMMER2.

* Adjust the nrelease build to print the location of the image files
  when it finishes.

4 years agodrm/linux: Add task_struct, rework sleep and wake up functions
François Tigeot [Mon, 10 Jun 2019 19:34:39 +0000 (21:34 +0200)]
drm/linux: Add task_struct, rework sleep and wake up functions

Really implement wake_up_process(), signal_pending(),
signal_pending_state() and schedule_timeout()

Some fixes contributed by Matthew Dillon.

4 years ago/etc/group: Add 'input', so it is available right away on new systems.
Sascha Wildner [Mon, 10 Jun 2019 12:30:26 +0000 (14:30 +0200)]
/etc/group: Add 'input', so it is available right away on new systems.

Pointed-out-by: zrj
4 years agoevdev: Create device entries with the "input" group
Peeter Must [Mon, 3 Jun 2019 07:57:11 +0000 (10:57 +0300)]
evdev: Create device entries with the "input" group

* Add a new group "input" with an id 43.

* Make the devfs subsystem override the /dev/input/event*
  devices with perm 0660 and root:input.

* This approach is standard in many Linux systems.

4 years agoRemove lint checks in system headers.
Sascha Wildner [Sun, 2 Jun 2019 17:23:22 +0000 (19:23 +0200)]
Remove lint checks in system headers.

Modern checkers do not (need to) pass this anymore to the build.

4 years agosys/vfs/hammer: Rename hammer_flush_inode_done() -> hammer_sync_inode_done()
Tomohiro Kusumi [Sun, 2 Jun 2019 05:54:18 +0000 (14:54 +0900)]
sys/vfs/hammer: Rename hammer_flush_inode_done() -> hammer_sync_inode_done()

It's a counterpart for hammer_sync_inode().

4 years agodrm: Sync drm_gem_object_lookup() with Linux 4.7.10
François Tigeot [Sun, 2 Jun 2019 05:16:11 +0000 (07:16 +0200)]
drm: Sync drm_gem_object_lookup() with Linux 4.7.10

4 years agolibm: Fix some -Wredundant-decls. signgam is in <math.h> already.
Sascha Wildner [Sat, 1 Jun 2019 15:03:30 +0000 (17:03 +0200)]
libm: Fix some -Wredundant-decls. signgam is in <math.h> already.

4 years agoCorrect some casts in printf arguments in various utilities.
Sascha Wildner [Sat, 1 Jun 2019 08:23:09 +0000 (10:23 +0200)]
Correct some casts in printf arguments in various utilities.

4 years agokernel/evdev: create input devices with UID_ROOT and GID_WHEEL
Peeter Must [Sat, 1 Jun 2019 06:56:05 +0000 (09:56 +0300)]
kernel/evdev: create input devices with UID_ROOT and GID_WHEEL

* In preparation to follow the same scheme as in drm devices:
  access rights will be set using the devfs system, see commit
  82aec1d31805500239e50c9b6ed8d25802b0a17c.

4 years agoem/emx/igb: Merge Intel em-7.7.4 and igb-2.5.6
Sepherosa Ziehau [Sun, 3 Mar 2019 12:51:53 +0000 (20:51 +0800)]
em/emx/igb: Merge Intel em-7.7.4 and igb-2.5.6

Most noticeably added I219 V6/V7 support for em/emx.

4 years agoresident(8): Remove a.out support.
Sascha Wildner [Fri, 31 May 2019 15:36:37 +0000 (17:36 +0200)]
resident(8): Remove a.out support.

4 years agoldd(1): Remove unneeded inclusion of <a.out.h>.
Sascha Wildner [Fri, 31 May 2019 15:36:08 +0000 (17:36 +0200)]
ldd(1): Remove unneeded inclusion of <a.out.h>.

4 years agogcore(1): Stop depending on <a.out.h>.
Sascha Wildner [Fri, 31 May 2019 15:36:03 +0000 (17:36 +0200)]
gcore(1): Stop depending on <a.out.h>.

4 years agoRemove symorder(1). It's no longer useful.
Sascha Wildner [Fri, 31 May 2019 15:32:08 +0000 (17:32 +0200)]
Remove symorder(1). It's no longer useful.

4 years agocrunchide(1): Remove a.out, elf32 and ECOFF traces.
Sascha Wildner [Fri, 31 May 2019 13:58:40 +0000 (15:58 +0200)]
crunchide(1): Remove a.out, elf32 and ECOFF traces.

4 years agodrm/radeon: Stop naming the kernel module "radeonkms"
François Tigeot [Fri, 31 May 2019 05:23:05 +0000 (07:23 +0200)]
drm/radeon: Stop naming the kernel module "radeonkms"

It is named "radeon" in Linux.

4 years agovkernel - Adjust use of GDF_VIRTUSER
Matthew Dillon [Fri, 31 May 2019 04:38:29 +0000 (23:38 -0500)]
vkernel - Adjust use of GDF_VIRTUSER

* Don't clear GDF_VIRTUSER until after exiting the critical section,
  otherwise hardclock() will tick sys instead of user.

  A user bound program should now show more reasonable values for
  user%.

* Scrap some debug counters that are no longer applicable, cleaning
  up a few cache line bounces.

4 years agodummynet - Poll only if operational, change default freq for vkernel
Matthew Dillon [Fri, 31 May 2019 03:41:32 +0000 (22:41 -0500)]
dummynet - Poll only if operational, change default freq for vkernel

* Default frequency for vkernel is now 100 hz instead of 1000 hz.
  The frequency can be changed at any time with a sysctl.

* The systimer is only configured when there are pipes or flows
  present, and will be deconfigured when there aren't.  This
  saves us from doing any unnecessary polling.

* dummynet still has some considerable holes related to SMP
  operation.  It really needs a rewrite to some degree.

4 years agodrm/linux: Implement i2c_bit_add_bus()
François Tigeot [Thu, 30 May 2019 15:42:44 +0000 (17:42 +0200)]
drm/linux: Implement i2c_bit_add_bus()

4 years agosysctl.8: Revert 39d69daecef529eb49d36fefa429c8ac08e7cbc1.
Sascha Wildner [Thu, 30 May 2019 13:03:40 +0000 (15:03 +0200)]
sysctl.8: Revert 39d69daecef529eb49d36fefa429c8ac08e7cbc1.

The manpage just says whether it's a number, a string or something
else, not the exact type.

4 years ago<sys/sysctl.h>: Remove the unused CTL_HW_NAMES define.
Sascha Wildner [Thu, 30 May 2019 11:25:44 +0000 (13:25 +0200)]
<sys/sysctl.h>: Remove the unused CTL_HW_NAMES define.

Reported-by: zrj
4 years agokernel/sysctl: Switch kern.osrevision to showing __DragonFly_version.
Sascha Wildner [Thu, 30 May 2019 10:56:52 +0000 (12:56 +0200)]
kernel/sysctl: Switch kern.osrevision to showing __DragonFly_version.

It was tied to a historic define (BSD) that started as 199506 and was
sporadically bumped in the past until 200708. Revert the define back
to 199506, as it is not supposed to be bumped, and add a comment about
this (taken from NetBSD). We cannot remove these defines completely
because at least some are used by ports.

4 years agodrm/linux: Add wait_event_interruptible_locked()
François Tigeot [Thu, 30 May 2019 08:06:06 +0000 (10:06 +0200)]
drm/linux: Add wait_event_interruptible_locked()

4 years agodrm/linux: Add vmalloc() and vzalloc()
François Tigeot [Thu, 30 May 2019 07:51:56 +0000 (09:51 +0200)]
drm/linux: Add vmalloc() and vzalloc()

4 years agodrm/linux: Add set_memory_uc()
François Tigeot [Thu, 30 May 2019 07:49:40 +0000 (09:49 +0200)]
drm/linux: Add set_memory_uc()

4 years agodrm/linux: Add gcd()
François Tigeot [Thu, 30 May 2019 07:48:47 +0000 (09:48 +0200)]
drm/linux: Add gcd()

4 years agodrm/linux: Add list_prev_entry()
François Tigeot [Thu, 30 May 2019 07:47:17 +0000 (09:47 +0200)]
drm/linux: Add list_prev_entry()

Obtained-from: FreeBSD

4 years agodrm/linux: Fix pci_map_page() arguments
François Tigeot [Thu, 30 May 2019 07:40:22 +0000 (09:40 +0200)]
drm/linux: Fix pci_map_page() arguments

4 years agovkernel - Restore vkernel build
Matthew Dillon [Wed, 29 May 2019 21:38:21 +0000 (14:38 -0700)]
vkernel - Restore vkernel build

* Finish cleaning up the vkernel pmap code so the build works again.

Tested-by: dillon, tested with a NFS boot.
4 years agokernel - Don't block in tstop() with locks held
Matthew Dillon [Wed, 29 May 2019 21:33:07 +0000 (14:33 -0700)]
kernel - Don't block in tstop() with locks held

* There are several places where the kernel improperly blocks on a
  STOP signal while locks might be held.  This is a particular problem
  when PCATCH is specified e.g. in the middle of the NFS code.  It is
  meant to catch INTR but it also improperly allowed STOP to function
  and left the vnode lock held.

  Several other places in the kernel also use PCATCH and don't expect
  the kernel to actually block indefinitely on a STOP.

* Don't block in STOP in these situations.  Simply mark the thread as
  stopped and wait until it tries to return to userland before actually
  stopping.

  Any kernel subsystems which desire to act on the STOP in-line instead
  of upon return to userland can do so manually, as long as they release
  all locks for the duration.

4 years ago<sys/syslimits.h>: Clean up inclusion check and warning.
Sascha Wildner [Wed, 29 May 2019 12:41:04 +0000 (14:41 +0200)]
<sys/syslimits.h>: Clean up inclusion check and warning.

4 years agoClean up a few math related manualpages.
Sascha Wildner [Tue, 28 May 2019 19:17:34 +0000 (21:17 +0200)]
Clean up a few math related manualpages.

* In frexp.3, change the library to libc, because it is part of libc,
  not libm (anymore).

* In fpclassify.3 and signbit.3, remove the LIBRARY section, because
  all these are macros from <math.h>.

4 years agokernel - Build 'evdev' into the kernel
Matthew Dillon [Tue, 28 May 2019 18:57:59 +0000 (11:57 -0700)]
kernel - Build 'evdev' into the kernel

* Build evdev into the kernel along with its EVDEV_SUPPORT option.

Requested-by: peeter
4 years agokernel - Refactor scheduler weightings part 2/2.
Matthew Dillon [Mon, 27 May 2019 00:20:48 +0000 (17:20 -0700)]
kernel - Refactor scheduler weightings part 2/2.

* Change the default fork()ing mechanic from 0x80 (random cpu) to
  0x20 (best cpu).  We no longer need to mix it up on fork because
  weight4 now works.

* The best cpu algorithm has a number of desirable characteristics
  for fork() and fork()/exec().

  - Will generally start the child topologically 'close' to the parent,
    reducing fork/exec/exit/wait overheads, but still spread the children
    out while machine load is light.  If the child sticks around for
    long enough, it will get spread out even more optimally.  If not,
    closer is better.

  - Will not stack children up on the same cpu unnecessarily (e.g. parent
    fork()s a bunch of times at once).

  - Will optimize heavy and very-heavy load situations.  If the child
    have nowhere else reasonable to go, this will schedule it on a
    hyper-thread sibling or even on the same cpu as the parent.  Depending
    on the load.

* Gives us around a 15% improvement in fork/exec/exit/wait performance.

* Once a second we clear the td_wakefromcpu hint on the currently
  running thread.  This allows a thread which has become cpu-bound
  to start to 'wander' afield (though the scheduler will still try to
  avoid moving it too far away, topologically).

4 years agokernel/pmap: Clean up no longer used MALLOC_DEFINE.
Sascha Wildner [Mon, 27 May 2019 16:09:05 +0000 (18:09 +0200)]
kernel/pmap: Clean up no longer used MALLOC_DEFINE.

4 years ago<sys/cdefs.h>: Remove the old unused __DF_VISIBLE.
Sascha Wildner [Sun, 26 May 2019 17:43:17 +0000 (19:43 +0200)]
<sys/cdefs.h>: Remove the old unused __DF_VISIBLE.

Nothing depends on it anymore and nothing sets _DRAGONFLY_SOURCE or
_NETBSD_SOURCE. We handle all non-POSIX visibility with __BSD_VISIBLE
quite well.

Pointed-out-by: zrj
4 years agoRemove expand(1) from the bootstrap tools.
Sascha Wildner [Sun, 26 May 2019 13:30:40 +0000 (15:30 +0200)]
Remove expand(1) from the bootstrap tools.

4 years agoroute(8): Simplify the keywords handling.
Sascha Wildner [Sun, 26 May 2019 12:54:53 +0000 (14:54 +0200)]
route(8): Simplify the keywords handling.

Adapted from FreeBSD. This eliminates paste(1) as a bootstrap tool.

4 years agodump(8): Remove some unneeded defines.
Sascha Wildner [Sun, 26 May 2019 12:02:07 +0000 (14:02 +0200)]
dump(8): Remove some unneeded defines.

4 years agokernel - VM rework part 21 - Start resynchronizing the vkernel
Matthew Dillon [Sun, 26 May 2019 16:49:02 +0000 (09:49 -0700)]
kernel - VM rework part 21 - Start resynchronizing the vkernel

* Fix some minor syntax errors.

* The vkernel is still not operational in master.  It will be a little
  while.  Even though the vkernel retains the old pmap mechanism, there
  are some i's to dot and t's to cross in the expectations the mainline
  kernel has of the APIs.

Reported-by: swildner
4 years agokernel - Backout 'Reduce token backoff'
Matthew Dillon [Sun, 26 May 2019 16:47:29 +0000 (09:47 -0700)]
kernel - Backout 'Reduce token backoff'

* Return the backoff to 4096.  Basically there are multiple situations
  here where a smaller backoff works better, and multiple situations
  where a larger backoff works better.  For now, return the setting to
  its former glory and don't mess with it.

4 years agokernel - Refactor scheduler weightings part 1/2.
Matthew Dillon [Sun, 26 May 2019 16:37:51 +0000 (09:37 -0700)]
kernel - Refactor scheduler weightings part 1/2.

* Refactor the scheduler's weightings and fix a few issues that
  have cropped up due to breaking previous tunings.  This gets
  our pgbench results back to normal.

* There will probably be a follow-up commit with a bit more
  tuning work, particular with regards to resetting the
  td_wakefromcpu field which we currently do not do at all.

* Increase weight1 (keep thread on current CPU) slightly,
  implement weight4, and re-tune the algorithm.

* Break-out the IPC pairing control fields into two new
  sysctls, kern.usched_dfly.ipc_smt and kern.usched_dfly.ipc_same,
  with the default set to -1 (auto).

  ipc_smt Tries to schedule IPC pairings onto sibling
hyperthreads to avoid cache mastership changes
when the load is greater than (ncpus / 2).

  ipc_same Tries to schedule IPC pairings onto the same
logical cpu to avoid both cache mastership changes
AND IPIs when the load is greater than (ncpus).

* Keep in mind that the scheduler cannot perfectly predict program
  behavior.  In particular, these IPC pairings can work better or worse
  depending on the mix between local cpu use within each process,
  verses the amount of data being transfered between them.  By default
  we try to localize IPC pairings to nearby cores but we do not try
  to schedule them to sibling hyperthreads unless the load is high
  enough for it to make sense.

* The main IPC weighting is weight2, whereas the fairness metric is
  weight4.  Generally speaking, weight4 should be somewhat smaller
  than weight2 but still high enough to ensure that available CPUs
  in the system are reasonably well utilized.  Also note that the
  fairness metric (weight4) is based on priority-weighted load.

4 years agokernel - pipe locks are not needed in the kqueue event code
Matthew Dillon [Sat, 25 May 2019 18:49:46 +0000 (11:49 -0700)]
kernel - pipe locks are not needed in the kqueue event code

* The kqueue event code locks the knote itself, and this should be
  sufficient to interlock any race between the filter and the
  other side.

  Remove the token locks from the event filters and add a little code
  to handle any invalid kn_data values (due to not being locked).

Testing-with: sysutils/pv (via zrj)

4 years agokernel - Reduce token backoff
Matthew Dillon [Sat, 25 May 2019 18:45:35 +0000 (11:45 -0700)]
kernel - Reduce token backoff

* Reduce lwkt.token_backoff_max from 4096 to 128.  4096 was just too
  long and results in poor performance when heavy token contention is
  present.

Testing-with: sysutils/pv (via zrj)

4 years agokernel/netmap: Move headers into <net/netmap/...>.
Sascha Wildner [Sat, 25 May 2019 07:31:30 +0000 (09:31 +0200)]
kernel/netmap: Move headers into <net/netmap/...>.

Note that netmap isn't hooked into the build right now, and because of
that, this commit results in removing them from their current location.

Some dports like net/libpcap started breaking after 2c68437386f4be2ed45a4
because configure found a building netmap_user.h and decided that we have
a current and usable netmap.

Reported-by: zrj
4 years agokernel - Enhance indefinite wait buffer console message
Matthew Dillon [Thu, 23 May 2019 16:24:41 +0000 (09:24 -0700)]
kernel - Enhance indefinite wait buffer console message

* Enhance debug info for indefinite wait buffers.

4 years agokernel: Remove two more unneeded .PATHs.
Sascha Wildner [Thu, 23 May 2019 07:43:14 +0000 (09:43 +0200)]
kernel: Remove two more unneeded .PATHs.

4 years agokernel/smbus: Remove an unneeded .PATH in a Makefile.
Sascha Wildner [Thu, 23 May 2019 07:17:09 +0000 (09:17 +0200)]
kernel/smbus: Remove an unneeded .PATH in a Makefile.

4 years agoMove <sys/fd_set.h> to <sys/_fd_set.h>.
Sascha Wildner [Thu, 23 May 2019 06:49:31 +0000 (08:49 +0200)]
Move <sys/fd_set.h> to <sys/_fd_set.h>.

It is only supposed to be included by other headers. Normal code
should use <sys/select.h>.

4 years agoDon't include the full <sys/signal.h> in headers that just need sigset_t.
Sascha Wildner [Thu, 23 May 2019 06:41:49 +0000 (08:41 +0200)]
Don't include the full <sys/signal.h> in headers that just need sigset_t.

Namely, <select.h> and <spawn.h>.

Split it out into a separate header, <sys/_sigset_t.h> and include that
in <spawn.h> and <sys/select.h>.

This cleans up these two headers' name space considerably.

Thanks to zrj for testing with a dports bulk build.

4 years agokernel - Reduce acpi_ec timeout after failure, silence errors
Matthew Dillon [Thu, 23 May 2019 06:27:57 +0000 (23:27 -0700)]
kernel - Reduce acpi_ec timeout after failure, silence errors

* Reduce the acpi_ec timeout from 750ms to 100ms after a
  failure.

* Automatically silence... well, all acpi error messages,
  after 10 acpi_ec errors.

* This allows the dell xps-13 to boot in a more reasonable
  period of time and not spew EC errors to the console all
  the time, as a default, without us having to disable EC manually..

4 years agodhclient - Allow 'start' keyword
Matthew Dillon [Thu, 23 May 2019 00:43:47 +0000 (17:43 -0700)]
dhclient - Allow 'start' keyword

* There's something weird in our rc scripts that is causing dhclient
  to be called with 'start <interface>' on the wlan, so temporarily
  hack allowing the 'start' keyword.

4 years agodrm: Reduce differences with Linux in ioctl code
François Tigeot [Wed, 22 May 2019 21:40:59 +0000 (23:40 +0200)]
drm: Reduce differences with Linux in ioctl code

4 years agokernel - VM rework part 20 - Fix vmmeter_neg_slop_cnt
Matthew Dillon [Wed, 22 May 2019 07:16:17 +0000 (00:16 -0700)]
kernel - VM rework part 20 - Fix vmmeter_neg_slop_cnt

* Fix some serious issues with the vmmeter_neg_slop_cnt calculation.
  The main problem is that this calculation was then causing
  vmstats.v_free_min to be recalculated to a much higher value
  than it should beeen calculated to, resulting in systems starting
  to page far earlier than they should.

  For example, the 128G TR started paging tmpfs data with 25GB of
  free memory, which was not intended.  The correct target for that
  amount of memory is more around 3GB.

* Remove vmmeter_neg_slop_cnt entirely and refactor the synchronization
  code to be smarter.  It will now synchronize vmstats fields whos
  adjustments exceed -1024, but only if paging would actually be
  needed in the worst-case scenario.

* This algorithm needs low-memory testing and might require more
  tuning.

4 years agokernel - Reduce/refactor nbuf and maxvnodes calculations.
Matthew Dillon [Wed, 22 May 2019 03:12:34 +0000 (20:12 -0700)]
kernel - Reduce/refactor nbuf and maxvnodes calculations.

* The prime motivation for this commit is to target about 1/20
  (5%) of physical memory for use by the kernel.  These changes
  significantly reduce kernel memory usage on systems with less
  than 4GB of ram (and more specific for systems with less
  than 1TB of ram), and also emplace more reasonable caps on
  systems with 128GB+ of ram.

  These changes return 100-200MB of ram to userland on systems
  with 1GB of ram, and return around 6.5GB of ram on systems
  with 128G of ram.

* The nbuf calculation and related code documentation was a bit
  crufty, still somewhat designed for an earlier era and was
  calculating about twice the stated 5% target.  For systems with
  128GB of ram or less the calculation was simply creating too many
  filesystem buffers, allowing as much as 10% of physical memory to
  be locked up by the buffer cache.

  Particularly on small systems, this 10% plus other kernel overheads
  left a lot less memory available for user programs than we would
  have liked.  This work gets us closer to the 5% target.

* Change the base calculation from 1/10 of physical memory to 1/20
  of physical memory, cutting the number of buffers in half on
  most systems.  The code documentation stated 1/20 but was actually
  calculating 1/10.

* On large memory systems > 100GB the number of buffers is now capped
  at around 400000 or so (allowing the buffer cache to use around
  6.5 GBytes).  This cap was previously based on a relatively
  disconnected parameter relating to available memory in early boot,
  and when triggered it actually miscalculating nbufs to be double
  the intended number.

  The new cap is based on a fixed maximum of 500MB worth of
  struct bufs, roughly similar to the original intention.  This
  change reduces the number of buffers reserved on system with
  more than around 100GB of ram from around 12GB worth of data
  down to 6.5GB.

* With the BKVABIO work eliminating most SMP invltlbs on buffer
  recyclement, there is no real reason to need a huge buffer
  cache.  Just make sure its big enough on large-memory machines
  to fully cache the likely live datasets for things like bulk
  compiles and such.

* For kern.maxvnodes (which can be changed at run-time if you
  desire), the base calcualtion on systems with less than 1GB
  of ram has been cut in half (~60K vnodes to ~30K vnodes).  It
  will ramp up more slowly until it roughly matches the prior
  calculation at 4GB of system memory.  On systems with enough
  memory, maxvnodes is now explicitly capped at 4M.

  There generally is no need to allow an excessive number of vnodes
  to be cached.

  For HAMMER1 you can set vfs.hammer.double_buffer=1 to cause it
  to cache data from the underlying device, allowing it to utilize
  all available free(ish) memory regardless of the maxvnodes setting.

  HAMMER2 caches disk blocks in the underlying device by default.
  The vnode-based vm_object caches decompressed data, so we want
  to have enough vnodes for nominal heavily parallel bulk operations
  to avoid unnecessary re-lookups of the vnode as well as avoid having
  to decompress the same thing over and over again.

  In both cases an excessively high kern.maxvnodes actually wastes
  memory on both HAMMER1 and HAMMER2... or at least makes the pageout
  daemon's job more difficult.

* Remove vfs.maxmallocbufspace.  It is no longer connected to
  anything.

4 years agokernel - VM rework part 19 - Cleanup
Matthew Dillon [Wed, 22 May 2019 02:24:20 +0000 (19:24 -0700)]
kernel - VM rework part 19 - Cleanup

* vmpageinfo breaks down the kernel load size, vm_page_array
  size, and buffer headers for the buffer cache, all of which
  are major boot-time wired kernel memory.

  Note that the vm_page_array[] uses 3.1% of physical memory.
  Its a lot, but there is no convenient way to make it less.

4 years agokernel - VM rework part 18 - Cleanup
Matthew Dillon [Tue, 21 May 2019 20:55:43 +0000 (13:55 -0700)]
kernel - VM rework part 18 - Cleanup

* Significantly reduce the zone limit for pvzone (for pmap
  pv_entry structures).  pv_entry's are no longer allocated
  on a per-page basis so the limit can be made much smaller.

  This also has the effect of reducing the per-cpu cache limit
  which ultimately stabilizes wired memory use for the zone.

* Also reduce the generic pre-cpu cache limit for zones.
  This only really effects the pvzone.

* Make pvzone, mapentzone, and swap_zone __read_mostly.

* Enhance vmstat -z, report current structural use and actual
  total memory use.

* Also cleanup the copyright statement for vm/vm_zone.c.  John Dyson's
  original copyright was slightly different than the BSD copyright and
  stipulated no changes, so separate out the DragonFly addendum.

4 years ago<net/netmap_user.h>: s/<malloc.h>/<stdlib.h>/.
Sascha Wildner [Tue, 21 May 2019 18:43:42 +0000 (20:43 +0200)]
<net/netmap_user.h>: s/<malloc.h>/<stdlib.h>/.

It is not used in base and in fact the netmap we have in the tree is
not hooked in, but it seems at least one port stumbles over this.

Reported-by: zrj
4 years agokernel - VM rework part 17 - Cleanup
Matthew Dillon [Tue, 21 May 2019 00:35:57 +0000 (17:35 -0700)]
kernel - VM rework part 17 - Cleanup

* Adjust kmapinfo and vmpageinfo in /usr/src/test/debug.
  Enhance the code to display more useful information.

* Get pmap_page_stats_*() working again.

* Change systat -vm's 'VM' reporting.  Replace VM-rss with PMAP and
  VMRSS.  Relabel VM-swp to SWAP and SWTOT.

  PMAP - Amount of real memory faulted into user pmaps.

  VMRSS - Sum of all process RSS's in thet system.  This is
  the 'virtual' memory faulted into user pmaps and
  includes shared pages.

  SWAP - Amount of swap space currently in use.

  SWTOT - Total amount of swap installed.

* Redocument vm_page.h.

* Remove dead code from pmap.c (some left over cruft from the
  days when pv_entry's were used for PTEs).

4 years agokernel - VM rework part 16 - Optimization & cleanup pass
Matthew Dillon [Mon, 20 May 2019 16:37:12 +0000 (09:37 -0700)]
kernel - VM rework part 16 - Optimization & cleanup pass

* Adjust __exclusive_cache_line to use 128-byte alignment as
  per suggestion by mjg.  Use this for the global vmstats.

* Add the vmmeter_neg_slop_cnt global, which is a more generous
  dynamic calculation verses -VMMETER_SLOP_COUNT.  The idea is to
  return how often vm_page_alloc() synchronizes its per-cpu statistics
  with the global vmstats.

4 years agokernel - VM rework part 15 - Core pmap work, refactor PG_*
Matthew Dillon [Mon, 20 May 2019 16:29:43 +0000 (09:29 -0700)]
kernel - VM rework part 15 - Core pmap work, refactor PG_*

* Augment PG_FICTITIOUS.  This takes over some of PG_UNMANAGED's previous
  capabilities.  In addition, the pmap_*() API will work with fictitious
  pages, making mmap() operation (aka of the GPU) more consistent.

* Add PG_UNQUEUED.  This prevents a vm_page from being manipulated in
  the vm_page_queues[] in any way.  This takes over another feature
  of the old PG_UNMANAGED flag.

* Remove PG_UNMANAGED

* Remove PG_DEVICE_IDX.  This is no longer relevant.  We use PG_FICTITIOUS
  for all device pages.

* Refactor vm_contig_pg_alloc(), vm_contig_pg_free(),
  vm_page_alloc_contig(), and vm_page_free_contig().

  These functions now set PG_FICTITIOUS | PG_UNQUEUED on the returned
  pages, and properly clear the bits upon free or if/when a regular
  (but special contig-managed) page is handed over to the normal paging
  system.

  This is combined with making the pmap*() functions work better with
  PG_FICTITIOUS is the primary 'fix' for some of DRMs hacks.