dragonfly.git
5 years agore: MACFG50 requires defragmentation in software, but no padding for runt. v5.2.2
Sepherosa Ziehau [Sat, 9 Jun 2018 11:45:55 +0000 (19:45 +0800)]
re: MACFG50 requires defragmentation in software, but no padding for runt.

Reported-by: YONETANI Tomokazu
Tested-by: YONETANI Tomokazu
5 years agoKernel - Additional cpu bug hardening part 2/2
Matthew Dillon [Mon, 11 Jun 2018 21:30:40 +0000 (14:30 -0700)]
Kernel - Additional cpu bug hardening part 2/2

* Due to speculative instruction execution, the kernel may
  speculatively execute instructions using data from registers that
  still contain userland-controlled content.

  Reduce the chance of this situation arising by proactively clearing
  all user registers after saving them for syscalls, exceptions, and
  interrupts.  In addition, for system calls, zero-out any
  unrestored registers on-return to avoid leaking kernel data back to
  userland.

* This was discussed over the last few months in various
  OS groups and I've decided to implement it.  After the FP
  debacle, it is prudent to also give general registers similar
  protections.

5 years agoKernel - Additional cpu bug hardening part 1/2
Matthew Dillon [Mon, 11 Jun 2018 20:43:22 +0000 (13:43 -0700)]
Kernel - Additional cpu bug hardening part 1/2

* OpenBSD recently made a commit that scraps the use of delayed FP
  state saving due to a rumor that the content of FP registers owned
  by another process can be speculatively detected when they are
  present for the current process, even when the TS bit is used to
  force a DNA trap.

  This rumor has been circulating for a while.  OpenBSD felt that the
  lack of responsiveness from Intel forced their hand.  Since they've
  gone ahead and pushed a fix for this potential problem, we are
  going to as well.

* DragonFlyBSD already synchronously saves FP state on switch-out.
  However, it only cleans the state up afterwords by calling fninit
  and this isn't enough to actually erase the content in the %xmm
  registers.  We want to continue to use delayed FP state restores
  because it saves a considerable amount of switching time when we do
  not have to do a FP restore.

  Most programs touch the FP registers at startup due to rtld linking,
  and more and more programs use the %xmm registers as general purpose
  registers.  OpenBSD's solution of always proactively saving and
  restoring FP state is a reasonable one.  DragonFlyBSD is going to
  take a slightly different tact in order to try to retain more optimal
  switching behavior when the FP unit is not in continuous use.

* Our first fix is to issue a FP restore on dummy state after our
  FP save to guarantee that all FP registers are zerod after FP state
  is saved.  This allows us to continue to support delayed FP state
  loads with zero chance of leakage between processes.

* Our second fix is to add a heuristic which allows the kernel to
  detect when the FP unit is being used seriously (verses just during
  program startup).

  We have added a sysctl machdep.npx_fpu_heuristic heuristic for this
  purpose which defaults to the value 32.  Values can be:

  0 - Proactive FPU state loading disabled (old behavior retained).
  Note that the first fix remains active, the FP register state
  is still cleared after saving so no leakage can occur.  All
  processes will take a DNA trap after a thread switch when they
  access the FP state.

  1 - Proactive FPU state loading is enabled at all times for a thread
  after the first FP access made by that thread.  Upon returning
  from a thread switch, the FPU state will already be ready to go
  and a DNA trap will not occur.

  N - Proactive FPU state loading enabled for N context switches, then
  disabled.  The next DNA fault after disablement then re-enables
  proactive loading for the next N context switches.

  Default value is 32.  This ensures that program startup can use
  the FP unit but integer-centric programs which don't afterwords
  will not incur the FP switching overhead (for either switch-away
  or switch-back).

5 years agokernel/radeon: Check the right variable in an if ().
Sascha Wildner [Tue, 12 Jun 2018 07:11:16 +0000 (09:11 +0200)]
kernel/radeon: Check the right variable in an if ().

This is Linux' 3a61b527b4e1f285d21b6e9e623dc45cf8bb391f.

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

5 years agokernel - Improve ACPI compatibility with older BIOSes
Matthew Dillon [Mon, 11 Jun 2018 20:21:53 +0000 (13:21 -0700)]
kernel - Improve ACPI compatibility with older BIOSes

* ACPI alignment field in ACPI resources can sometimes be 0, leading
  to passing 0 for 'align' to acpi_res_set_iorange() which panics the
  box with a division-by-zero fault.

* Relax handling of this argument by setting it to 1 if it is found
  to be 0.

* Fixes DFly panics with certain older BIOSes.

Reported-by: myu
5 years agonrelease/Makefile: Fix to use GITURL_{SRC,DPORTS} and update help
Aaron LI [Fri, 8 Jun 2018 07:58:47 +0000 (15:58 +0800)]
nrelease/Makefile: Fix to use GITURL_{SRC,DPORTS} and update help

The GITHOST and GITHOST_DPORTS were updated to be GITURL_SRC and GITURL_DPORTS
in ad8b70e08d7600e3f4eb3b36556d4540b1a9c119.

5 years agohammer2 - Fix kmalloc pool blowout on low-memory machines
Matthew Dillon [Thu, 24 May 2018 00:25:44 +0000 (17:25 -0700)]
hammer2 - Fix kmalloc pool blowout on low-memory machines

* Fix a kmalloc pool blown that can occur on low-memory machines due
  to too many disconnected hammer2_inode structures building up.

* Was previously fixed for things like rm -rf and bulk renames,
  but not for setattr (aka chown/chmod -R ops).

Reported-by: gjs278
5 years agotmpfs - Fix tmpfs_fid, fix NFS exports v5.2.1
Matthew Dillon [Sat, 12 May 2018 03:48:39 +0000 (20:48 -0700)]
tmpfs - Fix tmpfs_fid, fix NFS exports

* Fix the tmpfs_fid structure, the 64-bit elements made it incompatible
  with the system fid mapping.

  This fixes NFS exports of a tmpfs filesystem.

* Fix tmpfs_fhtovp, the inode number can exceed tmp->tm_nodes_max,
  do not error-out in that case.

5 years agomtree(8): Fix crc() prototype.
Sascha Wildner [Fri, 11 May 2018 10:06:50 +0000 (12:06 +0200)]
mtree(8): Fix crc() prototype.

It is taken from usr.bin/cksum/crc.c. This fixes a -Wlto-type-mismatch
warning reported by zrj. Similar to the fix for ckdist(1) as pushed in
e69bb3d9c4c6d6073c9c9c4a54753458fae55c7e.

5 years agorpc.yppasswdd(8): Fix ok_shell() prototype.
Sascha Wildner [Fri, 11 May 2018 09:46:03 +0000 (11:46 +0200)]
rpc.yppasswdd(8): Fix ok_shell() prototype.

It is taken from usr.bin/chpass/util.c. This fixes a -Wlto-type-mismatch
warning reported by zrj.

5 years agotcp_wrappers: Remove mystdarg.h and simplify code.
Sascha Wildner [Thu, 10 May 2018 17:51:34 +0000 (19:51 +0200)]
tcp_wrappers: Remove mystdarg.h and simplify code.

This fixes an -Wlto-type-mismatch warning (reported by zrj) because
syslog()'s prototype was wrongly setup (using VARARGS but it has to
take 2 arguments).

5 years agockdist(1): Sync with FreeBSD.
Sascha Wildner [Tue, 8 May 2018 19:22:18 +0000 (21:22 +0200)]
ckdist(1): Sync with FreeBSD.

Not much to see, but it allows us to raise WARNS to 6, and the crc()
prototype adjustment part also fixes a -Wlto-type-mismatch warning
that was..

Reported-by: zrj
5 years agokernel - Fix CVE-2018-8897, debug register issue
Matthew Dillon [Tue, 1 May 2018 03:47:20 +0000 (20:47 -0700)]
kernel - Fix CVE-2018-8897, debug register issue

* #DB can be delayed in a way that causes it to occur on the first
  instruction of the int $3 or syscall handlers.  These handlers must
  be able to detect and handle the condition.  This is a historical
  artifact of cpu operation that has existed for a very long time on
  both AMD and Intel CPUs.

* Fix by giving #DB its own trampoline stack and a way to load a
  deterministic %gs and %cr3 independent of the normal CS check.
  This is CVE-2018-8897.

* Also fix the NMI trampoline while I'm here.

* Also fix an old issue with debug register trace traps which can
  occur when the kernel is accessing the user's address space.
  This fix was lost years ago, now recovered.

Credits: Nick Peterson of Everdox Tech, LLC (original reporter)
Credits: Thanks to Microsoft for coordinating the OS vendor response

5 years agokernel/nfs: Use the correct prototype for sys_nfssvc().
Sascha Wildner [Mon, 7 May 2018 16:13:41 +0000 (18:13 +0200)]
kernel/nfs: Use the correct prototype for sys_nfssvc().

The code handles loading of nfs.ko (nfssvc() is the only {,un}loadable
syscall). sys_nfssvc()'s prototype is automatically generated, so just
use that.

The sy_narg setting is not strictly needed because it is already
initialized correctly. Just the sy_call pointer is either sys_nosys
or sys_nfssvc, depending on the module load.

Reported-by: zrj
5 years agomrsas(4): Remove wrong extra arg from MR_LdBlockSizeGet().
Sascha Wildner [Mon, 7 May 2018 12:43:02 +0000 (14:43 +0200)]
mrsas(4): Remove wrong extra arg from MR_LdBlockSizeGet().

Reported-by: zrj
5 years agoSync zoneinfo database with tzdata2018e from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 6 May 2018 20:20:20 +0000 (22:20 +0200)]
Sync zoneinfo database with tzdata2018e from ftp://ftp.iana.org/tz/releases

* North Korea switched back from +0830 to +09 on May, 5.

* Miscellaneous changes, see NEWS.

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

5 years agonetgraph7: Protect so_rcv properly
Sepherosa Ziehau [Tue, 1 May 2018 11:49:59 +0000 (19:49 +0800)]
netgraph7: Protect so_rcv properly

Reported-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>
Tested-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>

6 years agox86_64/ioapic: Make sure that legacy IRQ only appears on one CPU.
Sepherosa Ziehau [Mon, 23 Apr 2018 14:15:44 +0000 (22:15 +0800)]
x86_64/ioapic: Make sure that legacy IRQ only appears on one CPU.

The legacy IRQ lookup assumes only one CPU has a given legacy IRQ.

On system w/ large number of IOAPIC, GSI96 could be mapped to IRQ17
on CPU0 (since IRQ96 is used by SYSCALL), while GSI17 is mapped to
IRQ17 on another CPU.  This breaks later IRQ lookup.

Reported-by: Imre Vadasz
Tested-by: Imre Vadasz

6 years agoinet6/pim: Return IPPROTO_DONE if the mbuf is freed.
Sepherosa Ziehau [Tue, 17 Apr 2018 13:33:59 +0000 (21:33 +0800)]
inet6/pim: Return IPPROTO_DONE if the mbuf is freed.

This prevents the caller from using the freed mbuf.

Obtained-from: NetBSD via FreeBSD

6 years agokernel - Fix duplicate da0 or da* and locked up boot
Matthew Dillon [Sat, 21 Apr 2018 01:18:52 +0000 (18:18 -0700)]
kernel - Fix duplicate da0 or da* and locked up boot

* Fix duplicate da* reporting at boot which usually results in
  the boot locking up.

* The diskinfo was being installed while before CAM's softc->state
  normalized, potentially allowing I/O to occur during the probe
  sequence and causing the probe state to be repeated.

  Delay calling disk_setdiskinfo() until after softc->state is
  normalized.

6 years agogcc50: Deal with -Wnarrowing when compiled by gcc80.
zrj [Mon, 22 Jan 2018 07:46:00 +0000 (09:46 +0200)]
gcc50: Deal with -Wnarrowing when compiled by gcc80.

Cherry-pick to 5.2

6 years agoncurses: Allow for easier bootstrap of libtic.
zrj [Sun, 8 Apr 2018 11:52:47 +0000 (14:52 +0300)]
ncurses: Allow for easier bootstrap of libtic.

Mainly as backwards compat for gcc80.

Cherry-pick to 5.2

6 years ago<net/dlt.h> - Remove a comment which is no longer applicable
Antonio Huete Jimenez [Wed, 18 Apr 2018 08:30:33 +0000 (01:30 -0700)]
<net/dlt.h> - Remove a comment which is no longer applicable

6 years ago<net/dlt.h> - Add some more DLTs
Antonio Huete Jimenez [Wed, 18 Apr 2018 08:08:34 +0000 (01:08 -0700)]
<net/dlt.h> - Add some more DLTs

- The DLT_USER* dlts are reserved for private use, they won't be
  used ever by libpcap/tcpdump themselves.
- net/wireshark-qt5 (and probably others) use it

6 years agocontrib/libpcap - Local adjustments
Antonio Huete Jimenez [Mon, 9 Apr 2018 23:44:43 +0000 (16:44 -0700)]
contrib/libpcap - Local adjustments

- Use system's net/bpf.h instead of libpcap's one.
- Will help fixing net/vde2 and possible other ports that use a
  combination of net/bpf.h and pcap.h as described in f92f178f07f

6 years ago<net/dlt.h> - Add a bunch of DLTs from libpcap
Antonio Huete Jimenez [Mon, 9 Apr 2018 23:40:37 +0000 (16:40 -0700)]
<net/dlt.h> - Add a bunch of DLTs from libpcap

- As done in commit 34b07254ea and for the same reason as in
  f92f178f07f
- In prepartion to libpcap local adjustments

6 years agobpf - Add two new instructions
Antonio Huete Jimenez [Mon, 9 Apr 2018 23:38:48 +0000 (16:38 -0700)]
bpf - Add two new instructions

- Add BPF_MOD and BPF_XOR
- In prepartion to libpcap local adjustments

6 years agolibcompat: Remove the old and unused insque() and remque() functions. v5.2.0
Sascha Wildner [Tue, 3 Apr 2018 21:50:31 +0000 (23:50 +0200)]
libcompat: Remove the old and unused insque() and remque() functions.

We have a conforming implementation of those two functions in libc, so
nothing was taking the ones from libcompat. However, libcompat's
outdated manual pages were shadowing the good ones from libc.

Reported-by: zrj
6 years agoSync zoneinfo database with tzdata2018d from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 1 Apr 2018 12:24:15 +0000 (14:24 +0200)]
Sync zoneinfo database with tzdata2018d from ftp://ftp.iana.org/tz/releases

* Palestine started DST a week earlier, on March 24.

* Various changes to past time stamps and zone abbreviations.

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

6 years agoFix -Wsizeof-pointer-memaccess better.
Sascha Wildner [Fri, 23 Mar 2018 09:19:01 +0000 (10:19 +0100)]
Fix -Wsizeof-pointer-memaccess better.

My previous commits:

56267d362d5769c8df07bf26d5e322610e0d24b4
562a180a58780b719830629307e6283c30c85229

caused out of bounds write by one byte. This commit fixes the
warning and restores the code what was there before.

6 years agoloader/menu: Fix 'vfs.root.real_root' to be 'vfs.root.realroot'
Aaron LI [Sun, 1 Apr 2018 06:28:45 +0000 (14:28 +0800)]
loader/menu: Fix 'vfs.root.real_root' to be 'vfs.root.realroot'

This should be the same variable as used in /boot/loader.conf to specify
the real root partition.  See loader(8) and mkinitrd(8) for more info.

The intent here by unsetting it for the *rescue boot mode* is to prevent
the real root been mounted, and hence the system will stay in the md0
rescue root.

Verified-by: Matt Dillon
6 years agohammer2 - Increase bulkfree buffer size request and cap
Matthew Dillon [Sun, 1 Apr 2018 05:02:22 +0000 (22:02 -0700)]
hammer2 - Increase bulkfree buffer size request and cap

* Increase the kernel buffer size cap for hammer2 cleanups
  (aka bulkfree's) from 64MB to 1/16 physical memory.  Systems
  with more memory can accomodate larger in-memory bulkfree bitmap
  buffers.  Systems with less memory simply do multiple scan
  passes as per usual.

* Increase the buffer size requested by the hammer2 utility
  from 8MB to 1/16 physical memory.  The actual amount of memory
  allocated by the kernel will be 32MB per 1TB of filesystem, up to
  the cap.

* This will generally reduce the number of scans required for
  a 4TB filesystem from 16 to 1, meaning that bulkfree will take
  1/16 the time as it did before for a filesystem of that size.

  For example, a system with 128GB of ram would be able to
  request up to 8GB of buffer which can accomodate a bulkfree
  operation on a 256TB filesystem in a single pass.

6 years agomkinitrd(8): Fix the wrong variable "CONTENT_DIR" to be "CONTENT_DIRS"
Aaron LI [Sat, 31 Mar 2018 02:49:00 +0000 (10:49 +0800)]
mkinitrd(8): Fix the wrong variable "CONTENT_DIR" to be "CONTENT_DIRS"

6 years agokernel - Fix UFS bug on filesystem full conditions
Matthew Dillon [Fri, 30 Mar 2018 05:12:35 +0000 (22:12 -0700)]
kernel - Fix UFS bug on filesystem full conditions

* UFS was not properly translating the lbn to a block offset
  when trying to back-out an indirect block allocation during
  a write() which fails due to lack of space.

* Fixes a panic which could occur in the above situation.

Reported-by: Aaron LI
6 years agorc.d: Add ipfw3 rc script
Aaron LI [Thu, 29 Mar 2018 14:12:33 +0000 (22:12 +0800)]
rc.d: Add ipfw3 rc script

To use ipfw3, add 'ipfw3_enable=YES' to /etc/rc.conf .  By default, only
the 'ipfw3' and 'ipfw3_basic' modules will be loaded.  If you need more
ipfw3 modules, set them with 'ipfw3_modules="<modules> ..."' in
/etc/rc.conf .  See also the rc.conf(5) man page.

This ipfw3 rc script is largely based on the ipfw script.

The /etc/ipfw3.rules (a shell script) should be present to setup the
firewall rules, otherwise the default setup will block all incoming
connections, including your current connection!

NOTE:
I wrote this script for use in my VPS last year, but switched to
PF later, so more tests and improvements (e.g., flush tables on stop)
to this script are needed.

Reviewed-by: swildner
6 years agovirtio_pci - Fix vtpci_reinit MSI-X vector reinitialization.
Imre Vadász [Thu, 29 Mar 2018 20:10:07 +0000 (22:10 +0200)]
virtio_pci - Fix vtpci_reinit MSI-X vector reinitialization.

6 years agoiwm - Always clear watchdog timer, when bringing down firmware state.
Imre Vadász [Wed, 28 Mar 2018 20:46:14 +0000 (22:46 +0200)]
iwm - Always clear watchdog timer, when bringing down firmware state.

6 years agoiwm - Clear Time Event active state, when receiving End Notification.
Imre Vadász [Wed, 28 Mar 2018 20:26:18 +0000 (22:26 +0200)]
iwm - Clear Time Event active state, when receiving End Notification.

* This hopefully avoids some firmware panics, I was occasionally seeing,
  when iwm disconnects upon losing signal to an access point at some point.

* This is synchronizing the if_iwm_time_event.c file a bit more from the
  corresponding Linux iwlwifi/mvm/time-event.c.

Taken-From: Linux iwlwifi

6 years agoChanges for 5.2 branch. v5.2.0rc
Justin C. Sherrill [Tue, 27 Mar 2018 22:40:35 +0000 (18:40 -0400)]
Changes for 5.2 branch.

6 years agoif_vtnet - Cleanup ifalt_subque handling a bit.
Imre Vadász [Tue, 27 Mar 2018 18:40:14 +0000 (20:40 +0200)]
if_vtnet - Cleanup ifalt_subque handling a bit.

6 years agokernel/{ext2,u}fs: Remove unused 'in_exists' from struct indir.
Sascha Wildner [Tue, 27 Mar 2018 18:39:48 +0000 (20:39 +0200)]
kernel/{ext2,u}fs: Remove unused 'in_exists' from struct indir.

6 years agoif_vtnet - Get rid of separate vtnet_{rx,tx}_intr_task functions.
Imre Vadász [Mon, 26 Mar 2018 21:44:30 +0000 (23:44 +0200)]
if_vtnet - Get rid of separate vtnet_{rx,tx}_intr_task functions.

* Just inline them into vtnet_rx_vq_intr and vtnet_tx_vq_intr respectively.

6 years agoif_vtnet - Fixup previous commit.
Imre Vadász [Mon, 26 Mar 2018 20:56:29 +0000 (22:56 +0200)]
if_vtnet - Fixup previous commit.

6 years agoif_vtnet - Use ifsq_watchdog_* functions as the watchdog.
Imre Vadász [Sun, 25 Mar 2018 23:17:40 +0000 (01:17 +0200)]
if_vtnet - Use ifsq_watchdog_* functions as the watchdog.

* The existing watchdog code was commented out.

6 years agosys/vfs/autofs: Cleanups (sync with NetBSD and OpenBSD)
Tomohiro Kusumi [Mon, 26 Mar 2018 15:12:59 +0000 (00:12 +0900)]
sys/vfs/autofs: Cleanups (sync with NetBSD and OpenBSD)

FreeBSD has these in autofs.c, but only vfsops needs init/uninit.

6 years agolocate.updatedb(8): improve default search paths with small updates
Aaron LI [Sat, 10 Mar 2018 04:12:11 +0000 (12:12 +0800)]
locate.updatedb(8): improve default search paths with small updates

* Make locate.updatedb(8) default to search from all mount points with
  the allowed filesystem types.  Therefore, it is allowed to exclude the
  root filesystem type, while still correctly index other mounted
  filesystem with allowed types.  Otherwise, the whole filesystem is
  simply ignored if the root filesystem type is excluded.

* Although we can now ignore the root filesystem type from being indexed,
  but this is generally a configuration mistake, so we warn about this.

* Use stat(1) instead of the obscure "find -c" to help check whether the
  created database is empty.

* Print out the full find command by default (to help config/debug), also print
  a message when the database is successfully built.

* Update locate.rc accordingly.

* Explain why use cat instead of cp for the final database creation.

6 years agoif_vtnet - Don't drop vtnet_slz in some of the virtqueue_notify() calls.
Imre Vadász [Sun, 25 Mar 2018 19:59:43 +0000 (21:59 +0200)]
if_vtnet - Don't drop vtnet_slz in some of the virtqueue_notify() calls.

* There are several cases where the vtnet_slz serializer is dropped around
  virtqueue_notify() calls, with the hope that this allows other cores to
  run if_vtnet code in parallel.

* In vtnet_exec_ctrl_cmd(), it shouldn't make a significant performance
  difference, and avoids some theoretical race possibilities.

* In the vtnet_init_rx_vq initialization code, it also is irrelevant for
  performance, and only complicates things.

* In the vtnet_rxeof() and vtnet_start() cases it might actually be relevant
  for performance, so we keep those for now. When changing the driver to
  use the MULTI_SERIALIZERS MODE, the serializer dropping can also be
  removed in those two cases.

6 years agoif_vtnet - Remove vtnet_tick_ch and vtnet_cfgchg_task from softc struct.
Imre Vadász [Sun, 25 Mar 2018 19:05:04 +0000 (21:05 +0200)]
if_vtnet - Remove vtnet_tick_ch and vtnet_cfgchg_task from softc struct.

* Forgot to remove the softc variables in the changes
  c5f8e1538bcc13f7a39b805bcc5b774780 and 603be9646446bdb4292b6cd27544788c2c.

* Also remove a leftover taskqueue_drain() call.

6 years agoif_vtnet - Pass the vtnet serializer in ether_ifattach().
Imre Vadász [Sun, 25 Mar 2018 18:55:23 +0000 (20:55 +0200)]
if_vtnet - Pass the vtnet serializer in ether_ifattach().

* This is likely just an intermediate step, the plan is to eventually use
  the MULTI SERIALIZER MODE.

6 years agoif_vtnet - Remove unused vtnet_tick() code.
Imre Vadász [Sun, 25 Mar 2018 18:54:41 +0000 (20:54 +0200)]
if_vtnet - Remove unused vtnet_tick() code.

6 years agoif_vtnet - No need to use the taskqueue to run vtnet_update_link_status().
Imre Vadász [Sun, 25 Mar 2018 14:35:18 +0000 (16:35 +0200)]
if_vtnet - No need to use the taskqueue to run vtnet_update_link_status().

6 years ago[pci_vendors] Update pci_vendors to 2018.03.21
Eitan Adler [Sun, 25 Mar 2018 17:18:02 +0000 (17:18 +0000)]
[pci_vendors] Update pci_vendors to 2018.03.21

6 years ago[test] Hi Fred :-)
Aaron LI [Sun, 25 Mar 2018 12:27:26 +0000 (20:27 +0800)]
[test] Hi Fred :-)

6 years agodrm/linux: Add signal_pending_state
François Tigeot [Sun, 25 Mar 2018 08:34:02 +0000 (10:34 +0200)]
drm/linux: Add signal_pending_state

6 years agovirtio - Get rid of unused flags option in virtio_alloc_virtqueues().
Imre Vadász [Thu, 22 Mar 2018 23:08:43 +0000 (00:08 +0100)]
virtio - Get rid of unused flags option in virtio_alloc_virtqueues().

6 years agovirtio - Explicitly teardown interrupts in driver detach methods.
Imre Vadász [Sat, 24 Mar 2018 13:44:19 +0000 (14:44 +0100)]
virtio - Explicitly teardown interrupts in driver detach methods.

* This seems to be an easy way to avoid potential races during driver
  detachements.

6 years agovirtio - Move virtqueue_pending() checks into the child driver.
Imre Vadász [Wed, 13 Sep 2017 19:59:25 +0000 (21:59 +0200)]
virtio - Move virtqueue_pending() checks into the child driver.

* This makes it easier for now, to deal with virtqueue locking, when
  multiple virtqueues are mapped to a single interrupt vector.

6 years agovirtio - Get rid of config_change devmethod, treat like vq interrupts.
Imre Vadász [Tue, 12 Sep 2017 22:32:22 +0000 (00:32 +0200)]
virtio - Get rid of config_change devmethod, treat like vq interrupts.

6 years agovirtio - Specify handler and argument in bind_intr, instead of vq alloc.
Imre Vadász [Mon, 11 Sep 2017 20:59:58 +0000 (22:59 +0200)]
virtio - Specify handler and argument in bind_intr, instead of vq alloc.

6 years agovirtio - Refactor virtio bus API, to untangle virtuques from IRQ allocation.
Imre Vadász [Thu, 7 Sep 2017 22:22:49 +0000 (00:22 +0200)]
virtio - Refactor virtio bus API, to untangle virtuques from IRQ allocation.

* These API changes allow each virtio device driver to explicitly control
  the assignment of virtqueues to IRQ vectors.

* This allows explicitly assigning IRQ vectors to cpus. And virtio device
  drivers also get to know, on which cpu each virtqueue interrupt is
  running.

6 years agogroff/tmac: Revert doc-common back to vendor state.
Sascha Wildner [Sat, 24 Mar 2018 14:15:34 +0000 (15:15 +0100)]
groff/tmac: Revert doc-common back to vendor state.

Missing .Fx etc. versions should be added to mdoc.local instead, so
add any which were not in it yet.

While here, fix a typo from 12041c96816e1e7cccac302fd5656529fe9c9e9b
and add NetBSD 9.0 for fstyp.8.

6 years agosys/vfs/autofs: Revert 1bfb99b1b1("prevent assert on unmount")
Tomohiro Kusumi [Sat, 24 Mar 2018 09:18:00 +0000 (18:18 +0900)]
sys/vfs/autofs: Revert 1bfb99b1b1("prevent assert on unmount")

1bfb99b1b1 originally brought from NetBSD was not correct.
Autofs can't unmount when more than one level of directories
are created via indirect map.

6 years agodrm/linux: Add cmpxchg_relaxed()
François Tigeot [Sat, 24 Mar 2018 07:21:31 +0000 (08:21 +0100)]
drm/linux: Add cmpxchg_relaxed()

Obtained-from: FreeBSD

6 years agokernel - Fix namecache leak / broken hysteresis
Matthew Dillon [Fri, 23 Mar 2018 23:18:22 +0000 (16:18 -0700)]
kernel - Fix namecache leak / broken hysteresis

* We were double-using NCF_DESTROYED for both dummy ncp's for
  list iteration and to indicate a removed ncp.  This prevented
  the hysteresis code from properly cleaning up such ncp's.

  Symptoms were growing stalls every few seconds on one cpu as
  the hysteresis code would try to futiley clean up excess
  namecache entries.

* Use NCF_DUMMY instead of NCF_DESTROYED to check for dummy
  list iterators in the hysteresis code, allowing it to process
  NCF_DESTROYED ncps.

* These ncps could accumulate only in situations where the vnode
  nlinks count is greater than 1, since a file deletion when nlinks
  is 1 will delete the vnode and all related ncp's.

  When nlinks is greater than 1, a file entry deletion does not
  necessarily cause the vnode to be deleted, leaving the namecache
  records intact, but flagged NCF_DESTROYED, and prevented the
  hystersis code from operating correctly.

Reported-by: ftigeot
6 years agokernel/machdep: Remove unused and #if 0'd finishidentcpu() prototype.
Sascha Wildner [Fri, 23 Mar 2018 20:15:34 +0000 (21:15 +0100)]
kernel/machdep: Remove unused and #if 0'd finishidentcpu() prototype.

6 years agodrm/linux: Add a few functions (mostly stubs)
François Tigeot [Fri, 23 Mar 2018 14:09:48 +0000 (15:09 +0100)]
drm/linux: Add a few functions (mostly stubs)

6 years agovfs_unmountall.9: Document the new halting argument.
Sascha Wildner [Fri, 23 Mar 2018 12:47:29 +0000 (13:47 +0100)]
vfs_unmountall.9: Document the new halting argument.

6 years agokernel: Add missing atomic_fcmpset_*() variants
François Tigeot [Fri, 23 Mar 2018 09:59:33 +0000 (10:59 +0100)]
kernel: Add missing atomic_fcmpset_*() variants

They will be useful for newer drm code from Linux 4.8.

6 years agokernel/devfs: Use 1UL << ... in bitmap bit operations.
Sascha Wildner [Fri, 23 Mar 2018 09:30:18 +0000 (10:30 +0100)]
kernel/devfs: Use 1UL << ... in bitmap bit operations.

6 years agoRemove obsolete stabs.7 manual page.
Sascha Wildner [Fri, 23 Mar 2018 08:15:41 +0000 (09:15 +0100)]
Remove obsolete stabs.7 manual page.

6 years agovirtio_blk - Inline vtblk_complete into vtblk_vq_intr. Dedup sglist_reset.
Imre Vadász [Sat, 11 Mar 2017 20:13:19 +0000 (21:13 +0100)]
virtio_blk - Inline vtblk_complete into vtblk_vq_intr. Dedup sglist_reset.

6 years agovirtio_pci - Remove int return value from interrupt handler functions.
Imre Vadász [Mon, 6 Mar 2017 19:33:56 +0000 (20:33 +0100)]
virtio_pci - Remove int return value from interrupt handler functions.

6 years agokernel - devfs cleanup
Matthew Dillon [Thu, 22 Mar 2018 16:38:09 +0000 (09:38 -0700)]
kernel - devfs cleanup

* staticize two functions, remove *_fff() from manual pages (now
  static).

* Adjust documentation.

* Rename internal function from devfs_clone_bitmap_resize() to
  devfs_clone_bitmap_extend().  Document the slight weirdness in
  the extent of the passed-in 'newchunks' parameter, but do not change
  the API.

Submitted-by: Aaron LI, with added code comments by Matt
6 years agokernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys (2)
Matthew Dillon [Thu, 22 Mar 2018 16:09:50 +0000 (09:09 -0700)]
kernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys (2)

* Also fix incorrect shift type in devfs_clone_bitmap_set().

Submitted-by: Aaron LI
6 years agokernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys
Matthew Dillon [Thu, 22 Mar 2018 01:11:10 +0000 (18:11 -0700)]
kernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys

* Fix ifconfig tapN create for N >= 32.

* devfs_clone_bitmap_chk(), which only if_tap uses, was returning
  the wrong default value for unit numbers beyond the current
  dynamic size of the bitmap.

* Both devfs_clone_bitmap_chk() and devfs_clone_bitmap_put()
  were improperly using (1 << unit) instead of (1L << unit)
  when masking the 64-bit (long) bitmap elements, resulting in
  chaos for units >= 32.

* This also should fix pty issues >= 32 ptys.

Reported-by: Aaron Li
6 years agoidr.9: Improve this manual page a bit.
Sascha Wildner [Wed, 21 Mar 2018 21:02:46 +0000 (22:02 +0100)]
idr.9: Improve this manual page a bit.

Based on a patch submitted by Aaron LI <aly@aaronly.me>.

6 years agokernel - Fix quickhalt panic-on-reboot
Matthew Dillon [Wed, 21 Mar 2018 18:22:14 +0000 (11:22 -0700)]
kernel - Fix quickhalt panic-on-reboot

* Fix an issue with the quickhalt feature that shortcuts the
  unmounting of procfs, devfs, and tmpfs.

* Fixes a panic-on-reboot due to quickhalt still cleaning out
  the vnode ops even though it leaves the vnodes intact.  Don't
  clean out the vnode ops.

Reported-by: zrj
6 years agoBSD.include.dist: Use spaces to indent (see etc/mtree/README).
Sascha Wildner [Wed, 21 Mar 2018 15:29:23 +0000 (16:29 +0100)]
BSD.include.dist: Use spaces to indent (see etc/mtree/README).

6 years agoipfw3: use the headers in include folder
Bill Yuan [Wed, 21 Mar 2018 03:08:56 +0000 (03:08 +0000)]
ipfw3: use the headers in include folder

6 years agoipfw3: move the headers into include folder
Bill Yuan [Wed, 21 Mar 2018 03:07:54 +0000 (03:07 +0000)]
ipfw3: move the headers into include folder

6 years ago[bsd-family-tree]: announce NetBSD 7.1.2
Eitan Adler [Wed, 21 Mar 2018 09:07:51 +0000 (09:07 +0000)]
[bsd-family-tree]: announce NetBSD 7.1.2

6 years agommap.2: Remove reference to no longer existing BUGS section.
Sascha Wildner [Tue, 20 Mar 2018 20:49:36 +0000 (21:49 +0100)]
mmap.2: Remove reference to no longer existing BUGS section.

6 years agoboot/common/fs.h: Add a common definition of CTASSERT().
Sascha Wildner [Tue, 20 Mar 2018 09:11:06 +0000 (10:11 +0100)]
boot/common/fs.h: Add a common definition of CTASSERT().

6 years ago<net/if_poll.h>: Add license. It was based on sys/net/if_poll.c.
Sascha Wildner [Tue, 20 Mar 2018 08:12:02 +0000 (09:12 +0100)]
<net/if_poll.h>: Add license. It was based on sys/net/if_poll.c.

Reported-by: Aaron LI <aly@aaronly.me>
Discussed-with: sephe

6 years agokernel - Attempt to fix high vnlru cpu use
Matthew Dillon [Tue, 20 Mar 2018 01:39:21 +0000 (18:39 -0700)]
kernel - Attempt to fix high vnlru cpu use

* In certain situations _cache_cleanpos() gets into a livelock
  of some sort.  It is limited by a counter but the livelock creates
  havoc when it happens.

* It appears that _cache_cleanpos() can get into a situation where
  the head element of all available nchashtbl[] slots is not freeable
  (e.g. due to having multiple refs).  When this occurs, trailing
  elements in the chained hash table cannot be recycled.

  nchashtbl[] is typically very large, so this situation does not
  happen very often.  There are usually plenty of entries to pick
  away at.  However, it looks like situations can develop where
  enough entries get into this masked state that the hysteresis is
  unable to complete, resulting in a cpubound loop.

* Refactor the chained list from LIST to TAILQ and modify the
  _cache_cleanpos() function to cycle ncp's to the end of the
  list before trying to zap them.  If the zap fails, the next
  iteration will encounter a different head.

Reported-by: ftigeot
6 years agoatkbdc - Add additional ACPI PNP IDs specified by Microsoft for Keyboards.
Imre Vadász [Mon, 19 Mar 2018 22:39:17 +0000 (23:39 +0100)]
atkbdc - Add additional ACPI PNP IDs specified by Microsoft for Keyboards.

These IDs are from Microsofts device IDs list at
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/devids.txt
which is linked from http://www.uefi.org/PNP_ACPI_Registry.

This should fix some machines which failed to attach the PS2 Keyboard
after 131acb0380e93664f106117ebf8ba322a3d1b7c4, unless the acpi(4) module
was disabled.

6 years agoperiodic - Adjust daily 160 and 161 (hammer and hammer2 cleanup)
Matthew Dillon [Mon, 19 Mar 2018 19:23:14 +0000 (12:23 -0700)]
periodic - Adjust daily 160 and 161 (hammer and hammer2 cleanup)

* Use /usr/bin/lockf to avoid backing up many hammer or hammer2
  cleanup processes, as a cleanup (depending on the situation
  and vfs.hammer2.bulkfree_tps setting) can take longer than a
  day.

6 years agokernel - Implement QUICKHALT shortcut for unmounting during shutdown
Matthew Dillon [Mon, 19 Mar 2018 05:39:10 +0000 (22:39 -0700)]
kernel - Implement QUICKHALT shortcut for unmounting during shutdown

* Add the MNTK_QUICKHALT flag which allows the system to just unlink but
  otherwise ignore certain mount types during a halt or reboot.  For now
  we flag tmpfs, devfs, and procfs.

* The main impetus for this is to reduce the messing around we
  do with devfs during a shutdown.  Devfs has its fingers, and its
  vnodes, prettymuch sunk throughout the system (e.g. /dev/null, system
  console, vty's, root mount, and so on and so forth).  There's no
  real need to attempt to unwind all of that mess nicely.

6 years agodevfs - Fix a few more issues (3)
Matthew Dillon [Mon, 19 Mar 2018 04:57:29 +0000 (21:57 -0700)]
devfs - Fix a few more issues (3)

* devfs_unlinkp() was improperly setting node->v_node to NULL,
  which messes up certain interlocks for race avoidance.

* Use vhold()/vdrop() instead of vref()/vrele() to prevent
  vnode destruction during node teardown.  The node can be
  torndown with an unreferenced vnode.  vref() will panic if
  the refcnt is not already > 0.

* Refactor devfs_vop_reclaim() a bit.  Do not interpose the
  v_release_rdev() call between the node check and the call
  to devfs_freep().

6 years agokernel - Fix deadlock during halt/reboot
Matthew Dillon [Mon, 19 Mar 2018 04:12:14 +0000 (21:12 -0700)]
kernel - Fix deadlock during halt/reboot

* Fix a deadlock which occurs between udev and devfs.  udev
  must issue devfs_clone_bitmap_put() outside of the udev_lk.

* Fixes numerous shutdown/reboot deadlocks.

6 years agodevfs - Fix a few more issues (2)
Matthew Dillon [Mon, 19 Mar 2018 02:57:19 +0000 (19:57 -0700)]
devfs - Fix a few more issues (2)

* The devfs_freep() issues were more extensive then originally
  determined.  There was another race, primarily due to some
  vnodes (related to unlinked devfs nodes) getting torn down
  before aliases during umount.

* Add another flag and adjust the code to not free the node
  structure until all link references (nlinks) have gone
  away.

* Also refactor locking and sequencing to further bullet-proof
  vnode reclaims vs devfs_freep()'s.

6 years agopc64 - Improve TSC and LAPIC timer calibration code.
Imre Vadász [Sun, 25 Feb 2018 21:51:26 +0000 (22:51 +0100)]
pc64 - Improve TSC and LAPIC timer calibration code.

* The hw.tsc_calibrate_test=1 and hw.lapic_calibrate_test=1 tunables can
  be specified to test results of the calibration for different delays
  (from 100 milliseconds to 2 seconds in 100 millisecond steps).

* With this change the TSC and LAPIC calibration each should take only
  200 milliseconds, instead of the original 1 second and 2 second delays.

* This change tries to make the TSC calibration more exact, by averaging
  the TSC values from before and after reading the timer. By sampling the
  latency of reading the (HPET) timer, we can make sure that the start and
  end measurements of TSC and the (typically HPET or i8254) timer didn't
  get interrupted (e.g. by an SMI on hardware, or by the host when running
  virtualized), and filter out those outliers.

* Additionally for the TSC calibration the new code does 2 measurements at
  the start and end of the delay time, separated by 20 milliseconds. This
  should make results even more consistent.

* The hw.calibrate_tsc_fast=0 tunable can be set, to revert to the old TSC
  calibration code.

* Use the TSC to calibrate the LAPIC timer, when the TSC is invariant.
  Although this indirect calibration might accumulate inaccuracies, this
  still seems better. Since the TSC runs very fast, we can get a very
  accurate value in 200ms or even less.
  To forcibly disable the TSC based LAPIC calibration, set the
  hw.lapic_calibrate_fast=0 loader tunable.

* The fallback (without using the TSC) LAPIC calibration is slightly
  improved, by measuring the sysclock timestamp at the start and end of the
  measurement explicitly with sys_cputimer->count(). Also the lapic timer is
  explicitly read after starting the countdown.
  It also proves to be useful in at least some virtualization environments
  (e.g. QEMU with TCG emulation), to do some LAPIC timer access before
  actually measuring anything.

* The HPET and LAPIC mmio read accesses are no barrier for Intel and AMD
  cpus. So we explicitly have to avoid out-of-order execution of the rdtsc()
  call that follows the sys_cputimer->count(), by using rdtsc_ordered()
  which uses lfence or mfence on Intel and AMD CPUs respectively.

6 years agoacpi_hpet - Implement early HPET initialization for TSC calibration.
Imre Vadász [Mon, 5 Feb 2018 21:55:23 +0000 (22:55 +0100)]
acpi_hpet - Implement early HPET initialization for TSC calibration.

6 years agopc64 - Allow for initializing other cputimers than i8254 in early boot.
Imre Vadász [Sun, 18 Feb 2018 13:27:46 +0000 (14:27 +0100)]
pc64 - Allow for initializing other cputimers than i8254 in early boot.

6 years agoA little mdoc cleanup in 3 manual pages.
Sascha Wildner [Sun, 18 Mar 2018 22:11:19 +0000 (23:11 +0100)]
A little mdoc cleanup in 3 manual pages.

6 years agodm - synchronize disk info before returning
Matthew Dillon [Sun, 18 Mar 2018 19:26:17 +0000 (12:26 -0700)]
dm - synchronize disk info before returning

* DM now issues a disk_config(NULL) after setting up the disk info
  in order to wait for the probe to complete, otherwise callers
  may race trying to open() the disk device before it is actually
  ready.

* Fixes cryptsetup luksOpen errors which occur due to probe races,
  typically when used in a VM or qemu.

Reported-by: Aaron LI
6 years agoiwm - Improve firmware Time Event handling.
Imre Vadász [Sun, 18 Mar 2018 14:24:22 +0000 (15:24 +0100)]
iwm - Improve firmware Time Event handling.

* This is a mix of the OpenBSD Git 7fd9664469d1b717a307eebd74aeececbd3c41cc
  change, and syncing with the Linux iwlwifi code.

Taken-From: Linux iwlwifi, and OpenBSD

6 years ago<sys/mutex2.h>: Fix build without INVARIANTS.
Sascha Wildner [Sun, 18 Mar 2018 14:17:45 +0000 (15:17 +0100)]
<sys/mutex2.h>: Fix build without INVARIANTS.

Reported-by: ivadasz
6 years agoiwm - Avoid Tx watchdog timeout, when dropping a connection.
Imre Vadász [Sun, 18 Mar 2018 10:04:49 +0000 (11:04 +0100)]
iwm - Avoid Tx watchdog timeout, when dropping a connection.

6 years agoiwm - Track firmware state better, and improve handling in iwm_newstate().
Imre Vadász [Sat, 17 Mar 2018 14:48:02 +0000 (15:48 +0100)]
iwm - Track firmware state better, and improve handling in iwm_newstate().

* This avoids firmware resets in all the cases in iwm_newstate(). Instead
  iwm_bring_down_firmware() is called, which tears down all the STA
  connection state, according to the sc->sc_firmware_state value.

* Improve the behaviour of the LED blinking a bit, so it only blinks when
  there really is a wireless scan going on.

* Print the newstate arg in debug output of iwm_newstate(), to help in
  debugging.

This is inspired by the firmware state maintaining change in OpenBSD's iwm, by
stsp@openbsd.org (OpenBSD Git 0ddb056fb7370664b1d4b84392697cb17d1a414a).