]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAdd support for prio-tagged traffic for RDMA in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 09:11:53 +0000 (09:11 +0000)]
Add support for prio-tagged traffic for RDMA in ibcore.

When receiving a PCP change all GID entries are reloaded.
This ensures the relevant GID entries use prio tagging,
by setting VLAN present and VLAN ID to zero.

The priority for prio tagged traffic is set using the regular
rdma_set_service_type() function.

Fake the real network device to have a VLAN ID of zero
when prio tagging is enabled. This is logic is hidden inside
the rdma_vlan_dev_vlan_id() function which must always be used
to retrieve the VLAN ID throughout all of ibcore and the
infiniband network drivers.

The VLAN presence information then propagates through all
of ibcore and so incoming connections will have the VLAN
bit set. The incoming VLAN ID is then checked against the
return value of rdma_vlan_dev_vlan_id().

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoSet default GID type as RoCE when resolving RoCE route in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 09:09:17 +0000 (09:09 +0000)]
Set default GID type as RoCE when resolving RoCE route in ibcore.

cma_iboe_set_mgid() is updated to reflect the RoCEv2 GID check.

Linux commit:
5c181bda77f409d89ad513528eccac5f3a416474

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoSet RoCEv2 MGID according to spec in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 09:07:36 +0000 (09:07 +0000)]
Set RoCEv2 MGID according to spec in ibcore.

RoCEv2 Annex states that for RoCEv2 over IPv4, the corresponding
IPv4 address is encoded into the GID according to the following rule:
GID= :ffff:<IPv4 address>

Remove the 0xff0e prefix for RoCEv2 packets with IPv4 and leave it
zeroed and change rdma_is_multicast_addr() to consider the new logic.

Linux commit:
be1d325a335840a86c133a56c6a911c368bac0fd
1c3aea2bc8f0b2e5b57375ead40457ff75a3a2ec

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFor multicast functions in ibcore, verify that LIDs are multicast LIDs.
Hans Petter Selasky [Tue, 17 Jul 2018 09:04:36 +0000 (09:04 +0000)]
For multicast functions in ibcore, verify that LIDs are multicast LIDs.

The Infiniband spec defines "A multicast address is defined by a
MGID and a MLID" (section 10.5).

Add check to verify that the MLID value is in the correct address
range.

RoCE Annex (A16.9.10/11) declares that during attach (detach) QP to a
multicast group, if the QP is associated with a RoCE port, the
multicast group MLID is unused and is ignored.

During attach or detach multicast, when the QP is associated with a
port, it is enough to check the port's link layer and validate the
LID only if it is Infiniband. Otherwise, avoid validating the
multicast LID.

Linux commit:
8561eae60ff9417a50fa1fb2b83ae950dc5c1e21
5236333592244557a19694a51337df6ac018f0a7

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix for RDMA loopback over VLAN in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 09:02:29 +0000 (09:02 +0000)]
Fix for RDMA loopback over VLAN in ibcore.

Implement a more generic solution for detecting loopback.
The problem was that the default netdevice was resolved
for loopback also when VLAN was used. Use real network
device instead of loopback device for bound device
interface.

How to test:
ucmatose -b 127.0.0.1 -p 20090
ucmatose -s 5.6.5.1 -p 20090

Note that RDMA treats the IPv4 and IPv6 loopback
addresses like any address.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoAdd native FreeBSD support for multicast in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 08:59:34 +0000 (08:59 +0000)]
Add native FreeBSD support for multicast in ibcore.

This change adds support for registering multicast addresses,
both IPv4 and IPv6.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoIf the MGID/MLID pair is not on the list return an error in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 08:54:40 +0000 (08:54 +0000)]
If the MGID/MLID pair is not on the list return an error in ibcore.

A list of MGID/MLID pairs is built when doing a multicast attach.  When
the multicast detach is called, the list is searched, and regardless of
the search outcome, the driver detach is called.

If an MGID/MLID pair is not on the list, driver detach should not be
called, and an error should be returned.  Calling the driver without
removing an MGID/MLID pair from the list can leave the core and driver
out of sync.

Linux commit:
20c7840a77ddcb2ed2fbd66e8197db2868495751

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoAdd lock to multicast handlers in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 08:52:29 +0000 (08:52 +0000)]
Add lock to multicast handlers in ibcore.

When two handlers used the same object in the old schema, we blocked
the process in the kernel. The new schema just returns -EBUSY. This
could lead to different behaviour in applications between the old
schema and the new schema. In most cases, using such handlers
concurrently could lead to crashing the process. For example, if
thread A destroys a QP and thread B modifies it, we could have the
destruction happens before the modification. In this case, we are
accessing freed memory which could lead to crashing the process.
This is true for most cases. However, attaching and detaching
a multicast address from QP concurrently is safe. Therefore, we
preserve the original behaviour by adding a lock there.

Linux commit:
f48b726920d96dcd1860df06143bdea7d6d7dcc3

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoOnly update source address when resolving is successful in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 08:48:30 +0000 (08:48 +0000)]
Only update source address when resolving is successful in ibcore.

When resolving an IP address in ibcore, only update the source address
upon normal completion. The ibcore address resolve function does not
care about the scope ID value of the IPv6 link-local addresses and expects
this information has already been extracted into the bound_dev_if field.
Because the same IPv6 link-local address can exist on multiple interfaces
the ibcore address resolver gets confused and returns ENETUNREACH.

Instead of updating both source address and bound_dev_if just keep the
address set to any address until resolving completes. For the sake of code
symmetry a similar change has been applied to the IPv4 address resolve path.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoProcess address resolve requests at least one time per second in ibcore.
Hans Petter Selasky [Tue, 17 Jul 2018 08:34:49 +0000 (08:34 +0000)]
Process address resolve requests at least one time per second in ibcore.

When setting a large address resolve timeout it was observed that the
address resolving would succeed at the timeout and not when the address
was available. Make sure the address resolving requests are processed no
slower than one time every second.

While at it use "int" for jiffies instead of "unsigned long" to match
FreeBSD ticks.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoAdd a macro nan_mix() and use it to get NaN results that are (bitwise)
Bruce Evans [Tue, 17 Jul 2018 07:42:14 +0000 (07:42 +0000)]
Add a macro nan_mix() and use it to get NaN results that are (bitwise)
independent of the precision in most cases.  This is mainly to simplify
checking for errors.  r176266 did this for e_pow[f].c using a less
refined expression that often didn't work.  r176276 fixes an error in
the log message for r176266.  The main refinement is to always expand
to long double precision.  See old log messages (especially these 2)
and the comment on the macro for more general details.

Specific details:
- using nan_mix() consistently for the new and old pow*() functions was
  the only thing needed to make my consistency test for powl() vs pow()
  pass on amd64.

- catrig[fl].c already had all the refinements, but open-coded.

- e_atan2[fl].c, e_fmod[fl].c and s_remquo[fl] only had primitive NaN
  mixing.

- e_hypot[fl].c already had a different refined version of r176266.  Refine
  this further.  nan_mix() is not directly usable here since we want to
  clear the sign bit.

- e_remainder[f].c already had an earlier version of r176266.

- s_ccosh[f].c,/s_csinh[f].c already had a version equivalent to r176266.
  Refine this further.  nan_mix() is not directly usable here since the
  expression has to handle some non-NaN cases.

- s_csqrt.[fl]: the mixing was special and mostly wrong.  Partially fix the
  special version.

- s_ctanh[f].c already had a version of r176266.

5 years agoAdd needed locking for um_flags added in -r335808.
Kirk McKusick [Tue, 17 Jul 2018 04:43:58 +0000 (04:43 +0000)]
Add needed locking for um_flags added in -r335808.

While here document required locking details in ufsmount structure.

Reported by: kib
Reviewed by: kib

5 years agoFreeBSD_version bump as per r336351,
Pedro F. Giffuni [Tue, 17 Jul 2018 02:20:51 +0000 (02:20 +0000)]
FreeBSD_version bump as per r336351,

Updating the libstdc++ is likely to have consequences for archs that are
still using the older GCC based toolchain.

Requested by: mcl

5 years agoRevert 336358 and step away fron machine for the day...
Kyle Evans [Mon, 16 Jul 2018 23:32:24 +0000 (23:32 +0000)]
Revert 336358 and step away fron machine for the day...

VERSREQ < 7.+ physically will not work with new config(8) due to major bump,
which is why I bumped it in the first place... Back to the original version

5 years agoPartially revert r336353: sys/conf/* %VERSREQ bumps
Kyle Evans [Mon, 16 Jul 2018 21:53:30 +0000 (21:53 +0000)]
Partially revert r336353: sys/conf/* %VERSREQ bumps

The changes made in r335998 don't strictly require a newer config(8),
though it is advised. The %VERSREQ bumps were premature.

5 years agoModify the reasons for not issuing a delegation in the NFSv4.1 server.
Rick Macklem [Mon, 16 Jul 2018 21:32:50 +0000 (21:32 +0000)]
Modify the reasons for not issuing a delegation in the NFSv4.1 server.

The ESXi NFSv4.1 client will generate warning messages when the reason for
not issuing a delegation is two. Two refers to a resource limit and I do
not see why it would be considered invalid. However it probably was not the
best choice of reason for not issuing a delegation.
This patch changes the reasons used to ones that the ESXi client doesn't
complain about. This change does not affect the FreeBSD client and does
not appear to affect behaviour of the Linux NFSv4.1 client.
RFC5661 defines these "reasons" but does not give any guidance w.r.t. which
ones are more appropriate to return to a client.

Tested by: andreas.nagy@frequentis.com
PR: 226650
MFC after: 2 weeks

5 years agoUpdate igb_sctx_init for r336313, missed when incorporating shurd@'s
Marius Strobl [Mon, 16 Jul 2018 19:47:57 +0000 (19:47 +0000)]
Update igb_sctx_init for r336313, missed when incorporating shurd@'s
feedback on the initial D15720.

Reported by: kib

5 years agodtrace/powerpc: Correct register indices for non-indexed registers in the trapframe
Justin Hibbits [Mon, 16 Jul 2018 19:47:29 +0000 (19:47 +0000)]
dtrace/powerpc: Correct register indices for non-indexed registers in the trapframe

Fix an off-by-one error, LR starts at index 32, not index 33, and the others
follow suit.

5 years agozfsboot: fix build with WITHOUT_LOADER_GELI
Li-Wen Hsu [Mon, 16 Jul 2018 19:21:50 +0000 (19:21 +0000)]
zfsboot: fix build with WITHOUT_LOADER_GELI

Reviewed by: ian
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16292

5 years agoconfig(8): Bump major version after r335998
Kyle Evans [Mon, 16 Jul 2018 19:05:50 +0000 (19:05 +0000)]
config(8): Bump major version after r335998

config-generated hints.c/env.c from r335998 and later are incompatible with
earlier kernels due to no longer setting envmode/hintmode. A minor bump for
this is insufficient, as matching major version with a later minor version
is still viewed as backwards-compatible.

This was an MI kernel change, soo all VERSREQ's are bumped.

5 years agoOCF: Convert consumers to the session id typedef
Conrad Meyer [Mon, 16 Jul 2018 19:01:05 +0000 (19:01 +0000)]
OCF: Convert consumers to the session id typedef

These were missed in the earlier r336269.

No functional change.

Sponsored by: Dell EMC Isilon

5 years agoUpdate libstdc++ configuration.
Pedro F. Giffuni [Mon, 16 Jul 2018 18:53:28 +0000 (18:53 +0000)]
Update libstdc++ configuration.

Its been quite a while since the last time we updated this and since then
we have grown iconv and a bunch of complex math functions.

This only applies to the platforms which still use GCC 4.2.1 in the
toolchain.

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

5 years agosysrc(8): Send error message to stderr (not stdout)
Devin Teske [Mon, 16 Jul 2018 18:53:17 +0000 (18:53 +0000)]
sysrc(8): Send error message to stderr (not stdout)

PR: bin/229806
Reported by: Andreas Sommer <andreas.sommer87@googlemail.com>
MFC after: 3 days
X-MFC-to: stable/11 stable/10 stable/9
Sponsored by: Smule, Inc.

5 years agoDon't use the static keyword with DPCPU defines in arm64 modules.
Andrew Turner [Mon, 16 Jul 2018 18:21:29 +0000 (18:21 +0000)]
Don't use the static keyword with DPCPU defines in arm64 modules.

On arm64 compiler will create PC-relative loads and stores for static data.
This means it doesn't emit a relocation. Unfortunately the in-kernel linker
expects there to be one for DPCPU defines so it can modify its value so the
code will use the correct DPCPU region.

To workaround the lack of a relocation with static data remove it when
building modules on arm64. The kernel is unaffected as it doesn't rely on
modifying these relocations to find the data.

PR: 225684
Reported by: Johannes Lundberg <johalun0@gmail.com>
Reported by: Jose Luis Duran <jlduran@gmail.com>
Reported by: Greg V <greg@unrelenting.technology>
Reviewed by: bz
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D16145

5 years agoCreate an empty stdint.h for arm_neon.h to include.
Andrew Turner [Mon, 16 Jul 2018 15:39:33 +0000 (15:39 +0000)]
Create an empty stdint.h for arm_neon.h to include.

The armv8crypto module includes arm_neon.h for the compiler intrinsic
functions. This includes the userland stdint.h file that doesn't exist in
the kernel. Fix this by providing an empty stdint.h to be used when we
include arm_neon.h.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16254

5 years agoAdd pointer to freebsd-numerics for libm.
Warner Losh [Mon, 16 Jul 2018 15:29:32 +0000 (15:29 +0000)]
Add pointer to freebsd-numerics for libm.

5 years agoallwinner: a83t: Fix PLL_CPU clocks
Emmanuel Vadot [Mon, 16 Jul 2018 13:38:16 +0000 (13:38 +0000)]
allwinner: a83t: Fix PLL_CPU clocks

The PLL_CPU clocks formula is 24Mhz * N and not 24Mhz / N
Fix it by using a NKMP clock with fixed factor values for the one
unused.

5 years agoUnconditionally build libnv in legacy
Kyle Evans [Mon, 16 Jul 2018 13:14:53 +0000 (13:14 +0000)]
Unconditionally build libnv in legacy

Rather than using a config(8) built from new tree linking libnv built on
host.

5 years agoFix buildworld on FreeBSD 10
Alex Richardson [Mon, 16 Jul 2018 11:03:05 +0000 (11:03 +0000)]
Fix buildworld on FreeBSD 10

Since r336126 we depend on explicit_bzero() for the libmd
bootstrap. Add it to -legacy if it is not found in /usr/include/strings.h.

Reviewed By: ian
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D16245

5 years agoNo longer install sys/nv.h and sys/cnv.h in lib/libnv/Makefile
Alex Richardson [Mon, 16 Jul 2018 10:57:26 +0000 (10:57 +0000)]
No longer install sys/nv.h and sys/cnv.h in lib/libnv/Makefile

Use tools/build/Makefile to install the headers into ${WORLDTMP}/legacy
instead. Compared to r336026 this has the minor advantage that it avoids
unncessary header installation when building the non-bootstrap libnv.

Reviewed By: bdrewery, kevans
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D16187

5 years agoindent(1): rewrite the integer/floating constant scanning part of lexi.c
Piotr Pawel Stefaniak [Mon, 16 Jul 2018 05:46:50 +0000 (05:46 +0000)]
indent(1): rewrite the integer/floating constant scanning part of lexi.c

Remove procedural code that did the scanning, which was faulty and didn't
support complex constants such as 0x1p-61. Replace it with a finite state
machine expressed as a transition table. The table was rewritten by hand
from lx's output, given parts of grammar expressed as regular expressions.

lx is Katherine Flavel's lexer generator, currently available at
https://github.com/katef/libfsm and the parts of grammar were taken from
http://quut.com/c/ANSI-C-grammar-l-2011.html and extended to support binary
integer constants which are a popular GCC extension.

Reported by: bde

5 years agoRemove MODULE_PNP_INFO for ig4(4) driver
Oleksandr Tymoshenko [Mon, 16 Jul 2018 01:34:45 +0000 (01:34 +0000)]
Remove MODULE_PNP_INFO for ig4(4) driver

ig4(4) does not support suspend/resume but present on the hardware where
such functionality is critical, like laptops. Remove PNP info to avoid
breaking suspend/resume on the systems where ig4(4) load is not explicitly
requested by the user.

PR:             229791
Reported by:    Ali Abdallah

5 years agoRemove two checks that are always false
Oleksandr Tymoshenko [Mon, 16 Jul 2018 01:07:28 +0000 (01:07 +0000)]
Remove two checks that are always false

Outer loop condition contradicts inner check so code under inner condition
is not reachable. Remove it.

PR: 229722
Reported by: David Binderman

5 years agoRestore the check for the page size extension after r332489.
Mark Johnston [Sun, 15 Jul 2018 22:18:31 +0000 (22:18 +0000)]
Restore the check for the page size extension after r332489.

Without this, the support for transparent superpage promotion on i386
was left disabled.

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

5 years agosh: Don't treat % specially in CDPATH
Jilles Tjoelker [Sun, 15 Jul 2018 21:55:17 +0000 (21:55 +0000)]
sh: Don't treat % specially in CDPATH

5 years agoauditon(2): fix A_SETPOLICY with 64-bit values
Alan Somers [Sun, 15 Jul 2018 21:10:19 +0000 (21:10 +0000)]
auditon(2): fix A_SETPOLICY with 64-bit values

A_SETPOLICY is supposed to work with either 64 or 32-bit values, but due to a
typo the 64-bit version has never worked correctly.

Submitted by: aniketp
Reviewed by: asomers, cem
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16222

5 years agoindent(1): move case_indent from parser state to the options struct
Piotr Pawel Stefaniak [Sun, 15 Jul 2018 21:04:21 +0000 (21:04 +0000)]
indent(1): move case_indent from parser state to the options struct

This was missed in r334927.

5 years agoAdjust comment to reality since r286171.
Michael Tuexen [Sun, 15 Jul 2018 20:42:47 +0000 (20:42 +0000)]
Adjust comment to reality since r286171.

Sponsored by: Netflix, Inc.

5 years agoDon't require a local sshd for the local TCP state dtrace test
Michael Tuexen [Sun, 15 Jul 2018 20:41:16 +0000 (20:41 +0000)]
Don't require a local sshd for the local TCP state dtrace test

This change is similar to the one done in r286171 for
tst.ipv4localtcp.ksh. This not only reduces the requirements on the
system used for testing but results also in a graceful teardown of
the TCP connection.

Reviewed by: gnn@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16276

5 years agoFix the UDP tests for dtrace.
Michael Tuexen [Sun, 15 Jul 2018 20:34:22 +0000 (20:34 +0000)]
Fix the UDP tests for dtrace.

The code imported from opensolaris was depending on ping supporting
UDP for sending probes. Since this is not supported by ping on FreeBSD
use a perl script instead.
The remote test requires the usage of ksh93, so state that in the
sheband.
Enable the local test, but keep the remote test disabled, since it
requires a remote machine on the LAN.

Reviewed by: markj@, gnn@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16268

5 years agoTest PGA_REFERENCED after calling pmap_ts_referenced(), rather than before,
Alan Cox [Sun, 15 Jul 2018 19:25:15 +0000 (19:25 +0000)]
Test PGA_REFERENCED after calling pmap_ts_referenced(), rather than before,
so that a reference from a concurrently destroyed mapping is observed
during the current scan.

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

5 years agoAssorted TSO fixes for em(4)/iflib(9) and dead code removal:
Marius Strobl [Sun, 15 Jul 2018 19:04:23 +0000 (19:04 +0000)]
Assorted TSO fixes for em(4)/iflib(9) and dead code removal:
- Ever since the workaround for the silicon bug of TSO4 causing MAC hangs
  was committed in r295133, CSUM_TSO always got disabled unconditionally
  by em(4) on the first invocation of em_init_locked(). However, even with
  that problem fixed, it turned out that for at least e. g. 82579 not all
  necessary TSO workarounds are in place, still causing MAC hangs even at
  Gigabit speed. Thus, for stable/11, TSO usage was deliberately disabled
  in r323292 (r323293 for stable/10) for the EM-class by default, allowing
  users to turn it on if it happens to work with their particular EM MAC
  in a Gigabit-only environment.
  In head, the TSO workaround for speeds other than Gigabit was lost with
  the conversion to iflib(9) in r311849 (possibly along with another one
  or two TSO workarounds). Yet at the same time, for EM-class MACs TSO4
  got enabled by default again, causing device hangs. Therefore, change the
  default for this hardware class back to have TSO4 off, allowing users
  to turn it on manually if it happens to work in their environment as
  we do in stable/{10,11}. An alternative would be to add a whitelist of
  EM-class devices where TSO4 actually is reliable with the workarounds in
  place, but given that the advantage of TSO at Gigabit speed is rather
  limited - especially with the overhead of these workarounds -, that's
  really not worth it. [1]
  This change includes the addition of an isc_capabilities to struct
  if_softc_ctx so iflib(9) can also handle interface capabilities that
  shouldn't be enabled by default which is used to handle the default-off
  capabilities of e1000 as suggested by shurd@ and moving their handling
  from em_setup_interface() to em_if_attach_pre() accordingly.
- Although 82543 support TSO4 in theory, the former lem(4) didn't have
  support for TSO4, presumably because TSO4 is even more broken in the
  LEM-class of MACs than the later EM ones. Still, TSO4 for LEM-class
  devices was enabled as part of the conversion to iflib(9) in r311849,
  causing device hangs. So revert back to the pre-r311849 behavior of
  not supporting TSO4 for LEM-class at all, which includes not creating
  a TSO DMA tag in iflib(9) for devices not having IFCAP_TSO4 set. [2]
- In fact, the FreeBSD TCP stack can handle a TSO size of IP_MAXPACKET
  (65535) rather than FREEBSD_TSO_SIZE_MAX (65518). However, the TSO
  DMA must have a maxsize of the maximum TSO size plus the size of a
  VLAN header for software VLAN tagging. The iflib(9) converted em(4),
  thus, first correctly sets scctx->isc_tx_tso_size_max to EM_TSO_SIZE
  in em_if_attach_pre(), but later on overrides it with IP_MAXPACKET
  in em_setup_interface() (apparently, left-over from pre-iflib(9)
  times). So remove the later and correct iflib(9) to correctly cap
  the maximum TSO size reported to the stack at IP_MAXPACKET. While at
  it, let iflib(9) use if_sethwtsomax*().
  This change includes the addition of isc_tso_max{seg,}size DMA engine
  constraints for the TSO DMA tag to struct if_shared_ctx and letting
  iflib_txsd_alloc() automatically adjust the maxsize of that tag in case
  IFCAP_VLAN_MTU is supported as requested by shurd@.
- Move the if_setifheaderlen(9) call for adjusting the maximum Ethernet
  header length from {ixgbe,ixl,ixlv,ixv,em}_setup_interface() to iflib(9)
  so adjustment is automatically done in case IFCAP_VLAN_MTU is supported.
  As a consequence, this adjustment now is also done in case of bnxt(4)
  which missed it previously.
- Move the reduction of the maximum TSO segment count reported to the
  stack by the number of m_pullup(9) calls (which in the worst case,
  can add another mbuf and, thus, the requirement for another DMA
  segment each) in the transmit path for performance reasons from
  em_setup_interface() to iflib_txsd_alloc() as these pull-ups are now
  done in iflib_parse_header() rather than in the no longer existing
  em_xmit(). Moreover, this optimization applies to all drivers using
  iflib(9) and not just em(4); all in-tree iflib(9) consumers still
  have enough room to handle full size TSO packets. Also, reduce the
  adjustment to the maximum number of m_pullup(9)'s now performed in
  iflib_parse_header().
- Prior to the conversion of em(4)/igb(4)/lem(4) and ixl(4) to iflib(9)
  in r311849 and r335338 respectively, these drivers didn't enable
  IFCAP_VLAN_HWFILTER by default due to VLAN events not being passed
  through by lagg(4). With iflib(9), IFCAP_VLAN_HWFILTER was turned on
  by default but also lagg(4) was fixed in that regard in r203548. So
  just remove the now redundant and defunct IFCAP_VLAN_HWFILTER handling
  in {em,ixl,ixlv}_setup_interface().
- Nuke other redundant IFCAP_* setting in {em,ixl,ixlv}_setup_interface()
  which is (more completely) already done in {em,ixl,ixlv}_if_attach_pre()
  now.
- Remove some redundant/dead setting of scctx->isc_tx_csum_flags in
  em_if_attach_pre().
- Remove some IFCAP_* duplicated either directly or indirectly (e. g.
  via IFCAP_HWCSUM) in {EM,IGB,IXL}_CAPS.
- Don't bother to fiddle with IFCAP_HWSTATS in ixgbe(4)/ixgbev(4) as
  iflib(9) adds that capability unconditionally.
- Remove some unused macros from em(4).
- Bump __FreeBSD_version as some of the above changes require the modules
  of drivers using iflib(9) to be recompiled.

Okayed by: sbruno@ at 201806 DevSummit Transport Working Group [1]
Reviewed by: sbruno (earlier version), erj
PR: 219428 (part of; comment #10) [1], 220997 (part of; comment #3) [2]
Differential Revision: https://reviews.freebsd.org/D15720

5 years agoShut down the TCP connection to a DS in the pNFS client when Renew fails.
Rick Macklem [Sun, 15 Jul 2018 18:54:44 +0000 (18:54 +0000)]
Shut down the TCP connection to a DS in the pNFS client when Renew fails.

When a NFSv4.1 client mount using pNFS detects a failure trying to do a
Renew (actually just a Sequence operation), the code would simply try
again and again and again every 30sec.
This would tie up the "nfscl" thread, which should also be doing other
things like Renews on other DSs and the MDS.
This patch adds code which closes down the TCP connection and marks it
defunct when Renew detects an failure to communicate with the DS, so
further Renews will not be attempted until a new working TCP connection to
the DS is established.
It also makes the call to nfscl_cancelreqs() unconditional, since
nfscl_cancelreqs() checks the NFSCLDS_SAMECONN flag and does so while holding
the lock.
This fix only applies to the NFSv4.1 client whne using pNFS and without it
the only effect would have been an "nfscl" thread busy doing Renew attempts
on an unresponsive DS.

MFC after: 2 weeks

5 years agoRemove code to disable IFCAP_VLAN_HWFILTER by default for ixgbe(4) as VLAN
Marius Strobl [Sun, 15 Jul 2018 18:03:56 +0000 (18:03 +0000)]
Remove code to disable IFCAP_VLAN_HWFILTER by default for ixgbe(4) as VLAN
events are passed through by lagg(4) ever since r203548. Deactivation of
this capability by default due to lagg(4) was already not done for ixgbev(4)
and has been - although inadvertently - broken when em(4)/igb(4)/lem(4) and
ixl(4) were converted to iflib(9) in r311849 and r335338 respectively.

Reviewed by: erj
Differential Revision: https://reviews.freebsd.org/D15720 (part of)

5 years agoLet geli deal with lost devices without crashing.
Mariusz Zaborski [Sun, 15 Jul 2018 18:03:19 +0000 (18:03 +0000)]
Let geli deal with lost devices without crashing.

PR: 162036
Submitted by: Fabian Keil <fk@fabiankeil.de>
Obtained from: ElectroBSD
Discussed with: pjd@

5 years agoAs suggested by a comment in ixl_initialize_vsi(), use if_getcapenable(9)
Marius Strobl [Sun, 15 Jul 2018 18:02:50 +0000 (18:02 +0000)]
As suggested by a comment in ixl_initialize_vsi(), use if_getcapenable(9)
instead of directly interrogating ifp->if_capenable.

Reviewed by: erj (ixl_initialize_vsi())
Differential Revision: https://reviews.freebsd.org/D15720 (part of)

5 years agoFix declaration.
Mariusz Zaborski [Sun, 15 Jul 2018 17:31:50 +0000 (17:31 +0000)]
Fix declaration.

5 years agoUse capsicum helpers in fstype and ctld.
Mariusz Zaborski [Sun, 15 Jul 2018 17:21:19 +0000 (17:21 +0000)]
Use capsicum helpers in fstype and ctld.

Reviewed by: trasz

5 years agoExtend amount of possible coredumps from 10 to 100000 when using index format.
Mariusz Zaborski [Sun, 15 Jul 2018 17:10:12 +0000 (17:10 +0000)]
Extend amount of possible coredumps from 10 to 100000 when using index format.
The amount of digits in the name of corefile is assigned dynamically.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16118

5 years agosh: Don't use padvance() for MAIL/MAILPATH
Jilles Tjoelker [Sun, 15 Jul 2018 09:14:30 +0000 (09:14 +0000)]
sh: Don't use padvance() for MAIL/MAILPATH

Using padvance() requires undoing its append of '/' and prevents adjusting
its '%' logic to allow most directories with '%' in PATH.

No functional change is intended.

5 years agoUse EF_SEG_READ_STRING instead of EF_SEG_READ when reading strings.
Warner Losh [Sun, 15 Jul 2018 05:29:39 +0000 (05:29 +0000)]
Use EF_SEG_READ_STRING instead of EF_SEG_READ when reading strings.

Normally, we can get away with just reading the 1k buffer for the
string, since the placement of the data is generally no where near the
end of the file. However, it's possible that the string is within the
last 1k of the file, in which case the read will fail, and we'll not
produce the proper records needed for devmatch to work. By reading
using EF_SEG_READ_STRING, we automatically work around these problems
while still retaining safety.

This fix a problem with devmatch where we wouldn't load certain
modules (like ums). This didn't always happen (my tree didn't exhibit
it, while nathan's did because his optimization options were more
agressive).

Reported by: nathanw@

5 years agoacquire inp lock around ip6_pcbopt to fix IPV6_TCLASS panic
Matt Macy [Sun, 15 Jul 2018 00:47:06 +0000 (00:47 +0000)]
acquire inp lock around ip6_pcbopt to fix IPV6_TCLASS panic

Simple fix to address panics relating to setting IPV6_TCLASS
with setsockopt(). The premise of this change is that it is
ok to call malloc with M_NOWAIT while holding a lock on the
in6p.

If it later turns out that it is not ok, then major surgery
will be required, as ip6_setpktopt() will have to be fixed
(as it also calls malloc with M_NOWAIT) which pulls in the
ip6_pcbopts(), ip6_setpktopts(), ip6_setpktopt() call chain.

Submitted by: Jason Eggnet
Reviewed by: rrs, transport, sbruno
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16201

5 years agoepoch_test: fix compile
Matt Macy [Sun, 15 Jul 2018 00:31:17 +0000 (00:31 +0000)]
epoch_test: fix compile

- update to new interface

Reported by: manu

5 years agomsun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd
Matt Macy [Sun, 15 Jul 2018 00:23:10 +0000 (00:23 +0000)]
msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd

This corresponds to the latest status (hasn't changed in 9+
years) from openbsd of ld80/ld128 powl, and source cpowf, cpow,
cpowl (the complex power functions for float complex, double
complex, and long double complex) which are required for C99
compliance and were missing from FreeBSD. Also required for
some numerical codes using complex numbered Hamiltonians.

Thanks to jhb for tracking down the issue with making
weak_reference compile on powerpc.

When asked to review, bde said "I don't like it" - but
provided no actionable feedback or superior implementations.

Discussed with: jhb
Submitted by: jmd
Differential Revision: https://reviews.freebsd.org/D15919

5 years agoThere was quite a bit of feedback on r336282 that has led to the
Sean Bruno [Sat, 14 Jul 2018 23:53:51 +0000 (23:53 +0000)]
There was quite a bit of feedback on r336282 that has led to the
submitter to want to revert it.

5 years agopf tests: Basic synproxy test
Kristof Provost [Sat, 14 Jul 2018 21:32:32 +0000 (21:32 +0000)]
pf tests: Basic synproxy test

A very basic syncproxy test: set up a connection via a synproxy rule.
This triggeres the panic fixed in r336273.

5 years agoInvalidate the mapping before updating its physical address.
Alan Cox [Sat, 14 Jul 2018 20:14:00 +0000 (20:14 +0000)]
Invalidate the mapping before updating its physical address.

Doing so ensures that all threads sharing the pmap have a consistent
view of the mapping.  This fixes the problem described in the commit
log message for r329254 without the overhead of an extra page fault
in the common case.  (Now that all pmap_enter() implementations are
similarly modified, the workaround added in r329254 can be removed,
reducing the overhead of COW faults.)

With this change we can reuse the PV entry from the old mapping,
potentially avoiding a call to reclaim_pv_chunk().  Otherwise, there is
nothing preventing the old PV entry from being reclaimed.  In rare
cases this could result in the PTE's page table page being freed,
leading to a use-after-free of the page when the updated PTE is written
following the allocation of the PV entry for the new mapping.

Reviewed by: br, markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D16261

5 years agoReturn the intended return code.
Michael Tuexen [Sat, 14 Jul 2018 19:53:41 +0000 (19:53 +0000)]
Return the intended return code.

This bug was spotted by markj@ in D16268 because I copied this code part
and used it there. So fix it.

Sponsored by: Netflix, Inc.

5 years agoFix the pNFS client when mirrors aren't on the same machine.
Rick Macklem [Sat, 14 Jul 2018 19:51:44 +0000 (19:51 +0000)]
Fix the pNFS client when mirrors aren't on the same machine.

Without this patch, the client side NFSv4.1 pNFS code erroneously did writes
and commits to both DS mirrors using the TCP connection of the first one.
For my test setup this worked, since I have both DSs running on the same
machine, but it would have failed when the DSs are on separate machines.
This patch fixes the code to use the correct TCP connection for each DS.
This patch should only affect the NFSv4.1 client when using "pnfs" mounts
to mirrored DSs.

MFC after: 2 weeks

5 years agoFix shebangs and execute bit of test scripts.
Michael Tuexen [Sat, 14 Jul 2018 19:49:14 +0000 (19:49 +0000)]
Fix shebangs and execute bit of test scripts.

Since we don't have /usr/bin/ksh, use a generic way of specifying
ksh. Some of the tests only run with ksh93, so use this shell
for these tests. Two of the tests don't have the execute bit set,
so fix this, too.

Reviewed by: markj@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16270

5 years agoCorrect some typos.
Alan Cox [Sat, 14 Jul 2018 19:35:41 +0000 (19:35 +0000)]
Correct some typos.

Reviewed by: kib

5 years agoAdd mpo_vnode_check_setmode MAC method to MAC/veriexec.
Stephen J. Kiernan [Sat, 14 Jul 2018 17:21:16 +0000 (17:21 +0000)]
Add mpo_vnode_check_setmode MAC method to MAC/veriexec.
In the method, disallow changing SUID/SGID on verified files.

Obtained from: Juniper Networks, Inc.

5 years agoAdd support for pmap_enter(..., psind=1) to the i386 pmap. In other words,
Alan Cox [Sat, 14 Jul 2018 17:20:27 +0000 (17:20 +0000)]
Add support for pmap_enter(..., psind=1) to the i386 pmap.  In other words,
add support for explicitly requesting that pmap_enter() create a 2 or 4 MB
page mapping.  (Essentially, this feature allows the machine-independent
layer to create superpage mappings preemptively, and not wait for automatic
promotion to occur.)

Export pmap_ps_enabled() to the machine-independent layer.

Add a flag to pmap_pv_insert_pde() that specifies whether it should fail or
reclaim a PV entry when one is not available.

Refactor pmap_enter_pde() into two functions, one by the same name, that is
a general-purpose function for creating PDE PG_PS mappings, and another,
pmap_enter_4mpage(), that is used to prefault 2 or 4 MB read- and/or
execute-only mappings for execve(2), mmap(2), and shmat(2).

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D16246

5 years agoAdd config(8) options that can be used to enable building MAC/veriexec
Stephen J. Kiernan [Sat, 14 Jul 2018 17:18:17 +0000 (17:18 +0000)]
Add config(8) options that can be used to enable building MAC/veriexec
and its fingerprint modules into a kernel.

Reviewed by: sjg

5 years agoFix a typo which could cause a build breakage when building with MAC/veriexec
Stephen J. Kiernan [Sat, 14 Jul 2018 17:15:28 +0000 (17:15 +0000)]
Fix a typo which could cause a build breakage when building with MAC/veriexec
enabled in the kernel config.

Remove unused mac_veriexec_print_db prototype in internal header file.

5 years agoAdd support for TCP state names used by Solaris.
Michael Tuexen [Sat, 14 Jul 2018 17:12:04 +0000 (17:12 +0000)]
Add support for TCP state names used by Solaris.

For compatibility, add the TCP state names used by Solaris
and given in the Dtrace Guide available at
https://docs.oracle.com/cd/E37838_01/html/E61035/glhgu.html#OSDTGglhmv

Reviewed by: markj@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16269

5 years agoRemove RIPEMD-160 fingerprint modules for veriexec, since it has very
Stephen J. Kiernan [Sat, 14 Jul 2018 16:59:17 +0000 (16:59 +0000)]
Remove RIPEMD-160 fingerprint modules for veriexec, since it has very
little practical use and would not be recommended for anyone to use in
a production environment.

Reviewed by: sjg

5 years agoEliminate an unused var warning-error; the var is used only when parsing
Ian Lepore [Sat, 14 Jul 2018 16:33:11 +0000 (16:33 +0000)]
Eliminate an unused var warning-error; the var is used only when parsing
linux-style boot args, so wrap it in the appropriate ifdef.

5 years agoFixup memory management for fetching options in ip_ctloutput()
Sean Bruno [Sat, 14 Jul 2018 16:19:46 +0000 (16:19 +0000)]
Fixup memory management for fetching options in ip_ctloutput()

Submitted by: Jason Eggleston <jason@eggnet.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14621

5 years agoFix vnic fallback PHY name matching after r334880.
Mark Johnston [Sat, 14 Jul 2018 16:06:53 +0000 (16:06 +0000)]
Fix vnic fallback PHY name matching after r334880.

In some cases it seems that the PHY mode can only be identified by
matching against the corresponding device node name in the FDT.  r334880
broke this for the case where the node name contains a unit address.
Fix the problem by allowing a match in that case.

Reviewed by: andrew, sbruno
Tested by: sbruno
Differential Revision: https://reviews.freebsd.org/D16259

5 years agoffs_syncvnode: Remove unhelpful print
Conrad Meyer [Sat, 14 Jul 2018 15:45:11 +0000 (15:45 +0000)]
ffs_syncvnode: Remove unhelpful print

It can occur during ordinary use of softupdates, or perhaps if writes to the
underlying media fail (causing bufs to be redirtied).  Either way, it is not
particularly actionable.

Reviewed by: imp, kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D16258

5 years agopf: Fix synproxy
Kristof Provost [Sat, 14 Jul 2018 10:14:59 +0000 (10:14 +0000)]
pf: Fix synproxy

Synproxy was accidentally broken by r335569. The 'return (action)' must be
executed for every non-PF_PASS result, but the error packet (TCP RST or ICMP
error) should only be sent if the packet was dropped (i.e. PF_DROP) and the
return flag is set.

PR: 229477
Submitted by: Andre Albsmeier <mail AT fbsd.e4m.org>
MFC after: 1 week

5 years agoregex/engine.c: error: variable 'dp' set but not used
Toomas Soome [Sat, 14 Jul 2018 09:29:45 +0000 (09:29 +0000)]
regex/engine.c: error: variable 'dp' set but not used

The issue found with gcc6 build (originally on illumos, confirmed on FreeBSD).
Mark it __unused.

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

5 years agopf: Fix panic on vnet jail shutdown with synproxy
Kristof Provost [Sat, 14 Jul 2018 09:11:32 +0000 (09:11 +0000)]
pf: Fix panic on vnet jail shutdown with synproxy

When shutting down a vnet jail pf_shutdown() clears the remaining states, which
through pf_clear_states() calls pf_unlink_state().
For synproxy states pf_unlink_state() will send a TCP RST, which eventually
tries to schedule the pf swi in pf_send(). This means we can't remove the
software interrupt until after pf_shutdown().

MFC after: 1 week

5 years agoMinor adjustments:
Warner Losh [Sat, 14 Jul 2018 06:43:37 +0000 (06:43 +0000)]
Minor adjustments:

o Fix the parsing of the device path. a last minute change terminated
  it too soon.
o Kill setting LINES. We don't need to do it, and even if we did hard
  coding it to 24 is wrong.
o Now that the console is working again for the loader, adjust the
  printfs to be more in line with other platforms.

5 years agoAdd reporting of whether or not a keyboard is detected. In addition,
Warner Losh [Sat, 14 Jul 2018 01:46:19 +0000 (01:46 +0000)]
Add reporting of whether or not a keyboard is detected. In addition,
note that r336270's commit message was slightly incorrect. It changed
the default setting of the console to honor the ConOut
variable. Overrides via the command line are still possible, and we
use the devices in ConOut to set the proper console. If, for example,
serial cosnole is specified, we'll set console to "efi" if ConOut has
a serial port list and to either "efi comconsole" or "comconsole efi"
if not depending on whether -D or -D -h was specified.

RelNotes: Yes
Sponsored by: Netflix

5 years agouefi stand: Guess the console better
Warner Losh [Sat, 14 Jul 2018 00:40:38 +0000 (00:40 +0000)]
uefi stand: Guess the console better

For server machines, ComOut is set to the set of devices that the efi
console suppots. Parse it to see if we have serial, video or both.
Make that take precidence over the command line args. boot1.efi parses
them, but loader.efi doesn't. It's not clear where to read boot.conf
from, so we don't do that. The command line args can still be set via
efibootmgr, which is more inline with the UEFI boot manager to replace
that. These args are typically used only to set serial vs video and
the com speed line. We can infer that from ComOut, so do so.
Remember the com speed and hw.uart.console to match.

RelNotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15917

5 years agoOCF: Add a typedef for session identifiers
Conrad Meyer [Fri, 13 Jul 2018 23:46:07 +0000 (23:46 +0000)]
OCF: Add a typedef for session identifiers

No functional change.

This should ease the transition from an integer session identifier model to
an opaque pointer model.

5 years agoRe-unbreak smartpqi(4) GCC build
Conrad Meyer [Fri, 13 Jul 2018 22:49:48 +0000 (22:49 +0000)]
Re-unbreak smartpqi(4) GCC build

Like r333085, remove redundant declarations.

Redundant declarations were re-introduced in r336201.

Sponsored by: Dell EMC Isilon

5 years agolockmgr: tidy up slock/sunlock similar to other locks
Mateusz Guzik [Fri, 13 Jul 2018 22:40:14 +0000 (22:40 +0000)]
lockmgr: tidy up slock/sunlock similar to other locks

5 years agoDefine ADR subtype of ACPI type for a device path.
Warner Losh [Fri, 13 Jul 2018 21:03:32 +0000 (21:03 +0000)]
Define ADR subtype of ACPI type for a device path.

5 years agoUse the existing MSR_BIOS_SIGN on AMD.
Mark Johnston [Fri, 13 Jul 2018 20:56:20 +0000 (20:56 +0000)]
Use the existing MSR_BIOS_SIGN on AMD.

Reported by: kib
Sponsored by: The FreeBSD Foundation

5 years agoFix machdep_boot.c
Warner Losh [Fri, 13 Jul 2018 20:33:10 +0000 (20:33 +0000)]
Fix machdep_boot.c

A last minute change made this no longer compile. Pass the right arg
and eliminate now-unused variables from the code.

5 years agoCatch up to the inflate renaming.
Warner Losh [Fri, 13 Jul 2018 20:08:18 +0000 (20:08 +0000)]
Catch up to the inflate renaming.

5 years agoClose down the TCP connection to a pNFS DS when it is disabled.
Rick Macklem [Fri, 13 Jul 2018 20:03:05 +0000 (20:03 +0000)]
Close down the TCP connection to a pNFS DS when it is disabled.

So long as the TCP connection to a pNFS DS isn't shared with other DSs,
it can be closed down when the DS is being disabled in the pNFS client.
This causes any RPCs in progress to fail.
This patch only affects the NFSv4.1 pNFS client when errors occur
while doing I/O on a DS.

MFC after: 2 weeks

5 years agoEnable UART support for Xilinx Ultrascale+ SoCs
Marcin Wojtas [Fri, 13 Jul 2018 19:54:22 +0000 (19:54 +0000)]
Enable UART support for Xilinx Ultrascale+ SoCs

Xilinx Ultrascale+ are based on Cortex-A53 and use existing
UART driver (uart_dev_cdnc). Enable it in arm64 GENERIC config.

Submitted by: Michal Stanek <mst@semihalf.com>
Obtained from: Semihalf

5 years agoUse the name added in r336257.
Mark Johnston [Fri, 13 Jul 2018 19:45:12 +0000 (19:45 +0000)]
Use the name added in r336257.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoDefine the MSR used to fetch the current microcode patch level on AMD.
Mark Johnston [Fri, 13 Jul 2018 19:42:59 +0000 (19:42 +0000)]
Define the MSR used to fetch the current microcode patch level on AMD.

It is defined in the AMD family 17h register reference.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoFix glitched indentation (and rewrap as needed due to deeper indent).
Ian Lepore [Fri, 13 Jul 2018 18:58:37 +0000 (18:58 +0000)]
Fix glitched indentation (and rewrap as needed due to deeper indent).
No functional changes.

Reported by: rpokala@

5 years agog_eli_key_cmp is used only in the kernel, so only define it in the
Warner Losh [Fri, 13 Jul 2018 18:21:38 +0000 (18:21 +0000)]
g_eli_key_cmp is used only in the kernel, so only define it in the
kernel.

5 years agoUse if rather than case for a simple boolean. gcc thinks blks is
Warner Losh [Fri, 13 Jul 2018 18:19:33 +0000 (18:19 +0000)]
Use if rather than case for a simple boolean. gcc thinks blks is
undefined sometimes with the case, but enc is always 0 or 1, so
and if / else is better anyway.

5 years agoAdd missing include of sys/boot.h
Warner Losh [Fri, 13 Jul 2018 18:00:13 +0000 (18:00 +0000)]
Add missing include of sys/boot.h

5 years agoExtend loader(8) geli support to all architectures and all disk-like devices.
Ian Lepore [Fri, 13 Jul 2018 17:50:25 +0000 (17:50 +0000)]
Extend loader(8) geli support to all architectures and all disk-like devices.

This moves the bulk of the geli support from lib386/biosdisk.c into a new
geli/gelidev.c which implements a devsw-type device whose dv_strategy()
function handles geli decryption. Support for all arches comes from moving
the taste-and-attach code to the devopen() function in libsa.

After opening any DEVT_DISK device, devopen() calls the new function
geli_probe_and_attach(), which will "attach" the geli code to the open_file
struct by creating a geli_devdesc instance to replace the disk_devdesc
instance in the open_file. That routes all IO for the device through the
geli code.

A new public geli_add_key() function is added, to allow arch/vendor-specific
code to add keys obtained from custom hardware or other sources.

With these changes, geli support will be compiled into all variations of
loader(8) on all arches because the default is WITH_LOADER_GELI.

Relnotes: yes
Sponsored by: Microchip Technology Inc
Differential Revision: https://reviews.freebsd.org/D15743

5 years agoUse C99 initializers for instances of struct apic_enumerator.
Mark Johnston [Fri, 13 Jul 2018 17:42:48 +0000 (17:42 +0000)]
Use C99 initializers for instances of struct apic_enumerator.

MFC after: 3 days

5 years agoThere's two files in the sys tree named inflate.c, in addition
Warner Losh [Fri, 13 Jul 2018 17:41:28 +0000 (17:41 +0000)]
There's two files in the sys tree named inflate.c, in addition
to it being a common name elsewhere. Rename the old kzip one
to subr_inflate.c.

This actually fixes the build issues on sparc64 that my inclusion of
.PATH ${SYSDIR}/kern created in r336244, so also revert the broken
workaround I committed in r336249.

This slipped passed me because apparently, I never did a clean build.

5 years agoFix sparc64 builds
Warner Losh [Fri, 13 Jul 2018 17:15:14 +0000 (17:15 +0000)]
Fix sparc64 builds

gcc is complaining about struct infate being defined in a parameter
list. It's inclear how long this has been broken, but the fix is
simple enough.

5 years agoInvalidate the mapping before updating its physical address.
Alan Cox [Fri, 13 Jul 2018 17:12:50 +0000 (17:12 +0000)]
Invalidate the mapping before updating its physical address.

Doing so ensures that all threads sharing the pmap have a consistent
view of the mapping.  This fixes the problem described in the commit
log message for r329254 without the overhead of an extra fault in the
common case.  (Once the riscv pmap_enter() implementation is similarly
modified, the workaround added in r329254 can be removed, reducing the
overhead of CoW faults.)

See also r335784 for amd64.  The mips implementation of pmap_enter()
already reused the PV entry from the old mapping.

Reviewed by: kib, markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D16199

5 years agoTransition to boot_env_to_howto and boot_howto_to_env in the boot
Warner Losh [Fri, 13 Jul 2018 16:43:29 +0000 (16:43 +0000)]
Transition to boot_env_to_howto and boot_howto_to_env in the boot
loader.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205

5 years agoEliminate boot loader copies of boot arg parsing.
Warner Losh [Fri, 13 Jul 2018 16:43:23 +0000 (16:43 +0000)]
Eliminate boot loader copies of boot arg parsing.

Eliminate 4 of the copies of the arg parsing in /boot/laoder
by using boot_parse_cmdline.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205

5 years agoUse boot_parse_* to parse command line args and retire cut-n-paste
Warner Losh [Fri, 13 Jul 2018 16:43:17 +0000 (16:43 +0000)]
Use boot_parse_* to parse command line args and retire cut-n-paste
code that was substantially identical.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205