]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r331419:
hselasky [Fri, 30 Mar 2018 18:13:44 +0000 (18:13 +0000)]
MFC r331419:
Allow the libusb20_dev_get_port_path() function to be called when the
USB device is closed. This fixes a compatibility issue with upstream
libusb.

Found by: romain@

6 years agoMFC r303505, r303506, r303512, r303513, r303646, r320418, r323082,
hselasky [Fri, 30 Mar 2018 18:06:29 +0000 (18:06 +0000)]
MFC r303505, r303506, r303512, r303513, r303646, r320418, r323082,
r326169, r326563, r326649, r326716, r326764, r326765 and r329222:

RoCE/infiniband/iWarp upgrade to Linux 4.9 for kernel and userspace.
This commit merges projects/bsd_rdma_4_9 to 11-stable.

Compatibility wrappers have been made for existing 11-stable ibcore
APIs, including ib_reg_phys_mr().
Refer to "sys/ofed/include/rdma/ib_verbs_compat.h" for more information.

The iw_cxgb driver has not been updated and has been disconnected from
the build.

Sponsored by:   Mellanox Technologies

MFC r326169 and r326563:
RoCE/infiniband upgrade to Linux v4.9 for kernel and userspace.

List of kernel sources used:
============================

1) kernel sources were cloned from git://github.com/torvalds/linux.git
Top commit 69973b830859bc6529a7a0468ba0d80ee5117826 - tag: v4.9, linux-4.9

2) krping was cloned from https://github.com/larrystevenwise/krping
Top commit 292a2f1abf0348285e678a82264740d52e4dcfe4

List of userspace sources used:
===============================

1) rdma-core was cloned from https://github.com/linux-rdma/rdma-core.git
Top commit d65138ef93af30b3ea249f3a84aa6a24ba7f8a75

2) OpenSM was cloned from git://git.openfabrics.org/~halr/opensm.git
Top commit 85f841cf209f791c89a075048a907020e924528d

3) libibmad was cloned from git://git.openfabrics.org/~iraweiny/libibmad.git
Tag 1.3.13 with some additional patches from Mellanox.

4) infiniband-diags was cloned from git://git.openfabrics.org/~iraweiny/infiniband-diags.git
Tag 1.6.7 with some additional patches from Mellanox.

NOTES:
======

1) The mthca driver has been removed from userspace.
2) All GPLv2 only sources have been removed and where applicable
   rewritten from scratch under a BSD license.
3) List of fully supported drivers in userspace and kernel:
   a) iw_cxgbe (Chelsio)
   b) mlx4ib (Mellanox)
   c) mlx5ib (Mellanox)
4) WITH_OFED=YES is still required by make in order to build
   OFED userspace and kernel code.
5) Full support has been added for routable RoCE, RoCE v2.

MFC r326649:
Disconnect OFED after r326169 broke all DIRDEPS support for it.

MFC r326716:
Correctly define the unordered_map namespace in ofed/libibnetdisc .

This should fix ofed/libibnetdisc compilation with C-compilers
different from clang and GCC v4.2.1.

Submitted by:   kib
Sponsored by:   Mellanox Technologies

MFC r326764:
ofed: Remove duplicated symbols from the version file.

ld.bfd accepts multiple listing of the same symbol in the version script.
lld is stricter and errors out.  Since arm64 and sometimes amd64 use lld,
we should correct this cosmetic issue.

Sponsored by:   Mellanox Technologies
Reviewed by:    hselasky
Differential revision:  https://reviews.freebsd.org/D13329

MFC r326765:
ofed: Define barriers for mips and arm.

I used the strongest barriers available on the architectures, so if
the future analysis show that it is excessive, the barriers could be
relaxed. Still, it is unlikely that it is meaningful to run IB on 32bit
ARM or current MIPS machines, so the change is to make WITH_OFED to pass
tinderbox.

Sponsored by:   Mellanox Technologies
Reviewed by:    hselasky
Differential revision:  https://reviews.freebsd.org/D13329

MFC r303505:
sdp: Use an mbufq for received control packets.

This is simpler than the hand-rolled queue, and fixes a use-after-free.

Sponsored by:   EMC / Isilon Storage Division

MFC r303506:
sdp: Destroy the PCB lock before freeing to the zone.

Sponsored by:   EMC / Isilon Storage Division

MFC r303512:
sdp: Use malloc(9) instead of the Linux compat layer.

SDP transmit and receive rings are always created in a sleepable context,
so we can use M_WAITOK and remove error checks.

Sponsored by:   EMC / Isilon Storage Division

MFC r303513:
sdp: Destroy the RDMA ID after destroying the connection's queue pair.

This is the ordering documented by rdma_destroy_qp(). Also add a useful
KASSERT to sdp_pcbfree().

Sponsored by:   EMC / Isilon Storage Division

MFC r303646:
ipoib: Bound the number of egress mbufs buffered during pathrec lookups.

In pathological situations where the master subnet manager becomes
unresponsive for an extended period, we may otherwise end up queuing all
of the system's mbufs while waiting for a response to a path record lookup.

This addresses the same issue as commit 1e85b806f9 in Linux.

Reviewed by:    cem, ngie
Sponsored by:   EMC / Isilon Storage Division

MFC r329222:
Import the mthca kernel side infiniband driver from Linux 4.9 and fix
compilation under FreeBSD. The mthca driver was temporarily removed as
part of the Linux 4.9 RoCE/infinband upgrade.

Top commit in Linux source tree:
69973b830859bc6529a7a0468ba0d80ee5117826

Sponsored by:   Mellanox Technologies

MFC r320418.  Note that the socket lock _is_ the same as so_rcv's lock
in 11 and this is a no-op in this branch.

Sponsored by:   Chelsio Communications

MFC r323082:
cxgbe/iw_cxgbe: Set TCP_NODELAY before initiating connection so that
t4_tom picks it up right away.  This is less work than waiting for
the connection to be established before applying the setting.

Sponsored by:   Chelsio Communications

6 years agoMFC r331432:
kib [Fri, 30 Mar 2018 10:36:54 +0000 (10:36 +0000)]
MFC r331432:
There is no need to disable interrupts around npxsave call.

6 years agoMFC r331433: linuxkpi whitespace cleanup
emaste [Fri, 30 Mar 2018 02:04:46 +0000 (02:04 +0000)]
MFC r331433: linuxkpi whitespace cleanup

6 years agoMFC r331426: Rationalize license text on Linuxolator files
emaste [Fri, 30 Mar 2018 01:53:14 +0000 (01:53 +0000)]
MFC r331426: Rationalize license text on Linuxolator files

Many licenses on Linuxolator files contained small variations from the
standard FreeBSD license text.  To avoid license proliferation switch to
the standard 2-Clause FreeBSD license for those files where I have
permission from each of the listed copyright holders.

Approved by: rdivacky, marcel

6 years agoMFC r320695 (bdrewery): Fix out-of-tree kernel builds
emaste [Fri, 30 Mar 2018 01:22:47 +0000 (01:22 +0000)]
MFC r320695 (bdrewery): Fix out-of-tree kernel builds

after r331730 (MFC of r320275) when bsd.linker.mk not yet installed.

6 years agoMFC r329373: Correct module symbol export handling
emaste [Fri, 30 Mar 2018 01:19:53 +0000 (01:19 +0000)]
MFC r329373: Correct module symbol export handling

EXPORT_SYMS can be set to YES, NO, a list of symbols to export from a
module, or to a filename containing such a list.  For the case that it
is set to a symbol list, replace spaces in the list with newlines, so
the created file is in the format expected by kmod_syms.awk.

Sponsored by: Turing Robotic Industries Inc.

6 years agoMFC r321417: enable filter lib linker feature flag for lld 5.0+
emaste [Fri, 30 Mar 2018 00:10:39 +0000 (00:10 +0000)]
MFC r321417: enable filter lib linker feature flag for lld 5.0+

Also switch the logic to enable this for any non-lld linker, since
filter library support is fairly simple and is very likely supported
by any other linker capable of linking the FreeBSD base system.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r328522:
brooks [Thu, 29 Mar 2018 19:53:56 +0000 (19:53 +0000)]
MFC r328522:

Create deprecation management functions.

gone_in(majar, msg); If we're running in FreeBSD major, tell
the user this code may be deleted soon.
If we're running in FreeBSD major - 1,
the the user is deprecated and will
be gone in major.
Otherwise say nothing.

gone_in_dev(dev, major, msg) Just like gone_in, except use device_printf.

New tunable / sysctl debug.oboslete_panic: 0 - don't panic,
1 - panic in major or newer , 2 - panic in major - 1 or newer
default: 0

if NO_OBSOLETE_CODE is defined, then both of these turn into compile
time errors when building for major. Add options NO_OBSOLETE_CODE to
kernel build system.

This lets us tag code that's going away so users know it will be gone,
as well as automatically manage things.

Differential Review: https://reviews.freebsd.org/D13818

6 years agoMFC r320872:
kib [Thu, 29 Mar 2018 19:32:25 +0000 (19:32 +0000)]
MFC r320872:
Create libdl.so.1 as a filter for libc.so.7 which exports public dl*
functions.

6 years agoMFC r331562 (manu):
gjb [Thu, 29 Mar 2018 19:29:12 +0000 (19:29 +0000)]
MFC r331562 (manu):
 release: arm: Copy boot.scr from ports

 Latest u-boot update need u-boot script to load and start ubldr.
 (See D14230 for more details)
 Copy this file for our arm release on the fat partition.

6 years agoMFC r331375:
kib [Thu, 29 Mar 2018 15:12:03 +0000 (15:12 +0000)]
MFC r331375:
Do not send signals to init directly from shutdown_nice(9), do it from
the task context.

6 years agoMFC r331374:
kib [Thu, 29 Mar 2018 15:08:40 +0000 (15:08 +0000)]
MFC r331374:
Fixes for ptrace(PT_GETXSTATE_INFO) related to the padding in struct
ptrace_xstate_info).

6 years agoMFC 331345:
rpokala [Thu, 29 Mar 2018 15:00:48 +0000 (15:00 +0000)]
MFC 331345:

jedec_dimm: Use correct string length when populating sc->slotid_str

Don't limit the copy to the size of the target string *pointer* (always
4 on 32-bit / 8 on 64-bit). Instead, just use strdup().

6 years agoMFC kernel build-id support
emaste [Thu, 29 Mar 2018 12:52:58 +0000 (12:52 +0000)]
MFC kernel build-id support

MFC r320244, r320245, r320246, r320247, r320248, r320249,
    r320250 (bdrewery):

Add basic bsd.linker.mk auto included from bsd.compiler.mk.
This will provide LINKER_TYPE and LINKER_VERSION.

Support XLD for setting X_LINKER_TYPE and X_LINKER_VERSION.
This is similar to r300350 for bsd.compiler.mk.

Support cached linker values in environment.
This is similar to r289659 for bsd.compiler.mk.

LINKER_VERSION: Support external binutils.
The ports binutils stores the version in the 5th word so just look for
a version using a pattern instead.

Don't overwrite already-set LINKER_VERSION/LINKER_TYPE.

Provide proper values for X_LINKER_TYPE/VERSION when XLD == LD.

Pass along LINKER_* vars during installworld and show in test-system-compiler.

MFC r320258, r320272, r320275, r320502 (emaste):

change GNU ld LINKER_TYPE from binutils to bfd

GNU binutils includes two linkers: ld.bfd and ld.gold.  For clarity use
LINKER_TYPE=bfd to refer to ld.bfd, the original binutils linker that
identifies itself as "GNU ld".

bsd.linker.mk: add band-aid for linker invocation failure

In some cases bsd.linker.mk reports an error like:

  make[4]: ".../share/mk/bsd.linker.mk" line 56:
  Unknown linker from LD=ld -m elf32ppc_fbsd:"

For now change this to a .warning, and then assume GNU ld 2.17.50.
At present the linker type detection is used only for enabling build-id,
and we can carry on without it when type detection fails.

Also, show errors from ${LD} --version to aid in failure diagnosis.
Successful invocations of ${LD} --version produce no output on stderr
so this will not create any spam in non-failing builds.

enable --build-id for the kernel link

A Build-ID is an identifier generated at link time to uniquely identify
ELF binaries.  It allows efficient confirmation that an executable or
shared library and a corresponding standalone debuginfo file match.
(Otherwise, a checksum of the debuginfo file must be calculated when
opening it in a debugger.)

The FreeBSD base system includes GNU bfd ld 2.17.50 as the linker for
architectures other than arm64.  Build-ID support was added to bfd ld
shortly after that version, so was not previously available to us.

We can now start making use of Build-ID as we migrate to using lld or
bfd ld from ports, conditionally enabled based on the LINKER_TYPE and
LINKER_VERSION make variables added in r320244 and subsequent commits.

Introduce LINKER_FEATURES to avoid duplicating version logic

MFC r327857 (bdrewery, submitted by Dan McGregor):
Cache LINKER_FEATURES to fix the wrong ones being used.

Sponsored by:   Dell EMC Isilon
Sponsored by:   The FreeBSD Foundation

6 years agoMFC r305860, r306371
araujo [Thu, 29 Mar 2018 05:01:49 +0000 (05:01 +0000)]
MFC r305860, r306371

r305860:
Add an option called "random" that combined with "ether" can generate a
random MAC address for an Ethernet interface.

PR: 211984
Submitted by: pi@
Reviewed by: gnn, cem, jhb, lidl, rpokala, wblock
Approved by: wblock (manpages)

r306371:
Indicate that this is a locally administered MAC address.

Submitted by: lidl
Differential Revision: https://reviews.freebsd.org/D7903

PR: 226459
Requested by: tobik

6 years agoMFC r329817:
araujo [Thu, 29 Mar 2018 04:51:07 +0000 (04:51 +0000)]
MFC r329817:

The firewall_type is ignored if not set in rc.conf or rc.conf.local,
after r190575 there is an option to call rc.firewall with the firewall_type
passed in as an argument.

Submitted by: David P. Discher <dpd@dpdtech.com>
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D14286

6 years agoMFC r325621, r325622, r331227
mjoras [Thu, 29 Mar 2018 04:41:45 +0000 (04:41 +0000)]
MFC r325621, r325622, r331227

Add EVENTHANDLER_LIST and some users.

Also fix a longstanding bug in mtx initialization.

6 years agoRevert r330897:
eadler [Thu, 29 Mar 2018 02:50:57 +0000 (02:50 +0000)]
Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)

6 years agoMFC r329738: MFV r329736: 8969 Cannot boot from RAIDZ with parity > 1
mav [Thu, 29 Mar 2018 02:25:34 +0000 (02:25 +0000)]
MFC r329738: MFV r329736: 8969 Cannot boot from RAIDZ with parity > 1

illumos/illumos-gate@0fb055e81fd0cda5221da8ddd98b2f8d1fc6bdbe

At present it is possible to boot from a root pool that is on RAIDZ but not
one that is on RAIDZ2 or RAIDZ3.  This is because, at the time the pool
version is checked to ensure support for dual/triple parity, the uberblock
has not yet been loaded into the SPA and therefore the code determines that
the pool version is too old and returns ENOTSUP.

Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Andy Fiddaman <omnios@citrus-it.co.uk>

FreeBSD already had this fixed, so this is just a diff reduction.

6 years agoMFC r331559:
gjb [Thu, 29 Mar 2018 00:42:44 +0000 (00:42 +0000)]
MFC r331559:
 Escape trailing newlines in a long variable list for consistency.

Sponsored by: The FreeBSD Foundation

6 years agoMFC 331248: Set the proper vnet in IPsec callback functions.
jhb [Wed, 28 Mar 2018 17:49:31 +0000 (17:49 +0000)]
MFC 331248: Set the proper vnet in IPsec callback functions.

When using hardware crypto engines, the callback functions used to handle
an IPsec packet after it has been encrypted or decrypted can be invoked
asynchronously from a worker thread that is not associated with a vnet.
Extend 'struct xform_data' to include a vnet pointer and save the current
vnet in this new member when queueing crypto requests in IPsec.  In the
IPsec callback routines, use the new member to set the current vnet while
processing the modified packet.

This fixes a panic when using hardware offload such as ccr(4) with IPsec
after VIMAGE was enabled in GENERIC.

Sponsored by: Chelsio Communications

6 years agoMFC r326992: embed_mfs: support embedding mfs into loader
emaste [Wed, 28 Mar 2018 17:19:04 +0000 (17:19 +0000)]
MFC r326992: embed_mfs: support embedding mfs into loader

The script originally supported embedding an mfs into ELF files or any
other type of file, because it searched for magic strings to mark the
beginning and end of the embeddable section. It was later modified to
read the section offset and length via readelf, which made it work for
ELF only. Restore the ability to update arbitrary file types by using
the readelf technique for ELF, and the magic string technique for all
others (including PE/COFF files like loader.efi).

Submitted by: Zakary Nafziger <worldofzak@gmail.com>

MFC r327526: embed_mfs: correctly test grep return value

Reported by: br

MFC r327527: ath: revert accidental change committed with r327526

Sponsored by: The FreeBSD Foundation

6 years agoMFC r324707: embed_mfs: add error handling, usage
emaste [Wed, 28 Mar 2018 17:16:16 +0000 (17:16 +0000)]
MFC r324707: embed_mfs: add error handling, usage

Ensure that we are called with two arguments, and that the output file
is writable. Also, if we cannot find the mfs section report the output
file name rather than "kernel", as this script may be used with other
than kernels.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r315522: use INT3 instead of NOP for x86 binary padding
emaste [Wed, 28 Mar 2018 16:58:24 +0000 (16:58 +0000)]
MFC r315522: use INT3 instead of NOP for x86 binary padding

We should never end up executing the inter-function padding, so we
are better off faulting than silently carrying on to whatever function
happens to be next.

Note that LLD does this by default.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r323623: rename(2): document capability mode errors
emaste [Wed, 28 Mar 2018 16:55:45 +0000 (16:55 +0000)]
MFC r323623: rename(2): document capability mode errors

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325422: posix_fallocate.2: add an EINVAL errno case
emaste [Wed, 28 Mar 2018 16:54:15 +0000 (16:54 +0000)]
MFC r325422: posix_fallocate.2: add an EINVAL errno case

As of r325320 in HEAD posix_fallocate returns EINVAL on ZFS to indicate
that the underlying filesystem does not support this operation, per
POSIX.1-2008. Document this case in the man page.

Note that r325320 has not yet been merged to stable/11, and may or may
not be.  However, we should document that EINVAL may be returned if the
filesystem does not support posix_fallocate (even if we don't actually
do so in stable/11), as software should be prepared to handle that case.

Discussed with: avg
Sponsored by: The FreeBSD Foundation

6 years agoRegen *sysent.c after r331679 - posix_fallocate in capability mode
emaste [Wed, 28 Mar 2018 14:44:45 +0000 (14:44 +0000)]
Regen *sysent.c after r331679 - posix_fallocate in capability mode

Sponsored by: The FreeBSD Foundation

6 years agoMFC r324560: allow posix_fallocate in capability mode
emaste [Wed, 28 Mar 2018 14:39:56 +0000 (14:39 +0000)]
MFC r324560: allow posix_fallocate in capability mode

posix_fallocate is logically equivalent to writing zero blocks to the
desired file size and there is no reason to prevent calling it in
capability mode. posix_fallocate already checked for the CAP_WRITE
right, so we merely need to list it in capabilities.conf.

Also MFC r324564: allow posix_fallocate in 32-bit compat capability mode

Sponsored by: The FreeBSD Foundation

6 years agoMFC Capsicum open(2) and openat(2) documentation
emaste [Wed, 28 Mar 2018 14:35:24 +0000 (14:35 +0000)]
MFC Capsicum open(2) and openat(2) documentation

r306537 by cem: open.2: Document Capsicum behavior

Document open(2) and openat(2) behavior in Capsicum capability mode.

Sponsored by: Dell EMC Isilon

r323622 by emaste: open(2): update ENOTCAPABLE description for .. lookups

After r308732 (MFC of r308212) Capsicum permits .. lookups in capability
mode, as long as path component traversal does not escape the directory
corresponding to the provided file descriptor.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r331538:
markj [Wed, 28 Mar 2018 14:01:26 +0000 (14:01 +0000)]
MFC r331538:
Clamp IFLIB_RX_COPY_THRESH to MHLEN in iflib_rxd_pkt_get().

6 years agoMFC r331536:
markj [Wed, 28 Mar 2018 14:00:46 +0000 (14:00 +0000)]
MFC r331536:
Use LIST_FOREACH_SAFE in sleepq_chains_remove_matching().

6 years agoMFC r331329: Fix kernel memory disclosure in ibcs2_getdents
emaste [Wed, 28 Mar 2018 13:41:43 +0000 (13:41 +0000)]
MFC r331329: Fix kernel memory disclosure in ibcs2_getdents

ibcs2_getdents() copies a dirent structure to userland.  The ibcs2
dirent structure contains a 2 byte pad element.  This element is never
initialized, but copied to userland none-the-less.

Note that ibcs2 has not built on HEAD since r302095.

Submitted by: Domagoj Stolfa <ds815@cam.ac.uk>
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Security: Kernel memory disclosure (803)
Sponsored by: The FreeBSD Foundation

6 years agoRevert r331551. It is causing perl and tcl port build failures.
markj [Wed, 28 Mar 2018 13:39:20 +0000 (13:39 +0000)]
Revert r331551. It is causing perl and tcl port build failures.

Reported by: antoine

6 years agoMFC r331481: Import tzdata 2018d
philip [Wed, 28 Mar 2018 07:42:50 +0000 (07:42 +0000)]
MFC r331481: Import tzdata 2018d

6 years agoMFC: r331533
eadler [Wed, 28 Mar 2018 05:58:08 +0000 (05:58 +0000)]
MFC: r331533

[pci-vendors] Update to 2018-03-21

6 years agoMFC 318387: Add support for child devices that aren't ports.
jhb [Tue, 27 Mar 2018 20:49:47 +0000 (20:49 +0000)]
MFC 318387: Add support for child devices that aren't ports.

Invoke any identify routines of child drivers during attach before attaching
children, and delete any remaining devices after deleting ports.

Sponsored by: Chelsio Communications

6 years agoMFC r331422:
ken [Tue, 27 Mar 2018 20:34:49 +0000 (20:34 +0000)]
MFC r331422:

  ------------------------------------------------------------------------
  r331422 | ken | 2018-03-23 07:52:26 -0600 (Fri, 23 Mar 2018) | 42 lines

  Disable T10 Protection Information / EEDP handling for type 2 protection.

  The mps(4) and mpr(4) drivers and hardware handle T10 Protection
  Information, which is a system of checksums and guard blocks to protect
  data while it is being transferred and while it is on disk.  It is also
  known as T10 DIF.  For more details, see section 4.22 of the SBC-4 spec.

  Supporting Type 2 protection requires using 32 byte CDBs, and filling in
  the fields in those CDBs.  We don't yet support that in the da(4) driver.

  Type 1 and Type 3 protection don't require that, and can be handled by
  the mps(4)/mpr(4) driver's code and firmware without any additional
  input from the da(4) driver.

  If a drive has Type 2 protection enabled (you frequently see this with
  SAS drives shipped from Dell), don't set the various EEDP fields in the
  mps(4)/mpr(4) driver command fields.  Otherwise, you wind up with errors
  like this that would otherwise make no sense:

  (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00
  (da9:mpr0:0:18:0): CAM status: SCSI Status Error
  (da9:mpr0:0:18:0): SCSI status: Check Condition
  (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code)
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Field Replaceable Unit: 0
  (da9:mpr0:0:18:0): Command Specific Info: 0
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Descriptor 0x80: f8 21
  (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00
  (da9:mpr0:0:18:0): Error 22, Unretryable error

  In other words, what kind of strange SAS hard drive doesn't support a
  standard 10 byte SCSI READ command?  In this case, one that has Type 2
  protection enabled.

  We can revisit this when we put Type 2 protection support in the da(4)
  driver, but for now this will help people who put Type 2 formatted drives
  in a system and wonder what in the world is going on.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------

6 years agoMFC 329785: Move DDP PCB state into a helper structure.
jhb [Tue, 27 Mar 2018 20:14:22 +0000 (20:14 +0000)]
MFC 329785: Move DDP PCB state into a helper structure.

This consolidates all of the DDP state in one place.  Also, the code has
now been fixed to ensure that DDP state is only accessed for DDP
connections.  This should not be a functional change but makes it cleaner
and easier to add state for other TOE socket modes in the future.

Sponsored by: Chelsio Communications

6 years agoMFC r314568 (by emaste):
dim [Tue, 27 Mar 2018 18:52:27 +0000 (18:52 +0000)]
MFC r314568 (by emaste):

kern_sig.c: ANSIfy and remove archaic register keyword

Sponsored by: The FreeBSD Foundation

MFC r318389 (by emaste):

Remove register keyword from sys/ and ANSIfy prototypes

A long long time ago the register keyword told the compiler to store
the corresponding variable in a CPU register, but it is not relevant
for any compiler used in the FreeBSD world today.

ANSIfy related prototypes while here.

Reviewed by: cem, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10193

6 years agoMFC: r331627
jkim [Tue, 27 Mar 2018 17:54:46 +0000 (17:54 +0000)]
MFC: r331627

Merge OpenSSL 1.0.2o.

6 years agoMFC r330949:
brooks [Tue, 27 Mar 2018 17:51:45 +0000 (17:51 +0000)]
MFC r330949:

Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.

This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB.

Reviewed by: cem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14672

6 years agoMFC r330876, r330945
brooks [Tue, 27 Mar 2018 17:46:25 +0000 (17:46 +0000)]
MFC r330876, r330945

r330876:
Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.

For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
When the caddr_t stores an int, dereferencing addr as an (int *) results
in truncation on little-endian 64-bit systems and corruption (owing to
extracting top bits) on big-endian 64-bit systems. In practice the
value of chan was probably always zero on systems of the latter type as
all such FreeBSD platforms use a register-based calling convention.

Reviewed by: mav
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14673

r330945:
Add opt_compat.h to isp(4) as required by r330876.

6 years agoMFC r330820:
brooks [Tue, 27 Mar 2018 17:39:27 +0000 (17:39 +0000)]
MFC r330820:

Reject ioctls to SCSI enclosures from 32-bit compat processes.

The ioctl objects contain pointers and require translation and some
refactoring of the infrastructure to work.  For now prevent operation
on garbage values.  This is very slightly overbroad in that ENCIOC_INIT
is safe.

Reviewed by: imp, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14671

6 years agoMFC r330819, r330885, r330934
brooks [Tue, 27 Mar 2018 17:35:15 +0000 (17:35 +0000)]
MFC r330819, r330885, r330934

r330819:
Reject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.

These take a union ccb argument which is full of kernel pointers.
Substantial translation efforts would be required to make this work.
By rejecting the request we avoid processing or returning entierly
wrong data.

Reviewed by: imp, ken, markj, cem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14654

r330885:
We need opt_compat.h after r330819 and 330820.

Add opt_compat.h to fix the stand-alone build case.

Sponsored by: Netflix.

r330934:
This should have been += so clean builds work.

Noticed by: hps@

6 years agoMFC r331475: loader consoles: Implement SGR 24, 25
kevans [Tue, 27 Mar 2018 13:59:57 +0000 (13:59 +0000)]
MFC r331475: loader consoles: Implement SGR 24, 25

Mostly for completeness sake- implement 24 (no underline) and 25 (no blink)

6 years agoMFC r331247:
kib [Tue, 27 Mar 2018 13:09:35 +0000 (13:09 +0000)]
MFC r331247:
Check for wrap-around in vm_phys_alloc_seg_contig().

6 years agoMFC r330974: MFV r330973: 9164 assert: newds == os->os_dsl_dataset
avg [Tue, 27 Mar 2018 11:33:21 +0000 (11:33 +0000)]
MFC r330974: MFV r330973: 9164 assert: newds == os->os_dsl_dataset

PR: 225877

6 years agoMFC r331234: Rationalize license text on Linuxolator files
emaste [Tue, 27 Mar 2018 01:02:42 +0000 (01:02 +0000)]
MFC r331234: Rationalize license text on Linuxolator files

i386 linux.h missed in previous update.

Approved by: sos
Sponsored by: The FreeBSD Foundation

6 years agoMFC 330711:
jhb [Tue, 27 Mar 2018 00:35:35 +0000 (00:35 +0000)]
MFC 330711:
Permit sysctl(8) to set an array of numeric values for a single node.

Most sysctl nodes only return a single value, but some nodes return an
array of values (e.g. kern.cp_time).  sysctl(8) understand how to display
the values of a node that returns multiple values (it prints out each
numeric value separated by spaces).  However, until now sysctl(8) has
only been able to set sysctl nodes to a single value.  This change
allows sysctl to accept a new value for a numeric sysctl node that contains
multiple values separated by either spaces or commas.  sysctl(8) parses
this list into an array of values and passes the array as the "new" value
to sysctl(2).

Sponsored by: Chelsio Communications

6 years agoFix buildworld after r331586 by adapting the installation of
hselasky [Mon, 26 Mar 2018 23:23:11 +0000 (23:23 +0000)]
Fix buildworld after r331586 by adapting the installation of
dev/mlx5/mlx5io.h to the build system in FreeBSD 11-stable.

This is a direct commit.

Found by: jhb@
Pointy hat: hselasky@
Sponsored by:   Mellanox Technologies

6 years agoMFC r330654:
hselasky [Mon, 26 Mar 2018 21:14:20 +0000 (21:14 +0000)]
MFC r330654:
Check that the address is specified in mlx5tool(8).

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330670:
hselasky [Mon, 26 Mar 2018 21:11:43 +0000 (21:11 +0000)]
MFC r330670:
Make mlx5 compilable on ILP32 arches.

Sponsored by: Mellanox Technologies

6 years agoMFC r330660:
hselasky [Mon, 26 Mar 2018 21:06:23 +0000 (21:06 +0000)]
MFC r330660:
Add call to setup firmware data dump structure during device load in
mlx5core.

Do not consider the inability to create a firmware dump fatal, but
inform about the situation and allow the driver to attach. The device
might not implement the needed VSC, or we might not know the layout of
the registers map. In either case, only firmware dump functionality is
limited, the network operations should be fine.

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330659:
hselasky [Mon, 26 Mar 2018 21:04:47 +0000 (21:04 +0000)]
MFC r330659:
Avoid more LFENCE/SFENCe on x86 in mlx5en(4),
by using the FreeBSD native fences.

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330658:
hselasky [Mon, 26 Mar 2018 21:03:33 +0000 (21:03 +0000)]
MFC r330658:
Fix mlx5en(4) driver to properly call m_defrag().

When the mlx5en(4) driver was converted to using BUSDMA(9) the call to
m_defrag() was moved after the part of the TX routine that strips the
header from the mbuf chain. Before it called m_defrag it first trimmed
off the now-empty mbufs from the start of the chain. This has the side
effect of also removing the head of the chain that has M_PKTHDR set.
m_defrag() will not defrag a chain that does not have M_PKTHDR set,
thus it was effectively never defragging the mbuf chains.

As it turns out, trimming the mbufs in this fashion is unnecessary since
the call to bus_dmamap_load_mbuf_sg doesn't map empty mbufs anyway, so
remove it.

Differential Revision: https://reviews.freebsd.org/D12050
Submitted by: mjoras@
Sponsored by: Mellanox Technologies

6 years agoMFC r330657:
hselasky [Mon, 26 Mar 2018 21:02:20 +0000 (21:02 +0000)]
MFC r330657:
Use vport rather than physical-port MTU in mlx5en(4).

Set and report vport MTU rather than physical MTU,
The driver will set both vport and physical port mtu
and will rely on the query of vport mtu.

SRIOV VFs have to report their MTU to their vport manager (PF),
and this will allow them to work with any MTU they need
without failing the request.

Also for some cases where the PF is not a port owner, PF can
work with MTU less than the physical port mtu if set physical
port mtu didn't take effect.

Based on Linux upstream commit:
cd255efff9baadd654d6160e52d17ae7c568c9d3

Submitted by: Meny Yossefi <menyy@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330656:
hselasky [Mon, 26 Mar 2018 21:00:57 +0000 (21:00 +0000)]
MFC r330656:
Use the device unit number for naming the ifnet interface in mlx5en(4).

Currently the ifnet interface is named mceX, where X is a monotonically
incremented value. If the device is reset due to a fatal error, then the
interface name will change.  Using the device unit number will keep the
naming consistent across the reset logic.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330653:
hselasky [Mon, 26 Mar 2018 20:59:26 +0000 (20:59 +0000)]
MFC r330653:
Add kernel and userspace code to dump the firmware state of supported
ConnectX-4/5 devices in mlx5core.

The dump is obtained by reading a predefined register map from the
non-destructive crspace, accessible by the vendor-specific PCIe
capability (VSC). The dump is stored in preallocated kernel memory and
managed by the mlx5tool(8), which communicates with the driver using a
character device node.

The utility allows to store the dump in format
    <address> <value>
into a file, to reset the dump content, and to manually initiate the
dump.

A call to mlx5_fwdump() should be added at the places where a dump
must be fetched automatically. The most likely place is right before a
firmware reset request.

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330651:
hselasky [Mon, 26 Mar 2018 20:54:21 +0000 (20:54 +0000)]
MFC r330651:
Add vendor specific capability interface support in mlx5core.

Add the ability to access the vendor specific space gateway in order
to support reading and writing data into the different configuration
domains.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330650:
hselasky [Mon, 26 Mar 2018 20:52:02 +0000 (20:52 +0000)]
MFC r330650:
Use device_printf() instead of printf() when printing warnings and errors
to dmesg(8) in mlx5core.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330649:
hselasky [Mon, 26 Mar 2018 20:50:28 +0000 (20:50 +0000)]
MFC r330649:
Add support for per priority flow control, PFC, to mlx5en(4).

Add support for PFC and implement reading the per priority statistics
using the sysctl(8) interface. PFC is used together with VLAN priority
and can be enabled and disabled on a per priority basis.

Global pause frames and PFC are incompatible features and surrounding
logic has been added to warn the user about misconfiguration.

Update relevant mlx5core APIs for PFC configuration.

Sponsored by: Mellanox Technologies

6 years agoMFC r330646:
hselasky [Mon, 26 Mar 2018 20:36:32 +0000 (20:36 +0000)]
MFC r330646:
Fix race between PCI error handlers and health work in mlx5core.

linux commit 05ac2c0b7438ea08c5d54b48797acf9b22cb2f6f

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330645:
hselasky [Mon, 26 Mar 2018 20:35:12 +0000 (20:35 +0000)]
MFC r330645:
Avoid calling sleeping function from the health poll thread in mlx5core.

linux commit c1d4d2e92ad670168a17a57dfa182a5a5baa72d4

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330644 and r330714:
hselasky [Mon, 26 Mar 2018 20:33:31 +0000 (20:33 +0000)]
MFC r330644 and r330714:
Updates for PCI and health monitor recovery in mlx5core.
This patch accumulates the following Linux commits:

mlx5_health.c
78ccb25861d76a8fc5c678d762180e6918834200
  mlx5_core: Fix wrong name in struct
171bb2c560f45c0427ca3776a4c8f4e26e559400
  mlx5_core: Update health syndromes
0144a95e2ad53a40c62148f44fb0c1f9d2a0d1e9
  mlx5_core: Use accessor functions to read from device memory
ac6ea6e81a80172612e0c9ef93720f371b198918
  mlx5_core: Use private health thread for each device
fd76ee4da55abb21babfc69310d321b9cb9a32e0
  mlx5_core: Fix internal error detection conditions
2241007b3d783cbdbaa78c30bdb1994278b6f9b9
  mlx5: Clear health sick bit when starting health poll
712bfef60912d91033cb25739f7444d5b8d8c59f
  mlx5: Fix version printout in case of health issue
89d44f0a6c732db23b219be708e2fe1e03ee4842
  mlx5_core: Add pci error handlers to mlx5_core driver

mlx5_cmd.c
be87544de8df2b1eb34bcb5e32691287d96f9ec4
  mlx5_core: Fix async commands return code
a31208b1e11df334d443ec8cace7636150bb8ce2
  mlx5_core: New init and exit flow for mlx5_core
020446e01eebc9dbe7eda038e570ab9c7ab13586
  mlx5_core: Prepare cmd interface to system errors handling
89d44f0a6c732db23b219be708e2fe1e03ee4842
  mlx5_core: Add pci error handlers to mlx5_core driver
0d834442cc247c7b3f3bd6019512ae03e96dd99a
  mlx5: Fix teardown errors that happen in pci error handler

mlx5_main.c
5fc7197d3a256d9c5de3134870304b24892a4908
  mlx5: Add pci shutdown callback

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330608:
hselasky [Mon, 26 Mar 2018 20:28:50 +0000 (20:28 +0000)]
MFC r330608:
Implement priority to traffic class mapping in mlx5core.

Add support for mapping priority to traffic class via sysctl

Submitted by: Slava Shwartsman <slavash@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330607:
hselasky [Mon, 26 Mar 2018 20:27:08 +0000 (20:27 +0000)]
MFC r330607:
Implement rate limit per traffic class in mlx5core.

Add support for rate limiting traffic class via sysctl.

Submitted by: Slava Shwartsman <slavash@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330606:
hselasky [Mon, 26 Mar 2018 20:25:24 +0000 (20:25 +0000)]
MFC r330606:
Implement support for querying the current port rate in mlx5core.
The mlx5ib(4) part will be merged separately.

- Factor out port speed definitions into new port.h header file,
  similarly as done in Linux upstream.
- Correct two existing port speed definitions in mlx5en according to
  Linux upstream.

Sponsored by: Mellanox Technologies

6 years agoMFC r330604:
hselasky [Mon, 26 Mar 2018 20:10:49 +0000 (20:10 +0000)]
MFC r330604:
Add log message for unsupported QSFPs in mlx5core.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330603:
hselasky [Mon, 26 Mar 2018 20:09:36 +0000 (20:09 +0000)]
MFC r330603:
Make sure default VNET is set when adding a new interface in mlx5core.

Adding an interface might be done outside the device_attach() routine
and will then cause a panic, due to the VNET not being set.

Sponsored by: Mellanox Technologies

6 years agoMFC r330600:
hselasky [Mon, 26 Mar 2018 20:08:21 +0000 (20:08 +0000)]
MFC r330600:
Add timeout handle to commands with callback in mlx5core.

The current implementation does not handle timeout in case of command
with callback request, and this can lead to deadlock if the command
doesn't get firmware response. Add delayed callback timeout work
before posting the command to firmware. In case of real firmware
command completion we will cancel the delayed work. In case of
firmware command timeout the callback timeout handler will be called
and it will simulate firmware completion with timeout error.

linux commit 65ee67084589c1783a74b4a4a5db38d7264ec8b5

Sponsored by: Mellanox Technologies

6 years agoMFC r330599:
hselasky [Mon, 26 Mar 2018 20:06:37 +0000 (20:06 +0000)]
MFC r330599:
Fix potential deadlock in command mode change in mlx5core.

Call command completion handler in case of timeout when working in
interrupts mode. Avoid flushing the commands workqueue after acquiring
the semaphores to prevent a potential deadlock.

linux commit 9cba4ebcf374c3772f6eb61f2d065294b2451b49

Sponsored by: Mellanox Technologies

6 years agoMFC r330598:
hselasky [Mon, 26 Mar 2018 20:05:22 +0000 (20:05 +0000)]
MFC r330598:
Use a macro in mlx5_command_str() instead of copying OP name.

linux commit 42ca502e179d0654ef441333a9d0f35c948734f3

Sponsored by: Mellanox Technologies

6 years agoMFC r325661:
hselasky [Mon, 26 Mar 2018 20:01:58 +0000 (20:01 +0000)]
MFC r325661:
Expose the current hardware MTU in mlx5en(4) as a separate entry
in the sysctl tree.

Sponsored by: Mellanox Technologies

6 years agoMFC r325660:
hselasky [Mon, 26 Mar 2018 20:00:30 +0000 (20:00 +0000)]
MFC r325660:
Add support for configuring local multicast and unicast data traffic loopback
in mlx5en(4) driver via the sysctl interface.

Sponsored by: Mellanox Technologies

6 years agoMFC r325659:
hselasky [Mon, 26 Mar 2018 19:59:00 +0000 (19:59 +0000)]
MFC r325659:
Add support for disabling and enabling RX and TX DMA rings in mlx5en(4).
This is useful for supporting setups similar to Netmap.

Sponsored by: Mellanox Technologies

6 years agoMFC r331260:
markj [Mon, 26 Mar 2018 15:22:25 +0000 (15:22 +0000)]
MFC r331260:
Remove a lingering inaccuracy from mlock.2.

6 years agoMFC r331135:
markj [Mon, 26 Mar 2018 15:21:23 +0000 (15:21 +0000)]
MFC r331135:
Use __syscall(2) rather than syscall(2) in syscall/tst.args.c.

6 years agoMFC r331134:
markj [Mon, 26 Mar 2018 15:20:42 +0000 (15:20 +0000)]
MFC r331134:
Fix an access of an uninitialized variable in dtrace_probe().

6 years agoMFC r331128:
markj [Mon, 26 Mar 2018 15:19:45 +0000 (15:19 +0000)]
MFC r331128:
Have vm_page_replace() assert that the new page is not enqueued.

6 years agoMFC r331222:
markj [Mon, 26 Mar 2018 15:17:31 +0000 (15:17 +0000)]
MFC r331222:
Given hidden visibility to symbols referenced by the DOF section.

6 years agoMFC r331425:
markj [Mon, 26 Mar 2018 15:16:57 +0000 (15:16 +0000)]
MFC r331425:
Correct a couple of assertion messages in vm_page_reclaim_run().

6 years agoMFC r331364:
gjb [Mon, 26 Mar 2018 14:13:42 +0000 (14:13 +0000)]
MFC r331364:
 Remove google_accounts_manager from VM_RC_LIST in the GCE configuration
 file, no longer needed.

PR: 221714
Sponsored by: The FreeBSD Foundation

6 years agoMFC r331431:
kib [Mon, 26 Mar 2018 07:55:37 +0000 (07:55 +0000)]
MFC r331431:
Update comment to match current field names.

6 years agoMFC r331203:
ae [Mon, 26 Mar 2018 07:54:11 +0000 (07:54 +0000)]
MFC r331203:
  Remove note that `fwd tablearg` is supported only by IPv4. IPv6 is
  supported too.

6 years agoMFC r329844
truckman [Mon, 26 Mar 2018 04:41:23 +0000 (04:41 +0000)]
MFC r329844
MFC r329875 (by kib)

r329844 | truckman | 2018-02-22 16:12:51 -0800 (Thu, 22 Feb 2018) | 52 lines

Decrease latency by not wrapping the idle loop's potentially lengthy
search for a thread to steal inside a critical section.  Since this
allows the search to be preempted, restart the search if preemption
happens since the search results found earlier may no longer be
valid.

Decrease the latency of starting a thread that may be assigned to
this CPU during the search by polling for incoming threads during
the search and switching to that thread instead of continuing the
search.

Test for stale search results and restart the search before going
through the expense of calling tdq_lock_pair().  Retry some tests
after grabbing the locks since things may have changed while waiting
to get both locks.

Eliminate special case handling for stealing from an SMT peer that
uses 1 as the steal threshold.  This can only succeed if a thread
has been assigned but our SMT peer has not yet started executing
it.  This is quite rare and when it happens the other SMT thread
is generally waiting for the same tdq lock that we hold.  Basically
both SMT threads are racing to grab the same spin lock.

Add the kern.sched.always_steal knob from a ULE patch by jeff@.

Incorporate another idea from Jeff's ULE patch.  If the sched_switch()
detects that the CPU is about to go idle, try to steal a thread
before switching to the idle thread.  Since the search for a thread
to steal has to be done inside a critical section in this context,
limit the impact on latency by adding the knob kern.sched.trysteal_limit
to limit the topological distance of the search and don't restart
the search if we detect stale results.  If this search can't find
an stealable thread, the idle loop can do a more complete search.
Also poll for threads being assigned to this CPU during the search
and switch to them instead of continuing the search.  This change
is responsibile for the majority of the improvement in parallel
buildworld times.

In sched_balance_group() change the minimum threshold from stealing
a thread from 1 to 2.  Poaching a newly assigned thread from a CPU
that is waking up hasn't yet switched to that thread from idle is
likely very rare and is likely to have the same lock race as is
seen when stealing threads in the idle loop.  Also use tdq_notify()
to kick the destintation CPU instead of always sending an IPI.
Update a stale comment, the number of transferable threads is not
calculated.

------------------------------------------------------------------------
r329875 | kib | 2018-02-23 10:26:31 -0800 (Fri, 23 Feb 2018) | 5 lines

Restore UP build.

Reviewed by: kib (earlier version, r329844)
Reviewed by: truckman (r329875)
Comments by: avg, jeff, mav (r329844)
Differential Revision: https://reviews.freebsd.org/D12130

6 years agoMFC r330115: Add missing WITH_BSD_GREP_FASTMATCH description
kevans [Mon, 26 Mar 2018 00:30:46 +0000 (00:30 +0000)]
MFC r330115: Add missing WITH_BSD_GREP_FASTMATCH description

6 years agoMFC r331416, r331440: Loader consoles: Implement SGR 22, reste intensity
kevans [Mon, 26 Mar 2018 00:26:46 +0000 (00:26 +0000)]
MFC r331416, r331440: Loader consoles: Implement SGR 22, reste intensity

r331416:
Loader consoles: Implement SGR 22, reset intensity

r331440:
Match broken style of vidconsole.c

This particular function uses a broken mix of indentation styles. Match it
for the newly added SGR 22 bits.

6 years agoMFC r330781:
ae [Sun, 25 Mar 2018 03:50:38 +0000 (03:50 +0000)]
MFC r330781:
  Update pfkey_open() function to set socket's write buffer size to
  128k and receive buffer size to 2MB. In case if system has bigger
  default values, do not lower them.

  This should partially solve the problem, when setkey(8) returns
  EAGAIN error on systems with many SAs or SPs.

  PR: 88336
  Obtained from: NetBSD/ipsec-tools

6 years agoMFC r330779:
ae [Sun, 25 Mar 2018 03:45:02 +0000 (03:45 +0000)]
MFC r330779:
  Rework key_sendup_mbuf() a bit:

  o count in_nomem counter when we have failed to allocate mbuf for
    promisc socket;
  o count in_msgtarget counter when we have secussfully sent data to socket;
  o Since we are sending messages in a loop, returning error on first fail
    interrupts the loop, and all remaining sockets will not receive this
    message. So, do not return error when we have failed to send data to ALL
    or REGISTERED target. Return error only for KEY_SENDUP_ONE case. Now,
    when some socket has overfilled its receive buffer, this will not break
    other sockets.

6 years agoMFC r330771:
ae [Sun, 25 Mar 2018 03:37:26 +0000 (03:37 +0000)]
MFC r330771:
  Remove obsoleted and unused key_sendup() function.
  Also remove declaration for nonexistend key_usrreq() function.

MFC r330772:
  Check that we have PF_KEY sockets before iterating over all RAW sockets.

MFC r330775:
  Replace panic() with KASSERTs.

MFC r330777:
  Add KASSERT to check that proper targed was used.

6 years agoMFC r329989, r330044
ian [Sun, 25 Mar 2018 02:04:44 +0000 (02:04 +0000)]
MFC r329989, r330044

r329989:
Add support for booting into kdb on arm platforms when the RB_KDB is set
(using "boot -d" at the loader propmt or setting boot_ddb in loader.conf).

Submitted by: Thomas Skibo <thomasskibo@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D14428

r330044:
Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
to what other arches (all except riscv and armv4/5) do.

Submitted by: Hyun Hwang <hyun@caffeinated.codes>
Differential Revision: https://reviews.freebsd.org/D14465

6 years agoMFC r331123, r331126, r331129, r331132, r331136, r331138-r331139, r331141
ian [Sun, 25 Mar 2018 01:59:54 +0000 (01:59 +0000)]
MFC r331123, r331126, r331129, r331132, r331136, r331138-r331139, r331141

r331123:
Do not overwrite the contents of BIO_WRITE buffers.  SPI inherently
transfers data in both directions at once.  When writing to the device,
use a dummy buffer for the incoming data, not the same buffer as the
outgoing data.  Writes are done in FLASH_PAGE_SIZE chunks, which is only
256 bytes, so just put the dummy buffer into the softc.

r331126:
Remove a pointless KASSERT and reword a comment a bit.  The KASSERT tested
for the same condition that the preceeding lines checked for and would have
returned EIO, so the assert could never possibly trigger (sc_sectorsize must
inherently be an integer multiple of FLASH_PAGE_SIZE).

r331129:
Eliminate some unneeded intermediate variables.  Eliminate some redundant
parens in shift-and-mask expressions.  Reword and reflow some comments.

r331132:
Bugfix: wait for writes/erases to complete after starting them, instead of
before starting them.

Using the wait-before logic would make sense if there was useful time-
consuming work that could be done between the end of one write and the
beginning of the next, but it also requires doing the wait-for-ready before
reading, because a prior write or erase could still be in progress.  Reading
is the far more common case, so adding a whole extra bus transaction to
check for ready before each read would soak up any small gains that might be
had from doing async writes.

r331136:
Add sc_parent to the softc and use it in place of device_get_parent() calls
all over the place.  Also pass the softc as the arg to all the internal
functions instead of passing a device_t and calling device_get_softc() in
each function.

r331138:
Make all internal routines return an int error status, and check the
status at all call points.  Combine the get_status and wait_for_ready
routines, since waiting for ready is the only reason to ever get status.

r331139:
Add support for 4K and 32K erase block sizes.  Many of the supported chips
have these flags set in the ident table, but there was no code to support
using the smaller erase sizes.

r331141:
Add the device/chip type to the disk d_descr field, and print more info
about the chip including the erase block size at attach time.

Also add myself to the copyrights since at this point svn blame would point
to me as the culprit for much of this.

6 years agoMFC r331068:
ian [Sun, 25 Mar 2018 01:55:17 +0000 (01:55 +0000)]
MFC r331068:

Use EFI RTC capabilities info when registering, add bootverbose diagnostics.

Make some small improvements to the efirtc driver by obtaining the clock
capabilities (resolution and whether the sub-second counters are reset) and
using the info when registering the clock. When the hardware zeroes out the
subsecond info on clock-set, schedule clock updates to happen just before
top-of-second, so that the RTC time is closely in-sync with kernel time.

Also, in the identify() routine, always add the driver if EFI runtime
services are available, then decide in probe() whether to attach the driver
or not. If not attaching and bootverbose is on, say why. All of this is
basically to avoid "silent failure" -- if someone thinks there should be an
efi rtc and it's not attaching, at least they can set bootverbose and maybe
get a clue from the output.

Differential Revision: https://reviews.freebsd.org/D14565 (timed out)

6 years agoMFC r330773, r330778, r330782, r330797
ian [Sun, 25 Mar 2018 01:52:38 +0000 (01:52 +0000)]
MFC r330773, r330778, r330782, r330797

r330773:
Use separate mutexes for atrtc and i8254 locking.  Change all the strange
un-function-like RTC_LOCK/UNLOCK macro usage into normal function calls.
Since there is no longer any need to handle register access from a debugger
context, those function calls can just be regular mutex lock/unlock calls.

Requested by:  bde

r330778:
Everywhere that multiple registers are accessed in sequence, lock/unlock
just once around the whole group of accesses.

r330782:
Remove MTX_NOPROFILE from atrtc_lock, it was inappropriately copy/pasted
from the i8254 driver when I created separate mutexes for each.  The i8254
driver could be the active timecounter, leading to recursion during mutex
profiling, but the atrtc driver cannot be a timecounter, so it isn't needed.

r330797:
Give the atrtc_time_lock a unique name.

Reported by: hps@

6 years agoMFC r330050:
ian [Sun, 25 Mar 2018 01:47:57 +0000 (01:47 +0000)]
MFC r330050:

Initialize all members of vm_page::md_page for armv4/5 systems.  This fixes
a hang in SI_SUB_KMEM sysinit, and is apparently required after r323290.
Inspired by the commit message for r323676.

Reported by: andreast@

6 years agoMFC r330437-r330438, r330440, r331045
ian [Sun, 25 Mar 2018 01:47:17 +0000 (01:47 +0000)]
MFC r330437-r330438, r330440, r331045

r330437:
Do not stop the loop that configures gpio chipselect pins on the first
error, just ignore pins that don't configure and keep setting up the ones
that do.  (But when bootverbose is on, whine about the errors.)

r330438:
Defer attaching the spibus until timers and interrupts are working.  The
driver requires interrupts to do transfers, and the drivers for the SPI
devices on the bus quite reasonably expect to be able to do IO while probing
and attaching.

r330440:
Switch imx_gpio to attach at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE.
Pretty much any other device might need to manipulate a gpio pin during its
probe or attach routines, so these devices must be available as early as
possible.

The gpio device is an interrupt controller, but I didn't choose the
INTERRUPT pass for that reason (it works fine as an interrupt controller as
long as it attaches any time before interrupts are enabled).  That just
looked like the right place in the passes to ensure that it attaches before
any type of device that might need gpio pin manipulations.

r331045:
Add required interface header.

Reported by: andreast@

6 years agoMFC r322665
sevan [Sun, 25 Mar 2018 01:34:44 +0000 (01:34 +0000)]
MFC r322665

Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html

6 years agoMFC r316464
sevan [Sun, 25 Mar 2018 01:30:29 +0000 (01:30 +0000)]
MFC r316464

Whilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually
was the first release of an OS to ship with it.
Heads up by Ingo Schwarze.

6 years agoMFC 321881
sevan [Sun, 25 Mar 2018 01:24:52 +0000 (01:24 +0000)]
MFC 321881

For the udp-client example, instruct user to add an entry for a udp based
service.
For tcp-client & udp-client, use the same port in configuration snippet as used
in the comment prior to remove any ambiguity on the port number which needs to
be specified.