16 months agoinitrd: cd to '/' before umounting '/var'
Aaron LI [Thu, 20 Jun 2019 13:44:11 +0000 (21:44 +0800)]
initrd: cd to '/' before umounting '/var'

The HOME in initrd is set to '/var/home', thus umounting '/var' may
fail due to device busy, although this failure would not block the boot

16 months agokernel: Add whitespace between fw_stub.awk flags and their arguments.
Sascha Wildner [Wed, 19 Jun 2019 15:51:36 +0000 (17:51 +0200)]
kernel: Add whitespace between fw_stub.awk flags and their arguments.

It's more readable in the log file.

16 months agofw_stub.awk: correct usage message
Jan Sucan [Mon, 5 Jun 2017 16:16:59 +0000 (16:16 +0000)]
fw_stub.awk: correct usage message

* Add information about optional version and parent for the firmware

* Show that the -m option is mandatory.

16 months agofw_stub.awk: fix processing of values for the options when separated by space
Jan Sucan [Mon, 5 Jun 2017 15:54:09 +0000 (15:54 +0000)]
fw_stub.awk: fix processing of values for the options when separated by space

16 months agokernel - Change fill_kinfo_lwp() and fix top
Matthew Dillon [Wed, 19 Jun 2019 05:59:07 +0000 (22:59 -0700)]
kernel - Change fill_kinfo_lwp() and fix top

* Change fill_kinfo_lwp(), an internal function used by kern_proc.c
  and libkvm, to aggregate lwp data instead of replace it.

  Note that fill_kinfo_proc() will zero the lwp sub-structure and is
  already typically called before zero or more fill_kinfo_lwp() calls,
  so the new aggregation essentially just works even though the API is
  a bit different.

  In addition, when getprocs is told to aggregate lwps the tid field
  will be set to -1 since it is not applicable in the aggregation case.

* 'top' will now properly aggregate the threads belonging to a process
  when thread mode 'H' is not in effect.

* Also allow top to display cpu percentages above 100%, since in the
  aggregation case the sum of threads can easily exceed 100% of one core.

Requested-by: hsw
16 months agoopenpam: Implement blacklist.
zrj [Tue, 18 Jun 2019 17:48:20 +0000 (20:48 +0300)]
openpam: Implement blacklist.

Mainly to avoid issues for users who might miss what `make upgrade`
warns about. Currently only includes previously active OPIE modules.
Do not include pam_cleartext_pass_ok.so it should not be relevant for
any DragonFly installations by now.

16 months agosshd - Change options defaults to be more secure
Matthew Dillon [Tue, 18 Jun 2019 18:54:08 +0000 (11:54 -0700)]
sshd - Change options defaults to be more secure

* Change the password_authentication default to 0.  Passworded logins
  are NOT considered secure by default in DragonFly.

* Put in a succinct comment for both the pam default (0) and the
  password authentication default (also 0) to try to prevent them
  from being improper changed back to 1 accidently.

16 months agoRevert "sshd(8): Add USE_PAM handling defaults."
Matthew Dillon [Tue, 18 Jun 2019 18:49:32 +0000 (11:49 -0700)]
Revert "sshd(8): Add USE_PAM handling defaults."

We really did not intend to turn on passworded logins or pam by default.
They need to be turned off by default so the sshd_config is secure by
default.  PAM generally allows passworded logins which we do not consider
secure by default.

This reverts commit 19523637df5f6eb42b41f3dee51bd5d7c25d2219.

16 months agogpt(8): Explicitly avoid out of range in searching MBR partitions
Aaron LI [Tue, 18 Jun 2019 16:30:40 +0000 (00:30 +0800)]
gpt(8): Explicitly avoid out of range in searching MBR partitions

Avoid running off the end of an array in case thing we're looking for
isn't there.  This is probably impossible, but not obvious.

Obtained-from: NetBSD
Bug-report: #3015

16 months agojail.8: Document sysctl entries jail.{allow_raw_sockets,chflags_allowed}
Aaron LI [Tue, 18 Jun 2019 16:21:11 +0000 (00:21 +0800)]
jail.8: Document sysctl entries jail.{allow_raw_sockets,chflags_allowed}

Meanwhile, update the description of "jail.chflags_allowed" in the code.

Obtained-from: FreeBSD
Bug-report: #2935

16 months agojail: Implement read-only sysctl "jail.jailed"
Aaron LI [Mon, 17 Jun 2019 14:05:41 +0000 (22:05 +0800)]
jail: Implement read-only sysctl "jail.jailed"

Implement the read-only sysctl entry 'jail.jailed', which can be used to
determine if a process is running inside a jail (value is 1) or not
(value is 0).

NOTE: The current FreeBSD has such a sysctl entry called
'security.jail.jailed'.  However, DragonFly BSD doesn't not have any
'security.jail.*' but only 'jail.*' sysctl entries.

Meanwhile, update /etc/rc to use this new sysctl entry to better deal
with the rc scripts with the 'nojail' keyword.

Also document this sysctl entry in the jail.8 man page.

This commit is based mostly on FreeBSD as well as the patch in bug
report #118.

Reviewed-by: dillon, mjg (Mateusz Guzik)
Bug-report: #118

16 months agodrm - Fix system lockup bug in signal_pending_state()
Matthew Dillon [Mon, 17 Jun 2019 22:45:59 +0000 (15:45 -0700)]
drm - Fix system lockup bug in signal_pending_state()

* Fix a system lockup bug in signal_pending_state().  It was
  possible for the routine to indicate that no signal was pending
  for an interruptible state when a signal was in fact pending,
  causing a live-lock in a lksleep() loop.

* The proper API is to allow any signal to interrupt when the
  thread is in an interruptible state and to only allow a KILL
  signal to interrupt when the thread is in a non-interruptible

Testing-by: dillon, tuxillo
Reviewed-by: ftigeot
16 months agoNuke timed(8) (and timedc(8)). It is no longer used for time setting.
Sascha Wildner [Mon, 17 Jun 2019 17:28:18 +0000 (19:28 +0200)]
Nuke timed(8) (and timedc(8)). It is no longer used for time setting.

Adjust date(1) too for the removal (based on what FreeBSD did).

16 months 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()

16 months 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.

16 months 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.

16 months 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
16 months 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.

16 months 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/.

16 months 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.

16 months 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

16 months 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.

16 months 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

16 months 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

16 months 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.

16 months 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.

16 months 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 (+)

Bug-report: #2977

16 months 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

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

Requested-by: aly
16 months 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
16 months 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).

16 months 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

16 months 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
16 months 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:

Submitted-by: daftaupe
Bug-report: #3159

16 months 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

16 months 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

16 months 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

16 months 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

16 months 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

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

16 months 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.

16 months 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

16 months 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.

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

16 months 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.

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

16 months 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.

16 months 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.

16 months 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.

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

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

16 months 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.

16 months 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
16 months 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.

16 months 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.

16 months 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
16 months 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.

16 months 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.

16 months 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().

16 months 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

16 months 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.

16 months 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.

16 months 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

16 months 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.

16 months 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.

16 months 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>.

16 months 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>.

16 months 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.

16 months 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.

16 months 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.

16 months 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

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

16 months 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.

16 months 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()

16 months 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.

16 months 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
16 months 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.

16 months 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()

16 months 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()

16 months 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()

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

16 months 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

16 months 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

16 months 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.
16 months 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

  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.

16 months 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.

16 months 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>.

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

16 months 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.

16 months 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
16 months 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.

16 months 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.

16 months 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.

16 months 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
16 months 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.

16 months 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.

16 months 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)

16 months 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

Testing-with: sysutils/pv (via zrj)

16 months 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
17 months 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.

17 months 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.

17 months 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.