]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMFC r366275: Makefile.inc1: sysent: parallel subordinate sysent targets
Kyle Evans [Sat, 14 Nov 2020 02:03:34 +0000 (02:03 +0000)]
MFC r366275: Makefile.inc1: sysent: parallel subordinate sysent targets

makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in
parallel, so let's do it.

This is a trivial difference because runtime per-target is pretty small, but
I like seeing it run in parallel when my muscle memory types `make -sj4`.

3 years agoMFC r366430: ngctl: add -c (compact output) for the dot command
Kyle Evans [Sat, 14 Nov 2020 02:00:50 +0000 (02:00 +0000)]
MFC r366430: ngctl: add -c (compact output) for the dot command

The output of "ngctl dot" is suitable for small netgraph networks. Even
moderate complex netgraph setups (about a dozen nodes) are hard to
understand from the .dot output, because each node and each hook are shown
as a full blown structure.

This patch allows to generate much more compact output and graphs by
omitting the extra structures for the individual hooks. Instead the names of
the hooks are labels to the edges.

3 years agoMFC r367448: vt: resolve conflict between VT_ALT_TO_ESC_HACK and DBG
Kyle Evans [Sat, 14 Nov 2020 01:58:33 +0000 (01:58 +0000)]
MFC r367448: vt: resolve conflict between VT_ALT_TO_ESC_HACK and DBG

When using the ALT+CTRL+ESC sequence to break into kdb, the keyboard is
completely borked when you return. watch(8) shows that it's working, but
it's inserting escape sequences.

Further investigation revealed that VT_ALT_TO_ESC_HACK is the default and
directly conflicts with this sequence, so upon return from the debugger
ALKED is set.

If they triggered the break to debugger, it's safe to assume they didn't
mean to use VT_ALT_TO_ESC_HACK, so just unset it to reduce the surprise when
the keyboard seems non-functional upon return.

3 years agoMFC r367440: epoch: support non-preemptible epochs checking in_epoch()
Kyle Evans [Sat, 14 Nov 2020 01:55:54 +0000 (01:55 +0000)]
MFC r367440: epoch: support non-preemptible epochs checking in_epoch()

Previously, non-preemptible epochs could not check; in_epoch() would always
fail, usually because non-preemptible epochs don't imply THREAD_NO_SLEEPING.

For default epochs, it's easy enough to verify that we're in the given
epoch: if we're in a critical section and our record for the given epoch
is active, then we're in it.

This patch also adds some additional INVARIANTS bookkeeping. Notably, we set
and check the recorded thread in epoch_enter/epoch_exit to try and catch
some edge-cases for the caller. It also checks upon freeing that none of the
records had a thread in the epoch, which may make it a little easier to
diagnose some improper use if epoch_free() took place while some other
thread was inside.

This version differs slightly from what was just previously reviewed by the
below-listed, in that in_epoch() will assert that no CPU has this thread
recorded even if it *is* currently in a critical section. This is intended
to catch cases where the caller might have somehow messed up critical
section nesting, we can catch both if they exited the critical section or if
they exited, migrated, then re-entered (on the wrong CPU).

3 years agoMFC imgact_binmisc housecleaning: r367361, r367439, r367441-r367442,
Kyle Evans [Sat, 14 Nov 2020 01:28:04 +0000 (01:28 +0000)]
MFC imgact_binmisc housecleaning: r367361, r367439, r367441-r367442,
r367444, r367452, r367456, r367477

r367361:
imgact_binmisc: fix up some minor nits

- Removed a bunch of redundant headers
- Don't explicitly initialize to 0
- The !error check prior to setting imgp->interpreter_name is redundant, all
  error paths should and do return or go to 'done'. We have larger problems
  otherwise.

r367439:
imgact_binmisc: minor re-organization of imgact_binmisc_exec exits

Notably, streamline error paths through the existing 'done' label, making it
easier to quickly verify correct cleanup.

Future work might add a kernel-only flag to indicate that a interpreter uses
#a. Currently, all executions via imgact_binmisc pay the penalty of
constructing sname/fname, even if they will not use it. qemu-user-static
doesn't need it, the stock rc script for qemu-user-static certainly doesn't
use it, and I suspect these are the vast majority of (if not the only)
current users.

r367441:
binmiscctl(8): miscellaneous cleanup

- Bad whitespace in Makefile.
- Reordered headers, sys/ first.
- Annotated fatal/usage __dead2 to help `make analyze` out a little bit.
- Spell a couple of sizeof constructs as "nitems" and "howmany" instead.

r367442:
imgact_binmisc: validate flags coming from userland

We may want to reserve bits in the future for kernel-only use, so start
rejecting any that aren't the two that we're currently expecting from
userland.

r367444:
imgact_binmisc: abstract away the list lock (NFC)

This module handles relatively few execs (initial qemu-user-static, then
qemu-user-static handles exec'ing itself for binaries it's already running),
but all execs pay the price of at least taking the relatively expensive
sx/slock to check for a match when this module is loaded. Future work will
almost certainly swap this out for another lock, perhaps an rmslock.

The RLOCK/WLOCK phrasing was chosen based on what the callers are really
wanting, rather than using the verbiage typically appropriate for an sx.

r367452:
imgact_binmisc: reorder members of struct imgact_binmisc_entry (NFC)

This doesn't change anything at the moment since the out-of-order elements
were a pair of uint32_t, but future additions may have caused unnecessary
padding by following the existing precedent.

r367456:
imgact_binmisc: move some calculations out of the exec path

The offset we need to account for in the interpreter string comes in two
variants:

1. Fixed - macros other than #a that will not vary from invocation to
   invocation
2. Variable - #a, which is substitued with the argv0 that we're replacing

Note that we don't have a mechanism to modify an existing entry.  By
recording both of these offset requirements when the interpreter is added,
we can avoid some unnecessary calculations in the exec path.

Most importantly, we can know up-front whether we need to grab
calculate/grab the the filename for this interpreter. We also get to avoid
walking the string a first time looking for macros. For most invocations,
it's a swift exit as they won't have any, but there's no point entering a
loop and searching for the macro indicator if we already know there will not
be one.

While we're here, go ahead and only calculate the argv0 name length once per
invocation. While it's unlikely that we'll have more than one #a, there's no
reason to recalculate it every time we encounter an #a when it will not
change.

I have not bothered trying to benchmark this at all, because it's arguably a
minor and straightforward/obvious improvement.

r367477:
imgact_binmisc: limit the extent of match on incoming entries

imgact_binmisc matches magic/mask from imgp->image_header, which is only a
single page in size mapped from the first page of an image. One can specify
an interpreter that matches on, e.g., --offset 4096 --size 256 to read up to
256 bytes past the mapped first page.

The limitation is that we cannot specify a magic string that exceeds a
single page, and we can't allow offset + size to exceed a single page
either.  A static assert has been added in case someone finds it useful to
try and expand the size, but it does seem a little unlikely.

While this looks kind of exploitable at a sideways squinty-glance, there are
a couple of mitigating factors:

1.) imgact_binmisc is not enabled by default,
2.) entries may only be added by the superuser,
3.) trying to exploit this information to read what's mapped past the end
  would be worse than a root canal or some other relatably painful
  experience, and
4.) there's no way one could pull this off without it being completely
  obvious.

The first page is mapped out of an sf_buf, the implementation of which (or
lack thereof) depends on your platform.

3 years agoMFC r367076: diff: don't force the format to 'context' with -p immediately
Kyle Evans [Sat, 14 Nov 2020 00:59:55 +0000 (00:59 +0000)]
MFC r367076: diff: don't force the format to 'context' with -p immediately

Instead, leave the fomat as unspecified (if it hasn't been) and use the
-p flag as a hint to 'context' if no other formatting option is specified.

This fixes `diff -purw`, used frequently by emaste, and matches the behavior
of its GNU counterpart.

PR: 250015

3 years agoMFC r367572:
Mateusz Guzik [Fri, 13 Nov 2020 13:38:08 +0000 (13:38 +0000)]
MFC r367572:

    Allow rtprio_thread to operate on threads of any process

3 years agoMFC r367352,r367353:
Mateusz Guzik [Fri, 13 Nov 2020 13:36:46 +0000 (13:36 +0000)]
MFC r367352,r367353:

    pipe: fix POLLHUP handling if no events were specified
    pipe: whitespace nit in previous

3 years agoMFC r367567:
Mateusz Piotrowski [Fri, 13 Nov 2020 09:48:54 +0000 (09:48 +0000)]
MFC r367567:

Address a mandoc warning

3 years agoMFC r367538:
Bjoern A. Zeeb [Thu, 12 Nov 2020 17:26:19 +0000 (17:26 +0000)]
MFC r367538:

  arm64: bs_sr_<N> take II

  In r367327 generic_bs_sr_<n> were derived from mips.  Given we are calling
  generic_bs_w_<n> and no write directly, we do not have to do the address
  calculations ourselves as eneric_bs_w_<n> will do a str val [bsh, offset].
  All we actually have to do is increment offset.

3 years agoMFC r367485:
Dimitry Andric [Wed, 11 Nov 2020 22:18:24 +0000 (22:18 +0000)]
MFC r367485:

Merge commit 354d3106c from llvm git (by Kai Luo):

  [PowerPC] Skip combining (uint_to_fp x) if x is not simple type

  Current powerpc64le backend hits
  ```
  Combining: t7: f64 = uint_to_fp t6
  llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291:
  llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() &&
  "Expected a SimpleValueType!"' failed.
  ```
  This patch fixes it by skipping combination if `t6` is not simple
  type.
  Fixed https://bugs.llvm.org/show_bug.cgi?id=47660.

  Reviewed By: #powerpc, steven.zhang

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

This should fix the llvm assertion mentioned above when building the
following ports for powerpc64le:

* audio/traverso
* databases/percona57-pam-for-mysql
* databases/percona57-server
* emulators/citra
* emulators/citra-qt5
* games/7kaa
* graphics/dia
* graphics/mandelbulber
* graphics/pcl-pointclouds
* net-p2p/libtorrent-rasterbar
* textproc/htmldoc

Requested by: pkubaj

3 years agoMFC r366683:
Dimitry Andric [Wed, 11 Nov 2020 22:15:25 +0000 (22:15 +0000)]
MFC r366683:

Merge commit 35ecc7fe4 from llvm git (by Hubert Tong):

  [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

  Fix premature decision in the presence of type-dependent expression
  operands on whether AltiVec vector initializations from single
  expressions are "splat" operations.

  Verify that the instantiation is able to determine the correct cast
  semantics for both the scalar type and the vector type case.

  Note that, because the change only affects the single-expression case
  (and the target type is an AltiVec-style vector type), the
  replacement of a parenthesized list with a parenthesized expression
  does not change the semantics of the program in a program-observable
  manner.

  Reviewed By: aaron.ballman

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

This should fix 'Assertion failed: (isScalarType()), function
getScalarTypeKind, file /usr/src/contrib/llvm-project/clang/lib/AST
/Type.cpp, line 2146', when building the graphics/opencv-core port for
powerpc64le.

Requested by: pkubaj

3 years agoMFC r367093, r367117
Vincenzo Maffione [Wed, 11 Nov 2020 21:27:16 +0000 (21:27 +0000)]
MFC r367093, r367117

iflib: add per-tx-queue netmap timer

The way netmap TX is handled in iflib when TX interrupts are not
used (IFC_NETMAP_TX_IRQ not set) has some issues:
  - The netmap_tx_irq() function gets called by iflib_timer(), which
    gets scheduled with tick granularity (hz). This is not frequent
    enough for 10Gbps NICs and beyond (e.g., ixgbe or ixl). The end
    result is that the transmitting netmap application is not woken
    up fast enough to saturate the link with small packets.
  - The iflib_timer() functions also calls isc_txd_credits_update()
    to ask for more TX completion updates. However, this violates
    the netmap requirement that only txsync can access the TX queue
    for datapath operations. Only netmap_tx_irq() may be called out
    of the txsync context.

This change introduces per-tx-queue netmap timers, using microsecond
granularity to ensure that netmap_tx_irq() can be called often enough
to allow for maximum packet rate. The timer routine simply calls
netmap_tx_irq() to wake up the netmap application. The latter will
wake up and call txsync to collect TX completion updates.

This change brings back line rate speed with small packets for ixgbe.
For the time being, timer expiration is hardcoded to 90 microseconds,
in order to avoid introducing a new sysctl.
We may eventually implement an adaptive expiration period or use another
deferred work mechanism in place of timers.

Also, fix the timers usage to make sure that each queue is serviced
by a different CPU.

PR:     248652
Reported by:    sg@efficientip.com

3 years agoMFC r367335:
Mark Johnston [Wed, 11 Nov 2020 14:06:45 +0000 (14:06 +0000)]
MFC r367335:
amd64: Make it easier to configure exception stack sizes

3 years agoMFC r367097:
Mateusz Piotrowski [Wed, 11 Nov 2020 11:25:14 +0000 (11:25 +0000)]
MFC r367097:

Correct USB HID item in examples

It turns out that examples were incorrectly referring to Volume_Up
and Volume_Down, which are not defined at all.

PR: 250683

3 years agoMFC r367120:
Konstantin Belousov [Wed, 11 Nov 2020 00:43:13 +0000 (00:43 +0000)]
MFC r367120:
Check for process group change in tty_wait_background().

PR: 250701

3 years agoMFC r367302:
Brooks Davis [Tue, 10 Nov 2020 18:07:13 +0000 (18:07 +0000)]
MFC r367302:

sysvshm: pass relevant uap members as arguments

Alter shmget_allocate_segment and shmget_existing to take the values
they want from struct shmget_args rather than passing the struct
around.  In general, uap structures should only be the interface to
sys_<foo> functions.

This makes one small functional change and records the allocated space
rather than the requested space.  If this turns out to be a problem
(e.g. if software tries to find undersized segments by exact size
rather than using keys), we can correct that easily.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27077

3 years agoMFC r366751:
Hans Petter Selasky [Tue, 10 Nov 2020 13:36:07 +0000 (13:36 +0000)]
MFC r366751:
Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.

Discussed with: manu@
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r366806:
Hans Petter Selasky [Tue, 10 Nov 2020 13:32:50 +0000 (13:32 +0000)]
MFC r366806:
Add new USB quirk.

PR: 250422
Submitted by: vidwer+fbsdbugs@gmail.com
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r367269:
Hans Petter Selasky [Tue, 10 Nov 2020 13:22:52 +0000 (13:22 +0000)]
MFC r367269:
Fix for referencing file via its vnode in ibore.

Use the native vnode lookup functions, instead of going via the LinuxKPI,
because the file referenced is typically created outside the LinuxKPI, and
the LinuxKPI's fdget() can only resolve file descriptor numbers which
were created by itself.

The vnode pointer is used as an identifier to identify XRCD handles which
are sharing resources.

This patch fixes the so-called XRCD support in ibcore for FreeBSD.
Refer to ibv_open_xrcd(3) for more information how the file descriptor
argument is used.

Reviewed by: kib@
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r367236:
Hans Petter Selasky [Tue, 10 Nov 2020 13:18:44 +0000 (13:18 +0000)]
MFC r367236:
Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).

Submitted by: pedro martelletto <pedro@ambientworks.net>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r367096:
Hans Petter Selasky [Tue, 10 Nov 2020 13:15:53 +0000 (13:15 +0000)]
MFC r367096:
Add new USB IDs.

Submitted by: aleksi.kaalinpaa@kapsi.fi
PR: 250675
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r364860 and r366996:
Hans Petter Selasky [Tue, 10 Nov 2020 13:10:15 +0000 (13:10 +0000)]
MFC r364860 and r366996:
Implement extensible arrays API using the existing radix tree implementation
in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D25101
Reviewed by: kib @
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r366695:
Andrey V. Elsukov [Tue, 10 Nov 2020 12:45:59 +0000 (12:45 +0000)]
MFC r366695:
  Implement SIOCGIFALIAS.

  It is lightweight way to check if an IPv4 address exists.

  Submitted by: Roy Marples
  Differential Revision: https://reviews.freebsd.org/D26636

3 years agoMFC r366908 (modified for stable/12 KBI):
Andrey V. Elsukov [Tue, 10 Nov 2020 12:13:18 +0000 (12:13 +0000)]
MFC r366908 (modified for stable/12 KBI):
  Add dtrace SDT probe ipfw:::rule-matched.

  It helps to reduce complexity with debugging of large ipfw rulesets.
  Also define several constants and translators, that can by used by
  dtrace scripts with this probe.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D26879

3 years agoMFC r351863:
Mateusz Piotrowski [Tue, 10 Nov 2020 10:19:55 +0000 (10:19 +0000)]
MFC r351863:

rc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)

A user may set ${name}_env variable in rc.conf(5) in order to set additional
environment variables for a service command.  Unfortunately, at the moment
this variable is only honored when the command is specified via the command
variable. Those additional environment variables coming from ${name}_env
are never set if the service is started via the ${rc_arg}_cmd variable (for
example start_cmd).

PR: 239692
Reviewed by: bcr, jilles
Approved by: src (jilles)
Requested by: koobs

3 years agoMFC r367296:
Konstantin Belousov [Tue, 10 Nov 2020 08:59:55 +0000 (08:59 +0000)]
MFC r367296:
if_media.c SIOCGMEDIAX handler: improve loop

3 years agoMFC r367072:
Mateusz Piotrowski [Tue, 10 Nov 2020 08:33:45 +0000 (08:33 +0000)]
MFC r367072:

Mount devfs inside a beinstall(8) chroot

It turns out that without /dev/null beinstall is not able to complete and
instead exits with messages similar to these:

  --------------------------------------------------------------
  >>> Installing kernel GENERIC completed on Sun Oct 25 17:47:37 CET 2020
  --------------------------------------------------------------
  /tmp/beinstall.JleGoP/mnt: Inspecting dirs /usr/src /usr/obj/usr/src/amd64.amd64
  --- installworld ---
  make[1]: "/usr/obj/usr/src/amd64.amd64/toolchain-metadata.mk" line 1: Using cached toolchain metadata from build at t480 on Sun Oct 25 15:53:28 CET 2020
  make[2]: "/dev/null" line 2: Need an operator
  make[2]: Fatal errors encountered -- cannot continuemake[1]: "/usr/src/Makefile.inc1" line 593: CPUTYPE global should be set with ?=.
  Cleaning up ...
  umount -f /tmp/beinstall.JleGoP/mnt/usr/src /tmp/beinstall.JleGoP/mnt/usr/obj/usr/src/amd64.amd64 /tmp/beinstall.JleGoP/mnt
  Destroyed successfully
  error: Installworld failed!

Upon a bit of debugging, it turns out that /dev/null inside the chroot
environment is full random bytes, which cause "make -f /dev/null" to
misbehave. Mounting a proper devfs inside the chroot seems to be the most
appropriate way to fix it.

will@ also noted that this change requires that whatever is needed in devfs
must exist in the old kernel.

Approved by: will

3 years agoMFC r367291:
Mateusz Piotrowski [Tue, 10 Nov 2020 07:47:24 +0000 (07:47 +0000)]
MFC r367291:

rc.d/zfs: Add shutdown to KEYWORDS

The problem is that without walling /etc/rc.d/zfs on shutdown, resources
associated with ZFS mounts are not freed and the jails will remain in dying
state. In addition, the dataset is now in a dangling state, as the jail it
is attached to is dying.

A known workaround for jails was to add the following lines
to /etc/jail.conf, to make sure that "service zfs stop" is run
when the jail is stopped:

    exec.stop = "/bin/sh /etc/rc.shutdown";
    exec.stop += "/usr/sbin/service zfs stop || /usr/bin/true";

While the workaround seems to be okay-ish for the jail situation, it is
still unclean. However, for physical hosts this may wreak havoc with the
pool if shared spares are used, as "zfs unshare" is never invoked on
shutdown.

PR: 147444
Submitted by: Markus Stoff <markus__stoffdv_at>
Reported by: Mykah <mburkhardt__exavault_com>
Reviewed by: cy
Approved by: cy (src)
Relnotes: yes

3 years agoMFC r367435,367539:
Bjoern A. Zeeb [Mon, 9 Nov 2020 23:38:39 +0000 (23:38 +0000)]
MFC r367435,367539:

  usb_hub: giving up port reset - device vanished

  Improve the output of the recently often experienced debug message in order
  to gather further data.

PR: 237666

3 years agoMFC r367355:
Justin Hibbits [Mon, 9 Nov 2020 21:19:17 +0000 (21:19 +0000)]
MFC r367355:

Fix UMA alignment for COP2 context structure.

3 years agoMFC r366526:
Mitchell Horne [Mon, 9 Nov 2020 18:07:21 +0000 (18:07 +0000)]
MFC r366526:
Handle kmod local relocation failures gracefully

3 years agoMFC r367388:
Mark Johnston [Mon, 9 Nov 2020 15:37:57 +0000 (15:37 +0000)]
MFC r367388:
cryptotest: Add qat(4) coverage

3 years agoMFC r367387, r367422:
Mark Johnston [Mon, 9 Nov 2020 15:37:12 +0000 (15:37 +0000)]
MFC r367387, r367422:
Add firmware modules for qat(4)

3 years agoMFC r367386:
Mark Johnston [Mon, 9 Nov 2020 15:36:11 +0000 (15:36 +0000)]
MFC r367386:
Add qat(4)

3 years agoAdd hmac_init_ipad() and hmac_init_opad()
Mark Johnston [Mon, 9 Nov 2020 14:15:06 +0000 (14:15 +0000)]
Add hmac_init_ipad() and hmac_init_opad()

This is a merge of a small portion of r359374 which makes it easier
to maintain OpenCrypto drivers in stable/12.  No functional change
intended; this is a direct commit to stable/12.

Discussed with: jhb

3 years agoMFC r366576:
Mark Johnston [Mon, 9 Nov 2020 13:54:29 +0000 (13:54 +0000)]
MFC r366576:
syslogd: Avoid trimming host names in RFC 5424 mode

PR: 250014

3 years agoMFC r367420:
Mateusz Piotrowski [Mon, 9 Nov 2020 09:30:49 +0000 (09:30 +0000)]
MFC r367420:

Use Cm macros instead of Ar when referring to a specific memory disk type

3 years agoMFC r367005: MFV r366990: less v563.
Xin LI [Mon, 9 Nov 2020 05:17:23 +0000 (05:17 +0000)]
MFC r367005: MFV r366990: less v563.

Relnotes: yes

3 years agoBump __FreeBSD_version after ptsname_r addition.
Xin LI [Mon, 9 Nov 2020 01:55:30 +0000 (01:55 +0000)]
Bump __FreeBSD_version after ptsname_r addition.

3 years agoMFC r366781, r366866: Implement ptsname_r.
Xin LI [Mon, 9 Nov 2020 01:52:15 +0000 (01:52 +0000)]
MFC r366781, r366866: Implement ptsname_r.

3 years agoMFC r358477,365113,366767: arcmsr(4) 1.50.00.00.
Xin LI [Mon, 9 Nov 2020 01:38:02 +0000 (01:38 +0000)]
MFC r358477,365113,366767: arcmsr(4) 1.50.00.00.

3 years agoMFC r367261: Add icc (Isochronous Command Completion) ccb_ataio field.
Alexander Motin [Mon, 9 Nov 2020 01:14:22 +0000 (01:14 +0000)]
MFC r367261: Add icc (Isochronous Command Completion) ccb_ataio field.

3 years agoMFC r367052: Enable bioq 'car limit' added at r335066 at 128 bios.
Alexander Motin [Mon, 9 Nov 2020 01:13:28 +0000 (01:13 +0000)]
MFC r367052: Enable bioq 'car limit' added at r335066 at 128 bios.

Without the 'car limit' enabled (before this), running sequential ZFS scrub
on HDD without command queuing support, I've measured latency on concurrent
random reads reaching 4 seconds (surprised that not more).  Enabling this
reduced the latency to 65 milliseconds, while scrub still doing ~180MB/s.

For disks with command queuing this does not make much difference (if any),
since most time all the requests are queued down to the disk or HBA, leaving
nothing in the queue to sort.  And even if something does not fit, staying on
the queue, it is likely not for long.  To not limit sorting in such bursty
scenarios I've added batched counter zeroing when the queue is getting empty.

The internal scheduler of the SAS HDD I was testing seems to be even more
loyal to random I/O, reducing the scrub speed to ~120MB/s.  So in case
somebody worried this is limit is too strict -- it actually looks relaxed.

3 years agoMFC r367285:
Konstantin Belousov [Mon, 9 Nov 2020 00:39:48 +0000 (00:39 +0000)]
MFC r367285:
ifconfig: properly detect invalid mediaopt keywords.

3 years agoMFC r367042: mergemaster: Clarify installed and updated versions
Ed Maste [Sun, 8 Nov 2020 17:10:12 +0000 (17:10 +0000)]
MFC r367042: mergemaster: Clarify installed and updated versions

Describe "diff installed new" as "Displaying differences between
installed and new."  Previously mergemaster described them in the
opposite order.

PR: 249214
Reported by: Yuri Victorovich

3 years agoMFC r367256:
Mateusz Piotrowski [Sun, 8 Nov 2020 10:08:20 +0000 (10:08 +0000)]
MFC r367256:

Do not document default locations of the OpenBSD and NetBSD ports trees

Our own Ports Collection is not targeting those systems at the moment,
so let's stop documenting bits specific to OpenBSD and NetBSD in the ports
documentation. Especially, that it might bit rot one day.

3 years agoMFC r367252:
Konstantin Belousov [Sun, 8 Nov 2020 01:02:40 +0000 (01:02 +0000)]
MFC r367252:
net/if_media.c: improve IFMEDIA_DEBUG output.

3 years agoMFC r367251:
Konstantin Belousov [Sun, 8 Nov 2020 01:01:27 +0000 (01:01 +0000)]
MFC r367251:
Cleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall().

3 years agoMFC r367250:
Konstantin Belousov [Sun, 8 Nov 2020 01:00:10 +0000 (01:00 +0000)]
MFC r367250:
Cleanup of net/if_media.c: some style.

3 years agoMFC r367249:
Konstantin Belousov [Sun, 8 Nov 2020 00:59:09 +0000 (00:59 +0000)]
MFC r367249:
Cleanup of net/if_media.c: switch to ANSI C function definitions.

3 years agoMFC r367041: Fix incorrect constants of target tag action.
Alexander Motin [Sun, 8 Nov 2020 00:30:53 +0000 (00:30 +0000)]
MFC r367041: Fix incorrect constants of target tag action.

ocs_scsi_recv_cmd() receives the flags after ocs_get_flags_fcp_cmd(),
which translates them from FCP_TASK_ATTR_* to OCS_SCSI_CMD_*.  As result
non-SIMPLE requests turned into HEAD or ORDERED depending on direction.

3 years agoMFC r367323:
Dimitry Andric [Sat, 7 Nov 2020 19:57:19 +0000 (19:57 +0000)]
MFC r367323:

Update libcxxrt's private copy of elftoolchain demangler

This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with
the most recent version from upstream r3877. Similar to r367322, this
fixes a number of possible assertions, and allows it to correctly
demangle several names that it could not handle before.

PR: 250702

MFC r367337:

Make vector-related functions in libcxxrt's demangler static

Follow-up to r367323 by re-adding static to a number of the functions
copied from elftc's libelftc_vstr.c. This was requested by upstream.

PR: 250702

3 years agoSync up elftoolchain with head, except for the capsicum-related commits,
Dimitry Andric [Sat, 7 Nov 2020 19:55:03 +0000 (19:55 +0000)]
Sync up elftoolchain with head, except for the capsicum-related commits,
which are incompatible with stable/12.

MFC r345360 (by oshogbo):

strings: do not depend on stdin

Instead of depending on one stdin FILE structure and use freopen(3), pass to
the functions appropriate FILE structure.

Reviewed by: cem
Discussed with: emaste
Differential Revision: https://reviews.freebsd.org/D18037

MFC r345361 (by oshogbo):

strings: do not continue if getc or getcharacter returns EOF

Reported by: cem

MFC r345362 (by oshogbo):

Fix powerpc and arm builds after r345361.

Reported by: jenkins

MFC r345364 (by oshogbo):

In case of ENCODING_8BIT the EOF code will be pass to putchar.
EOF check should be done before (uint8_t)c > 127 test.

Reported by: cem

MFC r345431 (by oshogbo):

strings: return an error code and the char value separately

If we returning 32 bits value it's hard to distinguish if the returned value
is a valid one or if its an error (in case of EOF). For that reason separate
exit code of the function from the returned character.

Reported by: cem, se

MFC r346323 (by emaste):

readelf: speed up readelf -wo

Use an array instead of STAILQ, and sort at the end instead of while
adding new elements.

PR: 212539
Submitted by: Bora Ã–zarslan <borako.ozarslan@gmail.com>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation

MFC r346327 (by emaste):

readelf: use size_t for object counts

PR: 212539
Reported by: cem
Sponsored by: The FreeBSD Foundation

MFC r348776 (by csjp):

Teach readelf about some OpenBSD ELF program headers

- Add constants for OpenBSD wxneeded, bootdata and randomize to the
  FreeBSD elf_common.h file. This is the file that gets used by the
  elftoolchain library.
- Update readelf and elfdump utilities to decode these program headers
  if they are encountered.

Note: FreeBSD has it's own version of elfdump(1), which will be updated
in a subsequent commit. I am adding it here anyway because this diff is
going to be submitted upstream.

Discussed with: emaste
Reviewed by: imp
MFC afer: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20548

M    contrib/elftoolchain/elfdump/elfdump.c
M    contrib/elftoolchain/readelf/readelf.c
M    sys/sys/elf_common.h

MFC r349510 (by luporl):

[PowerPC64] readelf: print description for 'e_flags' in ELF header (ABI type)

This prints out description text with the meaning of 'Flags' value in PowerPC64.

Example:

$ readelf -h ~/tmp/t1-Flag2
ELF Header:

Magic:   7f 45 4c 46 02 02 01 09 00 00 00 00 00 00 00 00
Class:                             ELF64
Data:                              2's complement, big endian
Version:                           1 (current)
OS/ABI:                            FreeBSD
ABI Version:                       0
Type:                              EXEC (Executable file)
Machine:                           PowerPC 64-bit
Version:                           0x1
Entry point address:               0x10010000
Start of program headers:          64 (bytes into file)
Start of section headers:          209368 (bytes into file)
Flags:                             0x2, OpenPOWER ELF V2 ABI
Size of this header:               64 (bytes)
Size of program headers:           56 (bytes)
Number of program headers:         10
Size of section headers:           64 (bytes)
Number of section headers:         34
Section header string table index: 31

Submitted by:  alfredo.junior_eldorado.org.br
Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D20782

MFC r350511 (by emaste):

readelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND

These bits are used for Intel CET IBT/Shadow Stack.

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

MFC r354544 (by emaste):

elfcopy/strip: Ensure sections have required alignment on output

Object files may specify insufficient alignment on certain sections, for
example due to a bug in NASM[1].  When we detect that case in elfcopy or
strip, emit a warning and increase the alignment to the minimum
required.

The NASM bug was fixed in 2015[2], but we might as well have this fixup
(and warning) in elfcopy in case we encounter such a file for any other
reason.

This might be reworked somewhat upstream - see ELF Tool Chain
ticket 485[3].

[1] https://bugzilla.nasm.us/show_bug.cgi?id=3392307
[2] https://repo.or.cz/w/nasm.git/commit/1f0cb0f2c1ba632c0fab02424928cfb756a9160c
[3] https://sourceforge.net/p/elftoolchain/tickets/485/

PR: 198611
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2292

MFC r357540 (by markj):

readelf: Fix a double close of the input file.

The caller of dump_object() is responsible for opening the file, let it
be responsible for closing too.

CID: 1411588
Sponsored by: The FreeBSD Foundation

MFC r357541 (by markj):

readelf: Fix the check for an error from realloc().

Use err() instead of errx() while here, since realloc() sets errno.

CID: 1401326
Sponsored by: The FreeBSD Foundation

MFC r358499 (by emaste):

readelf: add PROTMAX_DISABLE and STKGAP_DISABLE

From r349609 (PROTMAX_DISABLE) and r354790 (STKGAP_DISABLE).  Commited
upstream (in a slightly different form) as r3831.

Sponsored by: The FreeBSD Foundation

MFC r358631 (by emaste):

Reserve WXNEEDED ELF feature control flag

This will be used to tag binaries that require W+X mappings, in advance
of the ability to prevent W^X in mmap/mprotect.

There is still some discussion about the flag's name, but the ABI won't
change even if the name does (as kib pointed out in the review).

Reviewed by: csjp, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23909

MFC r358637 (by emaste):

readelf: check note namesz and descsz

Previously corrupt note namesz or descsz (perhaps caused by readelf's
current lack of endian support for notes) resulted in a crash.  Check
that namesz and descsz do not extend beyond the end of the buffer before
trying to access name and desc data.

Reported by: jhb
Sponsored by: The FreeBSD Foundation

MFC r358639 (by emaste):

readelf: simplify namesz / descsz checks

Sponsored by: The FreeBSD Foundation

MFC r358685 (by emaste):

libelf: rationalize error handling in ELF note conversion

Previously _libelf_cvt_NOTE_tom (to host) returned false if a note's
namesz + descsz exceeded the buffer size, while _libelf_cvt_NOTE_tof
(to file) silently truncated.  Return false in the latter case too.

Sponsored by: The FreeBSD Foundation

MFC r358706 (by emaste):

readelf: add XEN_ELFNOTE_PHYS32_ENTRY note

See r336469 for details.

Sponsored by: The FreeBSD Foundation

MFC r358708 (by emaste):

readelf: decode and print Xen ELF note strings

Sponsored by: The FreeBSD Foundation

MFC r358713 (by emaste):

readelf: print GNU Build-ID

Sponsored by: The FreeBSD Foundation

MFC r359189 (by emaste):

readelf: simplify Xen string note printing

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24140

MFC r361662 (by emaste):

readelf: add more DT_FLAGS_1 flags

Reference:
https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html

> DF_1_SINGLETON  Singleton symbols exist.
> DF_1_STUB       Object is a stub.
> DF_1_PIE        Object is a position-independent executable.

Sponsored by: The FreeBSD Foundation

MFC r364517 (by kib):

Reserve FreeBSD ELF feature control bit LA48 to control VA layout on amd64.

Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

MFC r365489 (by bdragon):

[PowerPC64LE] PPC64LE support for libelf.

Fix native detection when building on powerpc64le.

I will be submitting this and r361104 upstream shortly.

Sponsored by: Tag1 Consulting, Inc.

MFC r366977 (by emaste):

libelf: add compression header support

GNU and Oracle libelf implementations added support for section
compression, intended to reduce the size of DWARF debug info (which
might be an order of magnitude larger than the code).

There are two compressed ELF section formats:

1. Old GNU - sections are renmaed to start with 'z'.  Section contains
   a magic number, uncompressed size, and compressed data.

2. Oracle and New GNU - compressed sections use the SHF_COMPRESSED flag.
   The compression header contains the compression type, uncompressed
   size, and uncompressed alignment.

The second style is preferred and this change implements only that one.

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24566

MFC r367209 (by emaste):

readelf: Add -z decompression support

Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision:    https://reviews.freebsd.org/D26909

MFC r367238 (by bdragon):

Fix 32-bit build after r367209

Fix build on systems with a 32-bit size_t.

Since it's being passed as a pointer, a 64-bit write to it will overflow.

MFC with: r367209

MFC r367322 (by dim):

Merge elftoolchain r3877 (by jkoshy):

  Incorporate fixes from Dimitry Andric:

  - Use a BUFFER_GROW() macro to avoid rounding errors in capacity
    calculations.
  - Fix a bug introduced in [r3531].
  - Fix handling of nested template parameters.

  Ticket: #581

This should fix a number of assertions on elftoolchain's cxxfilt, and
allow it to correctly demangle several names that it could not handle
before.

Obtained from: https://sourceforge.net/p/elftoolchain/code/3877/
PR: 250702

3 years agoMFC r344855 (by jhb):
Dimitry Andric [Sat, 7 Nov 2020 18:10:59 +0000 (18:10 +0000)]
MFC r344855 (by jhb):

Drop "All rights reserved" from my copyright statements.

Reviewed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D19485

3 years agoMFC r367327:
Bjoern A. Zeeb [Sat, 7 Nov 2020 16:35:48 +0000 (16:35 +0000)]
MFC r367327:

 arm64: implement bs_sr_<N>

  Implement the bs_sr_<N> generic functions based on the generic
  mips implementation calling the generic bs_w_<N> functions in a loop.

  ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4()
  is NULL.  It seems ral(4) and ti(4) might be the only consumers of
  these functions I could find quickly so keeping them in C rather than asm.

3 years agoMFC r367326:
Bjoern A. Zeeb [Sat, 7 Nov 2020 16:34:21 +0000 (16:34 +0000)]
MFC r367326:

 net80211: fix a typo

  Correct a typo referring to the wrong flags in a comment.
  No functional changes.

3 years agoMFC 366296: Avoid a dubious assignment to bio_data in aio_qbio().
John Baldwin [Sat, 7 Nov 2020 16:20:37 +0000 (16:20 +0000)]
MFC 366296: Avoid a dubious assignment to bio_data in aio_qbio().

A user pointer is not a suitable value for bio_data and the next block
of code always overwrites bio_data anyway.  Just use cb->aio_buf
directly in the call to vm_fault_quick_hold_pages().

3 years agoMFC r367022: Fix asymmetry in devstat(9) calls by GEOM.
Alexander Motin [Sat, 7 Nov 2020 13:16:11 +0000 (13:16 +0000)]
MFC r367022: Fix asymmetry in devstat(9) calls by GEOM.

Before this GEOM passed bio pointer to transaction end, but not start.
It was irrelevant until devstat(9) got DTrace hooks, that appeared to
provide bio pointer on I/O completion, but not on submission.

3 years agoMFC 365642: Add constant for the DE_CFG MSR on AMD CPUs.
John Baldwin [Fri, 6 Nov 2020 17:52:04 +0000 (17:52 +0000)]
MFC 365642: Add constant for the DE_CFG MSR on AMD CPUs.

3 years agoMFC r367300:
Mateusz Piotrowski [Fri, 6 Nov 2020 07:15:04 +0000 (07:15 +0000)]
MFC r367300:

build.7: Mention etcupdate(8) alongside mergemaster(8)

3 years agoMFC r367299:
Mateusz Piotrowski [Fri, 6 Nov 2020 07:14:04 +0000 (07:14 +0000)]
MFC r367299:

Fix a typo in the description of WITH_DEBUG_PORTS

For each origin listed in WITH_DEBUG_PORTS, the ports framework sets
WITH_DEBUG instead of WITH_DEBUG_PORTS.

3 years agoMFC r366978:
Konstantin Belousov [Fri, 6 Nov 2020 00:35:36 +0000 (00:35 +0000)]
MFC r366978:
xhci: Handle the case when MSI-X BAR is the same as IO BAR.

3 years agoMFC 365842,365844: Remove support for setting some obscure fields.
John Baldwin [Fri, 6 Nov 2020 00:07:46 +0000 (00:07 +0000)]
MFC 365842,365844: Remove support for setting some obscure fields.

365842:
Remove support for setting some obscure fields.

Don't permit setting the exception bitmap or VMCS entry interrupt
information.  These are not generally useful to set.  If it is needed
in the future, dedicated pseudo registers can be added for these that
would be used with vm_set_register().

365844:
Remove no longer used variable.

3 years agoMFC 365280: Pass a valid mode with O_CREATE to open(2).
John Baldwin [Thu, 5 Nov 2020 23:28:46 +0000 (23:28 +0000)]
MFC 365280: Pass a valid mode with O_CREATE to open(2).

CheriABI is pickier about the arguments to open(2) and crashes with a
fault if a mode isn't passed to an open() when O_CREATE is specified.

3 years agoMFC r367114.
Alexander V. Chernikov [Thu, 5 Nov 2020 22:41:54 +0000 (22:41 +0000)]
MFC r367114.

Fix use-after-free in icmp6_notify_error().

Reported by: Maxime Villard <max at m00nbsd.net>

3 years agoMFC 365055: Fix a buffer overrun.
John Baldwin [Thu, 5 Nov 2020 22:35:45 +0000 (22:35 +0000)]
MFC 365055: Fix a buffer overrun.

getln() returns 'len' valid characters.  line[len] is out of bounds.

3 years agoMFC 361810: Refer to AES-CBC as "aes-cbc" rather than "rijndael-cbc" for IPsec.
John Baldwin [Thu, 5 Nov 2020 19:37:56 +0000 (19:37 +0000)]
MFC 361810: Refer to AES-CBC as "aes-cbc" rather than "rijndael-cbc" for IPsec.

At this point, AES is the more common name for Rijndael128.  setkey(8)
will still accept the old name, and old constants remain for
compatiblity.

3 years agoMFC r366268 (and epoch parts of r357093):
Bjoern A. Zeeb [Thu, 5 Nov 2020 15:27:38 +0000 (15:27 +0000)]
MFC r366268 (and epoch parts of r357093):

 rtwn: narrow the epoch area

  Rather than placing the epoch around the entire receive loop which
  might call into rtwn_rx_frame() and USB and sleep, split the loop
  into two and leave us with one unlock/lock cycle as well.

PR: 249925

3 years agoMFC r366799:
Bjoern A. Zeeb [Thu, 5 Nov 2020 13:45:26 +0000 (13:45 +0000)]
MFC r366799:

  clk: fix indentation

  Just fix indentation of an if() clause.
  No functional changes intended.

3 years agoMFC r366623:
Bjoern A. Zeeb [Thu, 5 Nov 2020 13:43:06 +0000 (13:43 +0000)]
MFC r366623:

 ip_mroute: fix the viftable export sysctl

  It seems that in r354857 I got more than one thing wrong.
  Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
  days allocated and not longer static per-vnet viftable array.
  This fixes a problem with netstat -g which would show bogus information
  for the IPv4 Virtual Interface Table.

PR: 246626

3 years agoMFC r366523:
Bjoern A. Zeeb [Thu, 5 Nov 2020 13:38:26 +0000 (13:38 +0000)]
MFC r366523:

LinuxKPI: add a bitfield.h implementation.

  This code was iteratively implemented during the work on various WiFi
  drivers -- from individual functions to a macro-created implementations
  for the various bit sized needed (and then extended to more for
  comepleteness). Some of the bit combinations do not seem to make sense
  so are left out.

  The __bf_shf(x) was obtained from D26681 by manu.

3 years agoMFC r366817:
Bjoern A. Zeeb [Thu, 5 Nov 2020 12:17:50 +0000 (12:17 +0000)]
MFC r366817:

  net80211: factor out the priv(9) checks into OS specifc code.

  Factor out the priv(9) checks into OS specifc code so other OSes can equally
  implement them.  This sorts out those XXX in the net80211 code.
  We provide 3 arguments (cmd, vap, ifp) where available to the functions, in
  order to allow other OSes to use that data but also in case we'd add auditing
  to these check to have the information available. For now the arguments are
  marked __unused.

PR: 249403

3 years agoMFC r366800:
Bjoern A. Zeeb [Thu, 5 Nov 2020 12:16:22 +0000 (12:16 +0000)]
MFC r366800:

  net80211: update for (more) VHT160 support

  Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ()
  and its 80+80 counter part to check in vhtcaps for appropriate
  levels of support and use the macros throughout the code.

  Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue
  to vht80 in various parts of the code.

  Add ieee80211_add_channel_cbw() which also takes the CBW flag
  fields and make the former ieee80211_add_channel() a wrapper to it.
  With the CBW flags we can add HT/VHT channels passing them to
  getflags() for the 2/5ghz functions.

  In ifconfig(8) add the regdomain_addchans() support for VHT160
  and VHT80P80.

  With this (+ regdoain.xml updates) VHT160 channels can be
  configured, listed, and pass regdomain where appropriate.

3 years agoMFC r366525:
Bjoern A. Zeeb [Thu, 5 Nov 2020 12:14:51 +0000 (12:14 +0000)]
MFC r366525:

  net80211: whitespace

  Fix indentation for the multi-line copies of
  ieee80211_add_channel_list_5ghz() for the 3 bands.

3 years agoMFC r366524:
Bjoern A. Zeeb [Thu, 5 Nov 2020 12:12:26 +0000 (12:12 +0000)]
MFC r366524:

  80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()

  As we did in the kernel in r366112 replace the MS() macro with the version(s)
  added to the kernel: _IEEE80211_MASKSHIFT().  Also provide its counter part.
  This will later allow use to use other macros defined in net80211 headers
  here in ifconfig.

3 years agoMFC r366522:
Bjoern A. Zeeb [Thu, 5 Nov 2020 12:10:24 +0000 (12:10 +0000)]
MFC r366522:

  80211: non-functional changes

  Sort a few VHT160 and 80+80 lines, update some comments, and remove
  a superfluous ','.

  No functional changes intended.

3 years agoMFC r366112:
Bjoern A. Zeeb [Thu, 5 Nov 2020 12:08:04 +0000 (12:08 +0000)]
MFC r366112:

  Provide MS() and SM() macros for 80211 and wireless drivers.

  We have (two versions) of MS() and SM() macros which we use throughout
  the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
  to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
  macros.  Also change one internal case using both _S and _M instead of
  just _S away from _M (one of the reasons rtwn and rsu were not changed).

  This was done semi-mechanically.  No functional changes intended.

3 years agoMFC r365633:
Bjoern A. Zeeb [Thu, 5 Nov 2020 11:56:49 +0000 (11:56 +0000)]
MFC r365633:

  iwm: fix regression from r365419 (ieee80211_media_change())

  In r365419 ieee80211_media_change() callers were updated to not longer
  act on the obselete ENETRESET return code.
  While in the old days iwm has done a stop/init cycle in these cases,
  this was not executed since r193340.
  As a consequence simplify iwm code as well by passing ieee80211_media_change()
  right to ieee80211_vap_attach() as there is no more need for a local
  implementation.

  The actual problem was fixed in stable/12 since r365608;  this just
  reduces changes to HEAD.

PR: 248955

3 years agoMFC r365335:
Bjoern A. Zeeb [Thu, 5 Nov 2020 11:37:14 +0000 (11:37 +0000)]
MFC r365335:

  umass: enhance debugging

  Investigating a hang I found having some more error information
  available would be helpful, so be more verbose and also tell cam/xpt
  status in case of error/panic.

3 years agoMFC r365334:
Bjoern A. Zeeb [Thu, 5 Nov 2020 11:33:23 +0000 (11:33 +0000)]
MFC r365334:

  umass: fix a cam_sim leak in error case

  While debugging a hang I noticed that in case of error in
  umass_cam_attach_sim() we miss a cam_sim_free() call.
  Added that to not leak resources.

3 years agoMFC r365333:
Bjoern A. Zeeb [Thu, 5 Nov 2020 11:19:31 +0000 (11:19 +0000)]
MFC r365333:

  cam_sim: harmonize code related to acquiring a mtx

  cam_sim_free(), cam_sim_release(), and cam_sim_hold() all assign
  a mtx variable during declaration and then if NULL or the mtx is
  held may re-asign the variable and/or acquire/release a lock.

  Harmonize the code, avoiding double assignments and make it look
  the same for all three function (with cam_sim_free() not needing
  an extra case).

  No functional changes intended.

3 years agoMFC r364305:
Bjoern A. Zeeb [Thu, 5 Nov 2020 11:11:50 +0000 (11:11 +0000)]
MFC r364305:

  For consistency and to avoid any problems getting past the 31bit
  boundry change the last two IF_Mbps(2500) and additionally one
  IF_Mbps(5000) to ULL as well.

3 years agoMFC r364038: Enable hw.pci.enable_aspm tunable by default.
Alexander Motin [Thu, 5 Nov 2020 02:57:40 +0000 (02:57 +0000)]
MFC r364038: Enable hw.pci.enable_aspm tunable by default.

While effects on power saving is only a guess, effects on hot-plug are
clearly visible.  Lets try to enable it and see what happen.

3 years agoMFC 359263: Use the newer EINTEGRITY error when authentication fails.
John Baldwin [Wed, 4 Nov 2020 17:22:12 +0000 (17:22 +0000)]
MFC 359263: Use the newer EINTEGRITY error when authentication fails.

GELI used to fail with EINVAL when a read request spanned a disk
sector whose contents did not match the sector's authentication tag.
The recently-added EINTEGRITY more closely matches to the error in
this case.

3 years agoMFC r367112: Use proper variable for device path.
Alexander Motin [Wed, 4 Nov 2020 14:13:29 +0000 (14:13 +0000)]
MFC r367112: Use proper variable for device path.

It seems *-passthru commands were broken from the day one, since the
device path is fetched into opt.dev variable and not left in argv[optind].
The other three wrong argv[optind] instances are just in error messages.

3 years agoMFC r367109, r367113: Print NVMe controller capabilities in verbose dmesg.
Alexander Motin [Wed, 4 Nov 2020 14:12:29 +0000 (14:12 +0000)]
MFC r367109, r367113: Print NVMe controller capabilities in verbose dmesg.

Those values are not reported in controller identification, while sometimes
interesting for development and debugging.

3 years agoMFC r367258:
Mateusz Piotrowski [Wed, 4 Nov 2020 07:53:24 +0000 (07:53 +0000)]
MFC r367258:

Remove Tn macros from ifconfig.8

3 years agoMFC r367259:
Mateusz Piotrowski [Wed, 4 Nov 2020 07:51:59 +0000 (07:51 +0000)]
MFC r367259:

ifconfig.8: Improve formatting of -f in synopsis

3 years agoMFC r367121:
Brooks Davis [Tue, 3 Nov 2020 23:29:07 +0000 (23:29 +0000)]
MFC r367121:

Disable ssp raw test without ASAN

r366981 disabled ASAN when it might not be reliable (with an external
compiler), but this test is broken without ASAN so disable it completely
in that case.

PR: 250706
Reviewed by: emaste, lwhsu
Differential Revision: https://reviews.freebsd.org/D26982

3 years agoMFC r367063:
Brooks Davis [Tue, 3 Nov 2020 23:26:26 +0000 (23:26 +0000)]
MFC r367063:

Key decleration of union semun on src version

__FreeBSD__ is defined by the compiler derived from the triple.  When
building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
__FreeBSD__ was set to 12 when building lib32 (for some reason no triple
is being passed which seems to mean that we're taking default values
from the build system).  This in turn meant we end up with a double
decleration of union semun which is a build error.

Reviewed by: gshapiro, dim
Differential Revision: https://reviews.freebsd.org/D26902

3 years agoMFC 358556,360167: Add support for the TFTP windowsize option.
John Baldwin [Tue, 3 Nov 2020 20:43:01 +0000 (20:43 +0000)]
MFC 358556,360167: Add support for the TFTP windowsize option.

358556:
Add support for the TFTP windowsize option described in RFC 7440.

The windowsize option permits multiple blocks to be transmitted
before the receiver sends an ACK improving throughput for larger
files.

360167:
Abort transfer if fseeko() fails.

3 years agoMFC r366902: arm64: add uhci to GENERIC
Ed Maste [Tue, 3 Nov 2020 01:38:16 +0000 (01:38 +0000)]
MFC r366902: arm64: add uhci to GENERIC

uhci is (or, can be) used by VMware ESXi-Arm.

PR: 250308
Reported by: Vincent Milum Jr
Sponsored by: The FreeBSD Foundation

3 years agoMFC r366465, r367003, r367006, r367009
Ryan Moeller [Mon, 2 Nov 2020 20:00:50 +0000 (20:00 +0000)]
MFC r366465, r367003, r367006, r367009

Enable iterating all sysctls, even ones with CTLFLAG_SKIP
kern_sysctl: Misc code cleanup
sysctl: Misc code cleanup
sysctl+kern_sysctl: Honor SKIP for descendant nodes

3 years agoMFC r366838:
Mark Johnston [Mon, 2 Nov 2020 14:30:55 +0000 (14:30 +0000)]
MFC r366838:
vmem: Allocate btags before looping in vmem_xalloc()

3 years agoMFC r366837:
Mark Johnston [Mon, 2 Nov 2020 14:01:33 +0000 (14:01 +0000)]
MFC r366837:
vmem: Simplify bt_fill() callers a bit

3 years agoMFC r366834:
Mark Johnston [Mon, 2 Nov 2020 14:00:25 +0000 (14:00 +0000)]
MFC r366834:
vmx: Implement pmap (de)activation in C

3 years agoMFC r367136:
Li-Wen Hsu [Mon, 2 Nov 2020 01:34:43 +0000 (01:34 +0000)]
MFC r367136:

Whitespace cleanup

3 years agoMFC r367134:
Li-Wen Hsu [Mon, 2 Nov 2020 01:29:50 +0000 (01:29 +0000)]
MFC r367134:

Remove superfluous `this` in comment

PR: 250721
Submitted by: Hiroya EBINE <hebiyan@protonmail.com>

3 years agoMFC r366861: build vmware modules on arm64
Ed Maste [Mon, 2 Nov 2020 00:45:40 +0000 (00:45 +0000)]
MFC r366861: build vmware modules on arm64