]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r348504 (by kevans):
Dimitry Andric [Tue, 23 Jul 2019 18:40:32 +0000 (18:40 +0000)]
MFC r348504 (by kevans):

llvm-symbolizer: Move out of CLANG_EXTRAS, into CLANG

ASAN reports become a lot more useful with llvm-symbolizer in $PATH, and the
build is not much more time-consuming. The added benefit is that the
resulting reports will actually include symbol information; without, thread
trace information includes a bunch of addresses that immediately resolve to
an inline function in
^/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.h and take a
little more effort to examine.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D20484

MFC r349004:

Upgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
libunwind and openmp to the upstream release_80 branch r363030
(effectively, 8.0.1 rc2).  The 8.0.1 release should follow this within a
week or so.

MFC r349351 (by jhibbits, partially):

powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)

Summary:
Toolchain follow-up to r349350.  LLVM patches will be submitted upstream for
9.0 as well.

The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it
cannot determine for certain that it needs Secure-PLT, and some binaries do
not compile in such a way to make it know to use Secure-PLT.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598

MFC r349793:

Upgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
libunwind and openmp to the upstream release_80 branch r364487
(effectively, 8.0.1 rc3).  The 8.0.1 release will most likely
have no further changes.

MFC r350177:

Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.1 final release r366581.  The only functional change is a fix for a
mismerge of upstream r360816, which properly restores the r2 register
when unwinding on PowerPC64 (See https://reviews.freebsd.org/D20337).

Relnotes: yes
PR: 236062

4 years agobhyve: Fix resource leak when using strdup
Ed Maste [Tue, 23 Jul 2019 18:11:42 +0000 (18:11 +0000)]
bhyve: Fix resource leak when using strdup

MFC r340044 (araujo):

Fix resource leak when using strdup(3).

MFC r344160 (rgrimes):

In r340044 an attempt to quiet coverity warning cid 1357336
was incorrectly implemented leading to a possible double free.

It is possible for both the conditional free,
and the unconditional free added in r340044 to be done,
fix that by initializing uopt to NULL,
removing the conditional free,
and only using the unconditional free at the end.

CID: 1357336
Reported by:    Coverity

4 years agoMFC r349915 (seanc): usr.sbin/bhyve: initialize return value ...
Ed Maste [Tue, 23 Jul 2019 18:07:44 +0000 (18:07 +0000)]
MFC r349915 (seanc): usr.sbin/bhyve: initialize return value ...

... in xhci device interrupt handler

Coverity CID: 1357340

4 years agoMFC r350244: bhyve: correct out-of-bounds read in XHCI device emulation
Ed Maste [Tue, 23 Jul 2019 17:48:37 +0000 (17:48 +0000)]
MFC r350244: bhyve: correct out-of-bounds read in XHCI device emulation

Add appropriate bounds checks on the epid and streamid fields in the
device doorbell registers.

admbugs: 919
Submitted by: jhb
Reported by: Reno Robert <renorobert@gmail.com>
Reviewed by: markj
Approved by: so
Security: out-of-bounds read

4 years agoMFC r350221
Li-Wen Hsu [Tue, 23 Jul 2019 08:20:52 +0000 (08:20 +0000)]
MFC r350221

Temporarily skip sys.netpfil.pf.forward.{v4,v6} and sys.netpfil.pf.set_tos.v4
on i386 as they are flakey on it

PR: 239380
Sponsored by: The FreeBSD Foundation

4 years agoMFC r350219
Li-Wen Hsu [Tue, 23 Jul 2019 08:18:08 +0000 (08:18 +0000)]
MFC r350219

Temporarily skip lib.libc.regex.exhaust_test.regcomp_too_big and
lib.libregex.exhaust_test.regcomp_too_big on i386 as they are flakey on it

PR: 237450
Sponsored by: The FreeBSD Foundation

4 years agoMFC r350063:
Cy Schubert [Tue, 23 Jul 2019 02:30:24 +0000 (02:30 +0000)]
MFC r350063:

Refactor, removing one compare.

This changes the return code however the caller only tests for 0 and != 0.
One might ask then, why multiple return codes when the caller only tests
for 0 and != 0? From what I can tell, Darren probably passed various
return codes for sake of debugging. The debugging code is long gone
however we can still use the different return codes using DTrace FBT
traces. We can still determine why the compare failed by examining the
differences between the fr1 and fr2 frentry structs, which is a simple
test in DTrace. This allows reducing the number of tests, improving the
code while not affecting our ability to capture information for
diagnostic purposes.

4 years agoMFC r350156:
Konstantin Belousov [Mon, 22 Jul 2019 19:25:05 +0000 (19:25 +0000)]
MFC r350156:
Fix leak of memory and file refs with sendmsg(2) over unix domain sockets.

Approved by: so (insta-MFC)

4 years agonand: create device with 0640 permission
Ed Maste [Mon, 22 Jul 2019 01:06:06 +0000 (01:06 +0000)]
nand: create device with 0640 permission

rw-r----- is the usual/standard permissions for such devices.

Direct commit to stable/12 as this code has been removed in HEAD.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoMFC r349952
Vincenzo Maffione [Sun, 21 Jul 2019 11:40:00 +0000 (11:40 +0000)]
MFC r349952

usr.sbin/bhyve: close backend file descriptor during tap init error

Submitted by: seanc
Coverity CID:   1402953
Reviewed by:    scottl, markj, aleksandr.fedorov -at- itglobal.com
Approved by:    vmaffione, jhb
Differential Revision:  https://reviews.freebsd.org/D20913

4 years agoMFC r349935
Vincenzo Maffione [Sun, 21 Jul 2019 11:34:14 +0000 (11:34 +0000)]
MFC r349935

usr.sbin/bhyve: free resources when erroring out of pci_vtnet_init()

Submitted by: seanc
Coverity CID:   1402978
Approved by:    vmaffione
Reviewed by:    jhb
Differential Revision:  https://reviews.freebsd.org/D20912

4 years agoMFC r349868
Vincenzo Maffione [Sun, 21 Jul 2019 11:28:40 +0000 (11:28 +0000)]
MFC r349868

bhyve: net_backends.c: add missing __FBSDID

Reviewed by:    jhb
Differential Revision:  https://reviews.freebsd.org/D20883

4 years agoMFC r349867
Vincenzo Maffione [Sun, 21 Jul 2019 11:26:49 +0000 (11:26 +0000)]
MFC r349867

bhyve: add missing license identifiers in net_utils and net_backend

Reviewed by:    jhb, markj, imp
Differential Revision:  https://reviews.freebsd.org/D20874

4 years agoMFC r349803
Vincenzo Maffione [Sun, 21 Jul 2019 10:58:25 +0000 (10:58 +0000)]
MFC r349803

bhyve: abstraction for network backends

Bhyve can currently emulate two virtual NICs, namely virtio-net and e1000,
and connect to the host network through two backends, namely tap and netmap.
However, there is no interface between virtual NIC functionalities and
backend functionalities. As a result, the backend code is duplicated between
the two virtual NIC implementations and also within the same virtual NIC.
Also, e1000 cannot currently use netmap as a backend.
This patch introduces a network backend API between virtio-net/e1000 and
tap/netmap, to improve code reuse and add missing functionalities.
Virtual NICs and backends can negotiate virtio-net features, such as checksum
offload and TSO. If the backend supports the features, it will propagate this
information to the guest, so that the latter can make use of them. Currently,
only netmap VALE ports support the features, but support should be added to
tap in the future.

Reviewed by:    jhb, bryanv
Differential Revision:  https://reviews.freebsd.org/D20659

4 years agoMFC r349988:
Konstantin Belousov [Sun, 21 Jul 2019 08:28:28 +0000 (08:28 +0000)]
MFC r349988:
In dmar_find(), refuse to search for DMAR unit for non-PCI device.

PR: 239143

4 years agoMFC r349980:
Cy Schubert [Sun, 21 Jul 2019 00:47:06 +0000 (00:47 +0000)]
MFC r349980:

Calculate the offset of the interface name using FR_NAME rather than
calclulating it "by hand". This improves consistency with the rest of
the code and is in line with planned fixes and other work.

4 years agoMFC r349979:
Cy Schubert [Sun, 21 Jul 2019 00:44:52 +0000 (00:44 +0000)]
MFC r349979:

Recycle the unused FR_CMPSIZ macro which became orphaned in ipfilter 5
prior to its import into FreeBSD. This macro calculates the size to be
compared within the frentry structure. The ipfilter 4 version of the
macro calculated the compare size based upon the static size of the
frentry struct. Today it uses the ipfilter 5 method of calculating the
size based upon the new to ipfilter 5 fr_size value found in the
frentry struct itself.

No effective change in code is intended.

4 years agoMFC r349543
Li-Wen Hsu [Sat, 20 Jul 2019 08:40:31 +0000 (08:40 +0000)]
MFC r349543

Fix VOP_PUTPAGES(9) in regards to the use of VM_PAGER_CLUSTER_OK

Submitted by: Ka Ho Ng <khng300 at gmail.com>
Reviewed by: mckusick
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20695

4 years agoMFC r349872:
Li-Wen Hsu [Sat, 20 Jul 2019 07:04:25 +0000 (07:04 +0000)]
MFC r349872:

Correct definitions in sys.opencrypto.runtests.main for 32bit platform

Reviewed by: cem, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20894

4 years agoMFC r350048:
Mark Johnston [Fri, 19 Jul 2019 16:21:19 +0000 (16:21 +0000)]
MFC r350048:
Chase r350037.

4 years agoMFC r349890:
Philip Paeps [Fri, 19 Jul 2019 15:37:29 +0000 (15:37 +0000)]
MFC r349890:
  telnet: fix a couple of snprintf() buffer overflows

  Obtained from:       Juniper Networks

MFC r349896:
  telnet: fix minor style violationo

  While here also fix a very unlikely NULL pointer dereference.

  Submitted by:        Shawn Webb <shawn.webb@hardenedbsd.org>

4 years agoMFC r349940:
Andrey V. Elsukov [Fri, 19 Jul 2019 15:17:54 +0000 (15:17 +0000)]
MFC r349940:
  Correctly truncate the rule in case when it has several action opcodes.

  It is possible, that opcode at the ACTION_PTR() location is not real
  action, but action modificator like "log", "tag" etc. In this case we
  need to check for each opcode in the loop to find O_EXTERNAL_ACTION.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

MFC r349941:
  Do not modify cmd pointer if it is already last opcode in the rule.

4 years agoMFC r350037:
Mark Johnston [Fri, 19 Jul 2019 15:11:14 +0000 (15:11 +0000)]
MFC r350037:
Fix the arm64 page table entry attribute mask.

4 years agoMFC r350054:
Mark Johnston [Fri, 19 Jul 2019 15:07:31 +0000 (15:07 +0000)]
MFC r350054:
Use a platform-independent constant for PKG_MAX_SIZE.

PR: 238511

4 years agoMFC r349237:
Alan Somers [Fri, 19 Jul 2019 14:27:18 +0000 (14:27 +0000)]
MFC r349237:

VOP_REVOKE(9): update locking requirements per r143495

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20524

4 years agoMFC r349230, r349234, r349477
Alan Somers [Fri, 19 Jul 2019 14:16:11 +0000 (14:16 +0000)]
MFC r349230, r349234, r349477

r349230:
Add a VOP_BMAP(9) man page

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20704

r349234:
VOP_BMAP(9): fix typo in the copyright header

Reported by: rgrimes
MFC-With: 349230
Sponsored by: The FreeBSD Foundation

r349477:
[skip ci] VOP_BMAP.9: fix diction in copyright header

MFC-With: r349230
Sponsored by: The FreeBSD Foundation

4 years agoMFC r349041:
Alan Somers [Fri, 19 Jul 2019 14:13:50 +0000 (14:13 +0000)]
MFC r349041:

open(2): fix the description of O_FSYNC

The man page claims that with O_FSYNC (aka O_SYNC) the kernel will not cache
written data. However, that's not true. Nor does POSIX require it.
Perhaps it was true when that section of the man page was written in r69336
(I haven't checked). But it's not true now.  Now the effect is simply that
writes are sent to disk immediately and synchronously, but they're still
cached.

See also: https://pubs.opengroup.org/onlinepubs/9699919799/
See also: ffs_write in sys/ufs/ffs/ffs_vnops.c

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20641

4 years agoMFC r349009:
Alan Somers [Fri, 19 Jul 2019 14:12:11 +0000 (14:12 +0000)]
MFC r349009:

Add test cases for epair

Implements the missing test cases for epair in a similar fashion to the
existing tests. Fixes shared abstractions to work with epair tests.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reviewed by: asomers
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D20498

4 years agoMFC r349917:
Cy Schubert [Thu, 18 Jul 2019 11:46:37 +0000 (11:46 +0000)]
MFC r349917:

Remove a tautological test for adding a rule in the block that
adds rules.

4 years agoMFC r349898, r349916:
Cy Schubert [Thu, 18 Jul 2019 11:43:09 +0000 (11:43 +0000)]
MFC r349898, r349916:

ipfilter commands, in this case ipf(8), passes its operations and rules
via an ioctl interface. Rules can be added or removed and stats and
counters can be zeroed out. As the ipfilter interprets these
instructions or operations they are stored in an integer called
addrem (add/remove). 0 is add, 1 is remove, and 2 is clear stats and
counters. Much of this is not documented. This commit documents these
operations by replacing simple integers with a self documenting
enum along with a few basic comments.

4 years agoMFC r349910:
Mark Johnston [Thu, 18 Jul 2019 01:33:00 +0000 (01:33 +0000)]
MFC r349910:
Fix some ISS bit definitions for data aborts.

4 years agoMFC r344629:
Mark Johnston [Wed, 17 Jul 2019 16:52:25 +0000 (16:52 +0000)]
MFC r344629:
rtsol: Use vwarnx(3) to log messages to standard error.

4 years agoMFC r349276:
Johannes Lundberg [Wed, 17 Jul 2019 16:38:40 +0000 (16:38 +0000)]
MFC r349276:
LinuxKPI: Add atomic_long_sub macro.

Reviewed by: imp (mentor), hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D20718

4 years agoMFC r349277:
Johannes Lundberg [Wed, 17 Jul 2019 16:34:32 +0000 (16:34 +0000)]
MFC r349277:
LinuxKPI: Additions to rcu list.

- Add rcu list functions.
- Make rcu hlist's foreach macro use rcu calls instead of the non-rcu macro.
- Bump FreeBSD version so we have a checkpoint for the vboxvideo drm driver.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D20719

4 years agoMFC r349978:
Cy Schubert [Wed, 17 Jul 2019 01:05:33 +0000 (01:05 +0000)]
MFC r349978:

style(9)

4 years agoMFC r349711:
Mark Johnston [Wed, 17 Jul 2019 00:27:11 +0000 (00:27 +0000)]
MFC r349711:
iwm: Drain callouts after stopping the device during detach.

4 years agoMFC r345632 by lwhsu: Fix `make` in sys/modules
Eugene Grosbein [Tue, 16 Jul 2019 18:39:59 +0000 (18:39 +0000)]
MFC r345632 by lwhsu: Fix `make` in sys/modules

PR:             239120

4 years agoMFC r349971:
Dimitry Andric [Tue, 16 Jul 2019 17:39:58 +0000 (17:39 +0000)]
MFC r349971:

Pull in r365760 from upstream lld trunk (by Fangrui Song):

  [ELF] Handle non-glob patterns before glob patterns in version
  scripts & fix a corner case of --dynamic-list

  This fixes PR38549, which is silently accepted by ld.bfd.
  This seems correct because it makes sense to let non-glob patterns
  take precedence over glob patterns.

  lld issues an error because
  `assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before
  `assignExactVersion(ver, v.id, v.name);`.

  Move all assignWildcardVersion() calls after assignExactVersion()
  calls to fix this.

  Also, move handleDynamicList() to the bottom. computeBinding() called
  by includeInDynsym() has this cryptic rule:

      if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible)
return STB_LOCAL;

  Before the change:

  * foo's version is set to VER_NDX_LOCAL due to `local: *`
  * handleDynamicList() is called
    - foo.computeBinding() is STB_LOCAL
    - foo.includeInDynsym() is false
    - foo.isPreemptible is not set (wrong)
  * foo's version is set to V1

  After the change:

  * foo's version is set to VER_NDX_LOCAL due to `local: *`
  * foo's version is set to V1
  * handleDynamicList() is called
    - foo.computeBinding() is STB_GLOBAL
    - foo.includeInDynsym() is true
    - foo.isPreemptible is set (correct)

  Reviewed By: ruiu

  Differential Revision: https://reviews.llvm.org/D64550

This makes it longer necessary to patch the version scripts for the
samba ports, to avoid "duplicate symbol 'pdb_search_init' in version
script" errors.

PR: 230602

4 years agoMFC r349869
Vincenzo Maffione [Tue, 16 Jul 2019 17:27:51 +0000 (17:27 +0000)]
MFC r349869

update calendar.freebsd

4 years agoMFC r349472:
Li-Wen Hsu [Tue, 16 Jul 2019 16:23:56 +0000 (16:23 +0000)]
MFC r349472:

Follow r349460 to complete removing "flags" in struct gpiobus_ivar

Sponsored by: The FreeBSD Foundation

4 years agoMFC r349834
Eric van Gyzen [Tue, 16 Jul 2019 16:05:42 +0000 (16:05 +0000)]
MFC r349834

Ignore kern.vt.splash_cpu without graphics

When the system has no graphical console, such as bhyve in common
configurations, ignore kern.vt.splash_cpu, instead of panicking
on INVARIANTS kernels.

Reviewed by: cem dumbbell
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20877

4 years agoMFC r349579: nctgpio: change default pin names to those used by the datasheet(s)
Andriy Gapon [Tue, 16 Jul 2019 16:01:51 +0000 (16:01 +0000)]
MFC r349579: nctgpio: change default pin names to those used by the datasheet(s)

That is, instead of the current GPIO00 - GPIO15 the names will be GPIO00
- GPIO07, GPIO10 - GPIO17.  The first digit is a GPIO "bank" / group
number and the second one is a pin number within the bank.  Alternative
view is that the pin names are changed from decimal numbering scheme to
octal one (as there are 8 pins per bank).

4 years agoMFC r349460: gpiobus: provide a new hint, pin_list
Andriy Gapon [Tue, 16 Jul 2019 15:52:47 +0000 (15:52 +0000)]
MFC r349460: gpiobus: provide a new hint, pin_list

"pin_list" allows to specify child pins as a list of pin numbers.
Existing hint "pins" serves the same purpose but with a 32-bit wide bit
mask.  One problem with that is that a controller can have more than 32
pins.  One example is amdgpio.  Also, a list of numbers is a little bit
more human friendly than a matching bit mask.  As a side note, it seems
that in FDT pins are typically specified by their numbers as well.

This commit also adds accessors for instance variables (IVARs) that
define the child pins.  My primary goal is to allow a child to be
configured programmatically rather than via hints (assuming that FDT is
not supported on a platform).  Also, while a child should not care about
specific pin numbers that are allocated to it, it could be interested in
how many were actually assigned to it.

While there, I removed "flags" instance variable.  It was unused.

4 years agoMFC r349428,r349433: owc_gpiobus: clean / fix up the driver module things
Andriy Gapon [Tue, 16 Jul 2019 15:48:02 +0000 (15:48 +0000)]
MFC r349428,r349433: owc_gpiobus: clean / fix up the driver module things

"fdt" is removed from the driver module name as the driver does not
require FDT and can work very well on hints based systems.

A module dependency is added for gpiobus.  Without that owc cannot
resolve symbols in gpiobus if both are loaded as kernel modules.

Finally, a driver module module version is added.

4 years agoMFC r349408: gpio.4: document device hints common to all devices on gpiobus
Andriy Gapon [Tue, 16 Jul 2019 15:44:07 +0000 (15:44 +0000)]
MFC r349408: gpio.4: document device hints common to all devices on gpiobus

4 years agoMFC r349406: owc.4: document how to set up the 1-wire bus on a device.hints system
Andriy Gapon [Tue, 16 Jul 2019 15:36:05 +0000 (15:36 +0000)]
MFC r349406: owc.4: document how to set up the 1-wire bus on a device.hints system

4 years agoMFC r348688: first step towards enforcing must-succeed semantics for bus accessors
Andriy Gapon [Tue, 16 Jul 2019 15:28:28 +0000 (15:28 +0000)]
MFC r348688: first step towards enforcing must-succeed semantics for bus accessors

4 years agoMFC r349645:
Hans Petter Selasky [Tue, 16 Jul 2019 15:07:33 +0000 (15:07 +0000)]
MFC r349645:
Remove dead code added after r348743 in the LinuxKPI. The
LINUXKPI_VERSION macro is not defined for any compiled LinuxKPI code
which basically means __GFP_NOTWIRED is never checked when allocating
pages. This should work fine with the existing external DRM code as
long as the page wiring and unwiring is balanced.

Sponsored by: Mellanox Technologies

4 years agoMFC r348355: revert r273728 and parts of r306589, iicbus no-stop by default feature
Andriy Gapon [Tue, 16 Jul 2019 14:59:39 +0000 (14:59 +0000)]
MFC r348355: revert r273728 and parts of r306589, iicbus no-stop by default feature

After r349224 the only consumer of that broken code is gone.

4 years agoMFC r349581
Vincenzo Maffione [Mon, 15 Jul 2019 20:25:49 +0000 (20:25 +0000)]
MFC r349581

netmap: fix two panics with emulated adapter

This patch fixes 2 panics. The first one is due to the current VNET not
being set in the emulated adapter transmission path. The second one
is caused by the M_PKTHDR flag not being set when preallocated mbufs
are recycled in the transmit path.

Submitted by:   aleksandr.fedorov@itglobal.com
Reviewed by:    vmaffione
Differential Revision:  https://reviews.freebsd.org/D20824

4 years agoMFC r349966
Vincenzo Maffione [Mon, 15 Jul 2019 20:12:54 +0000 (20:12 +0000)]
MFC r349966

netmap: fix bug introduced by r349752

r349752 introduced a NULL pointer reference bug
in the emulated netmap code.

Reported by:    lwhsu

4 years agoMFC r349950:
Konstantin Belousov [Mon, 15 Jul 2019 08:21:21 +0000 (08:21 +0000)]
MFC r349950:
Style: avoid long lines by using .Fo instead of .Fn.

4 years agoMFC r349913:
Konstantin Belousov [Sun, 14 Jul 2019 05:40:03 +0000 (05:40 +0000)]
MFC r349913:
Ensure that mds_handler always points to a valid method.

4 years agoMFC r349912:
Konstantin Belousov [Sun, 14 Jul 2019 05:39:02 +0000 (05:39 +0000)]
MFC r349912:
Restore ability to pass NULL name argument to pthread_set_name_np(3)
to clear the thread name.

PR: 239142

4 years agoMFC r349876:
Dimitry Andric [Sat, 13 Jul 2019 10:46:01 +0000 (10:46 +0000)]
MFC r349876:

Apply a workaround to be able to build clang 8.0.0 headers with clang
3.4.1, which is still in the stable/10 branch.

It looks like clang 3.4.1 implements static_asserts by instantiating a
temporary static object, and if those are in an anonymous union, it
results in "error: anonymous union can only contain non-static data
members".

To work around this implementation limitation, move the static_asserts
in question out of the anonymous unions.

This should make building the latest stable/11 from stable/10 possible
again.

Reported by: Mike Tancsa <mike@sentex.net>

4 years agoMFC 347238: vmm(4): Pass through RDSEED feature bit to guests
John Baldwin [Sat, 13 Jul 2019 00:51:11 +0000 (00:51 +0000)]
MFC 347238: vmm(4): Pass through RDSEED feature bit to guests

4 years agoMFC 343068:
John Baldwin [Sat, 13 Jul 2019 00:23:20 +0000 (00:23 +0000)]
MFC 343068:
Use capsicum_helpers(3) that allow us to simplify the code and its functions
will return success when the kernel is built without support of
the capability mode.

It is important to note, that I'm taking a more conservative approach
with these changes and it will be done in small steps.

4 years agoMFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes.
John Baldwin [Fri, 12 Jul 2019 22:31:12 +0000 (22:31 +0000)]
MFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes.

339911:
Emulate machine check related MSR_EXTFEATURES to allow guest OSes to
boot on AMD FX Series.

339936:
Merge cases with upper block.
This is a cosmetic change only to simplify code.

343075:
vmm(4): Take steps towards multicore bhyve AMD support

vmm's CPUID emulation presented Intel topology information to the guest, but
disabled AMD topology information and in some cases passed through garbage.
I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but
guest CPUs can migrate between host threads, so the information presented
was not consistent.  This could easily be observed with 'cpucontrol -i 0xfoo
/dev/cpuctl0'.

Slightly improve this situation by enabling the AMD topology feature flag
and presenting at least the CPUID fields used by FreeBSD itself to probe
topology on more modern AMD64 hardware (Family 15h+).  Older stuff is
probably less interesting.  I have not been able to empirically confirm it
is sufficient, but it should not regress anything either.

343166:
vmm(4): Mask Spectre feature bits on AMD hosts

For parity with Intel hosts, which already mask out the CPUID feature
bits that indicate the presence of the SPEC_CTRL MSR, do the same on
AMD.

Eventually we may want to have a better support story for guests, but
for now, limit the damage of incorrectly indicating an MSR we do not yet
support.

Eventually, we may want a generic CPUID override system for
administrators, or for minimum supported feature set in heterogenous
environments with failover.  That is a much larger scope effort than
this bug fix.

348592:
Emulate the AMD MSR_LS_CFG MSR used for various Ryzen errata.

Writes are ignored and reads always return zero.

PR: 224476, 235010

4 years agoMFC 348210: Add a constant for the LS config MSR on AMD CPUs.
John Baldwin [Fri, 12 Jul 2019 20:05:30 +0000 (20:05 +0000)]
MFC 348210: Add a constant for the LS config MSR on AMD CPUs.

4 years agoMFC r349583:
Dimitry Andric [Fri, 12 Jul 2019 19:43:59 +0000 (19:43 +0000)]
MFC r349583:

Pull in r360968 from upstream llvm trunk (by Philip Reames):

  Clarify comments on helpers used by LFTR [NFC]

  I'm slowly wrapping my head around this code, and am making comment
  improvements where I can.

Pull in r360972 from upstream llvm trunk (by Philip Reames):

  [LFTR] Factor out a helper function for readability purpose [NFC]

Pull in r360976 from upstream llvm trunk (by Philip Reames):

  [IndVars] Don't reimplement Loop::isLoopInvariant [NFC]

  Using dominance vs a set membership check is indistinguishable from a
  compile time perspective, and the two queries return equivelent
  results.  Simplify code by using the existing function.

Pull in r360978 from upstream llvm trunk (by Philip Reames):

  [LFTR] Strengthen assertions in genLoopLimit [NFCI]

Pull in r362292 from upstream llvm trunk (by Nikita Popov):

  [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181)

  Fix for https://bugs.llvm.org/show_bug.cgi?id=31181 and partial fix
  for LFTR poison handling issues in general.

  When LFTR moves a condition from pre-inc to post-inc, it may now
  depend on value that is poison due to nowrap flags. To avoid this, we
  clear any nowrap flag that SCEV cannot prove for the post-inc addrec.

  Additionally, LFTR may switch to a different IV that is dynamically
  dead and as such may be arbitrarily poison. This patch will correct
  nowrap flags in some but not all cases where this happens. This is
  related to the adoption of IR nowrap flags for the pre-inc addrec.
  (See some of the switch_to_different_iv tests, where flags are not
  dropped or insufficiently dropped.)

  Finally, there are likely similar issues with the handling of GEP
  inbounds, but we don't have a test case for this yet.

  Differential Revision: https://reviews.llvm.org/D60935

Pull in r362971 from upstream llvm trunk (by Philip Reames):

  Prepare for multi-exit LFTR [NFC]

  This change does the plumbing to wire an ExitingBB parameter through
  the LFTR implementation, and reorganizes the code to work in terms of
  a set of individual loop exits. Most of it is fairly obvious, but
  there's one key complexity which makes it worthy of consideration.
  The actual multi-exit LFTR patch is in D62625 for context.

  Specifically, it turns out the existing code uses the backedge taken
  count from before a IV is widened. Oddly, we can end up with a
  different (more expensive, but semantically equivelent) BE count for
  the loop when requerying after widening.  For the nestedIV example
  from elim-extend, we end up with the following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  This is the only test in tree which seems sensitive to this
  difference. The actual result of using the wider BETC on this example
  is that we actually produce slightly better code. :)

  In review, we decided to accept that test change.  This patch is
  structured to preserve the old behavior, but a separate change will
  immediate follow with the behavior change.  (I wanted it separate for
  problem attribution purposes.)

  Differential Revision: https://reviews.llvm.org/D62880

Pull in r362975 from upstream llvm trunk (by Philip Reames):

  [LFTR] Use recomputed BE count

  This was discussed as part of D62880.  The basic thought is that
  computing BE taken count after widening should produce (on average)
  an equally good backedge taken count as the one before widening.
  Since there's only one test in the suite which is impacted by this
  change, and it's essentially equivelent codegen, that seems to be a
  reasonable assertion.  This change was separated from r362971 so that
  if this turns out to be problematic, the triggering piece is obvious
  and easily revertable.

  For the nestedIV example from elim-extend.ll, we end up with the
  following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  Note that before is an i32 type, and the after is an i64.  Truncating
  the i64 produces the i32.

Pull in r362980 from upstream llvm trunk (by Philip Reames):

  Factor out a helper function for readability and reuse in a future
  patch [NFC]

Pull in r363613 from upstream llvm trunk (by Philip Reames):

  Fix a bug w/inbounds invalidation in LFTR (recommit)

  Recommit r363289 with a bug fix for crash identified in pr42279.
  Issue was that a loop exit test does not have to be an icmp, leading
  to a null dereference crash when new logic was exercised for that
  case.  Test case previously committed in r363601.

  Original commit comment follows:

  This contains fixes for two cases where we might invalidate inbounds
  and leave it stale in the IR (a miscompile). Case 1 is when switching
  to an IV with no dynamically live uses, and case 2 is when doing
  pre-to-post conversion on the same pointer type IV.

  The basic scheme used is to prove that using the given IV (pre or
  post increment forms) would have to already trigger UB on the path to
  the test we're modifying. As such, our potential UB triggering use
  does not change the semantics of the original program.

  As was pointed out in the review thread by Nikita, this is defending
  against a separate issue from the hasConcreteDef case. This is about
  poison, that's about undef. Unfortunately, the two are different, see
  Nikita's comment for a fuller explanation, he explains it well.

  (Note: I'm going to address Nikita's last style comment in a separate
  commit just to minimize chance of subtle bugs being introduced due to
  typos.)

  Differential Revision: https://reviews.llvm.org/D62939

Pull in r363875 from upstream llvm trunk (by Philip Reames):

  [LFTR] Rename variable to minimize confusion [NFC]

  (Recommit of r363293 which was reverted when a dependent patch was.)

  As pointed out by Nikita in D62625, BackedgeTakenCount is generally
  used to refer to the backedge taken count of the loop. A conditional
  backedge taken count - one which only applies if a particular exit is
  taken - is called a ExitCount in SCEV code, so be consistent here.

Pull in r363877 from upstream llvm trunk (by Philip Reames):

  [LFTR] Stylistic cleanup as suggested in last review comment of
  D62939 [NFC]

  (Resumbit of r363292 which was reverted along w/an earlier patch)

Pull in r364346 from upstream llvm trunk (by Philip Reames):

  [LFTR] Adjust debug output to include extensions (if any)

Pull in r364693 from upstream llvm trunk (by Philip Reames):

  [IndVars] Remove a bit of manual constant folding [NFC]

  SCEV is more than capable of folding (add x, trunc(0)) to x.

Pull in r364709 from upstream llvm trunk (by Nikita Popov):

  [LFTR] Fix post-inc pointer IV with truncated exit count (PR41998)

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we
  have a truncated exit count we'll truncate the IV when comparing
  against the limit, in which case exit count overflow in post-inc form
  doesn't matter. However, for pointer IVs we don't do that, so we have
  to be careful about incrementing the IV in the wide type.

  I'm fixing this by removing the IVCount variable (which was ExitCount
  or ExitCount+1) and replacing it with a UsePostInc flag, and then
  moving the actual limit adjustment to the individual cases (which
  are: pointer IV where we add to the wide type, integer IV where we
  add to the narrow type, and constant integer IV where we add to the
  wide type).

  Differential Revision: https://reviews.llvm.org/D63686

Together, these should fix a hang when building the textproc/htmldoc
port, due to an incorrect loop optimization.

PR: 237515

4 years agoMFC r349929:
Cy Schubert [Fri, 12 Jul 2019 02:15:06 +0000 (02:15 +0000)]
MFC r349929:

Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c.
The reason for this is that ipftest(8), which still works on FreeBSD-11,
fails to link to it, breaking stable/11 builds.

ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle.
glebius@ suggested we disable building it until I can get around to
fixing it. Hence this was not caught in -current.

The intention is to fix ipftest(8) as it is used by the netbsd-tests
(imported by ngie@ many moons ago) for regression testing.

4 years agoMFC r349286, r349293
Doug Moore [Fri, 12 Jul 2019 02:03:43 +0000 (02:03 +0000)]
MFC r349286, r349293

Modify swapon(8) to invoke BIO_DELETE to trim swap devices, either if
'-E' appears on the swapon command line, or if "trimonce" appears as
an fstab option.

Remove #include <sys/types.h> to fix a style(9) violation.

Assisted by: alc
Release notes: yes
Approved by: kib (mentor)

4 years agoMFC r348987, r348989:
Cy Schubert [Fri, 12 Jul 2019 00:50:33 +0000 (00:50 +0000)]
MFC r348987, r348989:

Resolve IPv6 checksum errors with stateful inspection. According to
PR/203585 this appears to have been broken by r235959, which predates
the ipfilter 5.1.2 import into FreeBSD.

The IPv6 checksum calculation is incorrect. To resolve this we call
in6_cksum() to do the the heavy lifting for us, through a new function
ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe
is added to aid with future debugging.

Plus whitespace adjustments (r348989).

PR: 203275, 203585
Differential Revision: https://reviews.freebsd.org/D20583

4 years agoMFC r348986:
Cy Schubert [Fri, 12 Jul 2019 00:35:43 +0000 (00:35 +0000)]
MFC r348986:

Register pfil hooks when VNET != vnet0. r302298, which virtualized ipf,
assumed the pfil hook registration performed in ipf_modload() would take
are of this. However ipf_modload() is only called when the ipl kld is
loaded or when ipfilter is first called when it is statically linked
into the kernel at build time.

Prior to this, even though r302298 has been in the tree for a while, it
has never been used. So, r302298 in reality begins now.

PR: 212000
Reported by: ahsanb@

4 years agoMFC r349753
Vincenzo Maffione [Thu, 11 Jul 2019 20:14:59 +0000 (20:14 +0000)]
MFC r349753

netmap: Remove pointer leakage in netmap_mem2.c

PR:             238641
Submitted by:   Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed by:    vmaffione

4 years agoMFC r349752
Vincenzo Maffione [Thu, 11 Jul 2019 20:13:51 +0000 (20:13 +0000)]
MFC r349752

netmap: fix kernel pointer printing in netmap_generic.c

Print the adapter name rather than the address of the adapter
to avoid kernel address leakage.

PR:             Bug 238642
Submitted by:   Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed by:    vmaffione

4 years agoMFC r349612:
Mark Johnston [Thu, 11 Jul 2019 15:38:40 +0000 (15:38 +0000)]
MFC r349612:
Mark pages allocated from the per-CPU cache.

4 years agoMFC 349843:
Cy Schubert [Thu, 11 Jul 2019 00:44:09 +0000 (00:44 +0000)]
MFC 349843:

Update frtuc struct comments. It not only defines TCP things we are
interested in but also UDP.

While at it document the source and destination port variables.

4 years agoMFC r349842:
Cy Schubert [Thu, 11 Jul 2019 00:38:10 +0000 (00:38 +0000)]
MFC r349842:

Correct the description for the low port in the port compare struct.

Adjust the high port description to match that of the low port
description.

4 years agoMFC r349527,349538:
Martin Matuska [Thu, 11 Jul 2019 00:21:15 +0000 (00:21 +0000)]
MFC r349527,349538:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary
            (OSS-Fuzz 15431)
  PR #1218: Fixes to sparse file handling

4 years agolibsecureboot: allow OpenPGP support to be dormant
Simon J. Gerraty [Wed, 10 Jul 2019 21:35:55 +0000 (21:35 +0000)]
libsecureboot: allow OpenPGP support to be dormant

Since we can now add OpenPGP trust anchors at runtime,
ensure the latent support is available.

Ensure we do not add duplicate keys to trust store.

Also allow reporting names of trust anchors added/revoked

We only do this for loader and only after initializing trust store.
Thus only changes to initial trust store will be logged.

MFC of r349446

Reviewed by:    stevek
Differential Revision:  https://reviews.freebsd.org/D20700

4 years agoMFC r340093 (by imp): Document disbale_phy in ahcich sysctls.
Alexander Motin [Wed, 10 Jul 2019 12:15:07 +0000 (12:15 +0000)]
MFC r340093 (by imp): Document disbale_phy in ahcich sysctls.

4 years agoMFC r349418: Fix qlxgbe(4) static build.
Alexander Motin [Wed, 10 Jul 2019 12:10:10 +0000 (12:10 +0000)]
MFC r349418: Fix qlxgbe(4) static build.

4 years agoMFC r349641:
Tijl Coosemans [Wed, 10 Jul 2019 08:07:33 +0000 (08:07 +0000)]
MFC r349641:

Also remove lib32 versions of libradius.

4 years agoMFC r349640, r349706:
Tijl Coosemans [Wed, 10 Jul 2019 08:05:13 +0000 (08:05 +0000)]
MFC r349640, r349706:

Also remove lib32 version of libcasper.so.0.

4 years agoMFC r349539
Li-Wen Hsu [Tue, 9 Jul 2019 09:09:51 +0000 (09:09 +0000)]
MFC r349539

Skip sys.netpfil.pf.names.names and sys.netpfil.pf.synproxy.synproxy
temporarily because kernel panics when flushing epair queue.

PR: 238870
Sponsored by: The FreeBSD Foundation

4 years agoMFC r349794:
Konstantin Belousov [Tue, 9 Jul 2019 07:19:36 +0000 (07:19 +0000)]
MFC r349794:
Document atomicity for read(2) and write(2).

4 years agoRestore binary compatibility for epoch(9) API.
Hans Petter Selasky [Mon, 8 Jul 2019 21:33:14 +0000 (21:33 +0000)]
Restore binary compatibility for epoch(9) API.
This is a direct commit.

Discussed with: jhb@
Sponsored by: Mellanox Technologies

4 years agoMFC r349321: Improve AHCI Enclosure Management and SES interoperation.
Alexander Motin [Mon, 8 Jul 2019 10:21:38 +0000 (10:21 +0000)]
MFC r349321: Improve AHCI Enclosure Management and SES interoperation.

Since SES specs do not define mechanism to map enclosure slots to SATA
disks, AHCI EM code I written many years ago appeared quite useless,
that always bugged me.  I was thinking whether it was a good idea, but
if LSI HBAs do that, why I shouldn't?

This change introduces simple non-standard mechanism for the mapping
into both AHCI EM and SES code, that makes AHCI EM on capable controllers
(most of Intel's) a first-class SES citizen, allowing it to report disk
physical path to GEOM, show devices inserted into each enclosure slot in
`sesutil map` and `getencstat`, control locate and fault LEDs for specific
devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc.

I've successfully tested this on Supermicro X10DRH-i motherboard connected
with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane.
It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for
each disk identical to real SES of Supermicro SAS2 backplanes.

Relnotes: yes

4 years agoMFC r341811 (by delphij):
Alexander Motin [Mon, 8 Jul 2019 10:19:49 +0000 (10:19 +0000)]
MFC r341811 (by delphij):
Remove questionable initialization for ICH8M, rely on BIOS to properly
initialize the controller.

According to the datasheet, the old code checks if port 2 (P2E, 0x4) was
the only enabled port (except port 0, which was ignored by mask 0xfe),
and issue a write to the PCS register to disable all but port 0, right
before ahci_ctlr_reset.

Some other operating systems would issue a port enable to all ports, but
since the current code only does the special initialization for ICH8M,
it entirely and rely on BIOS to do the right thing (the alternative
would be https://reviews.freebsd.org/D18300?id=50922 , should we see
reports that we really need to do it).

Differential Revision:  https://reviews.freebsd.org/D18300

4 years agoMFC r340092 (by imp): Implement ability to turn on/off PHYs for AHCI devices.
Alexander Motin [Mon, 8 Jul 2019 10:18:11 +0000 (10:18 +0000)]
MFC r340092 (by imp): Implement ability to turn on/off PHYs for AHCI devices.

As part of Chuck's work on fixing kernel crashes caused by disk I/O
errors, it is useful to be able to trigger various kinds of
errors. This patch allows causing an AHCI-attached disk to disappear,
by having the driver keep the PHY disabled when the driver would
otherwise enable the PHY. It also allows making the disk reappear by
having the driver go back to setting the PHY enable/disable state as
it normal would and simulating the hardware event that causes a bus
rescan.

Submitted by: Chuck Silvers
Differential Revision: https://reviews.freebsd.org/D16043

4 years agoMFC r340041 (by miwi): - Add quirk for Samsung on Mac Mini 7,1
Alexander Motin [Mon, 8 Jul 2019 10:17:00 +0000 (10:17 +0000)]
MFC r340041 (by miwi): - Add quirk for Samsung on Mac Mini 7,1

PR: 201676
Submitted by: Ruben Kerkhof

4 years agoMFC r349246: SPC-3 and up require some UAs to be returned as fixed.
Alexander Motin [Sun, 7 Jul 2019 18:51:01 +0000 (18:51 +0000)]
MFC r349246: SPC-3 and up require some UAs to be returned as fixed.

4 years agoMFC r349243: Optimize xpt_getattr().
Alexander Motin [Sun, 7 Jul 2019 18:50:23 +0000 (18:50 +0000)]
MFC r349243: Optimize xpt_getattr().

Do not allocate temporary buffer for attributes we are going to return
as-is, just make sure to NUL-terminate them.  Do not zero temporary 64KB
buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled
and there are also length fields inside the returned data also.

4 years agoMFC r349220: Add wakeup_any(), cheaper wakeup_one() for taskqueue(9).
Alexander Motin [Sun, 7 Jul 2019 18:49:39 +0000 (18:49 +0000)]
MFC r349220: Add wakeup_any(), cheaper wakeup_one() for taskqueue(9).

wakeup_one() and underlying sleepq_signal() spend additional time trying
to be fair, waking thread with highest priority, sleeping longest time.
But in case of taskqueue there are many absolutely identical threads, and
any fairness between them is quite pointless.  It makes even worse, since
round-robin wakeups not only make previous CPU affinity in scheduler quite
useless, but also hide from user chance to see CPU bottlenecks, when
sequential workload with one request at a time looks evenly distributed
between multiple threads.

This change adds new SLEEPQ_UNFAIR flag to sleepq_signal(), making it wakeup
thread that went to sleep last, but no longer in context switch (to avoid
immediate spinning on the thread lock).  On top of that new wakeup_any()
function is added, equivalent to wakeup_one(), but setting the flag.
On top of that taskqueue(9) is switchied to wakeup_any() to wakeup its
threads.

As result, on 72-core Xeon v4 machine sequential ZFS write to 12 ZVOLs
with 16KB block size spend 34% less time in wakeup_any() and descendants
then it was spending in wakeup_one(), and total write throughput increased
by ~10% with the same as before CPU usage.

4 years agoMFC r349195: Use sbuf_cat() in GEOM confxml generation.
Alexander Motin [Sun, 7 Jul 2019 18:47:01 +0000 (18:47 +0000)]
MFC r349195: Use sbuf_cat() in GEOM confxml generation.

When it comes to megabytes of text, difference between sbuf_printf() and
sbuf_cat() becomes substantial.

4 years agoMFC r349190: Fix typo in r349178.
Alexander Motin [Sun, 7 Jul 2019 18:45:57 +0000 (18:45 +0000)]
MFC r349190: Fix typo in r349178.

4 years agoMFC r349178: Optimize kern.geom.conf* sysctls.
Alexander Motin [Sun, 7 Jul 2019 18:44:51 +0000 (18:44 +0000)]
MFC r349178: Optimize kern.geom.conf* sysctls.

On large systems those sysctls may generate megabytes of output.  Before
this change sbuf(9) code was resizing buffer by 4KB each time many times,
generating tons of TLB shootdowns.  Unfortunately in this case existing
sbuf_new_for_sysctl() mechanism, supposed to help with this issue, is not
applicable, since all the sbuf writes are done in different kernel thread.

This change improves situation in two ways:
 - on first sysctl call, not providing any output buffer, it sets special
sbuf drain function, just counting the data and so not needing big buffer;
 - on second sysctl call it uses as initial buffer size value saved on
previous call, so that in most cases there will be no reallocation, unless
GEOM topology changed significantly.

4 years agoMFC r349040: Minimize aggsum_compare(&arc_size, arc_c) calls.
Alexander Motin [Sun, 7 Jul 2019 18:42:25 +0000 (18:42 +0000)]
MFC r349040: Minimize aggsum_compare(&arc_size, arc_c) calls.

For busy ARC situation when arc_size close to arc_c is desired.  But
then it is quite likely that aggsum_compare(&arc_size, arc_c) will need
to flush per-CPU buckets to find exact comparison result.  Doing that
often in a hot path penalizes whole idea of aggsum usage there, since it
replaces few simple atomic additions with dozens of lock acquisitions.

Replacing aggsum_compare() with aggsum_upper_bound() in code increasing
arc_p when ARC is growing (arc_size < arc_c) according to PMC profiles
allows to save ~5% of CPU time in aggsum code during sequential write
to 12 ZVOLs with 16KB block size on large dual-socket system.

I suppose there some minor arc_p behavior change due to lower precision
of the new code, but I don't think it is a big deal, since it should
affect only very small window in time (aggsum buckets are flushed every
second) and in ARC size (buckets are limited to 10 average ARC blocks
per CPU).

4 years agoMFC r349039: Alike to ZoL disable metaslab allocation tracing code.
Alexander Motin [Sun, 7 Jul 2019 18:40:35 +0000 (18:40 +0000)]
MFC r349039: Alike to ZoL disable metaslab allocation tracing code.

It is too generous to collect in production debug traces that can only
be read with kernel debugger.  Illumos includes special code in their
mdb debugger to read it, we don't.

4 years agoMFC r349035: Properly align struct multilist_sublist to cache line.
Alexander Motin [Sun, 7 Jul 2019 18:39:32 +0000 (18:39 +0000)]
MFC r349035: Properly align struct multilist_sublist to cache line.

Manual Illumos alignment does not fit us due to different kmutex_t size.

4 years agoMFC r349029: Update td_runtime of running thread on each statclock().
Alexander Motin [Sun, 7 Jul 2019 18:38:40 +0000 (18:38 +0000)]
MFC r349029: Update td_runtime of running thread on each statclock().

Normally td_runtime is updated on context switch, but there are some kernel
threads that due to high absolute priority may run for many seconds without
context switches (yes, that is bad, but that is true), which means their
td_runtime was not updated all that time, that made them invisible for top
other then as some general CPU usage.

4 years agoMFC r349006: Move write aggregation memory copy out of vq_lock.
Alexander Motin [Sun, 7 Jul 2019 18:37:46 +0000 (18:37 +0000)]
MFC r349006: Move write aggregation memory copy out of vq_lock.

Memory copy is too heavy operation to do under the congested lock.
Moving it out reduces congestion by many times to almost invisible.
Since the original zio removed from the queue, and the child zio is
not executed yet, I don't see why would the copy need protection.
My guess it just remained like this from the time when lock was not
dropped here, which was added later to fix lock ordering issue.

Multi-threaded sequential write tests with both HDD and SSD pools
with ZVOL block sizes of 4KB, 16KB, 64KB and 128KB all show major
reduction of lock congestion, saving from 15% to 35% of CPU time
and increasing throughput from 10% to 40%.

4 years agoMFC r349292: Decouple enc/ses verbosity from bootverbose.
Alexander Motin [Sun, 7 Jul 2019 18:33:21 +0000 (18:33 +0000)]
MFC r349292: Decouple enc/ses verbosity from bootverbose.

I don't want to be regularly notified that my enclosure violates standards
until there is some real problem I want to debug.

4 years agoMFC r349287: Remove ancient SCSI-2/3 mentioning.
Alexander Motin [Sun, 7 Jul 2019 18:32:34 +0000 (18:32 +0000)]
MFC r349287: Remove ancient SCSI-2/3 mentioning.

4 years agoMFC r349284: Make ELEMENT INDEX validation more strict.
Alexander Motin [Sun, 7 Jul 2019 18:31:53 +0000 (18:31 +0000)]
MFC r349284: Make ELEMENT INDEX validation more strict.

SES specifications tell: "The Additional Element Status descriptors shall
be in the same order as the status elements in the Enclosure Status
diagnostic page".  It allows us to question ELEMENT INDEX that is lower
then values we already processed.  There are many SAS2 enclosures with
this kind of problem.

While there, add more specific error messages for cases when ELEMENT INDEX
is obviously wrong.  Also skip elements with INVALID bit set.

4 years agoMFC r349281: Fix individual_element_index when some type has 0 elements.
Alexander Motin [Sun, 7 Jul 2019 18:29:10 +0000 (18:29 +0000)]
MFC r349281: Fix individual_element_index when some type has 0 elements.

When some type has 0 elements, saved_individual_element_index was set
to -1 on second type bump, since individual_element_index was not
restored after the first.  To me it looks easier just to increment
saved_individual_element_index separately than think when to save it.

4 years agoMFC r349671:
Mark Johnston [Sun, 7 Jul 2019 17:45:17 +0000 (17:45 +0000)]
MFC r349671:
Cache the next queue element when traversing a page queue.

4 years agoMFC r349599:
Mark Johnston [Sun, 7 Jul 2019 17:43:15 +0000 (17:43 +0000)]
MFC r349599:
Fix handling of errors from sblock() in soreceive_stream().

PR: 238789

4 years agoMFC r349441 (by rgrimes):
Mark Johnston [Sun, 7 Jul 2019 17:30:23 +0000 (17:30 +0000)]
MFC r349441 (by rgrimes):
Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H).

PR: 238794