]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoCorrect entries for manpages removed in r359374.
John Baldwin [Tue, 24 Nov 2020 22:52:12 +0000 (22:52 +0000)]
Correct entries for manpages removed in r359374.

Reported by: Yuri Pankov <yuripv@yuripv.dev>
Sponsored by: Chelsio Communications

3 years agoRemove more legacy of parallel SCSI.
Alexander Motin [Tue, 24 Nov 2020 22:43:27 +0000 (22:43 +0000)]
Remove more legacy of parallel SCSI.

3 years agoRemove support for SSLv3 from fetch(3).
Jung-uk Kim [Tue, 24 Nov 2020 22:10:33 +0000 (22:10 +0000)]
Remove support for SSLv3 from fetch(3).

Support for SSLv3 was already removed from OpenSSL (r361392).

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

3 years agoUpdate dirdeps.mk et al to latest
Simon J. Gerraty [Tue, 24 Nov 2020 21:45:38 +0000 (21:45 +0000)]
Update dirdeps.mk et al to latest

Move some local tweaks to local.*.mk

Reviewed by: bdrewery
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27300

3 years agoPort rtsx(4) driver for Realtek SD card reader from OpenBSD.
Jung-uk Kim [Tue, 24 Nov 2020 21:28:44 +0000 (21:28 +0000)]
Port rtsx(4) driver for Realtek SD card reader from OpenBSD.

This driver provides support for Realtek PCI SD card readers.  It attaches
mmc(4) bus on card insertion and detaches it on card removal.  It has been
tested with RTS5209, RTS5227, RTS5229, RTS522A, RTS525A and RTL8411B.  It
should also work with RTS5249, RTL8402 and RTL8411.

PR: 204521
Submitted by: Henri Hennebert (hlh at restart dot be)
Reviewed by: imp, jkim
Differential Revision: https://reviews.freebsd.org/D26435

3 years agoDo not truncate the last character from serial number.
Jung-uk Kim [Tue, 24 Nov 2020 21:14:36 +0000 (21:14 +0000)]
Do not truncate the last character from serial number.

strlcpy() requires one more byte for the NULL character.

Submitted by: Henri Hennebert (hlh at restart dot be)
MFC after: 3 days

3 years agorelease: Merge the RPI2 and BEAGLEBONE image with the GENERICSD one
Emmanuel Vadot [Tue, 24 Nov 2020 17:53:13 +0000 (17:53 +0000)]
release: Merge the RPI2 and BEAGLEBONE image with the GENERICSD one

Both RPI2 and BEAGLEBONE are still popular and used arm boards.
Both u-boots can coexist as they are named differently and live in the
fat partition.
This leave us with only one image that can be used for both of those
boards and all the other ones supported by FreeBSD provided that you
install the correct u-boot on it.

Reviewed by: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27283

3 years agoRelease: arm: Remove config for old boards
Emmanuel Vadot [Tue, 24 Nov 2020 17:52:01 +0000 (17:52 +0000)]
Release: arm: Remove config for old boards

All those board are impossible to buy nowadays and could boot using the
GENERICSD image after putting the correct u-boot on them.

Reviewed by: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27282

3 years agoarm: Remove old amlogic support
Emmanuel Vadot [Tue, 24 Nov 2020 17:51:10 +0000 (17:51 +0000)]
arm: Remove old amlogic support

Remove the port for aml8726.
Kernel config was removed in r346096 and this port was never migrated
to GENERIC.
It is also impossible to obtain such hardware nowadays.

Reviewed by: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27281

3 years agoarm: Remove old rockchip support
Emmanuel Vadot [Tue, 24 Nov 2020 17:50:22 +0000 (17:50 +0000)]
arm: Remove old rockchip support

Remove the port for rk30xx.
Kernel config was removed in r346096 and this port was never migrated
to GENERIC.
It is also impossible to obtain such hardware nowadays and this code
don't provide anything beside booting.

Reviewed by: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27280

3 years agoUpdate RQSFLAG_* definitions.
Alexander Motin [Tue, 24 Nov 2020 17:37:12 +0000 (17:37 +0000)]
Update RQSFLAG_* definitions.

3 years agopf tests: provoke tag hashing panic
Kristof Provost [Tue, 24 Nov 2020 17:32:49 +0000 (17:32 +0000)]
pf tests: provoke tag hashing panic

Attempt to provoke the panic fixed in r367987.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27350

3 years agoata(4): Release the ioport resource if device initialization fails
Mark Johnston [Tue, 24 Nov 2020 17:13:08 +0000 (17:13 +0000)]
ata(4): Release the ioport resource if device initialization fails

PR: 251346
Submitted by: janm@transactionware.com
MFC after: 1 week

3 years agoping(8): Improve parameter validation
Mark Johnston [Tue, 24 Nov 2020 17:12:40 +0000 (17:12 +0000)]
ping(8): Improve parameter validation

- Use strtonum(3) to simplify bounds checking of numeric parameters.
- Fix bounds checking when filling out packet data in "sweep" mode.

PR: 239974, 239977, 239978
Reported by: Neeraj <neerajpal09@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25622

3 years agopf: Make tag hashing more robust
Mark Johnston [Tue, 24 Nov 2020 16:18:47 +0000 (16:18 +0000)]
pf: Make tag hashing more robust

tagname2tag() hashes the tag name before truncating it to 63 characters.
tag_unref() removes the tag from the name hash by computing the hash
over the truncated name.  Ensure that both operations compute the same
hash for a given tag.

The larger issue is a lack of string validation in pf(4) ioctl handlers.
This is intended to be fixed with some future work, but an extra safety
belt in tagname2hashindex() is worthwhile regardless.

Reported by: syzbot+a0988828aafb00de7d68@syzkaller.appspotmail.com
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27346

3 years agoRemove concept of mbox_sleep_ok.
Alexander Motin [Tue, 24 Nov 2020 15:32:25 +0000 (15:32 +0000)]
Remove concept of mbox_sleep_ok.

It was broken by design and unused for years due to conflicts between
different threads, fighting for the same set of mailbox registers, not
designed for multiple requests at a time.  So either request has to be
synchronous and spin under the lock, or it should be sent asynchronously
through the queues as Mailbox Command IOCB or some other way.

This removes any OS specifics from the wait code, so it can be inlined.

3 years agoRemove unneeded locking around xpt_bus_[de]register().
Alexander Motin [Tue, 24 Nov 2020 14:05:52 +0000 (14:05 +0000)]
Remove unneeded locking around xpt_bus_[de]register().

MFC after: 2 weeks

3 years agoarm64: Check if we have a map before checking the flags
Emmanuel Vadot [Tue, 24 Nov 2020 14:05:35 +0000 (14:05 +0000)]
arm64: Check if we have a map before checking the flags

This fixes amdgpu on arm64 where linuxkpi is calling id_mapped
and we call might_bounce without a map.

3 years agoRemove erradic assert after SVN r367149 in mlx5en(4).
Hans Petter Selasky [Tue, 24 Nov 2020 13:07:59 +0000 (13:07 +0000)]
Remove erradic assert after SVN r367149 in mlx5en(4).

The ratelimit tags may be shared, especially for unlimited TLS
traffic, and then the refcount is allowed to be greater than one
when freeing the send tag.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix a typo in a comment.
Cy Schubert [Tue, 24 Nov 2020 06:42:32 +0000 (06:42 +0000)]
Fix a typo in a comment.

MFC after: 3 days

3 years agoImplement request queue overflow protection.
Alexander Motin [Tue, 24 Nov 2020 04:16:49 +0000 (04:16 +0000)]
Implement request queue overflow protection.

Before this change in case of request queue overflow driver just froze the
device queue for 100ms to retry after.  It was pretty bad for performance.
This change introduces SIM queue freezing when free space on the request
queue drops below 255 entries (worst case of maximum I/O size S/G list),
checking for a chance to release it on I/O completion.  If the queue still
get overflowed somehow, the old mechanism is still in place, just with
delay reduced to 10ms.

With the earlier queue length increase overflows should not happen often,
but it is still easily reachable on synthetic tests.

3 years agolocks: push lock_delay_arg_init calls down
Mateusz Guzik [Tue, 24 Nov 2020 03:49:37 +0000 (03:49 +0000)]
locks: push lock_delay_arg_init calls down

Minor cleanup to skip doing them when recursing on locks and so that
they can act on found lock value if need be.

3 years agosx: drop spurious volatile keyword
Mateusz Guzik [Tue, 24 Nov 2020 03:48:44 +0000 (03:48 +0000)]
sx: drop spurious volatile keyword

3 years agoping6: update usage text after r365547
Alan Somers [Tue, 24 Nov 2020 02:51:45 +0000 (02:51 +0000)]
ping6: update usage text after r365547

MFC after: 2 weeks

3 years agoPrefer Em to Ar for emphasis
Warner Losh [Mon, 23 Nov 2020 18:37:19 +0000 (18:37 +0000)]
Prefer Em to Ar for emphasis

Em is better than Ar if all we want to do is underline the text.

Submitted by: yuripv@

3 years agodtrace: stop using eventhandlers for the part compiled into the kernel
Mateusz Guzik [Mon, 23 Nov 2020 18:27:21 +0000 (18:27 +0000)]
dtrace: stop using eventhandlers for the part compiled into the kernel

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D27311

3 years agothread: stash domain id to work around vtophys problems on ppc64
Mateusz Guzik [Mon, 23 Nov 2020 18:26:47 +0000 (18:26 +0000)]
thread: stash domain id to work around vtophys problems on ppc64

Adding to zombie list can be perfomed by idle threads, which on ppc64 leads to
panics as it requires a sleepable lock.

Reported by: alfredo
Reviewed by: kib, markj
Fixes: r367842 ("thread: numa-aware zombie reaping")
Differential Revision: https://reviews.freebsd.org/D27288

3 years agoLinuxolator: Replace use of eventhandlers by sysent hooks.
Konstantin Belousov [Mon, 23 Nov 2020 18:18:16 +0000 (18:18 +0000)]
Linuxolator: Replace use of eventhandlers by sysent hooks.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27309

3 years agoProvide ABI modules hooks for process exec/exit and thread exit.
Konstantin Belousov [Mon, 23 Nov 2020 17:29:25 +0000 (17:29 +0000)]
Provide ABI modules hooks for process exec/exit and thread exit.

Exec and exit are same as corresponding eventhandler hooks.

Thread exit hook is called somewhat earlier, while thread is still
owned by the process and enough context is available.  Note that the
process lock is owned when the hook is called.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27309

3 years agobin/setfacl: Little refactoring, no functional change.
Gleb Popov [Mon, 23 Nov 2020 17:00:06 +0000 (17:00 +0000)]
bin/setfacl: Little refactoring, no functional change.

The acl_from_stat function accepts a stat_t * argument, but only uses its
st_mode field. There is no reason to pass the whole struct, so make it accept
a mode_t and rename the function to acl_from_mode.
Linux has non-standard acl_from_mode function in its libacl, so naming the
function this way may help discovering it during porting efforts.

Reviewed by: tsoome, markj
Approved by: markj
Differential Revision: https://reviews.freebsd.org/D27292

3 years agoReplace paths in ctladm(8) examples with something sensible.
Edward Tomasz Napierala [Mon, 23 Nov 2020 14:30:27 +0000 (14:30 +0000)]
Replace paths in ctladm(8) examples with something sensible.

PR: 251181
Reviewed by: 0mp, rm, ygy
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D27249

3 years agoEnsure that the buffer is in nvme_single_map() mapped to single segment.
Michal Meloun [Mon, 23 Nov 2020 14:30:22 +0000 (14:30 +0000)]
Ensure that the buffer is in nvme_single_map() mapped to single segment.
Not a functional change.

MFC after: 1 week

3 years agoAssorted tweaks to hier(7): punctuation, some .Xr's, clarify wording.
Edward Tomasz Napierala [Mon, 23 Nov 2020 14:26:59 +0000 (14:26 +0000)]
Assorted tweaks to hier(7): punctuation, some .Xr's, clarify wording.

Reviewed by: 0mp, bcr, imp
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D27248

3 years agoMake sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.
Edward Tomasz Napierala [Mon, 23 Nov 2020 13:05:11 +0000 (13:05 +0000)]
Make sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.

Reviewed by: imp, mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26843

3 years agoMake tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free.
Edward Tomasz Napierala [Mon, 23 Nov 2020 13:02:23 +0000 (13:02 +0000)]
Make tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26841

3 years agoDon't check return from xpt_alloc_ccb() for being NULL; since it's not
Edward Tomasz Napierala [Mon, 23 Nov 2020 12:59:56 +0000 (12:59 +0000)]
Don't check return from xpt_alloc_ccb() for being NULL; since it's not
the _nowait wariant, it cannot fail.

Suggested by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agoMake hptmv(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.
Edward Tomasz Napierala [Mon, 23 Nov 2020 12:57:24 +0000 (12:57 +0000)]
Make hptmv(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.

Reviewed by: imp, mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26842

3 years agosmartpqi: don't bzero the new ccb; xpt_alloc_ccb_nowait() already does that.
Edward Tomasz Napierala [Mon, 23 Nov 2020 12:54:19 +0000 (12:54 +0000)]
smartpqi: don't bzero the new ccb; xpt_alloc_ccb_nowait() already does that.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26838

3 years agoarcmsr(4): don't bzero newly allocated ccb; xpt_alloc_ccb() already does that.
Edward Tomasz Napierala [Mon, 23 Nov 2020 12:50:38 +0000 (12:50 +0000)]
arcmsr(4): don't bzero newly allocated ccb; xpt_alloc_ccb() already does that.

Reviewed by: delphij, imp, ching2048@areca.com.tw
Tested by: ching2048@areca.com.tw
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26840

3 years agoRemove the 'wantparent' variable, unused since r145004.
Edward Tomasz Napierala [Mon, 23 Nov 2020 12:47:23 +0000 (12:47 +0000)]
Remove the 'wantparent' variable, unused since r145004.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27193

3 years agoFix two occurences of a typo in a comment introduced in r367530.
Michael Tuexen [Mon, 23 Nov 2020 10:13:56 +0000 (10:13 +0000)]
Fix two occurences of a typo in a comment introduced in r367530.

Reported by: lstewart@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27148

3 years agoarcconfig: add callsign again
Eitan Adler [Mon, 23 Nov 2020 04:39:29 +0000 (04:39 +0000)]
arcconfig: add callsign again

Problem

When using git-svn or other non-pure-svn tooling the original subversion
URL is not present. This causes arcanist/phabricator to be unable to
determine which repository is being modified.

Solution

Restore callsign to .arcconfig to enable exact repository matching even
with git-svn.

Reported By: jhb

3 years agocpuset_setproc: use the appropriate parent for new anonymous sets
Kyle Evans [Mon, 23 Nov 2020 02:49:53 +0000 (02:49 +0000)]
cpuset_setproc: use the appropriate parent for new anonymous sets

As far as I can tell, this has been the case since initially committed in
2008.  cpuset_setproc is the executor of cpuset reassignment; note this
excerpt from the description:

* 1) Set is non-null.  This reparents all anonymous sets to the provided
*    set and replaces all non-anonymous td_cpusets with the provided set.

However, reviewing cpuset_setproc_setthread() for some jail related work
unearthed the error: if tdset was not anonymous, we were replacing it with
`set`. If it was anonymous, then we'd rebase it onto `set` (i.e. copy the
thread's mask over and AND it with `set`) but give the new anonymous set
the original tdset as the parent (i.e. the base of the set we're supposed to
be leaving behind).

The primary visible consequences were that:

1.) cpuset_getid() following such assignment returns the wrong result, the
    setid that we left behind rather than the one we joined.
2.) When a process attached to the jail, the base set of any anonymous
    threads was a set outside of the jail.

This was initially bundled in D27298, but it's a minor fix that's fairly
easy to verify the correctness of.

A test is included in D27307 ("badparent"), which demonstrates the issue
with, effectively:

osetid = cpuset_getid()
newsetid = cpuset()
cpuset_setaffinity(thread)
cpuset_setid(osetid)
cpuset_getid(thread) -> observe that it matches newsetid instead of osetid.

MFC after: 1 week

3 years agofreebsd32: take the _umtx_op struct definitions back
Kyle Evans [Mon, 23 Nov 2020 00:58:14 +0000 (00:58 +0000)]
freebsd32: take the _umtx_op struct definitions back

Providing these in freebsd32.h facilitates local testing/measuring of the
structs rather than forcing one to locally recreate them. Sanity checking
offsets/sizes remains in kern_umtx.c where these are typically used.

3 years agokern: dup: do not assume oldfde is valid
Kyle Evans [Mon, 23 Nov 2020 00:33:06 +0000 (00:33 +0000)]
kern: dup: do not assume oldfde is valid

oldfde may be invalidated if the table has grown due to the operation that
we're performing, either via fdalloc() or a direct fdgrowtable_exp().

This was technically OK before rS367927 because the old table remained valid
until the filedesc became unused, but now it may be freed immediately if
it's an unshared table in a single-threaded process, so it is no longer a
good assumption to make.

This fixes dup/dup2 invocations that grow the file table; in the initial
report, it manifested as a kernel panic in devel/gmake's configure script.

Reported by: Guy Yur <guyyur gmail com>
Reviewed by: rew
Differential Revision: https://reviews.freebsd.org/D27319

3 years agoRefactor rib iterator functions.
Alexander V. Chernikov [Sun, 22 Nov 2020 20:21:10 +0000 (20:21 +0000)]
Refactor rib iterator functions.

* Make rib_walk() order of arguments consistent with the rest of RIB api
* Add rib_walk_ext() allowing to exec callback before/after iteration.
* Rename rt_foreach_fib_walk_del -> rib_foreach_table_walk_del
* Rename rt_forach_fib_walk -> rib_foreach_table_walk
* Move rib_foreach_table_walk{_del} to route/route_helpers.c
* Slightly refactor rib_foreach_table_walk{_del} to make the implementation
 consistent and prepare for upcoming iterator optimizations.

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

3 years agoif_dwc: Correctly configure the DMA engine based on the fdt properties
Emmanuel Vadot [Sun, 22 Nov 2020 20:16:46 +0000 (20:16 +0000)]
if_dwc: Correctly configure the DMA engine based on the fdt properties

Do not hardcode what we setup for the DMA engine configuration but
lookup the fdt properties and configuring accordingly.
Use a default value of 8 for the burst dma length for both TX and
RX, this is what we used for TX before.

3 years agorelease: rpi3: Copy the bcm2710 variant of the rpi2
Emmanuel Vadot [Sun, 22 Nov 2020 18:42:08 +0000 (18:42 +0000)]
release: rpi3: Copy the bcm2710 variant of the rpi2

This is the dtb intented to be used for booting RPI2 v1.2 in aarch64.

3 years agoFix debug build after 367926.
Alexander Motin [Sun, 22 Nov 2020 16:13:09 +0000 (16:13 +0000)]
Fix debug build after 367926.

3 years agonetmap: bridge: improve readability
Vincenzo Maffione [Sun, 22 Nov 2020 13:39:21 +0000 (13:39 +0000)]
netmap: bridge: improve readability

Multiple cosmetic changes, plus a fix to a verbose print
(indicating wrong net->host/host->net direction).

MFC after: 3 days

3 years agonetmap: valectl: switch to libnetmap
Vincenzo Maffione [Sun, 22 Nov 2020 10:02:56 +0000 (10:02 +0000)]
netmap: valectl: switch to libnetmap

Use the newer libnetmap (included in base) rather than the older
nm_open()/nm_close() defined in netmap_user.h

MFC after:      3 days

3 years agonetmap: nmreplay: switch to libnetmap
Vincenzo Maffione [Sun, 22 Nov 2020 09:38:01 +0000 (09:38 +0000)]
netmap: nmreplay: switch to libnetmap

Use the newer libnetmap (included in base) rather than the older
nm_open()/nm_close() defined in netmap_user.h

MFC after:      3 days

3 years agonetmap: lb: switch to libnetmap
Vincenzo Maffione [Sun, 22 Nov 2020 09:28:50 +0000 (09:28 +0000)]
netmap: lb: switch to libnetmap

Use the newer libnetmap (included in base) rather than the older
nm_open()/nm_close() defined in netmap_user.h

MFC after: 3 days

3 years agonetmap: pkt-gen: switch to libnetmap
Vincenzo Maffione [Sun, 22 Nov 2020 09:20:08 +0000 (09:20 +0000)]
netmap: pkt-gen: switch to libnetmap

Use the newer libnetmap (included in base) rather than the older
nm_open()/nm_close() defined in netmap_user.h

3 years agonetmap: bridge: switch to libnetmap
Vincenzo Maffione [Sun, 22 Nov 2020 09:10:12 +0000 (09:10 +0000)]
netmap: bridge: switch to libnetmap

Use the newer libnetmap (included in base) rather than the older
nm_open()/nm_close() defined in netmap_user.h

3 years ago[2/2] _umtx_op: introduce 32-bit/i386 flags for operations
Kyle Evans [Sun, 22 Nov 2020 05:47:45 +0000 (05:47 +0000)]
[2/2] _umtx_op: introduce 32-bit/i386 flags for operations

This patch takes advantage of the consolidation that happened to provide two
flags that can be used with the native _umtx_op(2): UMTX_OP___32BIT and
UMTX_OP__I386.

UMTX_OP__32BIT iindicates that we are being provided with 32-bit structures.
Note that this flag alone indicates a 64bit time_t, since this is the
majority case.

UMTX_OP__I386 has been provided so that we can emulate i386 as well,
regardless of whether the host is amd64 or not.

Both imply a different set of copyops in sysumtx_op. freebsd32__umtx_op
simply ignores the flags, since it's already doing a 32-bit operation and
it's unlikely we'll be running an emulator under compat32. Future work
could consider it, but the author sees little benefit.

This will be used by qemu-bsd-user to pass on all _umtx_op calls to the
native interface as long as the host/target endianness matches, effectively
eliminating most if not all of the remaining unresolved deadlocks for most.

This version changed a fair amount from what was under review, mostly in
response to refactoring of the prereq reorganization and battle-testing
it with qemu-bsd-user.  The main changes are as follows:

1.) The i386 flag got renamed to omit '32BIT' since this is redundant.
2.) The flags are now properly handled on 32-bit platforms to emulate other
    32-bit platforms.
3.) Robust list handling was fixed, and the 32-bit functionality that was
    previously gated by COMPAT_FREEBSD32 is now unconditional.
4.) Robust list handling was also improved, including the error reported
    when a process has already registered 32-bit ABI lists and also
    detecting if native robust lists have already been registered. Both
    scenarios now return EBUSY rather than EINVAL, because the input is
    technically valid but we're too busy with another ABI's lists.

libsysdecode/kdump/truss support will go into review soon-ish, along with
the associated manpage update.

Reviewed by: kib (earlier version)
MFC after: 3 weeks

3 years agoFix build after 367926.
Alexander Motin [Sun, 22 Nov 2020 05:42:52 +0000 (05:42 +0000)]
Fix build after 367926.

Option ISP_TARGET_MODE is evil.

3 years ago_umtx_op: move compat32 definitions back in
Kyle Evans [Sun, 22 Nov 2020 05:34:51 +0000 (05:34 +0000)]
_umtx_op: move compat32 definitions back in

These are reasonably compact, and a future commit will blur the compat32
lines by supporting 32-bit operations with the native _umtx_op.

3 years agofd: free old file descriptor tables when not shared
Robert Wing [Sun, 22 Nov 2020 05:00:28 +0000 (05:00 +0000)]
fd: free old file descriptor tables when not shared

During the life of a process, new file descriptor tables may be allocated. When
a new table is allocated, the old table is placed in a free list and held onto
until all processes referencing them exit.

When a new file descriptor table is allocated, the old file descriptor table
can be freed when the current process has a single-thread and the file
descriptor table is not being shared with any other processes.

Reviewed by:    kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D18617

3 years agoMake handlers and atpds overflows unlikely.
Alexander Motin [Sun, 22 Nov 2020 04:29:55 +0000 (04:29 +0000)]
Make handlers and atpds overflows unlikely.

 - Allocate 256 handlers more than payload commands for management purposes.
 - Increase maximum number of handlers from 8K to 16K by tuning the format.
 - Just to be safe limit the number of payload commands to 16K - 256.
 - Limit number of target exchanges in mixed mode to the number of atpds.
 - If we still somehow get out of atpds -- return BUSY, since we really are.

3 years agoDo not parent all busdma tags to the payload tag.
Alexander Motin [Sun, 22 Nov 2020 04:10:13 +0000 (04:10 +0000)]
Do not parent all busdma tags to the payload tag.

There is not much to inherit any more, may create more problems than solve.
Instead parent them all directly to upstream.

While there, add missed payload tag and tune scratch tag destructions.

3 years agoRemove remnants of execthrottle and maxalloc parameters.
Alexander Motin [Sun, 22 Nov 2020 02:51:30 +0000 (02:51 +0000)]
Remove remnants of execthrottle and maxalloc parameters.

The first was obsolete since 26xx, not used on 25xx and not needed on 24xx.
The second seems never worked on 24xx and up.

3 years agoStop using eventhandlers for itimers subsystem exec and exit hooks.
Konstantin Belousov [Sat, 21 Nov 2020 21:43:36 +0000 (21:43 +0000)]
Stop using eventhandlers for itimers subsystem exec and exit hooks.

While there, do some minor cleanup for kclocks.  They are only
registered from kern_time.c, make registration function static.
Remove event hooks, they are not used by both registered kclocks.
Add some consts.

Perhaps we can stop registering kclocks at all and statically
initialize them.

Reviewed by: mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27305

3 years agoImprove number reading by rounding up to a next unit earlier for memory display.
Michael Reifenberger [Sat, 21 Nov 2020 19:14:11 +0000 (19:14 +0000)]
Improve number reading by rounding up to a next unit earlier for memory display.

Submitted by: ota@j.email.ne.jp
Differential Revision: https://reviews.freebsd.org/D26503

3 years agonetmap: bridge, pkt-gen: fix man page typo
Vincenzo Maffione [Sat, 21 Nov 2020 18:47:13 +0000 (18:47 +0000)]
netmap: bridge, pkt-gen: fix man page typo

Reported by: ian
MFC after: 3 days

3 years agonetmap: bridge: update man page with more information
Vincenzo Maffione [Sat, 21 Nov 2020 18:20:21 +0000 (18:20 +0000)]
netmap: bridge: update man page with more information

Update the man page to describe how it is necessary to
enable promiscuous mode and/or disable offloads.

3 years agoRemove unused prototype.
Konstantin Belousov [Sat, 21 Nov 2020 10:58:19 +0000 (10:58 +0000)]
Remove unused prototype.

Missed part of r367918.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoStop using eventhandler to invoke umtx_exec hook.
Konstantin Belousov [Sat, 21 Nov 2020 10:32:40 +0000 (10:32 +0000)]
Stop using eventhandler to invoke umtx_exec hook.

There is no point in dynamic registration, umtx hook is there always.

Reviewed by: mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27303

3 years agocxgbe(4): Catch up with in-flight netmap rx before destroying queues.
Navdeep Parhar [Sat, 21 Nov 2020 03:27:32 +0000 (03:27 +0000)]
cxgbe(4): Catch up with in-flight netmap rx before destroying queues.

The netmap application using the driver is responsible for replenishing
the receive freelists and they may be totally depleted when the
application exits.  Packets in flight, if any, might block the pipeline
in case there aren't enough buffers left in the freelist.  Avoid this by
filling up the freelists with a driver allocated buffer.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoUnlucky change...
Alexander Motin [Sat, 21 Nov 2020 00:53:31 +0000 (00:53 +0000)]
Unlucky change...

MFC after: 3 days

3 years agoFix stupid math mistake in r366922.
Alexander Motin [Sat, 21 Nov 2020 00:51:39 +0000 (00:51 +0000)]
Fix stupid math mistake in r366922.

MFC after: 3 days

3 years agoDocument the new "tls" NFS mount option.
Rick Macklem [Fri, 20 Nov 2020 22:29:38 +0000 (22:29 +0000)]
Document the new "tls" NFS mount option.

Recent commits to head have added support for NFS over TLS
to the FreeBSD kernel.
To enable use of this for an NFS mount, the "tls" mount_nfs
option has been added.

Once the IETF has assigned an RFC number, I will replace "NNNN"
with the number.

This is a content change.

Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D26262

3 years agoUpdate man page for new TLS export options.
Rick Macklem [Fri, 20 Nov 2020 22:14:51 +0000 (22:14 +0000)]
Update man page for new TLS export options.

NFS over TLS uses three new export options, added by r364979.
This patch updates the exports.5 man page for these new options.
Once assigned by IETF, "NNNN" will be replaced with the RFC number.

This is a content change.

Reviewed by: gbe
Differential Revision: https://review.freebsd.org/D26241

3 years agoOnly attempt a VOP_UNLOCK() when the vn_lock() has been successful.
Kirk McKusick [Fri, 20 Nov 2020 20:22:01 +0000 (20:22 +0000)]
Only attempt a VOP_UNLOCK() when the vn_lock() has been successful.

No MFC as this code is not present in 12-stable.

Reported by:  Peter Holm
Reviewed by:  Mateusz Guzik
Tested by:    Peter Holm
Sponsored by: Netflix

3 years agoAdd lists for customizing legacy and bootstrap-tools.
Bryan Drewery [Fri, 20 Nov 2020 20:11:59 +0000 (20:11 +0000)]
Add lists for customizing legacy and bootstrap-tools.

Reviewed by: arichardson
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D27200

3 years agoIncrease queue depths from 1024/256 to 8192/1024 IOCBs.
Alexander Motin [Fri, 20 Nov 2020 19:36:34 +0000 (19:36 +0000)]
Increase queue depths from 1024/256 to 8192/1024 IOCBs.

Qlogic chips store S/G lists in the same queue as requests themselves.  In
the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024
IOCBs can store only 19 of such requests.  The increase reduces chances of
overflow, while we should be able to afford additional 512KB of RAM per HBA.
The Linux driver uses comparable numbers.

While there, decouple ATIO queue size from response queue size.  There is
no reason for them to be equal.

3 years ago[POWERPC] print uprintf_signal 'type' field in hex
Alfredo Dal'Ava Junior [Fri, 20 Nov 2020 18:52:37 +0000 (18:52 +0000)]
[POWERPC] print uprintf_signal 'type' field in hex

Print 'type' field in hex to improve readability

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D27294

3 years ago[POWERPC64LE,POWEPCSPE] set default kernel config for powerpc64le and powerpcspe...
Alfredo Dal'Ava Junior [Fri, 20 Nov 2020 18:42:01 +0000 (18:42 +0000)]
[POWERPC64LE,POWEPCSPE] set default kernel config for powerpc64le and powerpcspe variants

Default KERNCONF for powerpc64le should be GENERIC64, and powerpcspe should
select MPC85XXSPE

Reviewed by: bdragon,emaste
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D27257

3 years agoCleanup DMA handling.
Alexander Motin [Fri, 20 Nov 2020 18:02:04 +0000 (18:02 +0000)]
Cleanup DMA handling.

 - Make isp_start() to set all the IOCB fields aside of S/G list, removing
extra information from isp_send_cmd(), now only doing S/G lists and sending.
 - Turn DMA setup/free from being card and PCI-specific into OS-specific,
instead add new card-specific method for isp_send_cmd().  Previously this
function was a monster handling all the cards.
 - Remove double error code translation.

3 years agoWhen copying types from one CTF container to another, ensure that we
Jonathan T. Looney [Fri, 20 Nov 2020 17:26:02 +0000 (17:26 +0000)]
When copying types from one CTF container to another, ensure that we
encode 0-length (i.e. "") structure and union member names as offset 0.
This ensures that we don't confuse other parts of the CTF code which
expect this encoding.

This resolves a Dtrace error resolving members of anonymous structs/unions
within the (struct mbuf) type which some users were seeing after r366908.

While here, update the code in ctf_add_generic() to encode 0-length type
names as offset 0.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27246

3 years agohostapd.conf(5): Add missing 'l'
Gordon Bergling [Fri, 20 Nov 2020 17:13:13 +0000 (17:13 +0000)]
hostapd.conf(5): Add missing 'l'

In r367901 I accidentally deleted the 'l' while fixing a few
mandoc erros.

Spotted by: Yuri Pankov

3 years agomoused(8): Fix a few mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 17:04:49 +0000 (17:04 +0000)]
moused(8): Fix a few mandoc warnings

- new sentence, new line

3 years agocrashinfo(8): Fix a few mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 16:59:51 +0000 (16:59 +0000)]
crashinfo(8): Fix a few mandoc warnings

- new sentence, new line

3 years agohostapd.conf(5): Fix a mandoc warning
Gordon Bergling [Fri, 20 Nov 2020 16:57:06 +0000 (16:57 +0000)]
hostapd.conf(5): Fix a mandoc warning

- new sentence, new line

3 years agosyslog.conf(5): Fix a few mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 16:50:52 +0000 (16:50 +0000)]
syslog.conf(5): Fix a few mandoc warnings

- new sentence, new line
- skipping paragraph macro: Pp at the end of Sh

3 years agosnmp_wlan(3): Fix mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 16:46:51 +0000 (16:46 +0000)]
snmp_wlan(3): Fix mandoc warnings

- new sentence, new line

3 years agoiscsi.conf(5): Fix a mandoc warning
Gordon Bergling [Fri, 20 Nov 2020 16:41:32 +0000 (16:41 +0000)]
iscsi.conf(5): Fix a mandoc warning

- new sentence, new line

3 years agodevmatch(8): Fix section ordering
Gordon Bergling [Fri, 20 Nov 2020 16:34:01 +0000 (16:34 +0000)]
devmatch(8): Fix section ordering

- sections out of conventional order: Sh HISTORY

3 years agoriscv: always initialize the static kernel environment
Mitchell Horne [Fri, 20 Nov 2020 15:21:10 +0000 (15:21 +0000)]
riscv: always initialize the static kernel environment

Ensure we initialize the static environment when not booting via
loader(8), and provide a static buffer if this is the case. This fixes
two issues.

First, performing the initialization ensures that kenv variables set in
the kernel's config file are honored. Previously, any new or overridden
values were ignored.

Second, providing the static buffer allows variables to be set in the
device tree's bootargs property of the chosen node. This can be set by
u-boot or by QEMU's '-append' flag. Attempting to this prior to this
change resulted in an early panic, since the static environment had no
buffer backing it.

Submitted by: syrinx (earlier version)
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D25034

3 years agomsdosfs: suspend around unmount or remount rw->ro.
Konstantin Belousov [Fri, 20 Nov 2020 15:19:30 +0000 (15:19 +0000)]
msdosfs: suspend around unmount or remount rw->ro.

This also eliminates unsafe use of VFS_SYNC(MNT_WAIT).

Requested by: mckusick
Discussed with: imp
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D27269

3 years agoMake net/ifq.h C++ friendly
Mitchell Horne [Fri, 20 Nov 2020 14:45:45 +0000 (14:45 +0000)]
Make net/ifq.h C++ friendly

Don't use "new" as an identifier, and add explicit casts from void *.

As a general policy, FreeBSD doesn't make any C++ compatibility
guarantees for kernel headers like it does for userland, but it is a
small effort to do so in this case, to the benefit of a downstream
consumer (NetApp).

Reviewed by: rscheff
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27286

3 years agoRevert r367291 (KEYWORD: shutdown for rc.d/zfs)
Mateusz Piotrowski [Fri, 20 Nov 2020 14:37:07 +0000 (14:37 +0000)]
Revert r367291 (KEYWORD: shutdown for rc.d/zfs)

The problem is that zfs is asked to stop too early in the shutdown
sequence. Other services, such as syslog may still be running and have some
files open (e.g., under /var/log). This of course causes the messages like:

  cannot unmount '/var/run': umount failed
  cannot unmount '/var/log': umount failed
  cannot unmount '/var': umount failed
  cannot unmount '/usr/home': umount failed
  cannot unmount '/usr': umount failed
  cannot unmount '/': umount failed

For now, let's remove the shutdown KEYWORD from the zfs service, as people are
reporting problems in their setups:
https://lists.freebsd.org/pipermail/freebsd-current/2020-November/077559.html

In the future, we may think of stopping zfs on shutdown after all the other
services and just before init(8) exits. Another interesting option might be to
a new rcorder(8) KEYWORD like "shutdownjail", but this idea would need to be
discussed a bit.

Reported by: Johan Hendriks <joh.hendriks gmail.com>
Reported by: Yasuhiro KIMURA <yasu utahime.org>
Reported by: Tomoaki AOKI <junchoon dec.sakura.ne.jp>
Approved by: kevans (src)
MFC: 3 days
Differential Revision: https://reviews.freebsd.org/D27263

3 years agoUnlock channels when any of them are locked, when returning for non-busy state.
Konstantin Belousov [Fri, 20 Nov 2020 14:02:43 +0000 (14:02 +0000)]
Unlock channels when any of them are locked, when returning for non-busy state.

Reported and tested by: "Wall, Stephen" <stephen.wall@redcom.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoFix an issue I introuced in r367530: tcp_twcheck() can be called
Michael Tuexen [Fri, 20 Nov 2020 13:00:28 +0000 (13:00 +0000)]
Fix an issue I introuced in r367530: tcp_twcheck() can be called
with to == NULL for SYN segments. So don't assume tp != NULL.
Thanks to jhb@ for reporting and suggesting a fix.

PR: 250499
MFC after: 1 week
XMFC-with: r367530
Sponsored by: Netflix, Inc.

3 years agomsdosfs: Add trivial support for suspension.
Konstantin Belousov [Fri, 20 Nov 2020 12:31:02 +0000 (12:31 +0000)]
msdosfs: Add trivial support for suspension.

Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27269

3 years agocamcontrol(8): Fix some warnings spotted by mandoc
Gordon Bergling [Fri, 20 Nov 2020 11:45:08 +0000 (11:45 +0000)]
camcontrol(8): Fix some warnings spotted by mandoc

- skipping paragraph macro: Pp before Bl

3 years agoif_dwc: Add checksum offloading support
Emmanuel Vadot [Fri, 20 Nov 2020 11:31:25 +0000 (11:31 +0000)]
if_dwc: Add checksum offloading support

3 years agoif_dwc: Add flow control support
Emmanuel Vadot [Fri, 20 Nov 2020 11:31:04 +0000 (11:31 +0000)]
if_dwc: Add flow control support

3 years agoif_awg: Add a awg_dma_start_tx function that trigger dma engine
Emmanuel Vadot [Fri, 20 Nov 2020 11:30:44 +0000 (11:30 +0000)]
if_awg: Add a awg_dma_start_tx function that trigger dma engine

No functional changes intended

3 years agoif_dwc: Use if_ function where appropriate
Emmanuel Vadot [Fri, 20 Nov 2020 11:30:23 +0000 (11:30 +0000)]
if_dwc: Use if_ function where appropriate

No functional changes intended