dragonfly.git
7 years agosbin/newfs_hammer: Cleanup blocks with a single statement
Tomohiro Kusumi [Sun, 9 Apr 2017 00:05:29 +0000 (03:05 +0300)]
sbin/newfs_hammer: Cleanup blocks with a single statement

This commit basically does the same as what Linux kernel's coding
style mentions for braces, which is basically the same with BSDs.
https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst#3-placing-braces-and-spaces

No diff in sbin/newfs_hammer/newfs_hammer binary when assert(3)
is disabled.

7 years agosbin/hammer: Cleanup blocks with a single statement
Tomohiro Kusumi [Sun, 9 Apr 2017 00:04:16 +0000 (03:04 +0300)]
sbin/hammer: Cleanup blocks with a single statement

This commit basically does the same as what Linux kernel's coding
style mentions for braces, which is basically the same with BSDs.
https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst#3-placing-braces-and-spaces

No diff in sbin/hammer/hammer binary when assert(3) is disabled.

7 years agoifpoll: Use netisr_ncpus.
Sepherosa Ziehau [Sun, 9 Apr 2017 05:23:13 +0000 (13:23 +0800)]
ifpoll: Use netisr_ncpus.

7 years agoifpoll: Use SYSINIT to initialize per-cpu ifpoll context.
Sepherosa Ziehau [Sun, 9 Apr 2017 05:20:47 +0000 (13:20 +0800)]
ifpoll: Use SYSINIT to initialize per-cpu ifpoll context.

7 years agosys/vfs/hammer: Add __hammer_crc_get_xxx() for CRC test retry
Tomohiro Kusumi [Sat, 8 Apr 2017 16:53:12 +0000 (19:53 +0300)]
sys/vfs/hammer: Add __hammer_crc_get_xxx() for CRC test retry

On retry, we don't need extra conditionals inlined (once or twice)
from calling hammer_datacrc(), since we know retry uses old crc.

Newly added inline functions are renamed versions of original ones
before 4c09d9c4.

7 years agosys/vfs/hammer: Cleanups on CRC functions
Tomohiro Kusumi [Sat, 8 Apr 2017 16:39:47 +0000 (19:39 +0300)]
sys/vfs/hammer: Cleanups on CRC functions

Just sync style with other part of the same file.

7 years agosys/vfs/hammer: Add comments on volume version 7 CRC (4c09d9c4)
Tomohiro Kusumi [Thu, 6 Apr 2017 23:18:01 +0000 (02:18 +0300)]
sys/vfs/hammer: Add comments on volume version 7 CRC (4c09d9c4)

There's no official documentation on this, but shouldn't be necessary
as CRC change does nothing directly to users.

7 years agoinpcb: Use netisr_ncpus for listing inpcbs.
Sepherosa Ziehau [Sat, 8 Apr 2017 06:38:06 +0000 (14:38 +0800)]
inpcb: Use netisr_ncpus for listing inpcbs.

7 years agosyncache: Use netisr_ncpus instead of ncpus2
Sepherosa Ziehau [Sat, 8 Apr 2017 05:52:02 +0000 (13:52 +0800)]
syncache: Use netisr_ncpus instead of ncpus2

7 years agosyncache: Cache align per-cpu data.
Sepherosa Ziehau [Sat, 8 Apr 2017 05:51:15 +0000 (13:51 +0800)]
syncache: Cache align per-cpu data.

7 years agoipdemux: Use netisr_ncpus instead of ncpus2.
Sepherosa Ziehau [Sat, 8 Apr 2017 05:36:23 +0000 (13:36 +0800)]
ipdemux: Use netisr_ncpus instead of ncpus2.

7 years agoinet6: Restore mbuf hash after defragmentation.
Sepherosa Ziehau [Sat, 8 Apr 2017 13:26:40 +0000 (21:26 +0800)]
inet6: Restore mbuf hash after defragmentation.

Reported-by: zach
7 years agoipfrag: Max # of frags per-cpu should use ncpus instead of ncpus2.
Sepherosa Ziehau [Sat, 8 Apr 2017 02:10:15 +0000 (10:10 +0800)]
ipfrag: Max # of frags per-cpu should use ncpus instead of ncpus2.

7 years agoinet: Use netisr_ncpus for ifdetach inet processing.
Sepherosa Ziehau [Sat, 8 Apr 2017 02:01:24 +0000 (10:01 +0800)]
inet: Use netisr_ncpus for ifdetach inet processing.

7 years agoBump __DragonFly_version
John Marino [Fri, 7 Apr 2017 19:12:02 +0000 (14:12 -0500)]
Bump __DragonFly_version

There have been several signficant changes recently, including the
relocation of the signal trampline, a new KERN_PROC_SIGTRAMP sysctl,
the implementation of the NX (no-execute) pmap bit and the
machdep.pmap_nx_enable TUNABLE.

7 years agoarp: Group llinfo and timer together.
Sepherosa Ziehau [Fri, 7 Apr 2017 07:27:06 +0000 (15:27 +0800)]
arp: Group llinfo and timer together.

7 years agoarp: Ignore ARP probes by default.
Sepherosa Ziehau [Fri, 7 Apr 2017 07:15:44 +0000 (15:15 +0800)]
arp: Ignore ARP probes by default.

ARP probes are widely used by Cisco switches.

7 years agoarp: ARP entry list should be initialized on all available CPUs.
Sepherosa Ziehau [Fri, 7 Apr 2017 06:30:38 +0000 (14:30 +0800)]
arp: ARP entry list should be initialized on all available CPUs.

7 years agodrm: Include opt_drm.h so that 'options VGA_SWITCHEROO' will be seen by vga_switcheroo.h.
Peeter Must [Wed, 5 Apr 2017 13:18:49 +0000 (16:18 +0300)]
drm: Include opt_drm.h so that 'options VGA_SWITCHEROO' will be seen by vga_switcheroo.h.

7 years agonet: Make netisr_ncpus sysctl read-only.
Sepherosa Ziehau [Wed, 5 Apr 2017 05:52:28 +0000 (13:52 +0800)]
net: Make netisr_ncpus sysctl read-only.

7 years agonet: Define # of cpus for network processing.
Sepherosa Ziehau [Wed, 5 Apr 2017 05:44:24 +0000 (13:44 +0800)]
net: Define # of cpus for network processing.

Ease ncpus2 -> ncpus transition.

7 years agonet: netisr_cpu -> netisr_threads; no functional changes.
Sepherosa Ziehau [Tue, 4 Apr 2017 09:22:45 +0000 (17:22 +0800)]
net: netisr_cpu -> netisr_threads; no functional changes.

7 years agonet: Get rid of ifnet threads.
Sepherosa Ziehau [Mon, 3 Apr 2017 14:34:34 +0000 (22:34 +0800)]
net: Get rid of ifnet threads.

7 years agoipfw3: Reduce dependency on ifnet threads.
Sepherosa Ziehau [Mon, 3 Apr 2017 14:16:37 +0000 (22:16 +0800)]
ipfw3: Reduce dependency on ifnet threads.

Prepare to get rid of them.

7 years agoipfw: Reduce dependency on ifnet threads.
Sepherosa Ziehau [Mon, 3 Apr 2017 13:38:20 +0000 (21:38 +0800)]
ipfw: Reduce dependency on ifnet threads.

Prepare to get rid of them.

7 years agobridge: Reduce dependency on ifnet threads.
Sepherosa Ziehau [Mon, 3 Apr 2017 09:27:16 +0000 (17:27 +0800)]
bridge: Reduce dependency on ifnet threads.

Prepare to get rid of them.

7 years agovlan: Reduce dependency on ifnet threads.
Sepherosa Ziehau [Sun, 2 Apr 2017 13:55:51 +0000 (21:55 +0800)]
vlan: Reduce dependency on ifnet threads.

Prepare to get rid of them.

7 years agoipflow: Reduce dependency on ifnet threads.
Sepherosa Ziehau [Sun, 2 Apr 2017 13:27:35 +0000 (21:27 +0800)]
ipflow: Reduce dependency on ifnet threads.

Prepare to get rid of them.

7 years agonet: Reduce dependency on ifnet threads.
Sepherosa Ziehau [Sun, 2 Apr 2017 12:42:52 +0000 (20:42 +0800)]
net: Reduce dependency on ifnet threads.

Prepare to get rid of them.

7 years agokernel - Implement NX (3) - cleanup
Matthew Dillon [Tue, 4 Apr 2017 17:57:40 +0000 (10:57 -0700)]
kernel - Implement NX (3) - cleanup

* Cleanup extra PROT_EXEC's.

7 years agokernel - Implement machdep.pmap_nx_enable TUNABLE
Matthew Dillon [Tue, 4 Apr 2017 17:46:57 +0000 (10:46 -0700)]
kernel - Implement machdep.pmap_nx_enable TUNABLE

* Implement machdep.pmap_nx_enable TUNABLE.  You can set this to 0
  in /boot/loader.conf to disable the NX feature.

* Also conditionalize on the cpu feature bit being present.

7 years agobsd-family-tree: Sync with FreeBSD (DragonFly 4.8.0, macOS 10.12).
Sascha Wildner [Tue, 4 Apr 2017 11:50:35 +0000 (13:50 +0200)]
bsd-family-tree: Sync with FreeBSD (DragonFly 4.8.0, macOS 10.12).

7 years agoReally ensure that our world/kernel are built under POSIX locale ("C").
Sascha Wildner [Tue, 4 Apr 2017 11:49:28 +0000 (13:49 +0200)]
Really ensure that our world/kernel are built under POSIX locale ("C").

dedd9a18e4bbd4f206f9d7f4dba97b92a85e5d49 used LANG but that won't
override any LC_* that are already set.

7 years agokernel - Implement NX (2)
Matthew Dillon [Mon, 3 Apr 2017 23:18:39 +0000 (16:18 -0700)]
kernel - Implement NX (2)

* Flesh out NX implementation for main kernel.

* Implement NX support for the vkernel.

7 years agokernel - Implement NX
Matthew Dillon [Mon, 3 Apr 2017 20:38:56 +0000 (13:38 -0700)]
kernel - Implement NX

* Implement the NX (no-execute) pmap bit.

* Shift sigtramp down to a page-bound and protect it prot|VM_PROT_EXECUTE.

* Map the rest of the user stack VM_PROT_READ|VM_PROT_WRITE without
  VM_PROT_EXECUTE.

7 years agoif_vtnet - Add back vtnet_tx_size variable for now, to fix build.
Imre Vadász [Sun, 2 Apr 2017 20:17:26 +0000 (22:17 +0200)]
if_vtnet - Add back vtnet_tx_size variable for now, to fix build.

7 years agosbin/hammer: Remove local variables only used within assert(3)
Tomohiro Kusumi [Sun, 2 Apr 2017 18:45:44 +0000 (21:45 +0300)]
sbin/hammer: Remove local variables only used within assert(3)

These are bothering compile with assert(3) disabled.
Assertions are still there, but local variables are removed.

7 years agolibc/libpthread: Inject threadsafe locking callbacks for rtld.
Imre Vadász [Sun, 2 Apr 2017 11:50:15 +0000 (13:50 +0200)]
libc/libpthread: Inject threadsafe locking callbacks for rtld.

* Make rtld thread-safe. Add lib/libthread_xu/thread/thr_rtld.c
  to the build and use it to inject pthread based locking callbacks
  for rtld.

* In rtld_lock.c, do the thread_mask_clear(lock->mask); after releasing
  the actual lock, to avoid deadlocks when rtld is called recursively
  from the pthread locking callbacks.
  XXX An alternative solution for this issue would be, to flag the
      libpthread dynamic library as bind_now to avoid the recursive rtld
      calls.

7 years agoif_vtnet - Remove vtnet_{rx,tx}_size variables. Change rx_header padding.
Imre Vadász [Mon, 6 Mar 2017 21:21:40 +0000 (22:21 +0100)]
if_vtnet - Remove vtnet_{rx,tx}_size variables. Change rx_header padding.

* With a padding of 2 bytes, struct vtnet_rx_header will be 12 bytes now,
  which should be correct to ensure the 4 byte alignment of the frame
  payload, when mergeable Rx buffers are not negotiated.

7 years agovirtio_blk - No need to negotiate unused (and legacy) VIRTIO_BLK_F_BARRIER.
Imre Vadász [Sun, 2 Apr 2017 10:25:00 +0000 (12:25 +0200)]
virtio_blk - No need to negotiate unused (and legacy) VIRTIO_BLK_F_BARRIER.

7 years agoif_vtnet - Default to link up, when VIRTIO_NET_F_STATUS is not negotiated.
Imre Vadász [Sun, 12 Mar 2017 21:01:08 +0000 (22:01 +0100)]
if_vtnet - Default to link up, when VIRTIO_NET_F_STATUS is not negotiated.

7 years agovirtio_blk - Clean up some unneeded functionalities.
Imre Vadász [Sat, 18 Feb 2017 23:19:09 +0000 (00:19 +0100)]
virtio_blk - Clean up some unneeded functionalities.

* Get rid of remaining code for handling the B_ORDERED flag.
  B_ORDERED doesn't even exist anymore in DragonFly.

* Get rid of sc->vtblk_req_ready request list. We can just use
  bioqdisksort() to add a request - that we failed to enqueue ino the
  virtqueue - back into the bioq.

* Rename req->vbr_bp field to req->vbr_bio.

* Switch vtblk_req_free list from TAILQ to SLIST. A small optimization,
  none of the additional features of the TAILQ are needed here.

7 years agovirtio: Replace one cpu_mfence() by cpu_lfence(), and one by cpu_sfence().
Imre Vadász [Mon, 13 Feb 2017 19:16:14 +0000 (20:16 +0100)]
virtio: Replace one cpu_mfence() by cpu_lfence(), and one by cpu_sfence().

* The cpu_mfence() in virtqueue_dequeue() can be replaced by cpu_lfence(),
  since we only need to make sure that we read the vq->vq_ring.used->idx
  value before reading any other entries from the vq->vq_ring.used ring.

* The cpu_mfence() in vq_ring_update_avail() can be replaced by
  cpu_sfence(), since no one else is writing to the vq->vq_ring.avail
  struct.

7 years agovirtio - Get rid of nop {vtblk/vtnet}_modevent methods.
Imre Vadász [Sat, 11 Mar 2017 18:19:41 +0000 (19:19 +0100)]
virtio - Get rid of nop {vtblk/vtnet}_modevent methods.

7 years agokernel - Fix broken wakeup in crypto code
Matthew Dillon [Sat, 1 Apr 2017 23:43:28 +0000 (16:43 -0700)]
kernel - Fix broken wakeup in crypto code

* Depending on which crypto driver is being used and the crypto load,
  the crp_sleep variable for the wrong tdinfo is tested to determine
  whether a wakeup is needed or not.  This can result in the crypto thread
  not being woken up when new work is pending.

* Can cause the crypto subsystem to stall indefinitely, in particular
  during a normal shutdown,

Reported-by: jh32
7 years agoFix some cases where an index was used before its limits check.
Sascha Wildner [Fri, 31 Mar 2017 14:58:37 +0000 (16:58 +0200)]
Fix some cases where an index was used before its limits check.

Dragonfly-bugs: 2998, 2999, 3000, 3001

7 years agolibkvm: Fix char pointer dereference.
Sascha Wildner [Fri, 31 Mar 2017 13:18:28 +0000 (15:18 +0200)]
libkvm: Fix char pointer dereference.

7 years agousr.sbin/Makefile: Fix sorting.
Sascha Wildner [Fri, 31 Mar 2017 07:08:18 +0000 (09:08 +0200)]
usr.sbin/Makefile: Fix sorting.

7 years agouefi.8: Leave the .Dd.
Sascha Wildner [Fri, 31 Mar 2017 07:03:30 +0000 (09:03 +0200)]
uefi.8: Leave the .Dd.

7 years agoPartly revert "uefi.8: Extend SEE ALSO and fix HISTORY."
Sascha Wildner [Fri, 31 Mar 2017 06:58:21 +0000 (08:58 +0200)]
Partly revert "uefi.8: Extend SEE ALSO and fix HISTORY."

This partly reverts commit 2bd356f2144fabf57cc538aa4ebb0a70c1baacc9.

UEFI boot support as such was indeed added in 4.5. 4.7 only added
support to the installer.

7 years agouefi.8: Extend SEE ALSO and fix HISTORY.
Sascha Wildner [Fri, 31 Mar 2017 06:53:40 +0000 (08:53 +0200)]
uefi.8: Extend SEE ALSO and fix HISTORY.

7 years agoefisetup.8: Some mdoc improvements.
Sascha Wildner [Fri, 31 Mar 2017 06:53:11 +0000 (08:53 +0200)]
efisetup.8: Some mdoc improvements.

7 years agoefisetup(8): Fix permissions in the tree.
Sascha Wildner [Fri, 31 Mar 2017 06:52:41 +0000 (08:52 +0200)]
efisetup(8): Fix permissions in the tree.

7 years agomdoc: Fix manlint warning in efisetup.8
Sascha Wildner [Fri, 31 Mar 2017 06:52:06 +0000 (08:52 +0200)]
mdoc: Fix manlint warning in efisetup.8

7 years ago<sys/libkern.h>: Fix whitespace/indent, remove arg names in prototypes.
Sascha Wildner [Fri, 31 Mar 2017 06:35:01 +0000 (08:35 +0200)]
<sys/libkern.h>: Fix whitespace/indent, remove arg names in prototypes.

7 years ago<machine/stdint.h>: Check __cplusplus first.
Sascha Wildner [Fri, 31 Mar 2017 06:27:58 +0000 (08:27 +0200)]
<machine/stdint.h>: Check __cplusplus first.

Avoids -Wundef warnings when compiling C++ (which does not define
__STDC_VERSION__).

7 years agotest/vkernel - Add MAKE_JOBS
Antonio Huete Jimenez [Thu, 30 Mar 2017 23:43:08 +0000 (01:43 +0200)]
test/vkernel - Add MAKE_JOBS

7 years agonrelease - Show MAKE_JOBS in help
Antonio Huete Jimenez [Thu, 30 Mar 2017 23:27:05 +0000 (01:27 +0200)]
nrelease - Show MAKE_JOBS in help

7 years agovkernel - Fix build
Antonio Huete Jimenez [Thu, 30 Mar 2017 22:54:24 +0000 (00:54 +0200)]
vkernel - Fix build

7 years agomixer - Fix sscanf() overflow
Matthew Dillon [Thu, 30 Mar 2017 21:04:14 +0000 (14:04 -0700)]
mixer - Fix sscanf() overflow

* Fix %s buffer sizes in sscanf().

Reported-by: dcb
7 years agogcore - fix overflow in sscanf
Matthew Dillon [Thu, 30 Mar 2017 21:02:47 +0000 (14:02 -0700)]
gcore - fix overflow in sscanf

* Fix an overflow which can occur in the sscanf() used to parse
  /proc/*/map

Reported-by: dcb
7 years agocamcontrol - non-critical fgetc() cleanup
Matthew Dillon [Thu, 30 Mar 2017 20:53:05 +0000 (13:53 -0700)]
camcontrol - non-critical fgetc() cleanup

* fgetc() returns int, check EOF against int return, not char.

Reported-by: dcb
7 years agokernel - Fix deadlock in sound system
Matthew Dillon [Thu, 30 Mar 2017 01:23:27 +0000 (18:23 -0700)]
kernel - Fix deadlock in sound system

* There is a deadlock between the sound system and devfs where one thread
  locks the sound system and calls into devfs, and another calls into devfs
  which holds the devfs lock while calling back into the sound system.

* Fixed by unlocking devfs across the callback.

* Easily triggered by the mate desktop (mate-session, sound preference,
  click random sound effects until deadlock occurs).

Reported-by: ozmage
7 years agogcc - Adjust the unwind code to use the new sigtramp probe sysctl
Matthew Dillon [Wed, 29 Mar 2017 18:31:45 +0000 (11:31 -0700)]
gcc - Adjust the unwind code to use the new sigtramp probe sysctl

* Adjust the unwind code to use the new sigtramp probe sysctl instead
  of hardwiring an address range relative to the ps_strings sysctl.

Reported-by: marino
7 years agokernel - Add KERN_PROC_SIGTRAMP
Matthew Dillon [Wed, 29 Mar 2017 18:23:47 +0000 (11:23 -0700)]
kernel - Add KERN_PROC_SIGTRAMP

* Add a sysctl to retrieve the sigtramp address range for gdb.

Reported-by: marino
7 years agoKernel - Temporarily move sigtramp lower
Matthew Dillon [Wed, 29 Mar 2017 16:57:18 +0000 (09:57 -0700)]
Kernel - Temporarily move sigtramp lower

* There is a bug in Ryzen related to the kernel iretq'ing into a high user
  %rip address near the end of the user address space (top of user stack).
  This is a temporary workaround for the issue.

* The original %rip for sigtramp was 0x00007fffffffffe0.  Moving it down
  to fa0 wasn't sufficient.  Moving it down to f00 moved the bug from nearly
  instant to taking a few hours to reproduce.  Moving it down to be0 it took
  a day to reproduce.  Moving it down to 0x00007ffffffffba0 (this commit)
  survived the overnight test.

7 years agoacpi/pstate: Don't attach, if _PSS contains invalid frequency.
Sepherosa Ziehau [Wed, 29 Mar 2017 03:43:29 +0000 (11:43 +0800)]
acpi/pstate: Don't attach, if _PSS contains invalid frequency.

Reported-and-Tested-by: OzMage
7 years agopowerd: Add option to disable adjusting userland scheduler's usable CPUs.
Sepherosa Ziehau [Wed, 29 Mar 2017 02:51:12 +0000 (10:51 +0800)]
powerd: Add option to disable adjusting userland scheduler's usable CPUs.

7 years agokern: Add per-cpu helper threads, which handles lwkt messages.
Sepherosa Ziehau [Mon, 27 Mar 2017 05:14:16 +0000 (13:14 +0800)]
kern: Add per-cpu helper threads, which handles lwkt messages.

They will be used to avoid netisr abusing.

7 years agokernel/ale: Fix one more parentheses issue.
Sascha Wildner [Wed, 29 Mar 2017 07:36:54 +0000 (09:36 +0200)]
kernel/ale: Fix one more parentheses issue.

Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2991>

7 years agokernel - Fix improper parens
Matthew Dillon [Tue, 28 Mar 2017 19:40:36 +0000 (12:40 -0700)]
kernel - Fix improper parens

* Fix improper parens.  The code paths luckily worked correctly
  even with the mistakes, for the most part.

* Fix bug in netgraph (netgraph is not used much in DragonFly).

Reported-by: dcb / bugs #2989, 2990, 2991, 2992
7 years agokernel/identcpu: Add string for MONITORX/MWAITX support to AMD Features2.
Sascha Wildner [Mon, 27 Mar 2017 17:50:42 +0000 (19:50 +0200)]
kernel/identcpu: Add string for MONITORX/MWAITX support to AMD Features2.

Taken-from: FreeBSD

7 years agodrm: Enable commented-out vga_switcheroo code
François Tigeot [Mon, 27 Mar 2017 09:41:33 +0000 (11:41 +0200)]
drm: Enable commented-out vga_switcheroo code

With-input-from: peeter0007 and ivadasz

7 years agosound/hda: Sync device ID table with FreeBSD
Sepherosa Ziehau [Mon, 27 Mar 2017 07:17:22 +0000 (15:17 +0800)]
sound/hda: Sync device ID table with FreeBSD

Obtained-from: FreeBSD

7 years agokernel - Add a BIOS quirks for AMD
Matthew Dillon [Mon, 27 Mar 2017 06:40:56 +0000 (23:40 -0700)]
kernel - Add a BIOS quirks for AMD

* BIOS may fail to set InitApicIdCpuIdLo.  Set it if no VMM capability.

* BIOS may configure Family 10h processors to convert WC+ to CD,
  fixup if the BIOS did this.

Taken-From: FreeBSD

7 years agokernel - Add GD_IRESERVED access to assembly
Matthew Dillon [Mon, 27 Mar 2017 06:40:20 +0000 (23:40 -0700)]
kernel - Add GD_IRESERVED access to assembly

* Useful for debugging.  No use-cases committed.

7 years agokernel - Spread IPIs out to more priority levels
Matthew Dillon [Mon, 27 Mar 2017 06:35:55 +0000 (23:35 -0700)]
kernel - Spread IPIs out to more priority levels

* Due to the brandamaged way the LAPIC queues received IPIs, each
  priority level (the top 4 bits of the 8 bit vector) has a 2-entry
  FIFO.  Bring in comments from FreeBSD on how this works.

* Change our IPI vectors which previously used 2 priority levels to now
  use 3 priority levels.  Each source is generally limited by an atomic
  op to avoid multi-queueing and hopefully that means the above LAPIC hw
  queue will never refuse to accept an IPI.

  IPIQ and TIMER use group 1

  INVLTLB (and INVLPG) uses group 2

  SNIFF, CPUSTOP, and SPURIOUSINT use group 3

* Reduces the number of vectors available per cpu by 16, but shouldn't
  present that big a problem.

7 years agokernel - Enhance the sniff code, refactor interrupt disablement for IPIs
Matthew Dillon [Mon, 27 Mar 2017 06:24:09 +0000 (23:24 -0700)]
kernel - Enhance the sniff code, refactor interrupt disablement for IPIs

* Add kern.sniff_enable, default to 1.  Allows the sysop to disable the
  feature if desired.

* Add kern.sniff_target, allows sniff IPIs to be targetted to all cpus
  (-1), or to a particular cpu (0...N).  This feature allows the sysop
  to test IPI delivery to particular CPUs (typically monitoring with
  systat -pv 0.1) to determine that delivery is working properly.

* Bring in some additional AMD-specific setup from FreeBSD, beginnings
  of support for the APIC Extended space.  For now just make sure the
  extended entries are masked.

* Change interrupt disablement expectations.  The caller of apic_ipi(),
  selected_apic_ipi(), and related macros is now required to hard-disable
  interrupts rather than these functions doing so.  This allows the caller
  to run certain operational sequences atomically.

* Use the TSC to detect IPI send stalls instead of a hard-coded loop count.

* Also set the APIC_LEVEL_ASSERT bit when issuing a directed IPI, though
  the spec says this is unnecessary.  Do it anyway.

* Remove unnecessary critical section in selected_apic_ipi().  We are in
  a hard-disablement and in particular we do not want to accidently trigger
  a splz() due to the crit_exit() while in the hard-disablement.

* Enhance the IPI stall detection and recovery code.  Provide more
  inforamtion.  Also enable the LOOPMASK_IN debugging tracker by default.

* Add a testing feature to machdep.all_but_self_ipi_enable.  By setting
  this to 2, we force the smp_invltlb() to always use the ALL_BUT_SELF IPI.
  For testing only.

7 years agokernel - Use the TSC as the cpu clock on AMD Ryzen or later
Matthew Dillon [Mon, 27 Mar 2017 06:15:35 +0000 (23:15 -0700)]
kernel - Use the TSC as the cpu clock on AMD Ryzen or later

* The TSC is usable as the cpu clock on AMD Ryzen or later, adjust
  the code for this.

* Recode hw.tsc_cputimer_force to still run the TSC test, but then
  force use of the TSC for the cpu clock whether the test succeeds
  or fails.

Suggested-by: Sephe
7 years agokernel - Enhance machdep.cpu_idle_hlt
Matthew Dillon [Mon, 27 Mar 2017 06:08:30 +0000 (23:08 -0700)]
kernel - Enhance machdep.cpu_idle_hlt

* Enhance machdep.cpu_idle_hlt.  It was not operating as advertised for
  settings 0 or 3+.  Add mode 5.

  0 - Now spins as documented (wasn't, before)
  1 - Uses MONITOR/MWAIT if supported, HLT otherwise
  2 - Uses mode (1) up to a point, then uses mode (3)
  3 - Always use the ACPI halt code.
  4 - Always use HLT (do not use MONITOR/MWAIT even if supported)
  5 - Always spin

* Recode the default setting for AMD cpus (but no functional changes).
  Default setting is 3 for AMD.

7 years agokernel - Enhanced reporting by process killer
Matthew Dillon [Mon, 27 Mar 2017 06:04:34 +0000 (23:04 -0700)]
kernel - Enhanced reporting by process killer

* Issue a kprintf() when trying to kill a process so we know when
  the attempt is made.  The 'killed' message we already have only
  prints when the attempt succeeds.

* Additional metrics when reporting 'low on memory+swap' now available
  with bootverbose.

7 years agokernel - Remove if_sl, if_ppp, and if_faith from the kernel build
Matthew Dillon [Fri, 17 Mar 2017 21:10:50 +0000 (14:10 -0700)]
kernel - Remove if_sl, if_ppp, and if_faith from the kernel build

* Remove if_sl, if_ppp, and if_faith from the kernel build.  These
  interfaces may be loaded as modules.

* Add missing MODULE_VERSION for if_sl and if_ppp.  This allows these
  modules to be specified in /boot/loader.conf without crashing the
  kernel if the kernel already happens to build them in, for forwards
  and backwards run-time compatibility.

7 years agohammer - HAMMER Version 7
Matthew Dillon [Fri, 17 Mar 2017 21:06:24 +0000 (14:06 -0700)]
hammer - HAMMER Version 7

* Add support for version 7 which changes the CRC mechanic from the
  old slow CRC code to the faster ISCSI CRC code.  We don't use the CRC
  instruction yet but ths base ISCSI CRC from FreeBSD is 6x faster than
  the CRC code we were using before.

* Change newfs_hammer default to version 7 (for master).

7 years agohammer2 - Fix cluster synchronization bug (2+ nodes)
Matthew Dillon [Fri, 17 Mar 2017 21:04:59 +0000 (14:04 -0700)]
hammer2 - Fix cluster synchronization bug (2+ nodes)

* Fix a bug where hammer2_cluster_check() can end up in an infinite
  loop.

* Look for pfs_names[] in all PFSs associated with a cluster.

* Add missing xop retirement in pfs-delete.

* Skip the directory empty check in pfs-delete.

* Preliminary code to deallocate an element of a live PFS

7 years agohammer2 - Stabilization for cluster code, features
Matthew Dillon [Fri, 10 Mar 2017 17:22:17 +0000 (09:22 -0800)]
hammer2 - Stabilization for cluster code, features

* Start working on stabilizing cluster operations when two or more
  nodes are present for a PFS.

* Fix a race in the strategy write code when writing out a buffer.  The
  buffer can be retired by the frontend before all cluster entities have
  a chance to use it.  This is what we actualy want to have happen (we
  don't want a dead or slow SLAVE to hold-up front-end operations, for
  example).

  Fix this by verifying that the bp is good and, at least for now, copying
  its data to a temporary buffer.

  Note that while it is expected that SLAVEs can get out of sync here,
  the synchronization thread is intended to eventually get everything
  synched up.

  (we may address this later for SLAVEs that are in good working later).

* Refactor the XOP API a bit to make access to the temporary buffer easier.

* We no longer need to pass (bp) into the strategy write support routines.
  Pass the data buffer instead.

* When reconstituting a hammer2 support thread, make sure any flags
  left-over from the previous use have been cleared.  Fixes an issue
  where support threads go missing after repeated unmount/mount
  operations.

* Add the feature where a hammer2 mount can simply specify @LABEL.  If
  LABEL is already available, the mount code will find and mount it.
  This feature will eventually be used to make it easier to access
  networked H2 PFSs.

  Note that the hammer2 user must still issue base mounts (typically
  /dev/blah@LOCAL) for hammer2 to recognize hammer2 partitions.  Ultimately
  I may auto-scan available drives but for now I am not.

* Fix missing CFLAGS->KCFLAGS conversion in Makefile.

* Fix administrative thread signaling interactions, tsleep and wakeup
  addresses were not matched up properly.

7 years agohammer2 - Have mount assume that @LABEL refers to a hammer2 vfs
Matthew Dillon [Fri, 10 Mar 2017 17:19:50 +0000 (09:19 -0800)]
hammer2 - Have mount assume that @LABEL refers to a hammer2 vfs

* hammer2 will soon allow mount @LABEL <mountpt> for any LABEL that it
  already knows about.  Make the base mount program aware of this and
  do not require the user to specify the vfs type.

7 years agodebug - separate out crc32.c and icrc32.c
Matthew Dillon [Fri, 10 Mar 2017 17:18:44 +0000 (09:18 -0800)]
debug - separate out crc32.c and icrc32.c

* Separate the code out into two test programs, one for the original crc
  code and one using the iscsi crc code.

7 years agoKernel - quick workaround for Ryzen
Matthew Dillon [Sun, 26 Mar 2017 22:27:29 +0000 (15:27 -0700)]
Kernel - quick workaround for Ryzen

* Quick workaround for a Ryzen issue that we can release with.

7 years agokernel - Stir longer in arc4random
Matthew Dillon [Sun, 26 Mar 2017 17:12:19 +0000 (10:12 -0700)]
kernel - Stir longer in arc4random

* Stir longer in arc4random

Taken-from: FreeBSD
Reported-by: jaykishan mutkawoa
7 years agoif_vtnet - Allocate struct vtnet_tx_header entries from a queue.
Imre Vadász [Mon, 20 Mar 2017 19:16:50 +0000 (20:16 +0100)]
if_vtnet - Allocate struct vtnet_tx_header entries from a queue.

* The existing code was sequentially allocating from an array of
  struct vtnet_tx_header, using an appropriately sized area.
  But this scheme turns out to be a very bad idea when we get out-of-order
  completions in the virtqueue.

* Instead allocate struct vtnet_tx_header entries from an SLIST.

* This should avoid crashes from memory-corruption or use-after-free in
  if_vtnet(9), when running in KVM on Linux, using Linux's vhost-net
  in-kernel virtqueue accelerator.

7 years agodrm/i915: Update to Linux 4.7.10
François Tigeot [Thu, 23 Mar 2017 17:45:12 +0000 (18:45 +0100)]
drm/i915: Update to Linux 4.7.10

* Various bugfixes, including GPU-specific ones on Ironlake and more
  recent hardware.
  Runtime power management and atomic modesetting have been specially
  improved.

* Fix Hardware hangs on Ironlake, Sandybridge, Ivybridge, Skylake and
  Kabylake GPUs

* Fix various display flickering issues, including PSR, Broadwell and
  Display-port specific ones

* Kabylake support is no longer considered experimental

* Color management has been added for Broadwell, Skylake, Kabylake as
  well as Cherryview and Broxton GPUs. The intent is to obtain more
  accurate color representation on various types of panel.

7 years agokernel: Add a port of the Linux 4.8 vga_switcheroo module
François Tigeot [Thu, 23 Mar 2017 09:04:44 +0000 (10:04 +0100)]
kernel: Add a port of the Linux 4.8 vga_switcheroo module

Submitted-by: Peeter Must <karu.pruun@gmail.com>
7 years ago<sys/unistd.h>: Add missing _PC_TIMESTAMP_RESOLUTION.
Sascha Wildner [Thu, 23 Mar 2017 09:18:12 +0000 (10:18 +0100)]
<sys/unistd.h>: Add missing _PC_TIMESTAMP_RESOLUTION.

We don't handle it yet though.

7 years agobuild - Add the 'efisetup' script
Matthew Dillon [Thu, 23 Mar 2017 02:06:57 +0000 (19:06 -0700)]
build - Add the 'efisetup' script

* Add the 'efisetup' script to /usr/sbin.  This script is capable of
  creating a pristine UEFI bootable DragonFlyBSD installation on the
  target drive.  The target drive will be wiped.

  Note that this script does only a basic installation... literally once
  it sets up the partitions it just does an installworld, make distribution,
  and installkernel, and then some minor adjustments to create the initial
  /etc/rc.conf, /etc/fstab, and /boot/loader.conf.

* Requires that you previously did a buildworld and buildkernel
  before running the script.

7 years agokernel - Fix panic in zget() during heavy paging
Matthew Dillon [Thu, 23 Mar 2017 01:43:08 +0000 (18:43 -0700)]
kernel - Fix panic in zget() during heavy paging

* Fix a panic that can occur in zget() when a large number of swap info
  blocks are needed from the swap_zone.

  Fix by reformulation how new items are added to the zone.  This is a
  non-critical code path, but we make it a bit more SMP friendly anyway.

* Use the opportunity to get rid of the VM object ZONE_INTERRUPT uses.
  The two that are left are never destroyed, so there's no need to track
  the pages in an object.

Reported-by: tkusumi
7 years ago<time.h>: Shuffle some prototypes around (no functional change).
Sascha Wildner [Wed, 22 Mar 2017 20:42:31 +0000 (21:42 +0100)]
<time.h>: Shuffle some prototypes around (no functional change).

7 years agoUpdate the pciconf(8) database.
Sascha Wildner [Wed, 22 Mar 2017 19:59:33 +0000 (20:59 +0100)]
Update the pciconf(8) database.

March 16, 2017 snapshot from http://pciids.sourceforge.net/

7 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Wed, 22 Mar 2017 19:50:10 +0000 (20:50 +0100)]
bsd-family-tree: Sync with FreeBSD.

7 years agoSync zoneinfo database with tzdata2017b from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Wed, 22 Mar 2017 08:18:30 +0000 (09:18 +0100)]
Sync zoneinfo database with tzdata2017b from ftp://ftp.iana.org/tz/releases

Haiti resumed observance of DST in 2017.  (Thanks to Steffen Thorsen.)

7 years agotest - Flesh out randread statistics reporting
Matthew Dillon [Tue, 21 Mar 2017 01:27:34 +0000 (18:27 -0700)]
test - Flesh out randread statistics reporting

* Cleanup the output.  Report the aggregate IOPS, average latency,
  aggregate bandwidth, low and high latencies, and the standard
  deviation for the test on a per-second basis.

* Standard deviation notes:

  68%     Of the samples are within 1 standard deviation, so if the
    reported stddev is 7uS, then 68% of the samples are +/- 7uS
    of the average reported value.

  95.45%    Of the samples are within 2 standard deviations.  +/- 14uS
    in the example.

  99.73%    Of the samples are within 3 standard deviations.  +/- 21uS
    in the example.