Commit Graph

244113 Commits

Author SHA1 Message Date
John Baldwin
c311f5ebf6 Adjust the deprecated warnings for /dev/crypto to be less noisy.
Warn when actual operations are performed instead of when sessions are
created.  The /dev/crypto engine in OpenSSL 1.0.x tries to create
sessions for all possible algorithms each time it is initialized
resulting in spurious warnings.

Reported by:	Mike Tancsa
MFC after:	3 days
Sponsored by:	Chelsio Communications
2019-08-27 21:29:37 +00:00
Mateusz Guzik
4840711516 unionfs: stop passing LK_INTERLOCK to VOP_UNLOCK
This is part of the preparation to remove flags argument from VOP_UNLOCK.
Also has a side effect of fixing stacking on top of nullfs broken by r351472.

Reported by:	cy
Sponsored by:	The FreeBSD Foundation
2019-08-27 20:51:17 +00:00
Mateusz Guzik
368cabbcb5 vfs: stop passing LK_INTERLOCK to VOP_UNLOCK
The plan is to drop the flags argument. There is also a temporary bug
now that nullfs ignores the flag.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21252
2019-08-27 20:30:56 +00:00
Hiroki Sato
76d46bbb0e MFV r351553:
Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions
specified in the command-line option from working.

This patch has been accepted by the upstream.

Reviewed by and discussed with:	gshapiro
2019-08-27 20:11:45 +00:00
Hiroki Sato
1c3e417caf Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions
specified in the command-line option from working.

This patch has been accepted by the upstream.

Reviewed by and discussed with:	gshapiro
2019-08-27 19:37:19 +00:00
Emmanuel Vadot
0178a63ffe arm64: rk3399: pinctrl: Add gpio banks and fix iomux
Since r351187 the pinctrl driver need to know the gpio bank as it
directly attach the gpio driver to handle some setup that might
be present in the dts, add the gpio banks table for rk3399.
While here fix some IOMUX definition that prevented to boot
on RK3399 as pinctrl wasn't configured correctly.

Submitted by:	mmel (original version)
MFC after:	2 weeks
MFC With:	r351187
2019-08-27 18:00:01 +00:00
Emmanuel Vadot
8a27f35631 arm64: rk3328: pinctrl: Add gpio banks and fix iomux
Since r351187 the pinctrl driver need to know the gpio bank as it
directly attach the gpio driver to handle some setup that might
be present in the dts, add the gpio banks table for rk3328.
While here fix some IOMUX definition that prevented to boot
on RK3328 as pinctrl wasn't configured correctly.

Submitted by:	mmel (original version)
MFC after:	2 weeks
MFC With:	r351187
2019-08-27 17:59:09 +00:00
Alexander Motin
8d718012fe Always check cam_periph_error() status for ERESTART.
Even if we do not expect retries, we better be sure, since otherwise it
may result in use after free kernel panic.  I've noticed that it retries
SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-08-27 16:41:06 +00:00
Mark Johnston
44e4def73b Remove an extraneous + 1 in _domainset_create().
DOMAINSET_FLS, like our fls(), is 1-indexed.

Reported by:	alc
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-08-27 15:42:08 +00:00
Alan Somers
95b523ea71 ping: raise WARNS level to 6
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21405
2019-08-27 15:34:37 +00:00
Mark Johnston
8e6975047e Fix several logic issues in domainset_empty_vm().
- Don't add 1 to the result of DOMAINSET_FLS.
- Do not modify domainsets containing only empty domains.
- Always flatten a _PREFER policy to _ROUNDROBIN if the preferred
  domain is empty.  Previously we were doing this only when ds_cnt > 1.

These bugs could cause hangs during boot if a VM domain is empty.

Tested by:	hselasky
Reviewed by:	hselasky, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21420
2019-08-27 14:06:34 +00:00
Justin Hibbits
7038069e9c Revert a part of r350883 that should never have gone in
The wire_count change is not part of the unification, and doesn't even make
sense.

Reported by:	markj
2019-08-27 14:04:32 +00:00
Edward Tomasz Napierala
912b6fa37e Fix build on 32 bit archs. 2019-08-27 13:55:45 +00:00
Edward Tomasz Napierala
5a38af1fb8 Introduce <sys/qmath.h>, a fixed-point math library from Netflix.
This makes it possible to perform mathematical operations
on
fractional values without using floating point. It operates on Q
numbers, which are integer-sized, opaque structures initialized
to hold a chosen number of integer and fractional
bits.


For a general description of the Q number system, see the "Fixed Point
Representation & Fractional Math" whitepaper[1]; for the actual
API see the qmath(3) man page.

This is one of dependencies for the upcoming stats(3) framework[2]
that will be applied to the TCP stack in a later commit.

1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf
2. https://reviews.freebsd.org/D20477

Reviewed by:	bcr (man pages, earlier version), sef (earlier version)
Discussed with:	cem, dteske, imp, lstewart
Sponsored By:	Klara Inc, Netflix
Obtained from:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20116
2019-08-27 11:46:22 +00:00
Michal Meloun
f69c06c303 Add support for RK3288 into existing RockChip drivers.
This patch ensures only minimal level of compatibility necessary to boot
on RK3288 based boards. GPIO and pinctrl interaction, missing in current
implementation, will be improved by own patch in the near future.

MFC after:	2 weeks
MFC with:	r351452
2019-08-27 09:20:01 +00:00
Konstantin Belousov
95acb40caa vn_vget_ino_gen(): relock the lower vnode on error.
The function' interface assumes that the lower vnode is passed and
returned locked always.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-08-27 08:28:38 +00:00
Navdeep Parhar
c537e887ac cxgbe/t4_tom: Initialize all TOE connection parameters in one place.
Remove now-redundant items from toepcb and synq_entry and the code to
support them.

Let the driver calculate tx_align, rx_coalesce, and sndbuf by default.

Reviewed by:	jhb@
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D21387
2019-08-27 04:19:40 +00:00
Navdeep Parhar
241c83909c cxgbe/t4_tom: Limit work requests with immediate payload to a single
descriptor.  The per-tid tx credits are in demand during active Tx and
it's best not to use too many just for payload.

Sponsored by:	Chelsio Communications
2019-08-27 01:16:02 +00:00
John Baldwin
b2e60773c6 Add kernel-side support for in-kernel TLS.
KTLS adds support for in-kernel framing and encryption of Transport
Layer Security (1.0-1.2) data on TCP sockets.  KTLS only supports
offload of TLS for transmitted data.  Key negotation must still be
performed in userland.  Once completed, transmit session keys for a
connection are provided to the kernel via a new TCP_TXTLS_ENABLE
socket option.  All subsequent data transmitted on the socket is
placed into TLS frames and encrypted using the supplied keys.

Any data written to a KTLS-enabled socket via write(2), aio_write(2),
or sendfile(2) is assumed to be application data and is encoded in TLS
frames with an application data type.  Individual records can be sent
with a custom type (e.g. handshake messages) via sendmsg(2) with a new
control message (TLS_SET_RECORD_TYPE) specifying the record type.

At present, rekeying is not supported though the in-kernel framework
should support rekeying.

KTLS makes use of the recently added unmapped mbufs to store TLS
frames in the socket buffer.  Each TLS frame is described by a single
ext_pgs mbuf.  The ext_pgs structure contains the header of the TLS
record (and trailer for encrypted records) as well as references to
the associated TLS session.

KTLS supports two primary methods of encrypting TLS frames: software
TLS and ifnet TLS.

Software TLS marks mbufs holding socket data as not ready via
M_NOTREADY similar to sendfile(2) when TLS framing information is
added to an unmapped mbuf in ktls_frame().  ktls_enqueue() is then
called to schedule TLS frames for encryption.  In the case of
sendfile_iodone() calls ktls_enqueue() instead of pru_ready() leaving
the mbufs marked M_NOTREADY until encryption is completed.  For other
writes (vn_sendfile when pages are available, write(2), etc.), the
PRUS_NOTREADY is set when invoking pru_send() along with invoking
ktls_enqueue().

A pool of worker threads (the "KTLS" kernel process) encrypts TLS
frames queued via ktls_enqueue().  Each TLS frame is temporarily
mapped using the direct map and passed to a software encryption
backend to perform the actual encryption.

(Note: The use of PHYS_TO_DMAP could be replaced with sf_bufs if
someone wished to make this work on architectures without a direct
map.)

KTLS supports pluggable software encryption backends.  Internally,
Netflix uses proprietary pure-software backends.  This commit includes
a simple backend in a new ktls_ocf.ko module that uses the kernel's
OpenCrypto framework to provide AES-GCM encryption of TLS frames.  As
a result, software TLS is now a bit of a misnomer as it can make use
of hardware crypto accelerators.

Once software encryption has finished, the TLS frame mbufs are marked
ready via pru_ready().  At this point, the encrypted data appears as
regular payload to the TCP stack stored in unmapped mbufs.

ifnet TLS permits a NIC to offload the TLS encryption and TCP
segmentation.  In this mode, a new send tag type (IF_SND_TAG_TYPE_TLS)
is allocated on the interface a socket is routed over and associated
with a TLS session.  TLS records for a TLS session using ifnet TLS are
not marked M_NOTREADY but are passed down the stack unencrypted.  The
ip_output_send() and ip6_output_send() helper functions that apply
send tags to outbound IP packets verify that the send tag of the TLS
record matches the outbound interface.  If so, the packet is tagged
with the TLS send tag and sent to the interface.  The NIC device
driver must recognize packets with the TLS send tag and schedule them
for TLS encryption and TCP segmentation.  If the the outbound
interface does not match the interface in the TLS send tag, the packet
is dropped.  In addition, a task is scheduled to refresh the TLS send
tag for the TLS session.  If a new TLS send tag cannot be allocated,
the connection is dropped.  If a new TLS send tag is allocated,
however, subsequent packets will be tagged with the correct TLS send
tag.  (This latter case has been tested by configuring both ports of a
Chelsio T6 in a lagg and failing over from one port to another.  As
the connections migrated to the new port, new TLS send tags were
allocated for the new port and connections resumed without being
dropped.)

ifnet TLS can be enabled and disabled on supported network interfaces
via new '[-]txtls[46]' options to ifconfig(8).  ifnet TLS is supported
across both vlan devices and lagg interfaces using failover, lacp with
flowid enabled, or lacp with flowid enabled.

Applications may request the current KTLS mode of a connection via a
new TCP_TXTLS_MODE socket option.  They can also use this socket
option to toggle between software and ifnet TLS modes.

In addition, a testing tool is available in tools/tools/switch_tls.
This is modeled on tcpdrop and uses similar syntax.  However, instead
of dropping connections, -s is used to force KTLS connections to
switch to software TLS and -i is used to switch to ifnet TLS.

Various sysctls and counters are available under the kern.ipc.tls
sysctl node.  The kern.ipc.tls.enable node must be set to true to
enable KTLS (it is off by default).  The use of unmapped mbufs must
also be enabled via kern.ipc.mb_use_ext_pgs to enable KTLS.

KTLS is enabled via the KERN_TLS kernel option.

This patch is the culmination of years of work by several folks
including Scott Long and Randall Stewart for the original design and
implementation; Drew Gallatin for several optimizations including the
use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records
awaiting software encryption, and pluggable software crypto backends;
and John Baldwin for modifications to support hardware TLS offload.

Reviewed by:	gallatin, hselasky, rrs
Obtained from:	Netflix
Sponsored by:	Netflix, Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D21277
2019-08-27 00:01:56 +00:00
Mark Johnston
a70e17eeca Fix a few nits in vm_pqbatch_process_page().
- Don't bother masking off non-queue state flags when loading the
  page's atomic state, since it is only required for one of the
  function's assertions.  Update the assertion instead.
- Remove an incorrect comment regarding synchronization with the
  page daemon.  The page daemon only ever checks for PGA_ENQUEUED
  with the page queue lock held.
- When clearing requeue flags, only clear the flags that have been
  acted upon.

Reviewed by:	kib (previous version)
Discussed with:	alc
Tested by:	pho (part of a larger patch)
MFC after:	1 week
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D21368
2019-08-26 20:20:10 +00:00
Alexander Motin
4e38d474e1 Announce PCI Segment Groups supported to PCI host _OSC.
According to ACPI 6.3 specification:
    The OS sets this bit to 1 if it supports PCI Segment Groups as defined
    by the _SEG object, and access to the configuration space of devices
    in PCI Segment Groups as described by this specification.  Otherwise,
    the OS sets this bit to 0.

As far as I see we support both of those as PCI domains for quite a while.

MFC after:	2 months
2019-08-26 17:54:19 +00:00
Alexander Motin
21e51c82fb Don't consider PCIe hot-plug command timeout fatal.
According to my tests and errata to several generations of Intel CPUs,
PCIe hot-plug command completion reporting is not very reliable thing.
At least on my Supermicro X11DPi-NT board I never saw it reported.
Before this change timeout code detached devices and tried to disable
the slot, that in my case resulted in hot-plugged device being detached
just a second after it was successfully detected and attached.  This
change removes that, so in case of timeout it just prints the error and
continue operation.  Linux does the same.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-08-26 17:27:36 +00:00
John Baldwin
87210a0c6d Stop using des_cblock * for arguments to DES functions.
This amounts to a char ** since it is a char[8] *.  Evil casts mostly
resolved the fact that what was actually passed in were plain char *.
Instead, change the DES functions to use 'unsigned char *' for keys
and for input and output buffers.

Reviewed by:	cem, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D21389
2019-08-26 17:25:07 +00:00
Michael Tuexen
15ddc5e43f Don't hold the rs_mtx lock while calling malloc().
Reviewed by:		rrs@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D21416
2019-08-26 16:23:47 +00:00
Michael Tuexen
7d143bd2df Identify eMAG CPU used in Ampere Computing systems.
Reviewed by:		emaste@
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D21314
2019-08-26 16:12:14 +00:00
Edward Tomasz Napierala
90a7bed401 Make it clear what the userland traces are in the ktrace(1) man page.
MFC after:	2 weeks
2019-08-26 10:18:19 +00:00
Edward Tomasz Napierala
375409b48b .Xr ports(7) and development(7).
MFC after:	2 weeks
2019-08-26 10:16:46 +00:00
Xin LI
b770b08061 Comment boot block checks and perform additional sanity checks:
The following checks are now being enforced:

 - bpbBytesPerSec: only accept 512, 1024, 2048 and 4096.
 - bpbSecPerClust: only accept 1, 2, 4, 8, 16, 32, 64 and 128.
 - bpbResSectors: require non-zero.
 - bpbFATs: require non-zero.
 - bpbSectors: require zero for FAT32.
 - bpbFATsmall: require zero for FAT32.
 - bpbHugeSectors: require non-zero for FAT32.

Bail out if the BPB contained values that do not meet these requirements.

We also require FATsecs * FATsecs to not overflow 32-bit unsigned
integer.

Check for backup boot block was removed because the checker does not take
corrective action, and msdosfs driver ignores it too.
2019-08-26 06:41:17 +00:00
Xin LI
110f229794 MFV r351500: Fix CLEAR_HASH macro to be usable as a single statement.
MFC after:	2 weeks
2019-08-26 00:46:39 +00:00
Xin LI
befc3e504d Import vendor commit 38e8ce32afbaa82f67d992b9f3056f281fe69259:
Author: Mark Adler <madler@alumni.caltech.edu>
  Date:   Sun Jan 22 23:38:52 2017 -0800

    Fix CLEAR_HASH macro to be usable as a single statement.

    As it is used in deflateParams().
2019-08-25 23:51:44 +00:00
Mateusz Guzik
8795830c1a vfs: swap vop_unlock_post and vop_unlock_pre definitions to the logical order
The change is no-op.

Sponsored by:	The FreeBSD Foundation
2019-08-25 22:30:18 +00:00
Warner Losh
65b351483f Replace -Werror with ${WERROR} in pmcstudy 2019-08-25 22:06:26 +00:00
Warner Losh
32e6af4641 Replace -Werror with ${WERROR} in module builds 2019-08-25 22:06:17 +00:00
Mark Johnston
b48d4efe75 Handle UMA_ANYDOMAIN in kstack_import().
The kernel thread stack zone performs first-touch allocations by
default, and must handle the case where the local memory domain
is empty.  For most UMA zones this is handled in the keg layer,
but cache zones currently must implement a policy for this case.
Simply use a round-robin policy if UMA_ANYDOMAIN is passed.

Reported and tested by:	bcran
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
2019-08-25 21:14:46 +00:00
Konstantin Belousov
c6a810919b amd64: loose constraints on the APs dpcpu and nmi/dbg stack allocations.
Use DOMAINSET_PREF() instead of DOMAINSET_FIXED(), to gracefully
fallback in case of memory-less domain.

Reported and tested by:	bcran
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
2019-08-25 21:01:40 +00:00
Konstantin Belousov
46213cc528 amd64: If domain-local page for pcpu cannot be allocated, keep use
existing one.

Allocation failure is possible for instance when cpu domain has no memory.

Reported and tested by:	bcran
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
2019-08-25 20:57:39 +00:00
Vincenzo Maffione
df4e516f0f netmap: remove obsolete file
The netmap_pt.c module has become obsolete after
the refactoring that added netmap_kloop.c.
Remove it and unlink it from the build system.

MFC after:	1 week
2019-08-25 20:16:03 +00:00
Justin Hibbits
8da08d5123 powerpc/booke: Clean up pmap a little for 64-bit
64-bit Book-E pmap doesn't need copy and zero bounce pages, nor the mutex.
Don't initialize them or reserve space for them.
2019-08-25 20:11:35 +00:00
Justin Hibbits
e7f2151c75 powerpc/booke: Use the DMAP if possible in pmap_map()
This avoids unnecessary TLB usage for statically mapped regions, such as
vm_page_array.
2019-08-25 20:08:48 +00:00
Warner Losh
7d65d42046 Fix bogusly declared WERRORs in kernel build
Many arm kernel configs bogusly specified WERROR=-Werror. There's no
reason for this because the default is that and there's no reason to
override. These date from a time when we needed to add additional
warning->error suppression. They are obsolete and were cut and paste
propagated from file to file.

Comment out all the WERROR=.... lines in powerpc. They aren't bogus,
but were appropriate for the old defaults for gcc4.2.1. Now that we've
made the policy decision to suppress -Werror by default on these
platforms, it is appropriate to comment these out. People wishing to
fix these errors can still un-comment them out, or say WERROR=-Werror
on the command line.

Fix two instances (cut and paste propagation) of hard-coded -Werror
in x86 code. Replace with ${WERROR} instead. This is a no-op change
except for people who build WERROR=-Wno-error :).

This should fix tinderbox / CI breakage.
2019-08-25 19:39:31 +00:00
Hiroki Sato
3eeebb94f1 Fix build (r351481). 2019-08-25 19:27:14 +00:00
Hiroki Sato
0e31d5241d Document soft updates journaling and GEOM-based UFS journaling.
Reviewed by:	mckusick
2019-08-25 18:52:10 +00:00
Hiroki Sato
639eac2087 Add MODULE_PNP_INFO() to vmci(4). This allows devd(8) to load the
kernel module automatically when FreeBSD is running on VMware.

Reviewed by:		mp
Differential Revision:	https://reviews.freebsd.org/D21182
2019-08-25 18:46:10 +00:00
Mateusz Piotrowski
babc4e8145 mixer(8): Report an error if the passed value is an empty string
This patch fixes a bug that made the mixer command enter
an infinite loop when instructed to set the value of a device
to an empty string (e.g., `mixer vol ""`).

Additionally, some tests for mixer(8) are being added.

PR:		240039
Reviewed by:	hselasky, mav
Approved by:	src (hselasky, mav)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21409
2019-08-25 17:55:31 +00:00
Xin LI
21aae72489 Remove zlib 1.0.4 from kernel.
PR:		229763
Reviewed by:	emaste, Yoshihiro Ota <ota j email ne jp>
Differential Revision:	https://reviews.freebsd.org/D21375
2019-08-25 17:13:00 +00:00
Konstantin Belousov
783a68aa33 Move OBJT_VNODE specific code from vm_object_terminate() to
vnode_destroy_vobject().

Reviewed by:	alc, jeff (previous version), markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21357
2019-08-25 13:26:06 +00:00
Xin LI
4e8671dd78 GZIO: Update to use zlib 1.2.11.
PR:		229763
Submitted by:	Yoshihiro Ota <ota j email ne jp>
Differential Revision:	https://reviews.freebsd.org/D21408
2019-08-25 07:50:44 +00:00
Doug Moore
83ea714f4f vm_map_simplify_entry considers merging an entry with its two
neighbors, and is used in a way so that if entries a and b cannot be
merged, we consider them twice, first not-merging a with its successor
b, and then not-merging b with its predecessor a. This change replaces
vm_map_simplify_entry with vm_map_try_merge_entries, which compares
two adjacent entries only, and uses it to avoid duplicated
merge-checks.

Tested by: pho
Reviewed by: alc
Approved by: markj (implicit)
Differential Revision: https://reviews.freebsd.org/D20814
2019-08-25 07:06:51 +00:00
Mateusz Guzik
33d46a3cef nullfs: reduce areas protected by vnode interlock
Some places only take the interlock to hold the vnode, which was a requiremnt
before they started being manipulated with atomics. Use the newly introduced
vholdnz to bump the count.

Reviewed by:	kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21358
2019-08-25 05:13:15 +00:00
Mateusz Guzik
0256405e98 vfs: add vholdnz (for already held vnodes)
Reviewed by:	kib (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21358
2019-08-25 05:11:43 +00:00