dragonfly.git
5 years agoRemove timezone typo via 'make upgrade'.
Sascha Wildner [Thu, 4 Apr 2019 06:22:47 +0000 (08:22 +0200)]
Remove timezone typo via 'make upgrade'.

5 years agosys/vfs/fuse: Drop PCATCH from tsleep on waiting IPC completion
Tomohiro Kusumi [Tue, 2 Apr 2019 15:30:11 +0000 (00:30 +0900)]
sys/vfs/fuse: Drop PCATCH from tsleep on waiting IPC completion

Even with kern_sigprocmask(SIG_BLOCK) called prior to tsleep(9),
tsleep with PCATCH flag can still catch a signal (e.g. SIGINT) and
return 0 (not EINTR).

This is due to tsleep(9) setting "lp->lwp_flags |= LWP_SINTR;" before
going into sleep when PCATCH is specified.

When this happens, KKASSERT() after tsleep(9) can be false, so just
drop PCATCH.

5 years agokernel - Add AC256 (sound) quirk
Matthew Dillon [Tue, 2 Apr 2019 23:00:06 +0000 (16:00 -0700)]
kernel - Add AC256 (sound) quirk

* Add quirk for AC256 sound devices.

Taken-from: FreeBSD
Tested-by: drill-use@irc
5 years agoSync ACPICA with Intel's version 20190329.
Sascha Wildner [Tue, 2 Apr 2019 16:31:40 +0000 (18:31 +0200)]
Sync ACPICA with Intel's version 20190329.

* Improve namespace support: Remove address nodes from global list
  after method termination to properly remove Operation Region nodes
  that are declared dynamically.

* Some improvements in iasl(8) and acpiexec(8).

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

Thanks to zrj for testing.

5 years agoSync zoneinfo database with tzdata2019a from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Tue, 2 Apr 2019 16:11:55 +0000 (18:11 +0200)]
Sync zoneinfo database with tzdata2019a from ftp://ftp.iana.org/tz/releases

* Palestine will not start DST until 2019-03-30, instead of 2019-03-23 as
  previously predicted.

* Metlakatla rejoined Alaska Time (from previously Pacific Standard Time)
  on 2019-01-20.

* Affecting older timestamps only: Israel observed DST in 1980 and 1984.

For a detailed list of changes, see share/zoneinfo/NEWS.

5 years agosys/vfs: Remove .vop_mmap implementations
Tomohiro Kusumi [Mon, 1 Apr 2019 17:40:27 +0000 (02:40 +0900)]
sys/vfs: Remove .vop_mmap implementations

These either return EINVAL or panic.
VOP_MMAP() is unused in the first place.

(FreeBSD got rid of VOP_MMAP() entirely in 2000.)
--
commit 1afa7eea2714a80f7f460a084f2dd793df48a236
Author: eivind <eivind@FreeBSD.org>
Date:   Wed Nov 1 17:57:24 2000 +0000

    Give vop_mmap an untimely death.  The opportunity to give it a timely
    death timed out in 1996.

5 years agosys/vfs/fuse: Add fuse_vop_{get,put}pages()
Tomohiro Kusumi [Mon, 1 Apr 2019 17:31:59 +0000 (02:31 +0900)]
sys/vfs/fuse: Add fuse_vop_{get,put}pages()

No functional changes (yet).

5 years agosys/vfs/fuse: Add assertions
Tomohiro Kusumi [Mon, 1 Apr 2019 17:25:07 +0000 (02:25 +0900)]
sys/vfs/fuse: Add assertions

5 years agosys/vfs/fuse: Cleanup (use TAILQ_FOREACH())
Tomohiro Kusumi [Mon, 1 Apr 2019 15:25:36 +0000 (00:25 +0900)]
sys/vfs/fuse: Cleanup (use TAILQ_FOREACH())

Didn't need to use safe version.

5 years agolapic: Don't do AMD C1E fixup on virtual machines by default.
Sepherosa Ziehau [Mon, 1 Apr 2019 12:29:39 +0000 (20:29 +0800)]
lapic: Don't do AMD C1E fixup on virtual machines by default.

Host should already have fixed it up.

This is a follow-up fix for:
cb46bbd1802f449d255ccfb68937b5f3f2284584

5 years agorc.d/sysctl: Use buffer to print out the sysctl changes.
zrj [Mon, 1 Apr 2019 09:14:02 +0000 (12:14 +0300)]
rc.d/sysctl: Use buffer to print out the sysctl changes.

Fixes output in logs (does not break lines).

5 years agoClean up some gcc50 remains.
Sascha Wildner [Mon, 1 Apr 2019 08:54:47 +0000 (10:54 +0200)]
Clean up some gcc50 remains.

5 years agokernel - Add LAPIC timer C1E test skip for AWS
Matthew Dillon [Sun, 31 Mar 2019 22:35:02 +0000 (15:35 -0700)]
kernel - Add LAPIC timer C1E test skip for AWS

* AWS's new EPYC instances (such as m5ad.large) will general-protect
  fault on the MSR we use to test lapic C1E.  For now introduce a
  tunable that allows this test to be turned off.

* AWS instances should put 'hw.lapic_timer_c1e_test=0' in
  /boot/loader.conf

* Allows DFly to boot on AWS as of ami-027940491fc788325 on us-east
  N. Virginia.

5 years agoMove <sys/termios.h> to <termios.h>.
Sascha Wildner [Sun, 31 Mar 2019 18:37:28 +0000 (20:37 +0200)]
Move <sys/termios.h> to <termios.h>.

CCEQ() is moved to <sys/_termios.h>. The kernel needs nothing else from
it.

The few dports that were including <sys/termios.h> were mostly missing
some kind of "... || defined(__DragonFly__)" to go with FreeBSD's
adjustments.

Thanks to zrj and tuxillo for taking care of dports.

5 years agosys/vfs/fuse: Add initial FUSE support
Tomohiro Kusumi [Sun, 31 Mar 2019 16:30:07 +0000 (01:30 +0900)]
sys/vfs/fuse: Add initial FUSE support

The basic code design comes from FreeBSD, but the code is written
from scratch. It was just easier to write from scratch than trying to
port sys/fs/fuse/* in FreeBSD for various reasons. Note that this is
to implement FUSE API/ABI, but not to be compatible with FreeBSD
implementation which contains FreeBSD specific sysctls, etc.

The initial version doesn't support FUSE_WRITE by disabling
VOP_WRITE() by returning EOPNOTSUPP. It currently works with simple
write(2) calls like dd(1) via direct I/O, but not when syncer thread
or mmap(2) gets involved under non trivial conditions. It looks to
be doable with custom VOP_GETPAGES() and VOP_PUTPAGES(), but if not
then it requires some changes to sys/kern/* and sys/vm/* to properly
support writes.

Besides above, this initial version supports basic FUSE operations
invoked from file related system calls via FUSE VOP's, but not things
like FUSE_IOCTL, FUSE_POLL, FUSE_FALLOCATE, etc. Although dmesg says
FUSE 7.28, don't expect it to support everything 7.28 (or anywhere
close to 7.28) says it has.

FUSE will be dropped from DragonFly releases until it gets stabilized
to certain extent including above, at least for write support.

5 years agosys/kern: Add struct file* arg to VOP_{GETATTR,SETATTR,READ,WRITE,FSYNC,READDIR}
Tomohiro Kusumi [Sun, 31 Mar 2019 16:30:07 +0000 (01:30 +0900)]
sys/kern: Add struct file* arg to VOP_{GETATTR,SETATTR,READ,WRITE,FSYNC,READDIR}

This commit changes VOP interface to support FUSE API/ABI.
It just adds an additional struct file* argument to VOP's, so that
FUSE VOP's can access *fp pointer (currently accessible only from
caller of VOP's if any, with exception of VOP_OPEN(), VOP_CLOSE(),
etc) and make use of its ->private_data pointer.

FUSE API/ABI requires FUSE to maintain a per file (usually per file
descriptor) data called fh. The fh is an opaque data whose purpose
may differ among userspace filesystems, but typically used to store
file descriptor value or arbitrary userspace address used by the
userspace filesystem process.

Below diagram illustrates typical flow of maintaining fh. The
userspace filesystem uses fd obtained from opening backing store
(e.g fd for regular file, socket, etc) for fh, as a consequence of
end user's open(2) syscall, and expects FUSE to maintain that value
for future use as an identifier for userspace.

* Notes on Linux VFS I/F vs BSD VFS I/F:
In Linux, supporting the concept of fh is quite straight forward since
Linux kernel has functions vector built around (opened)file including
things like mmap(2) handler, in addition to a vector built around
inode.

But since DragonFly doesn't have a vector built around file (other
than a simple struct fileops, which doesn't meet requirements of fh),
this change was needed for selected VOP's as minimum requirements
for initial FUSE API/ABI support.

--
FUSE user                  FUSE                       FUSE userspace fs
|                          |                          |
|---------open(2)--------->|                          |
| * issue VOP_OPEN         |---------VOP_OPEN-------->|
|                          | * issue FUSE_OPEN        | * open something
|                          |                          | * reply fd as fh
|                          |<--------VOP_OPEN---------|
|<--------open(2)----------| * store fh in fp         |
| * open success           |                          |
|                          |                          |
|...                       |                          |
|...                       |                          |
|                          |                          |
|---------read(2)--------->|                          |
| * issue VOP_READ         |---------VOP_READ-------->|
|                          | * issue FUSE_READ        |
|                          |   with fh from fp        | * read something
|                          |                          |   using fh for fd
|                          |<--------VOP_READ---------|
|<--------read(2)----------| * return read bytes      |
| * uiomove() success      |                          |
|                          |                          |

5 years agokernel: Remove two duplicate #include's.
Sascha Wildner [Sat, 30 Mar 2019 17:51:46 +0000 (18:51 +0100)]
kernel: Remove two duplicate #include's.

5 years agocallout.9: Fix callout_terminate() prototype.
Sascha Wildner [Sat, 30 Mar 2019 16:57:09 +0000 (17:57 +0100)]
callout.9: Fix callout_terminate() prototype.

5 years agokernel - Fix panic in uhci attach error path (2)
Matthew Dillon [Sat, 30 Mar 2019 03:21:39 +0000 (20:21 -0700)]
kernel - Fix panic in uhci attach error path (2)

* Add missing header file for last commit.

5 years agodrm/ttm: Sync with Linux 3.16
François Tigeot [Fri, 29 Mar 2019 21:26:33 +0000 (22:26 +0100)]
drm/ttm: Sync with Linux 3.16

5 years agocallout.9: Remove an unneeded .Pp (before .It). Also bump .Dd.
Sascha Wildner [Fri, 29 Mar 2019 20:51:19 +0000 (21:51 +0100)]
callout.9: Remove an unneeded .Pp (before .It). Also bump .Dd.

5 years agodrm/linux: Add some shrinker stub code
François Tigeot [Fri, 29 Mar 2019 20:03:21 +0000 (21:03 +0100)]
drm/linux: Add some shrinker stub code

5 years agokernel - Fix panic in uhci attach error path
Matthew Dillon [Fri, 29 Mar 2019 16:52:51 +0000 (09:52 -0700)]
kernel - Fix panic in uhci attach error path

* Fix a panic in uhci's attach error path for an early failure
  case.  uhci was trying to release a non-existant irq.

Reported-by: peeter007, zrj
5 years agoAdjust for the removal of callout_stop_sync().
Sascha Wildner [Fri, 29 Mar 2019 16:23:48 +0000 (17:23 +0100)]
Adjust for the removal of callout_stop_sync().

* Remove the manual page via 'make upgrade'.

* Update porting_drivers.txt

5 years agokernel/netgraph7: Fix the build after the recent callout changes.
Sascha Wildner [Thu, 28 Mar 2019 21:56:58 +0000 (22:56 +0100)]
kernel/netgraph7: Fix the build after the recent callout changes.

5 years agokernel - Add callout API calls for netgraph7 (2)
Matthew Dillon [Thu, 28 Mar 2019 21:38:59 +0000 (14:38 -0700)]
kernel - Add callout API calls for netgraph7 (2)

* Obviously we have to choose rarg/rfunc or qarg/qfunc.
  From examining the two use cases, select qarg/qfunc.

5 years agokernel - Add callout API calls for netgraph7
Matthew Dillon [Thu, 28 Mar 2019 19:46:54 +0000 (12:46 -0700)]
kernel - Add callout API calls for netgraph7

* Add a few more API calls to callout to support
  netgraph7's abuse of the mechanism.

Reported-by: swildner
5 years agokernel - make bcmp linux-compatible, add memcmp
Matthew Dillon [Thu, 28 Mar 2019 06:45:38 +0000 (23:45 -0700)]
kernel - make bcmp linux-compatible, add memcmp
world  - make bcmp linux-compatible

* Make bcmp and memcmp the same.  Our bcmp() was returning
  0 or 1 (not subtracting the last byte), which is compatible
  with the manual page but it isn't what linux does.

* It also looks like memcmp is sometimes turned into bcmp by
  the compiler (?), at least when compiling the kernel, so
  we don't want to break that either.

* Add memcmp to the kernel build, synchronize both memcmp and bcmp
  from libc.

* This makes our bcmp compatible with linux.

5 years agokernel - Try to ensure a uniform fsid for exports (2)
Matthew Dillon [Thu, 28 Mar 2019 06:06:30 +0000 (23:06 -0700)]
kernel - Try to ensure a uniform fsid for exports (2)

* Just use a direct fsid.val[0]/val[1] comparison for now.

  Fixes NFS exports.  kernel compile is converting memcmp to
  bcmp but bcmp doesn't returned a signed value.  Will have to
  check compatibility issues and fix in a follow-up commit.

5 years agokernel - Try to ensure a uniform fsid for exports
Matthew Dillon [Thu, 28 Mar 2019 05:16:01 +0000 (22:16 -0700)]
kernel - Try to ensure a uniform fsid for exports

* For filesystems which do not generate their own fsid (hammer2, tmpfs,
  others) we generate a fsid based on the mount path.

* Ensure fsid is uniquified when inserting onto the mount list.
  Collisions should be rare but the hash is only around 24 bits.

* Index the mount structure on a RB tree via the fsid.

5 years agokernel - Rewrite the callout_*() API (4)
Matthew Dillon [Thu, 28 Mar 2019 03:01:46 +0000 (20:01 -0700)]
kernel - Rewrite the callout_*() API (4)

* Remove a debugging kprintf().

5 years agokernel - Rewrite the callout_*() API (3)
Matthew Dillon [Wed, 27 Mar 2019 23:26:06 +0000 (16:26 -0700)]
kernel - Rewrite the callout_*() API (3)

* Fix callout_reset_bycpu() (it was queueing to the current cpu
  instead of the specified cpu).

5 years agoman9/Makefile: Remove wrong backslash.
Sascha Wildner [Wed, 27 Mar 2019 19:19:02 +0000 (20:19 +0100)]
man9/Makefile: Remove wrong backslash.

Introduced in eb67213abec698ffb555ee926f2761bcb7e95f55.

While here, sort callout.9 MLINKS.

Reported-by: zrj
5 years agomtree/BSD.usr.dist: Sort.
Sascha Wildner [Wed, 27 Mar 2019 17:59:47 +0000 (18:59 +0100)]
mtree/BSD.usr.dist: Sort.

5 years agoworld - Add missing sample file for aws imaging script
Matthew Dillon [Wed, 27 Mar 2019 17:50:14 +0000 (10:50 -0700)]
world - Add missing sample file for aws imaging script

* Add missing sample file for aws imaging script.

* Add missing mtree directory for above.

* Fixes installworld

5 years agokernel - Fix more wiring / fictitious bugs w/recent VM work
Matthew Dillon [Wed, 27 Mar 2019 17:32:05 +0000 (10:32 -0700)]
kernel - Fix more wiring / fictitious bugs w/recent VM work

* Fictitious pages cannot be placed on any VM paging queue,
  assert this and fix a few places where it could.

* This will remove most of the 'Encountered wired page %p on queue'
  warnings reported.  This kprintf() is still in place for the moment
  because generally speaking pages should be unwired before VM objects
  are destroyed.

  But other than VM object destruction, its actually ok for wired pages
  to be on the paging queues now.

5 years agokernel - Rewrite the callout_*() API (2)
Matthew Dillon [Wed, 27 Mar 2019 17:10:39 +0000 (10:10 -0700)]
kernel - Rewrite the callout_*() API (2)

* Fix misc issues, particularly synchronous stalls in tsleep
  due to races.  Also some of the flag accounting was broken,
  and STOP was not properly overriding a queued RESET.

5 years agoworld - Fix fstat and gcore
Matthew Dillon [Wed, 27 Mar 2019 17:08:25 +0000 (10:08 -0700)]
world - Fix fstat and gcore

* fstat needs to iterate vm_map_entry's
  via the RB tree, but it isn't entirely trivial because we
  have to kread().

* gcore needs to steal a different field for its iterator
  when building a map from procfs.

* Fixes buildworld.

Reported-by: zrj
5 years agoRevert "fstat(1): Convert to RB_FOREACH() for memory maps."
Matthew Dillon [Wed, 27 Mar 2019 17:05:27 +0000 (10:05 -0700)]
Revert "fstat(1): Convert to RB_FOREACH() for memory maps."

This reverts commit b8459d8490f9cd3174dc62a0e1ac4bae85da83b9.

This won't work because the pointers are in kvm, will commit
a rewrite in a sec.

5 years agovkernel64: Sync to recent API changes.
zrj [Wed, 27 Mar 2019 12:22:32 +0000 (14:22 +0200)]
vkernel64: Sync to recent API changes.

5 years agofstat(1): Convert to RB_FOREACH() for memory maps.
zrj [Wed, 27 Mar 2019 09:48:02 +0000 (11:48 +0200)]
fstat(1): Convert to RB_FOREACH() for memory maps.

After 47ec0953d00a4e55498312418ed65d3aadc9cc8a kernel change.

5 years ago<sys/callout.h>: Add missing <sys/spinlock.h> include.
zrj [Wed, 27 Mar 2019 09:39:49 +0000 (11:39 +0200)]
<sys/callout.h>: Add missing <sys/spinlock.h> include.

Needed for userland tools after:
eb67213abec698ffb555ee926f2761bcb7e95f55

5 years agofdisk.8: Update DragonFly slice type to 108 (6C)
Aaron LI [Wed, 27 Mar 2019 08:27:14 +0000 (16:27 +0800)]
fdisk.8: Update DragonFly slice type to 108 (6C)

5 years agokernel - Rewrite the callout_*() API
Matthew Dillon [Tue, 26 Mar 2019 21:11:56 +0000 (14:11 -0700)]
kernel - Rewrite the callout_*() API

* Rewrite the entire API from scratch and improve compatibility
  with FreeBSD.  This is not an attempt to achieve full API compatibility,
  as FreeBSD's API has unnecessary complexity that coders would frequently
  make mistakes interpreting.

* Remove the IPI mechanisms in favor of fine-grained spin-locks instead.

* Add some robustness features in an attempt to track down corrupted
  callwheel lists due to originating subsystems freeing structures out
  from under an active callout.

* The code supports a full-blown type-stable/adhoc-reuse structural
  separation between the front-end and the back-end, but this feature
  is currently not operational and may be removed at some future point.
  Instead we currently just embed the struct _callout inside the
  struct callout.

* Replace callout_stop_sync() with callout_cancel().

* callout_drain() is now implemented as a synchronous cancel instead
  of an asynchronous stop, which is closer to the FreeBSD API and
  expected operation for ported code (usb stack in particular).  We
  will just have to fix any deadlocks which we come across.

* Retain our callout_terminate() function as the 'better' way to
  stop using a callout, as it will not only cancel the callout but
  also de-flag the structure so it can no longer be used.

5 years agokernel - Refactor swapcache heuristic
Matthew Dillon [Sun, 24 Mar 2019 05:57:02 +0000 (22:57 -0700)]
kernel - Refactor swapcache heuristic

* Refactor the swapcache inactive queue heuristic to remove a
  write to a global variable that is in the critical path, and
  to improve operation.  This should reduce cpu cache ping-ponging.

* Change vpgqueues.lcnt from an int to a long, change misc use
  cases in the pageout code to a long.

* Use __aligned(64) to 64-byte-align vm_page_queues[].  It was
  previously only 32-byte aligned.

5 years agokernel - Preliminary vm_page hash lookup (2), cleanups, page wiring
Matthew Dillon [Sat, 23 Mar 2019 22:29:14 +0000 (15:29 -0700)]
kernel - Preliminary vm_page hash lookup (2), cleanups, page wiring

* Correct a bug in vm.fault_quick operation.  Soft-busied pages cannot
  be safely wired or unwired.  This fixes a wire/unwire race related panic.

* Optimize vm_page_unhold() to normally not have to obtain any spin-locks
  at all, since related pages are almost never in the PQ_HOLD VM page
  queue.  This leaves open a minor race condition where pages with
  a hold_count of 0 can accumulate in PQ_HOLD.

* Add vm_page_scan_hold() to the pageout daemon.  Unconditionally scan
  PQ_HOLD very slowly to remove any pages whos hold_count is 0.

* REFACTOR PAGE WIRING.  Wiring vm_page's no longer removes them from
  whatever paging queue they are on.  Instead, proactively remove
  such pages from the queue only when we need to (typically in the
  pageout code).

* Remove unused PV_FLAG_VMOBJECT.

* Fix missing atomic-op in pc64/x86_64/efirt.c

* Do not use m->md.pv_list for pagetable pages.  It is now only used for
  terminal pages.

* Properly initialize pv_flags to 0 when a pv_entry is allocated.

* Add debugging to detect managed pmap_enter()s without an object.

* Conditionalize the setting of PG_MAPPED and PG_WRITEABLE in the
  pmap code to avoid unnecessary cpu cache mastership changes.

* Move assertions in vm_pageout.c that could trigger improperly due
  to a race.

5 years agokernel - Optimize vm_page_wakeup(), vm_page_hold(), vm_page_unhold()
Matthew Dillon [Sat, 23 Mar 2019 21:11:42 +0000 (14:11 -0700)]
kernel - Optimize vm_page_wakeup(), vm_page_hold(), vm_page_unhold()

* vm_page_wakeup() does not need to acquire the vm_page spin-lock.
  The caller holding the page busied is sufficient.

* vm_page_hold() does not need to acquire the vm_page spin-lock as
  the caller is expected to hold the page busied, soft-busied,
  or stabilized via an interlock (such as the vm_object interlock).

* vm_page_unhold() only needs to acquire the vm_page spin-lock on
  the 1->0 transition of m->hold_count.

5 years agokernel - Preliminary vm_page hash lookup
Matthew Dillon [Sat, 23 Mar 2019 18:37:36 +0000 (11:37 -0700)]
kernel - Preliminary vm_page hash lookup

* Add preliminary vm_page hash lookup code which avoids most
  locks, plus support in vm_fault.  Default disabled, with debugging
  for now.

* This code still soft-busies the vm_page, which is an improvement over
  hard-busying it in that it won't contend, but we will eventually want
  to entirely avoid all atomic ops on the vm_page to *really* get the
  concurrent fault performance.

5 years agokernel - Refactor vm_map structure 1/2
Matthew Dillon [Sat, 23 Mar 2019 02:50:07 +0000 (19:50 -0700)]
kernel - Refactor vm_map structure 1/2

* Remove the embedded vm_map_entry 'header' from vm_map.

* Remove the prev and next fields from vm_map_entry.

* Refactor the code to iterate only via the RB tree.  This is not as
  optimal as the prev/next fields were, but we can improve the RB tree
  code later to recover the performance.

5 years agokernel - Fix df and unmount of bad NFS volumes
Matthew Dillon [Wed, 27 Mar 2019 02:33:03 +0000 (19:33 -0700)]
kernel - Fix df and unmount of bad NFS volumes

* Fix an issue where a bad filesystem would not be listed in the
  df output due to the vfsstat refresh failing.  Allow vfsstat refreshes
  to fail.

* Fix an issue where a NFS mount that goes bad could not be unmounted
  due to the path lookup failing with EBADRPC, ESTALE, or EIO.  These
  may now be unmounted with umount -f ...

5 years agowait.2: Fix excessive .Dv usage. Use proper markup.
Sascha Wildner [Tue, 26 Mar 2019 09:15:24 +0000 (10:15 +0100)]
wait.2: Fix excessive .Dv usage. Use proper markup.

5 years agokernel: Clean up the usage of <machine/pc/bios.h> and the header itself.
Sascha Wildner [Mon, 25 Mar 2019 17:51:08 +0000 (18:51 +0100)]
kernel: Clean up the usage of <machine/pc/bios.h> and the header itself.

* In the boot code, use defines from this header instead of keeping local
  ones.

* In acpi_machdep.c, remove an unneeded inclusion of the header.

* Remove unused stuff from the header.

Reported-by: zrj
5 years agoipfw(8): Remove unnecessary cast.
Sascha Wildner [Mon, 25 Mar 2019 10:21:27 +0000 (11:21 +0100)]
ipfw(8): Remove unnecessary cast.

5 years agodumpfs(8): Fix conversion of 32 bit ufs_time_t's with ctime().
Sascha Wildner [Mon, 25 Mar 2019 09:16:53 +0000 (10:16 +0100)]
dumpfs(8): Fix conversion of 32 bit ufs_time_t's with ctime().

Data from neighboring fields was leaking in, leading to odd dates.

5 years agokernel/pc64: Remove leftover debug kprintf.
zrj [Sun, 24 Mar 2019 12:10:16 +0000 (14:10 +0200)]
kernel/pc64: Remove leftover debug kprintf.

5 years agokernel: Fix indent.
Sascha Wildner [Sun, 24 Mar 2019 13:28:18 +0000 (14:28 +0100)]
kernel: Fix indent.

5 years agosysctl(8): Add support for char and short sized values.
Sascha Wildner [Sat, 23 Mar 2019 21:47:26 +0000 (22:47 +0100)]
sysctl(8): Add support for char and short sized values.

This was missing from 347aefc6a85af5bf5b7a1a6918f706878a8232ef.

Reported-by: zrj
5 years agodrm/ttm: Remove unused headers
François Tigeot [Sat, 23 Mar 2019 19:28:22 +0000 (20:28 +0100)]
drm/ttm: Remove unused headers

Reminded-by: swildner
5 years agodrm/ttm: Remove two useless files
François Tigeot [Sat, 23 Mar 2019 11:44:08 +0000 (12:44 +0100)]
drm/ttm: Remove two useless files

5 years agodrm/linux: Add atomic_long_inc_not_zero()
François Tigeot [Sat, 23 Mar 2019 11:36:37 +0000 (12:36 +0100)]
drm/linux: Add atomic_long_inc_not_zero()

Obtained-from: FreeBSD

5 years agogcc47: Add local -save-temps=objects option.
zrj [Wed, 20 Mar 2019 06:29:42 +0000 (08:29 +0200)]
gcc47: Add local -save-temps=objects option.

Just for convenience, same as in:
df642abc046981dfea4020a80f466a1acc7607ca

5 years agogcc80: Add local -save-temps=objects option.
zrj [Wed, 20 Mar 2019 06:08:06 +0000 (08:08 +0200)]
gcc80: Add local -save-temps=objects option.

The gcc currently supports -save-temps= cwd, obj, object(not documented).
None of those variants can be used at all during buildworld sequence,
even at serial buildworld, without interfering with build in funny ways.
This is very easy to notice while compiling libraries, where rules are:
 * foo.c --> foo.o  (non-pic)
 * foo.c --> foo.So (pic)
 * foo.c --> foo.po (profiled)

The added option forces to use full object name (if it was supplied)
when constructing names for .s and .i intermediates, as follows:
 cc -c foo.c -o foo.o --> foo.o.s + foo.o.i
This allows to use -save-temps globally during buildworld and it is
*less* likely to interfere while producing normally created objects.
Repeated quickworld likely *will* have side effects, because the '-o'
flags are not used for kernel and programs (foo.s will shadow foo.c).

Tested by binary comparing /usr/obj trees for differences.

5 years agocsu: Expand .note section manipulation.
zrj [Wed, 20 Mar 2019 06:03:30 +0000 (08:03 +0200)]
csu: Expand .note section manipulation.

No functional change.

5 years agosmbfs - Bring in some string safety and type-o corrections
Matthew Dillon [Wed, 20 Mar 2019 05:40:30 +0000 (22:40 -0700)]
smbfs - Bring in some string safety and type-o corrections

* Bring in some string safety fixes and type-o corrections from
  FreeBSD.

Submitted-by: Varun C H
Taken-from: FreeBSD

5 years agopthreads - sleep() needs strong reference
Matthew Dillon [Wed, 20 Mar 2019 05:34:47 +0000 (22:34 -0700)]
pthreads - sleep() needs strong reference

* Fix problem with sleep() not canceling due to missing strong
  reference.

Reported-by: godfrey
5 years agoministat(1): Fix terminal width handling
Aaron LI [Wed, 20 Mar 2019 05:12:52 +0000 (13:12 +0800)]
ministat(1): Fix terminal width handling

ministat(1) will prefer to get the terminal width from the "COLUMNS"
environment variable, in which case the plot will overflow by 2 columns
because the plot frame is not considered.  Fix this issue.

However, in Emacs's "shell" mode (not the "term" mode), the plot will
still overflow because Emacs puts a '\' at the right-most column.  One
can manually modify the "COLUMNS" environment variable or use the "-w"
option to workaround this issue.

Reported-by: swildner
5 years agohammer2 - Fix panic on corrupt root inode on mount
Matthew Dillon [Wed, 20 Mar 2019 04:40:24 +0000 (21:40 -0700)]
hammer2 - Fix panic on corrupt root inode on mount

* If the root inode is corrupt at mount time H2 was panicing
  instead of cleanly aborting.  Fixed by adding missing initialization.

* This case can occur when the device is partially overwritten by
  a dd or another filesystem.  Redundant volume headers may still alow
  H2 to find one, but the iroot might reside at a lower block number and
  already have been blown away.

Reported-by: BJoe / Bug #3181
5 years agoRemove a deleted header via 'make upgrade'.
Sascha Wildner [Tue, 19 Mar 2019 21:21:01 +0000 (22:21 +0100)]
Remove a deleted header via 'make upgrade'.

5 years agogcc50: Retire sources and makefiles.
zrj [Tue, 19 Mar 2019 14:01:32 +0000 (14:01 +0000)]
gcc50: Retire sources and makefiles.

5 years agogcc50: Disconnect from buildworld.
zrj [Tue, 19 Mar 2019 13:48:09 +0000 (13:48 +0000)]
gcc50: Disconnect from buildworld.

You served us good.

5 years agokvm.3: More markup. Also begin sentences on a new line.
Sascha Wildner [Tue, 19 Mar 2019 09:52:22 +0000 (10:52 +0100)]
kvm.3: More markup. Also begin sentences on a new line.

5 years agokvm.3: Remove unnecessary argument to .Nm
Sascha Wildner [Tue, 19 Mar 2019 09:49:48 +0000 (10:49 +0100)]
kvm.3: Remove unnecessary argument to .Nm

5 years agolibc - Update manual page for wait.2
Matthew Dillon [Mon, 18 Mar 2019 21:00:59 +0000 (14:00 -0700)]
libc - Update manual page for wait.2

* Update the manual page for wait.2, properly describing the
  si_code and si_status fields of the siginfo_t structure to
  match recent fixes.

5 years agokernel - Fix info->si_code for waitid() (2)
Matthew Dillon [Mon, 18 Mar 2019 20:43:41 +0000 (13:43 -0700)]
kernel - Fix info->si_code for waitid() (2)

* Our si_status was W*() encoded, but linux does not W*() encode
  theirs.

  Do not W*() encode ours either.  Also properly decode the exit signal
  and exit code.

5 years agokernel - Fix info->si_code for waitid()
Matthew Dillon [Mon, 18 Mar 2019 20:05:18 +0000 (13:05 -0700)]
kernel - Fix info->si_code for waitid()

* info->si_code was improperly setting CLD_KILLED for normal exit()s
  with non-zero exit codes.

Reported-by: tuxillo
5 years agoRemove the unhooked/-used man(1) command from usr.bin.
Sascha Wildner [Mon, 18 Mar 2019 09:22:14 +0000 (10:22 +0100)]
Remove the unhooked/-used man(1) command from usr.bin.

It was added in 2013 but not continued on. I will soon replace the man(1)
we use (in gnu/usr.bin) with FreeBSD's.

5 years agokernel: Remove a no longer needed header file.
Sascha Wildner [Mon, 18 Mar 2019 09:18:35 +0000 (10:18 +0100)]
kernel: Remove a no longer needed header file.

5 years agoRemove /usr/share/misc/man.template.
Sascha Wildner [Sun, 17 Mar 2019 14:19:14 +0000 (15:19 +0100)]
Remove /usr/share/misc/man.template.

We don't write new manpages with these macros.

5 years agodrm/ttm: Sync ttm_bo_man_put_node() with Linux 3.18
François Tigeot [Sun, 17 Mar 2019 14:06:06 +0000 (15:06 +0100)]
drm/ttm: Sync ttm_bo_man_put_node() with Linux 3.18

5 years agorcsfile.5: Fix mandoc -Wunsupp warning.
Sascha Wildner [Sun, 17 Mar 2019 14:05:10 +0000 (15:05 +0100)]
rcsfile.5: Fix mandoc -Wunsupp warning.

5 years agomandoc(1): Further adjustments.
Sascha Wildner [Sun, 17 Mar 2019 13:03:45 +0000 (14:03 +0100)]
mandoc(1): Further adjustments.

* Add some libraries we reference with .Lb.

* Add mandoc(1)'s makewhatis.8 to the yet unused manual pages.

5 years agoLocal adjustments for the mandoc(1) upgrade.
Sascha Wildner [Sun, 17 Mar 2019 12:32:50 +0000 (13:32 +0100)]
Local adjustments for the mandoc(1) upgrade.

5 years agoMerge branch 'vendor/MDOCML'
Sascha Wildner [Sun, 17 Mar 2019 12:31:04 +0000 (13:31 +0100)]
Merge branch 'vendor/MDOCML'

5 years agoImport mandoc-1.14.5 and leave only the files we need.
Sascha Wildner [Sun, 17 Mar 2019 11:18:18 +0000 (12:18 +0100)]
Import mandoc-1.14.5 and leave only the files we need.

It is in preparation for eventually switching to it for manual page
displaying.

5 years agoFix some typos in manpages/messages.
Sascha Wildner [Sun, 17 Mar 2019 00:18:41 +0000 (01:18 +0100)]
Fix some typos in manpages/messages.

5 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 17 Mar 2019 00:10:26 +0000 (01:10 +0100)]
Update the pciconf(8) database.

March 14, 2019 snapshot from https://pci-ids.ucw.cz

5 years agoidr.9: Fix idr_remove() prototype.
Sascha Wildner [Sat, 16 Mar 2019 09:02:20 +0000 (10:02 +0100)]
idr.9: Fix idr_remove() prototype.

5 years agodrm/linux: Improve linux/wait.h
François Tigeot [Sat, 16 Mar 2019 07:19:00 +0000 (08:19 +0100)]
drm/linux: Improve linux/wait.h

5 years agodrm/linux: Add ATOMIC_INIT()
François Tigeot [Fri, 15 Mar 2019 20:01:19 +0000 (21:01 +0100)]
drm/linux: Add ATOMIC_INIT()

5 years agoImport ministat(1) from FreeBSD
Aaron LI [Fri, 15 Mar 2019 06:29:33 +0000 (14:29 +0800)]
Import ministat(1) from FreeBSD

This utility calculates fundamental statistical properties of the input
data and determines whether or not there is statistical difference
between them.

From the HISTORY section of the man page:
"The ministat command was written by Poul-Henning Kamp out of
frustration over all the bogus benchmark claims made by people with no
understanding of the importance of uncertainty and statistics."

5 years agoi386 removal, part 71/x: Remove legacy FreeBSD brand.
Sascha Wildner [Thu, 14 Mar 2019 21:11:33 +0000 (22:11 +0100)]
i386 removal, part 71/x: Remove legacy FreeBSD brand.

We had a compat layer in i386 that was intended to run old DragonFly
binaries from <1.2 times if my memory serves well. That also worked
with FreeBSD 4.x binaries. It was removed in part 7 and 8 of this
commit series.

This commit reverts cee191cabfed209fdad9972bd88be5b18e310361.

It also removes all references to ld-elf.so.1.

Reported-by: zrj
5 years agodrm/ttm: convert to unified vma offset manager
Matthew Dillon [Sat, 9 Mar 2019 19:09:14 +0000 (11:09 -0800)]
drm/ttm: convert to unified vma offset manager

* Add TTM_BO_PRIV_FLAG_ACTIVE.

* Changes so we can use more of the linux ttm_bo_vm.c code.  Fake
  struct vm_fault, fake struct vm_operations_struct, and adjust
  struct vm_area_struct.  Also add related flags.

  The VM interface to DragonFlyBSD is now (mostly) a wrapper around
  the linux code.

* The linux red/black tree code uses some of the DFly RB macros.
  This means that struct rb_root must be compatible.  Add missing
  fields.  This fixes RB_REMOVE breakage due to it trying to iterate
  rbh_inprog.

* Add set_need_resched() (empty)

* radeon_bo_is_reserved() is no longer applicable and has been removed,
  allowing us to avoid implementintg ttm_bo_is_reserved().  Note that
  linux-current does not have these functions.

* Refactor radeon_do_test_moves() so reflect the linux code a bit
  better.  This fixes a few error paths.

* radeon_verify_access() remains empty.  We need the struct file
  (which we don't have) to implement it.

* Make some adjustments to ttm_mem_type_from_pace() and other
  API functions which use struct ttm_place instead of uint32_t.
  This better reflects the linux code and fixes compile-time breakage
  due to the partial API patch.

  Make other struct ttm_place adjustments.

* bdev->dev_mapping is broken (partial API update in WIP) and is
  still always NULL because ttm_bo_device_init() does not yet initialize
  it (needs an argument passed from the chipset code).

* refactor ttm_bo_man_get_node() to fix compile issues.

* Completely rewrite the DragonFly API interfacing code in ttm_bo_vm.c.
  Hopefully the fault code is now far, far more robust than it was before.

  Add debug code to check for duplicate vm_page insertions, in case
  we hit that panic again (it had problems due to bdev->dev_mapping being
  NULL before that issue was tracked down).

5 years agodrm/ttm: get rid of ttm_bo_is_reserved usage
François Tigeot [Tue, 12 Mar 2019 18:10:26 +0000 (19:10 +0100)]
drm/ttm: get rid of ttm_bo_is_reserved usage

5 years agodrm/ttm: inline ttm_bo_reserve and related calls
François Tigeot [Tue, 12 Mar 2019 18:09:34 +0000 (19:09 +0100)]
drm/ttm: inline ttm_bo_reserve and related calls

5 years agosys/vm: Fix vnode_pager_haspage() description
Tomohiro Kusumi [Tue, 12 Mar 2019 12:47:22 +0000 (05:47 -0700)]
sys/vm: Fix vnode_pager_haspage() description

Not uptodate with the code since
1b9d3514e66df9d4bc5a25c898c7c8cbe414e3e4 in 2010.

5 years agopsm - Fix panic in ps/2 mouse driver
Matthew Dillon [Tue, 12 Mar 2019 04:10:12 +0000 (21:10 -0700)]
psm - Fix panic in ps/2 mouse driver

* Fix a race in the ps/2 driver where a callout could be interrupted
  by psmintr() and corrupt the ps/2 packet buffer, causing a panic.

* Use a lockmgr lock instead of (archaic) critical sections for interrupt
  protection.  Also use the locked callout API.  This will hopefully
  prevent any further corruption.

Reported-by: drill-use@irc
5 years agokernel - Fix IDR bugs
Matthew Dillon [Sat, 9 Mar 2019 19:24:26 +0000 (11:24 -0800)]
kernel - Fix IDR bugs

* Allow ptr to be NULL in idr_remove() and idr_replace().

* Note that linux ERR returns from idr_replace() still not implemented
  (requires the related ERR macros to be moved out of drm).  idr_replace()
  still returns NULL when the id cannot be found.

Requested-by: aly
5 years agodrm/ttm: convert to the reservation api
François Tigeot [Mon, 11 Mar 2019 22:00:40 +0000 (23:00 +0100)]
drm/ttm: convert to the reservation api

Additional-bugfix-by: dillon
5 years agodrm: Fully rework the ww_mutex implementation
Matthew Dillon [Mon, 11 Mar 2019 20:12:30 +0000 (21:12 +0100)]
drm: Fully rework the ww_mutex implementation

Fixing various bugs and inaccurate assertions

5 years agoufs - Expand time_t support to 48 bits
Matthew Dillon [Mon, 11 Mar 2019 05:46:39 +0000 (22:46 -0700)]
ufs - Expand time_t support to 48 bits

* Fix time overflow issues in the original 32-bit UFS code in two
  ways.  First, treat the original 32-bit seconds fields as unsigned.
  Second, utilize the spare fields to expand these fields to 48 bits
  each.  Retain the nanosecond-grain accuracy of the nsec fields.

  These changes should be both forwards and backwards compatible within
  the respective supported timestamp ranges for filesystems created by
  DragonFlyBSD and for legacy UFS1 systems.

  However, DFly will no longer be compatible with any modern UFS1
  implementation in other operating systems which reuse the spare fields
  for other purposes.

  Also, dump and restore are still limited to 32-bit time stamps.  This
  should not be an issue since these utilities are basically no longer used
  in modern day.  UFS1 is still useful, but deprecated, and we don't really
  intend for it to be used with later incarnations that might still be in
  use by other OSes.  We do want to make sure that the time fields work
  properly, however, as UFS1 is still useful for certain things.

* The original di_atime, di_mtime, and di_ctime fields were implemented
  as signed 32 bit fields.  Change these to unsigned, extending time_t
  support from 2036 into the 2100 range.

* In addition, use the spare fields in the dinode to provide another
  16 bits to each of atime, mtime, and ctime, expanding the time fields
  to 48 bits (around 9 million years).

Noticed-by: aly