]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoUnbreak etcupdate(8) and mergemaster(8) after r352950
kevans [Wed, 2 Oct 2019 12:46:28 +0000 (12:46 +0000)]
Unbreak etcupdate(8) and mergemaster(8) after r352950

r352950 introduced improper case fall-through for shell scripts. Fix it with
a pipe.

Reported by: lwhsu, David Wolfskill

4 years agoFix build failure for gcc after r352983, due to
hselasky [Wed, 2 Oct 2019 12:45:39 +0000 (12:45 +0000)]
Fix build failure for gcc after r352983, due to
not using static variable declared by net/sff8472.h .

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix build failure for 32-bit platforms after r352991, due to
hselasky [Wed, 2 Oct 2019 12:02:14 +0000 (12:02 +0000)]
Fix build failure for 32-bit platforms after r352991, due to
incorrect printf() formatter string.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRename etc/rc.d/abi to etc/rc.d/linux; after moving out the SysV IPC stuff
trasz [Wed, 2 Oct 2019 11:40:40 +0000 (11:40 +0000)]
Rename etc/rc.d/abi to etc/rc.d/linux; after moving out the SysV IPC stuff
it's entirely linux-specific.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21830

4 years agoBump driver version for mlx5core, mlx5en(4) and mlx5ib(4).
hselasky [Wed, 2 Oct 2019 11:15:35 +0000 (11:15 +0000)]
Bump driver version for mlx5core, mlx5en(4) and mlx5ib(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoPrint numeric error_type and module_status in mlx5core
hselasky [Wed, 2 Oct 2019 11:06:01 +0000 (11:06 +0000)]
Print numeric error_type and module_status in mlx5core
in case the strings are not available.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd print to show user a reason for rejecting buffer size change in mlx5en(4).
hselasky [Wed, 2 Oct 2019 11:05:05 +0000 (11:05 +0000)]
Add print to show user a reason for rejecting buffer size change in mlx5en(4).

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoOnly update lossy buffers config when manual PFC configuration was done
hselasky [Wed, 2 Oct 2019 11:02:54 +0000 (11:02 +0000)]
Only update lossy buffers config when manual PFC configuration was done
in mlx5en(4).

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoImprove mlx5_fwdump_prep logging in mlx5core.
hselasky [Wed, 2 Oct 2019 11:01:05 +0000 (11:01 +0000)]
Improve mlx5_fwdump_prep logging in mlx5core.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRandomize the delay when waiting for VSC flag in mlx5core.
hselasky [Wed, 2 Oct 2019 10:59:44 +0000 (10:59 +0000)]
Randomize the delay when waiting for VSC flag in mlx5core.

The PRM suggests random 0 - 10ms to prevent multiple waiters on the same
interval in order to avoid starvation.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUse size_t for byte_to_write variable when comparing to eeprom_info_out_len
hselasky [Wed, 2 Oct 2019 10:58:27 +0000 (10:58 +0000)]
Use size_t for byte_to_write variable when comparing to eeprom_info_out_len
which is also size_t in mlx5tool(8).

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoWait for FW readiness before initializing command interface in mlx5core.
hselasky [Wed, 2 Oct 2019 10:53:28 +0000 (10:53 +0000)]
Wait for FW readiness before initializing command interface in mlx5core.

Before attempting to initialize the command interface we must wait till
the fw_initializing bit is clear.

If we fail to meet this condition the hardware will drop our
configuration, specifically the descriptors page address.  This scenario
can happen when the firmware is still executing an FLR flow and did not
finish yet so the driver needs to wait for that to finish.

Linux commits:
6c780a0267b8
b8a92577f4be.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix regression issue about bad refcounting of unlimited send tags
hselasky [Wed, 2 Oct 2019 10:46:57 +0000 (10:46 +0000)]
Fix regression issue about bad refcounting of unlimited send tags
in mlx5en(4) after r348254.

The unlimited send tags are shared amount multiple connections and are
not allocated per send tag allocation request. Only increment the refcount.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoSeal transmit path with regards to using destroyed mutex in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:43:49 +0000 (10:43 +0000)]
Seal transmit path with regards to using destroyed mutex in mlx5en(4).

It may happen during link down that the running state may be observed
non-zero in the transmit routine, right before the running state is
cleared. This may end up using a destroyed mutex.

Make all channel mutexes and callouts persistant.

Preserve receive and send queue statistics during link toggle.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRemove unused cpu field from channel structure in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:26:26 +0000 (10:26 +0000)]
Remove unused cpu field from channel structure in mlx5en(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRemove mkey_be from channel structure in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:25:47 +0000 (10:25 +0000)]
Remove mkey_be from channel structure in mlx5en(4).
Use value from priv structure instead.
This saves some space in the channel structure.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoReturn an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core.
hselasky [Wed, 2 Oct 2019 10:24:13 +0000 (10:24 +0000)]
Return an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd sysctl(8) to get and set forward error correction, FEC, configuration
hselasky [Wed, 2 Oct 2019 10:22:15 +0000 (10:22 +0000)]
Add sysctl(8) to get and set forward error correction, FEC, configuration
in mlx5en(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd the ability to query the EEPROM information in mlx5tool(8).
hselasky [Wed, 2 Oct 2019 10:19:17 +0000 (10:19 +0000)]
Add the ability to query the EEPROM information in mlx5tool(8).

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoMove EEPROM information query from a sysctl in mlx5en(4) to an ioctl
hselasky [Wed, 2 Oct 2019 10:14:55 +0000 (10:14 +0000)]
Move EEPROM information query from a sysctl in mlx5en(4) to an ioctl
in mlx5core. The EEPROM information is not only a property of the
mlx5en(4) driver.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd support for buffer parameter manipulations in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:08:04 +0000 (10:08 +0000)]
Add support for buffer parameter manipulations in mlx5en(4).

The following sysctls are added:
dev.mce.N.conf.qos.cable_length
dev.mce.N.conf.qos.buffers_size
dev.mce.N.conf.qos.buffers_prio

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoImport Linux code to query/set buffer state in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:05:34 +0000 (10:05 +0000)]
Import Linux code to query/set buffer state in mlx5en(4).

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd mlx5e_dbg() compatibility macro.
hselasky [Wed, 2 Oct 2019 09:59:42 +0000 (09:59 +0000)]
Add mlx5e_dbg() compatibility macro.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUpdate definitons for PPTB and PBMC registers layouts in mlx5core.
hselasky [Wed, 2 Oct 2019 09:58:00 +0000 (09:58 +0000)]
Update definitons for PPTB and PBMC registers layouts in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd definition for the Port Buffer Status Register in mlx5core.
hselasky [Wed, 2 Oct 2019 09:57:12 +0000 (09:57 +0000)]
Add definition for the Port Buffer Status Register in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoSort the ports registers definitions numerically in mlx5core.
hselasky [Wed, 2 Oct 2019 09:56:27 +0000 (09:56 +0000)]
Sort the ports registers definitions numerically in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUnify prints in mlx5en(4).
hselasky [Wed, 2 Oct 2019 09:49:44 +0000 (09:49 +0000)]
Unify prints in mlx5en(4).

All prints in mlx5en(4) should use on of the macros:
mlx5_en_err/dbg/warn

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUnify prints in mlx5core.
hselasky [Wed, 2 Oct 2019 09:48:01 +0000 (09:48 +0000)]
Unify prints in mlx5core.

All prints in mlx5core should use on of the macros:
mlx5_core_err/dbg/warn

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd proper print in case of 0x0 health syndrome in mlx5core.
hselasky [Wed, 2 Oct 2019 09:46:14 +0000 (09:46 +0000)]
Add proper print in case of 0x0 health syndrome in mlx5core.

In case of health counter fails to increment it indicates a bad device health.
In case when the syndrome indicated by firmware is 0x0, this indicates that
firmware is unable to respond to initialization segment reads.
Add proper print in this case.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd missing blank line at the end of the print in mlx5core.
hselasky [Wed, 2 Oct 2019 09:45:07 +0000 (09:45 +0000)]
Add missing blank line at the end of the print in mlx5core.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRemove no longer needed fwdump register tables from mlx5core.
hselasky [Wed, 2 Oct 2019 09:43:48 +0000 (09:43 +0000)]
Remove no longer needed fwdump register tables from mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRead rege map from crdump scan space in mlx5core.
hselasky [Wed, 2 Oct 2019 09:40:23 +0000 (09:40 +0000)]
Read rege map from crdump scan space in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoDefine MLX5_VSC_DOMAIN_SCAN_CRSPACE.
hselasky [Wed, 2 Oct 2019 09:34:34 +0000 (09:34 +0000)]
Define MLX5_VSC_DOMAIN_SCAN_CRSPACE.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUse the MLX5_VSC_DOMAIN_SEMAPHORES constant instead of hand-rolled symbol
hselasky [Wed, 2 Oct 2019 09:33:38 +0000 (09:33 +0000)]
Use the MLX5_VSC_DOMAIN_SEMAPHORES constant instead of hand-rolled symbol
in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoMove mlx5_ifc_vsc_space_bits and mlx5_ifc_vsc_addr_bits to mlx5_ifc.h.
hselasky [Wed, 2 Oct 2019 09:32:41 +0000 (09:32 +0000)]
Move mlx5_ifc_vsc_space_bits and mlx5_ifc_vsc_addr_bits to mlx5_ifc.h.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoMake the mlx5_vsc_wait_on_flag(9) function global.
hselasky [Wed, 2 Oct 2019 09:31:36 +0000 (09:31 +0000)]
Make the mlx5_vsc_wait_on_flag(9) function global.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd port module event software counters in mlx5core.
hselasky [Wed, 2 Oct 2019 09:29:55 +0000 (09:29 +0000)]
Add port module event software counters in mlx5core.
While at it, fixup PME based on latest PRM defines.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoCorrect and update some counter names in mlx5en(4).
hselasky [Wed, 2 Oct 2019 09:27:56 +0000 (09:27 +0000)]
Correct and update some counter names in mlx5en(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoExport channel IRQ number as part of the "hw_ctx_debug" sysctl(8) in mlx5en(4).
hselasky [Wed, 2 Oct 2019 09:27:08 +0000 (09:27 +0000)]
Export channel IRQ number as part of the "hw_ctx_debug" sysctl(8) in mlx5en(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoCleanup naming of IRQ vectors in mlx5en.
hselasky [Wed, 2 Oct 2019 09:23:33 +0000 (09:23 +0000)]
Cleanup naming of IRQ vectors in mlx5en.
Remove unused IRQ naming functions and arrays.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd support for Multi-Physical Function Switch, MPFS, in mlx5en.
hselasky [Wed, 2 Oct 2019 09:22:22 +0000 (09:22 +0000)]
Add support for Multi-Physical Function Switch, MPFS, in mlx5en.

MPFS is a logical switch in the Mellanox device which forward packets
based on a hardware driven L2 address table, to one or more physical-
or virtual- functions. The physical- or virtual- function is required
to tell the MPFS by using the MPFS firmware commands, which unicast
MAC addresses it is requesting from the physical port's traffic.
Broadcast and multicast traffic however, is copied to all listening
physical- and virtual- functions and does not need a rule in the MPFS
switching table.

Linux commit: eeb66cdb682678bfd1f02a4547e3649b38ffea7e
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoImplement macro for asserting priv lock in mlx5en.
hselasky [Wed, 2 Oct 2019 09:16:17 +0000 (09:16 +0000)]
Implement macro for asserting priv lock in mlx5en.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix for missing cleanup code in error case in mlx5en.
hselasky [Wed, 2 Oct 2019 09:15:07 +0000 (09:15 +0000)]
Fix for missing cleanup code in error case in mlx5en.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoCheck return value of mlx5_vector2eqn() function in mlx5en.
hselasky [Wed, 2 Oct 2019 09:14:01 +0000 (09:14 +0000)]
Check return value of mlx5_vector2eqn() function in mlx5en.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoMake sure the number of IRQ vectors doesn't exceed 256 in mlx5core.
hselasky [Wed, 2 Oct 2019 09:12:53 +0000 (09:12 +0000)]
Make sure the number of IRQ vectors doesn't exceed 256 in mlx5core.
The "intr" field in "struct mlx5_ifc_eqc_bits" is only 8 bits wide.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUpdate warning and error print formats in mlx5ib.
hselasky [Wed, 2 Oct 2019 09:11:01 +0000 (09:11 +0000)]
Update warning and error print formats in mlx5ib.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix reported max SGE calculation in mlx5ib.
hselasky [Wed, 2 Oct 2019 09:09:28 +0000 (09:09 +0000)]
Fix reported max SGE calculation in mlx5ib.

Add the 512 bytes limit of RDMA READ and the size of remote address to the max
SGE calculation.

Submitted by: slavash@
Linux commit: 288c01b746aa
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoMake sure the transmit loop doesn't get starved in ipoib.
hselasky [Wed, 2 Oct 2019 09:06:13 +0000 (09:06 +0000)]
Make sure the transmit loop doesn't get starved in ipoib.

When the software send queue gets filled up, callbacks to
if_transmit will stop. Make sure the transmit callback
routine checks the send queue and outputs any remaining
mbufs. Else the remaining mbufs may simply sit in the
output queue blocking the transmit path.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoNotify all sleeping threads of device removal in krping.
hselasky [Wed, 2 Oct 2019 09:03:48 +0000 (09:03 +0000)]
Notify all sleeping threads of device removal in krping.
Implement d_purge for krping_cdevsw.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoConvert pnmatch to single element array in regexec calls
kan [Wed, 2 Oct 2019 06:15:30 +0000 (06:15 +0000)]
Convert pnmatch to single element array in regexec calls

The regexec function is declared as taking an array of regmatch_t
elements, and passing in the pointer to singleton element, while
correct, triggers a Coverity warning. Convert the singleton into
an array of one to silence the warning.

Reported by: Coverity
Coverity CID: 10097321009733
MFC after: 2 weeks

4 years agoshm_open2(2): completely unbreak
kevans [Wed, 2 Oct 2019 02:37:34 +0000 (02:37 +0000)]
shm_open2(2): completely unbreak

kern_shm_open2(), since conception, completely fails to pass the mode along
to kern_shm_open(). This breaks most uses of it.

Add tests alongside this that actually check the mode of the returned
files.

PR: 240934 [pulseaudio breakage]
Reported by: ler, Andrew Gierth [postgres breakage]
Diagnosed by: Andrew Gierth (great catch)
Tested by: ler, tmunro
Pointy hat to: kevans

4 years agocaroot: add @generated tags to extracted .pem
kevans [Wed, 2 Oct 2019 01:27:50 +0000 (01:27 +0000)]
caroot: add @generated tags to extracted .pem

As is the current trend; while these files are manually curated, they are
still generated.  If they end up in a review, it would be helpful to also
take the hint and hide them.

4 years ago[3/3] etcupdate and mergemaster support for certctl
kevans [Wed, 2 Oct 2019 01:06:37 +0000 (01:06 +0000)]
[3/3] etcupdate and mergemaster support for certctl

This commit add support for certctl in mergemaster and etcupdate. Both will
either rehash or prompt for rehash as new certificates are
trusted/blacklisted.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from: secteam
Differential Revision: https://reviews.freebsd.org/D17389

4 years ago[2/3] Add certctl(8)
kevans [Wed, 2 Oct 2019 01:05:53 +0000 (01:05 +0000)]
[2/3] Add certctl(8)

This is a simple utility to hash all trusted on the system into
/etc/ssl/certs. It also allows the user to blacklist certificates they do
not trust.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from: secteam
Differential Revision: https://reviews.freebsd.org/D16857

4 years ago[1/3] Initial infrastructure for SSL root bundle in base
kevans [Wed, 2 Oct 2019 01:05:29 +0000 (01:05 +0000)]
[1/3] Initial infrastructure for SSL root bundle in base

This setup will add the trusted certificates from the Mozilla NSS bundle
to base.

This commit includes:
- CAROOT option to opt out of installation of certs
- mtree amendments for final destinations
- infrastructure to fetch/update certs, along with instructions

A follow-up commit will add a certctl(8) utility to give the user control
over trust specifics. Another follow-up commit will actually commit the
initial result of updatecerts.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from: secteam
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16856

4 years agogeneric_ehci: Enable all phys and resets
manu [Tue, 1 Oct 2019 22:20:03 +0000 (22:20 +0000)]
generic_ehci: Enable all phys and resets

The number of phys and resets is not defined and it controller dependent
so enable/disable every one of them.

4 years agoarm: allwinner: a10_ehci: Enable all phys
manu [Tue, 1 Oct 2019 22:19:12 +0000 (22:19 +0000)]
arm: allwinner: a10_ehci: Enable all phys

Even if there should be only one phy enable all the ones declared in
the dts just to be sure.

4 years agoNeed to use ${${_${group}DIR_${file}}} for STAGE_DIR
sjg [Tue, 1 Oct 2019 20:32:03 +0000 (20:32 +0000)]
Need to use ${${_${group}DIR_${file}}} for STAGE_DIR

STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g} was getting
${STAGE_OBJTOP}BINDIR rather than
${STAGE_OBJTOP}${BINDIR} when FILESDIR=BINDIR

Reviewed by: stevek
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21858

4 years agoarm: allwinner: a10_ehci: Look for the phy based on the id
manu [Tue, 1 Oct 2019 20:22:54 +0000 (20:22 +0000)]
arm: allwinner: a10_ehci:  Look for the phy based on the id

phy-names was never in the bindings schema even if it was present
in some DTS. Get the optional phy based on its ID.

PR: 240978

4 years agogeneric_ohci: Look for the phy based on the id
manu [Tue, 1 Oct 2019 20:21:49 +0000 (20:21 +0000)]
generic_ohci: Look for the phy based on the id

phy-names was never in the bindings schema even if it was present
in some DTS. Get the optional phy based on its ID.

4 years agoImprove latency of synchronous 128KB writes.
mav [Tue, 1 Oct 2019 20:09:25 +0000 (20:09 +0000)]
Improve latency of synchronous 128KB writes.

Before my ZIL space optimization few years ago 128KB writes were logged
as two 64KB+ records in two 128KB log blocks.  After that change it became
~124KB+/4KB+ in two 128KB log blocks to free space in the second block
for another record.  Unfortunately in case of 128KB only writes, when space
in the second block remained unused, that change increased write latency by
imbalancing checksum computation time between parallel threads.

This change introduces new 68KB log block size, used for both writes below
67KB and 128KB-sharp writes.  Writes of 68-127KB are still using one 128KB
block to not increase processing overhead.  Writes above 131KB are still
using full 128KB blocks, since possible saving there is small.  Mixed loads
will likely also fall back to previous 128KB, since code uses maximum of
the last 10 requested block sizes.

On a simple 128KB write test with queue depth of 1 this change demonstrates
~15-20% performance improvement.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoAdd 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm.
ian [Tue, 1 Oct 2019 19:39:00 +0000 (19:39 +0000)]
Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm.

This adds 8 and 16 bit versions of the cmpset and fcmpset functions. Macros
are used to generate all the flavors from the same set of instructions; the
macro expansion handles the couple minor differences between each size
variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc).

In addition to handling new sizes, the instruction sequences used for cmpset
and fcmpset are rewritten to be a bit shorter/faster, and the new sequence
will not return false when *dst==*old but the store-exclusive fails because
of concurrent writers. Instead, it just loops like ldrex/strex sequences
normally do until it gets a non-conflicted store. The manpage allows LL/SC
architectures to bogusly return false, but there's no reason to actually do
so, at least on arm.

Reviewed by: cognet

4 years agosyr827: Switch to iicdev_{readfrom,writeto}
manu [Tue, 1 Oct 2019 18:32:27 +0000 (18:32 +0000)]
syr827: Switch to iicdev_{readfrom,writeto}

Also use IIC_INTRWAIT as we need this to work with the rockchip i2c driver.

4 years agoarm64: rockchip: rk805: Switch to iicdev_{readfrom,writeto}
manu [Tue, 1 Oct 2019 18:30:06 +0000 (18:30 +0000)]
arm64: rockchip: rk805: Switch to iicdev_{readfrom,writeto}

This simpify the code a bit.

4 years agoMove httpd to simple_httpd...
kevans [Tue, 1 Oct 2019 18:14:37 +0000 (18:14 +0000)]
Move httpd to simple_httpd...

This avoids PATH conflicts with a real httpd, as a user will likely almost
always prefer the more fully-featured httpd. This also lines up with the
historical name of the program.

4 years agosysalls.master: remove superfluous ellipsis in comment
emaste [Tue, 1 Oct 2019 17:05:21 +0000 (17:05 +0000)]
sysalls.master: remove superfluous ellipsis in comment

A single period is sufficient in this comment, and making this change
lets us find references to varargs syscalls by searching for ...

4 years agoIn short, pmap_enter_quick_locked("user space", ..., VM_PROT_READ) doesn't
alc [Tue, 1 Oct 2019 15:33:47 +0000 (15:33 +0000)]
In short, pmap_enter_quick_locked("user space", ..., VM_PROT_READ) doesn't
work.  More precisely, it doesn't set ATTR_AP(ATTR_AP_USER) in the page
table entry, so any attempt to read from the mapped page by user space
generates a page fault.  This problem has gone unnoticed because the page
fault handler, vm_fault(), will ultimately call pmap_enter(), which
replaces the non-working page table entry with one that has
ATTR_AP(ATTR_AP_USER) set.

This change reduces the number of page faults during a "buildworld" by
about 19.4%.

Reviewed by: andrew, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21841

4 years agoAdd a top-level makeman target
kevans [Tue, 1 Oct 2019 15:10:35 +0000 (15:10 +0000)]
Add a top-level makeman target

Abstracting away the details of how src.conf(5) is generated is arguably a
good thing; do so with a top-level makeman target.

4 years agoRegen src.conf(5) after r352927 (HTTPD option added)
kevans [Tue, 1 Oct 2019 14:56:31 +0000 (14:56 +0000)]
Regen src.conf(5) after r352927 (HTTPD option added)

4 years agoMove simple_httpd out of picobsd, add HTTPD option (default OFF)
kevans [Tue, 1 Oct 2019 14:55:16 +0000 (14:55 +0000)]
Move simple_httpd out of picobsd, add HTTPD option (default OFF)

picobsd/tinyware has had this compact HTTPD server for a long time, and some
people do use it. Move it out into usr.sbin well in advance of any action
being taken on picobsd.

This has been gated behind an HTTPD option defaulted to *off*, primarily for
two reasons:
1.) This code likely needs a good audit, as it's been living off in picobsd
    land for a long time, and
2.) We don't currently ship an httpd and this may not be a welcome surprise.

Reviewed by: eugen
Differential Revision: https://reviews.freebsd.org/D21724

4 years agoClean up duplicate entries in sys/conf/files
rstone [Tue, 1 Oct 2019 13:36:01 +0000 (13:36 +0000)]
Clean up duplicate entries in sys/conf/files

Reviewed by: imp

4 years agoxen/ctrl: acknowledge all control requests
royger [Tue, 1 Oct 2019 08:21:41 +0000 (08:21 +0000)]
xen/ctrl: acknowledge all control requests

Currently only suspend requests are acknowledged by writing an empty
string back to the xenstore control node, but poweroff or reboot
requests are not acknowledged and FreeBSD simply proceeds to perform
the desired action.

Fix this by acknowledging all requests, and remove the suspend specific
ack done in the handler.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

4 years agoAdd iflag=fullblock to dd
mmacy [Mon, 30 Sep 2019 22:00:48 +0000 (22:00 +0000)]
Add iflag=fullblock to dd

Normally, count=n means read(2) will be called n times on the input to dd. If
the read() returns short, as may happen when reading from a pipe, fewer bytes
will be copied from the input. With conv=sync the buffer is padded with zeros
to fill the rest of the block.

iflag=fullblock causes dd to continue reading until the block is full, so that
count=n means n full blocks are copied. This flag is compatible with illumos
and GNU dd and is used in the ZFS test suite.

Submitted by: Ryan Moeller
Reviewed by: manpages, mmacy@
MFC after: 1 week
Sponsored by:  iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D21441

4 years agoAdd oflag=fsync and oflag=sync capability to dd
mmacy [Mon, 30 Sep 2019 21:56:42 +0000 (21:56 +0000)]
Add oflag=fsync and oflag=sync capability to dd

Sets the O_FSYNC flag on the output file. oflag=fsync and oflag=sync are
synonyms just as O_FSYNC and O_SYNC are synonyms. This functionality is
intended to improve portability of dd commands in the ZFS test suite.

Submitted by: Ryan Moeller
Reviewed by: manpages, mmacy@
MFC after: 1 week
Sponsored by:  iXsytems, Inc.
Differential Revision: https://reviews.freebsd.org/D21422

4 years agodd: Check result of close(2) for errors
mmacy [Mon, 30 Sep 2019 21:53:26 +0000 (21:53 +0000)]
dd: Check result of close(2) for errors

close(2) can return errors from previous operations which should not be ignored.

PR: 229616
Submitted by: Thomas Hurst
Reported by: Thomas Hurst
Reviewed by: mmacy@
Obtained from: Ryan Moeller
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21376

4 years agoAdd conv=fdatasync flag to dd
mmacy [Mon, 30 Sep 2019 21:48:12 +0000 (21:48 +0000)]
Add conv=fdatasync flag to dd

The fdatasync flag performs an fdatasync(2) on the output file before closing it.
This will be useful for the ZFS test suite.

Submitted by: Ryan Moeller
Reviewed by: manpages, mmacy@
MFC after: 1 week
Sponsored by: iXSystems, Inc.
Differential Revision: https://reviews.freebsd.org/D21373

4 years agoUpdate cloudabi(32|64) sysents with "make sysent".
brooks [Mon, 30 Sep 2019 21:14:33 +0000 (21:14 +0000)]
Update cloudabi(32|64) sysents with "make sysent".

MFC after: 1 week

4 years agoRegen after r347228 and r352693.
brooks [Mon, 30 Sep 2019 21:00:19 +0000 (21:00 +0000)]
Regen after r347228 and r352693.

No functional change.

4 years agoRestore the ability to set capenabled directly in syscalls.conf.
brooks [Mon, 30 Sep 2019 20:58:29 +0000 (20:58 +0000)]
Restore the ability to set capenabled directly in syscalls.conf.

This fixes generation of cloudabi syscall tables broken in r340424.

Reviewed by: kevans, emaste
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21821

4 years agoRemove more identifiers orphaned by r351742.
markj [Mon, 30 Sep 2019 20:39:25 +0000 (20:39 +0000)]
Remove more identifiers orphaned by r351742.

Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D21642

4 years agoPull in r357528 from upstream llvm trunk (by Craig Topper):
dim [Mon, 30 Sep 2019 19:24:21 +0000 (19:24 +0000)]
Pull in r357528 from upstream llvm trunk (by Craig Topper):

  [X86] Check MI.isConvertibleTo3Addr() before calling
  convertToThreeAddress in X86FixupLEAs.

  X86FixupLEAs just assumes convertToThreeAddress will return nullptr
  for any instruction that isn't convertible.

  But the code in convertToThreeAddress for X86 assumes that any
  instruction coming in has at least 2 operands and that the second one
  is a register. But those properties aren't guaranteed of all
  instructions. We should check the instruction property first.

Pull in r365720 from upstream llvm trunk (by Craig Topper):

  [X86] Don't convert 8 or 16 bit ADDs to LEAs on Atom in FixupLEAPass.

  We use the functions that convert to three address to do the
  conversion, but changing an 8 or 16 bit will cause it to create a
  virtual register. This can't be done after register allocation where
  this pass runs.

  I've switched the pass completely to a white list of instructions
  that can be converted to LEA instead of a blacklist that was
  incorrect. This will avoid surprises if we enhance the three address
  conversion function to include additional instructions in the future.

  Fixes PR42565.

This should fix assertions/segfaults when compiling certain ports with
CPUTYPE=atom.

PR: 240928
MFC after: 3 days

4 years agolinux_renameat2: don't add extra \n on error.
kaktus [Mon, 30 Sep 2019 19:05:14 +0000 (19:05 +0000)]
linux_renameat2: don't add extra \n on error.

linux_msg() already adds \n at the end of all messages.

Reported by: emaste, kib (mentor), mjg (mentor)
Reviewed by: kib (mentor), mjg (mentor)
Differential Revision: https://reviews.freebsd.org/D21852

4 years agolibsysdecode: decode PROT_MAX flags
kaktus [Mon, 30 Sep 2019 19:03:43 +0000 (19:03 +0000)]
libsysdecode: decode PROT_MAX flags

Extend libsysdecode to pretty-print PROT_MAX flags and fix decoding of regular protection flags broken since r349240.

before:
truss:
mmap(0x0,40960,0x30000,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
kdump:
11439 protmax  CALL  mmap(0,0xa000,0x30000<><invalid>196608,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)

after:
truss:
mmap(0x0,40960,PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
kdump:
11439 protmax  CALL  mmap(0,0xa000,0x30000<PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)

Reviewed by: kib (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D21706

4 years agoCapsicumize nm(1).
markj [Mon, 30 Sep 2019 17:27:59 +0000 (17:27 +0000)]
Capsicumize nm(1).

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21107

4 years agonm: Adjust argc and argv in get_opt().
markj [Mon, 30 Sep 2019 17:26:42 +0000 (17:26 +0000)]
nm: Adjust argc and argv in get_opt().

This refactoring makes it slightly easier to capsicumize nm(1).

Discussed with: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoCapsicumize c++filt(1).
markj [Mon, 30 Sep 2019 16:10:42 +0000 (16:10 +0000)]
Capsicumize c++filt(1).

Reviewed by: emaste
Discussed with: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21106

4 years agoAdd IFLIB_SINGLE_IRQ_RX_ONLY.
markj [Mon, 30 Sep 2019 15:59:07 +0000 (15:59 +0000)]
Add IFLIB_SINGLE_IRQ_RX_ONLY.

As of r347221 the iflib legacy interrupt mode setup assumes that drivers
perform both receive and transmit processing from the interrupt handler.
This assumption is invalid in the vmxnet3 driver, so introduce the
IFLIB_SINGLE_IRQ_RX_ONLY flag to make iflib avoid tx processing in the
interrupt handler.

PR: 239118
Reported and tested by: Juraj Lutter <otis@sk.freebsd.org>
Obtained from: marius
Reviewed by: gallatin
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21831

4 years agoarm64: rockchip: rk_clk_pll: Check mode on recalc
manu [Mon, 30 Sep 2019 15:01:09 +0000 (15:01 +0000)]
arm64: rockchip: rk_clk_pll: Check mode on recalc

If the pll is in slow or deep slow mode return the correct frequency.

4 years agoarm64: rockchip: correct reset value
manu [Mon, 30 Sep 2019 15:00:22 +0000 (15:00 +0000)]
arm64: rockchip: correct reset value

If bit is 0 the reset is not asserted.
Also register our self as a reset provider, this was commented
in r352850

Reported by: mmel

4 years agoFix coredump_phnum_test when kern.compress_user_cores != 0
vangyzen [Mon, 30 Sep 2019 14:05:44 +0000 (14:05 +0000)]
Fix coredump_phnum_test when kern.compress_user_cores != 0

If `kern.compress_user_cores` is non-zero, decompress the core file.

Use `sysctl -f` to restore previous values.

Don't bother restoring `ulimit -c`, since that's a per-process value.

Check more commands with `atf_check`.

Reviewed by: olivier ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21820

4 years agosyscalls.master: consistency, move ); to newline (no functional change)
kevans [Mon, 30 Sep 2019 13:26:16 +0000 (13:26 +0000)]
syscalls.master: consistency, move ); to newline (no functional change)

4 years agoDon't use stack memory which is not initialized.
tuexen [Mon, 30 Sep 2019 12:06:57 +0000 (12:06 +0000)]
Don't use stack memory which is not initialized.
Thanks to Mark Wodrich for reporting this issue for the userland stack in
https://github.com/sctplab/usrsctp/issues/380
This issue was also found for usrsctp by OSS-fuzz in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17778

MFC after: 3 days

4 years agoInitialize baseaddr to suppres warning.
ray [Sun, 29 Sep 2019 23:47:23 +0000 (23:47 +0000)]
Initialize baseaddr to suppres warning.

Pointy hat to: ray

4 years agoections into expected offset in binary format.
ray [Sun, 29 Sep 2019 22:34:01 +0000 (22:34 +0000)]
ections into expected offset in binary format.
Calculate binary file offset using address field, bacause software know only offset to known data, not where to load segment.
With that patch, kernel .data section can have any alignment/offset - kernel boor fine.

PR: 235391
Reviewed by: markj
MFC after: 1 month
Differential Revision: D21827

4 years agoamd64 pmap: batch chunk removal in pmap_remove_pages
mjg [Sun, 29 Sep 2019 20:44:13 +0000 (20:44 +0000)]
amd64 pmap: batch chunk removal in pmap_remove_pages

pv list lock is the main bottleneck during poudriere -j 104 and
pmap_remove_pages is the most impactful consumer. It frees chunks with the lock
held even though it plays no role in correctness. Moreover chunks are often
freed in groups, sample counts during buildkernel (0-sized frees removed):

    value  ------------- Distribution ------------- count
          0 |                                         0
          1 |                                         8
          2 |@@@@@@@                                  19329
          4 |@@@@@@@@@@@@@@@@@@@@@@                   58517
          8 |                                         1085
         16 |                                         71
         32 |@@@@@@@@@@                               24919
         64 |                                         899
        128 |                                         7
        256 |                                         2
        512 |                                         0

Thus:
1. batch freeing
2. move it past unlocking pv list

Reviewed by: alc (previous version), markj (previous version), kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21832

4 years agomemfd_create(3): Don't actually force hugetlb size with MFD_HUGETLB
kevans [Sun, 29 Sep 2019 17:30:10 +0000 (17:30 +0000)]
memfd_create(3): Don't actually force hugetlb size with MFD_HUGETLB

The size flags are only required to select a size on systems that support
multiple sizes. MFD_HUGETLB by itself is valid.

4 years agoAdjust tests after page fault changes in r352807
jilles [Sun, 29 Sep 2019 15:17:58 +0000 (15:17 +0000)]
Adjust tests after page fault changes in r352807

Commit r352807 fixed various signal numbers and codes from page faults;
adjust the tests so they expect the fixes to be present.

PR: 211924

4 years agoRFC 7112 requires a host to put the complete IP header chain
tuexen [Sun, 29 Sep 2019 10:45:13 +0000 (10:45 +0000)]
RFC 7112 requires a host to put the complete IP header chain
including the TCP header in the first IP packet.
Enforce this in tcp_output(). In addition make sure that at least
one byte payload fits in the TCP segement to allow making progress.
Without this check, a kernel with INVARIANTS will panic.
This issue was found by running an instance of syzkaller.

Reviewed by: jtl@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21665

4 years agoMFD_*: swap ordering
kevans [Sun, 29 Sep 2019 03:26:29 +0000 (03:26 +0000)]
MFD_*: swap ordering

This API is still young enough that I would expect no one to be dependant on
this yet... Swap the ordering while it's young to match Linux values to
potentially ease implementation of linuxolator syscall, being able to reuse
existing constants.

4 years agofdt_slicer: bump to SI_ORDER_THIRD following r347183
kevans [Sun, 29 Sep 2019 03:12:35 +0000 (03:12 +0000)]
fdt_slicer: bump to SI_ORDER_THIRD following r347183

r347183 bumped GEOM classes to SI_ORDER_SECOND to resolve a race between
them and the initialization of devsoftc.mtx in devinit, but missed this
dependency on g_flashmap that may now lose the race against GEOM
classes/g_init.

There's a great comment that describes the situation that has also been
updated with the new ordering of GEOM classes.

Reported by: bdragon
MFC after: 4 days