]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMerge rev. 329197 from HEAD:
n_hibma [Tue, 20 Feb 2018 19:33:33 +0000 (19:33 +0000)]
Merge rev. 329197 from HEAD:

 DSCP values passed to setdscp need to be lowercase.

6 years agoMFC r325410:
gonzo [Tue, 20 Feb 2018 18:12:07 +0000 (18:12 +0000)]
MFC r325410:

Increase TX_MAX_SEGS from 10 to 20 for the if_awg.c driver

Under certain traffic pattern awg driver does not recover from TX queue
full condition. The actual source of the problem is not identified yet
but jmcneill@ agreed that bumping TX_MAX_SEGS to 20 is OK as a workaround
for the problem (NetBSD has it set to 128).

Also add some diagnostic printfs to prevent silent failure of bus_dma
functions in the future

PR will be kept open until root cause of the issue is identified and fixed

PR: 219927
Submitted by: Tom Vijlbrief <tvijlbrief@gmail.com>
Approved by: jmcneill

6 years agoMFC r329216:
kib [Tue, 20 Feb 2018 10:35:13 +0000 (10:35 +0000)]
MFC r329216:
linuxkpi: Do not leak pages on put.

6 years agoMFC r329215:
kib [Tue, 20 Feb 2018 10:34:15 +0000 (10:34 +0000)]
MFC r329215:
Do not leak rv->psind in some specific situations.

6 years agoMFC r328938:
markj [Tue, 20 Feb 2018 00:34:42 +0000 (00:34 +0000)]
MFC r328938:
Simplify synchronization read error handling.

6 years agoMFC r327502:
gonzo [Mon, 19 Feb 2018 19:55:29 +0000 (19:55 +0000)]
MFC r327502:

nctgpio: add new device id for the GPIO chip in PCEngines APU3

PR: 224512
Submitted by: mike@sentex.net

6 years agoMFC r329374:
markj [Mon, 19 Feb 2018 17:03:50 +0000 (17:03 +0000)]
MFC r329374:
Use the conventional name for an array of pages.

6 years agoMFC r329181
vangyzen [Mon, 19 Feb 2018 15:56:33 +0000 (15:56 +0000)]
MFC r329181

Update the MTU in affected routes when IPv6 RA changes the MTU

ip6_calcmtu() only looks at the interface MTU if neither the TCP hostcache
nor the route provides an MTU.  Update the routes so they do not provide
stale MTUs.

This fixes UNH IPv6 conformance test cases v6LC_4_1_08 and v6LC_4_1_09,
which use a RA to reduce the link MTU from 1500 to 1280.

Reported and tested by: Farrell Woods <Farrell_Woods@Dell.com>
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14257

6 years agoMFC r329053
vangyzen [Mon, 19 Feb 2018 15:54:26 +0000 (15:54 +0000)]
MFC r329053

Fix ICMPv6 redirects

icmp6_redirect_input() validates that a redirect packet came from the
current gateway for the respective destination.  To do this, it compares
the source address, which has an embedded scope zone id, to the next-hop
address, which does not.  If the address is link-local, which should be
the case, the comparison fails and the redirect is ignored.

Insert the scope zone id into the next-hop address so the comparison
is accurate.

Unsurprisingly, this fixes 35 UNH IPv6 conformance test cases.

Submitted by: Farrell Woods <Farrell_Woods@Dell.com> (initial revision)
Reviewed by: ae melifaro dab
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14254

6 years agoMFC r329347:
kib [Mon, 19 Feb 2018 10:59:19 +0000 (10:59 +0000)]
MFC r329347:
Note that on amd64 pmap_enter(psind = 1) works.

6 years agoMFC r328541:
ae [Mon, 19 Feb 2018 10:34:30 +0000 (10:34 +0000)]
MFC r328541:
  Do not skip scope zone violation check, when mbuf has M_FASTFWD_OURS flag.

  When mbuf has M_FASTFWD_OURS flag, this means that a destination address
  is our local, but we still need to pass scope zone violation check,
  because protocol level expects that IPv6 link-local addresses have
  embedded scope zone indexes. This should fix the problem, when ipfw is
  used to forward packets to local address and source address of a packet
  is IPv6 LLA.

  Reported by: asomers@

6 years agoMFC r328540:
ae [Mon, 19 Feb 2018 10:30:34 +0000 (10:30 +0000)]
MFC r328540:
  Assign IPv6 link-local address to loopback interfaces whith unit > 0.

  When an interface has IFF_LOOPBACK flag in6_ifattach() tries to assing
  IPv6 loopback address to this interface. It uses in6ifa_ifpwithaddr()
  to check, that interface doesn't already have given address and then
  uses in6_ifattach_loopback(). If in6_ifattach_loopback() fails, it just
  exits and thus skips assignment of IPv6 LLA.
  Fix this using in6ifa_ifwithaddr() function. If IPv6 loopback address is
  already assigned in the system, do not call in6_ifattach_loopback().

  PR: 138678

6 years agoMFC r328864:
wulf [Sun, 18 Feb 2018 22:04:42 +0000 (22:04 +0000)]
MFC r328864:

psm(4): Fix panic occuring soon after PS/2 packet has been rejected by
synaptics or elantech sanity checker.

After packet has been rejected contents of packet buffer is not cleared
with setting of inputbytes counter to 0. So when this packet buffer is
filled again being an element of circular queue, new data appends to old
data rather than overwrites it. This leads to packet buffer overflow
after 10 rounds.

Fix it with setting of packet's inputbytes counter to 0 after rejection.

While here add extra logging of rejected packets.

PR: 222667 (for reference)
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>

6 years agoMFC r329092:
brooks [Sun, 18 Feb 2018 20:49:43 +0000 (20:49 +0000)]
MFC r329092:

Add a deprecation warning when using the feature which mounts devices
to see how much space it on them.

Adjust MOUNT_CHAR_DEVS to allow the free space of already mounted
devices to be displayed and report an appropriate error if the
device isn't mounted.

Reviewed by: cem
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8801

6 years agoMFC r320851:
markj [Sun, 18 Feb 2018 19:46:57 +0000 (19:46 +0000)]
MFC r320851:
Add a helper function to agp(4) which installs a single GTT entry.

6 years agoMFC r329101:
ae [Sun, 18 Feb 2018 11:36:46 +0000 (11:36 +0000)]
MFC r329101:
  Reinitialize IP header length after checksum calculation. It is used
  later by TCP-MD5 code.

  This fixes the problem with broken TCP-MD5 over IPv4 when NIC has
  disabled TCP checksum offloading.

  PR: 223835

6 years agoMFC r328256:
mav [Sun, 18 Feb 2018 00:27:35 +0000 (00:27 +0000)]
MFC r328256:
MFV r328255: 8972 zfs holds: In scripted mode, do not pad columns with spaces

illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39

https://www.illumos.org/issues/8972:
'zfs holds -H' does not properly output content in scripted mode. It uses a
tab instead of two spaces, but it still pads column widths with spaces when
it should not.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Allan Jude <allanjude@freebsd.org>

6 years agoMFC r328254:
mav [Sun, 18 Feb 2018 00:26:34 +0000 (00:26 +0000)]
MFC r328254:
MFV r328253: 8835 Speculative prefetch in ZFS not working for misaligned reads

illumos/illumos-gate@5cb8d943bc8513c6230589aad5a409d58b0297cb

https://www.illumos.org/issues/8835:
Sequential reads not aligned to block size are not detected by ZFS
prefetcher as sequential, killing prefetch and severely hurting
performance.  It is caused by dmu_zfetch() in case of misaligned
sequential accesses being called with overlap of one block.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Allan Jude <allanjude@freebsd.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Alexander Motin <mav@FreeBSD.org>

6 years agoMFC r328252: MFV r328251: 8652 Tautological comparisons with ZPROP_INVAL
mav [Sun, 18 Feb 2018 00:26:00 +0000 (00:26 +0000)]
MFC r328252: MFV r328251: 8652 Tautological comparisons with ZPROP_INVAL

illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2

https://www.illumos.org/issues/8652:
Clang and GCC prefer to use unsigned ints to store enums. With Clang, that
causes tautological comparison warnings when comparing a zfs_prop_t or
zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error
handling code is being silently removed as a result.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Alan Somers <asomers@gmail.com>

6 years agoMFC r328250: MFV r328249:
mav [Sun, 18 Feb 2018 00:25:21 +0000 (00:25 +0000)]
MFC r328250: MFV r328249:
8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs

illumos/illumos-gate@2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9

https://www.illumos.org/issues/8641:
"zpool clear" and "zinject -d" can both operate on specific vdevs, either
leaf or interior. However, due to an oversight, neither works on a "spare"
or "replacing" vdev. For example:

sudo zpool create foo raidz1 c1t5000CCA000081D61d0 c1t5000CCA000186235d0 spare c
1t5000CCA000094115d0
sudo zpool replace foo c1t5000CCA000186235d0 c1t5000CCA000094115d0
$ zpool status foo pool: foo
state: ONLINE
scan: resilvered 81.5K in 0h0m with 0 errors on Fri Sep 8 10:53:03 2017
config:

NAME                         STATE     READ WRITE CKSUM
        foo                          ONLINE       0     0     0
          raidz1-0                   ONLINE       0     0     0
            c1t5000CCA000081D61d0    ONLINE       0     0     0
            spare-1                  ONLINE       0     0     0
              c1t5000CCA000186235d0  ONLINE       0     0     0
              c1t5000CCA000094115d0  ONLINE       0     0     0
        spares
          c1t5000CCA000094115d0      INUSE     currently in use
$ sudo zinject -d spare-1 -A degrade foo
cannot find device 'spare-1' in pool 'foo'
$ sudo zpool clear foo spare-1
cannot clear errors for spare-1: no such device in pool

Even though there was nothing to clear, those commands shouldn't have
reported an error. by contrast, trying to clear "raidz1-0" works just fine:
$ sudo zpool clear foo raidz1-0

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Alan Somers <asomers@gmail.com>

6 years agoMFC r328248: MFV r328247:
mav [Sun, 18 Feb 2018 00:24:31 +0000 (00:24 +0000)]
MFC r328248: MFV r328247:
8959 Add notifications when a scrub is paused or resumed

illumos/illumos-gate@301fd1d6f25595cd8c6d6795f39c72d97aff8cd9

Reviewed by: Alek Pinchuk <pinchuk.alek@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Sean Eric Fagan <sef@ixsystems.com>

6 years agoMFC r328246:
mav [Sun, 18 Feb 2018 00:23:51 +0000 (00:23 +0000)]
MFC r328246:
MFV r328245: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic

illumos/illumos-gate@01a059ee0cdece49f47fd4d70086dd5bc7d0b0ff

https://www.illumos.org/issues/8856:
arc_cksum_is_equal() calls zio_push_transform() that requires abd_t*
(second arg), but a void* is passed.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Roman Strashkin <roman.strashkin@nexenta.com>

6 years agoMFC r328234: MFV r328233:
mav [Sun, 18 Feb 2018 00:23:12 +0000 (00:23 +0000)]
MFC r328234: MFV r328233:
8898 creating fs with checksum=skein on the boot pools fails ungracefully

illumos/illumos-gate@9fa2266d9a78b8366e1cd2d5f050e8b5e37d558c

https://www.illumos.org/issues/8898:
# zfs create -o checksum=skein rpool/test
internal error: Result too large
Abort (core dumped)

Not a big deal per se, but should be handled correctly.

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

PR:             222199

6 years agoMFC r328232:
mav [Sun, 18 Feb 2018 00:21:42 +0000 (00:21 +0000)]
MFC r328232:
MFV r328231: 8897 zpool online -e fails assertion when run on non-leaf vdevs

illumos/illumos-gate@9a551dd645b478816cb11251b19f5034d885bf01

https://www.illumos.org/issues/8897:
# zpool online -e test mirror-1
Assertion failed: nvlist_lookup_string(tgt, "path", &pathname) == 0, file ../common/libzfs_pool.c, line 2558, function zpool_vdev_online
Abort (core dumped)

Not a big deal per se, but should be handled gracefully, same way as 'offline' and 'online' without '-e'.

Also reported as: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221408

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

6 years agoMFC r328230: MFV r328229:
mav [Sun, 18 Feb 2018 00:20:46 +0000 (00:20 +0000)]
MFC r328230: MFV r328229:
8930 zfs_zinactive: do not remove the node if the filesystem is readonly

illumos/illumos-gate@93c618e0f4932dc0bb9a9c90d8c4a5d029de5797

https://www.illumos.org/issues/8930:
We normally remove an unlinked node when its last user goes away and the
node becomes inactive. However, we should not do that if the filesystem
is mounted read-only including the case where it has its readonly
property set. The node will remain on the unlinked queue, so it will
not be leaked.

One particular scenario is when we receive an incremental stream into a
mounted read-only filesystem and that stream contains an unlinked file
(still on the unlinked queue). If that file is opened before the
receive and some time later after the receive it becomes inactive we
would remove it and, thus, modify the read-only filesystem. As a
result, the filesystem would diverge from its source and further
incremental receives would not be possible (without forcing a rollback).

Another related scenario, that may or may not be possible depending on an
OS / VFS policy, is when an open file is unlinked, then the filesystem is
remounted read-only, and then the file is closed.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Andriy Gapon <avg@FreeBSD.org>

6 years agoMFC r328228: MFV r328227: 8909 8585 can cause a use-after-free kernel panic
mav [Sun, 18 Feb 2018 00:20:06 +0000 (00:20 +0000)]
MFC r328228: MFV r328227: 8909 8585 can cause a use-after-free kernel panic

illumos/illumos-gate@94ddd0900a8838f62bba15e270649a42f4ef9f81

https://www.illumos.org/issues/8909:
There's a race condition that exists if `zil_free_lwb` races with either
`zil_commit_waiter_timeout` and/or `zil_lwb_flush_vdevs_done`.

Here's an example panic due to this bug:

> ::status
    debugging crash dump vmcore.0 (64-bit) from ip-10-110-205-40
    operating system: 5.11 dlpx-5.2.2.0_2017-12-04-17-28-32b6ba51fb (i86pc)
    image uuid: 4af0edfb-e58e-6ed8-cafc-d3e9167c7513
    panic message:
    BAD TRAP: type=e (#pf Page fault) rp=ffffff0010555970 addr=60 occurred in mo
dule "zfs" due to a NULL pointer dereference
    dump content: kernel pages only

> $c
    zio_shrink+0x12()
    zil_lwb_write_issue+0x30d(ffffff03dcd15cc0ffffff03e0730e20)
    zil_commit_waiter_timeout+0xa2(ffffff03dcd15cc0ffffff03d97ffcf8)
    zil_commit_waiter+0xf3(ffffff03dcd15cc0ffffff03d97ffcf8)
    zil_commit+0x80(ffffff03dcd15cc0, 9a9)
    zfs_write+0xc34(ffffff03dc38b140ffffff0010555e60, 40, ffffff03e00fb758, 0)
    fop_write+0x5b(ffffff03dc38b140ffffff0010555e60, 40, ffffff03e00fb758, 0)
    write+0x250(42, fffffd7ff4832000, 2000)
    sys_syscall+0x177()

If there's an outstanding lwb that's in `zil_commit_waiter_timeout`
waiting to timeout, waiting on it's waiter's CV, we must be sure not to
call `zil_free_lwb`. If we end up calling `zil_free_lwb`, then that LWB
may be freed and can result in a use-after-free situation where the
stale lwb pointer stored in the `zil_commit_waiter_t` structure of the
thread waiting on the waiter's CV is used.

A similar situation can occur if an lwb is issued to disk, and thus in
the `LWB_STATE_ISSUED` state, and `zil_free_lwb` is called while the
disk is servicing that lwb. In this situation, the lwb will be freed by
`zil_free_lwb`, which will result in a use-after-free situation when the
lwb's zio completes, and `zil_lwb_flush_vdevs_done` is called.

This race condition is prevented in `zil_close` by calling `zil_commit`
before `zil_free_lwb` is called, which will ensure all outstanding (i.e.
all lwb's in the `LWB_STATE_OPEN` and/or `LWB_STATE_ISSUED` states)
reach the `LWB_STATE_DONE` state before the lwb's are freed
(`zil_commit` will not return untill all the lwb's are
`LWB_STATE_DONE`).

Further, this race condition is prevented in `zil_sync` by only calling
`zil_free_lwb` for lwb's that do not have their `lwb_buf` pointer set.
All lwb's not in the `LWB_STATE_DONE` state will have a non-null value
for this pointer; the pointer is only cleared in
`zil_lwb_flush_vdevs_done`, at which point the lwb's state will be
changed to `LWB_STATE_DONE`.

This race is present in `zil_suspend`, leading to this bug.

At first glance, it would appear as though this would not be true
because `zil_suspend` will call `zil_commit`, just like `zil_close`, but
the problem is that `zil_suspend` will set the zilog's `zl_suspend`
field prior to calling `zil_commit`. Further, in `zil_commit`, if
`zl_suspend` is set, `zil_commit` will take a special branch of logic
and use `txg_wait_synced` instead of performing the normal `zil_commit`
logic.

This call to `txg_wait_synced` might be good enough for the data to
reach disk safely before it returns, but it does not ensure that all
outstanding lwb's reach the `LWB_STATE_DONE` state before it returns.
This is because, if there's an lwb "stuck" in
`zil_commit_waiter_timeout`, waiting for it's lwb to timeout, it will
maintain a non-null value for it's `lwb_buf` field and thus `zil_sync`
will not free that lwb. Thus, even though the lwb's data is already on
disk, the lwb will be left lingering, waiting on the CV, and will
eventually timeout and be issued to disk even though the write is
unnesseary.

So, after `zil_commit` is called from `zil_suspend`, we incorrectly
assume that there are not outstanding lwb's, and proceed to free all
lwb's found on the zilog's lwb list. As a result, we free the lwb that
will later be used `zil_commit_waiter_timeout`.

Reviewed by: John Kennedy <jwk404@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>

6 years agoMFC r328226: MFV r328225:
mav [Sun, 18 Feb 2018 00:19:03 +0000 (00:19 +0000)]
MFC r328226: MFV r328225:
8603 rename zilog's "zl_writer_lock" to "zl_issuer_lock"

illumos/illumos-gate@cf07d3da9915c0d22da8f59e991639f819463cef

https://www.illumos.org/issues/8603:
  To help make the ZIL's code more understandable, it was suggested that
  the zilog_t's "zl_writer_lock" field should be renamed to "zl_issuer_lock".

Reviewed by: C Fraire <cfraire@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>

6 years agoMFC r328224: MFV r328220: 8677 Open-Context Channel Programs
mav [Sun, 18 Feb 2018 00:17:37 +0000 (00:17 +0000)]
MFC r328224: MFV r328220: 8677 Open-Context Channel Programs

illumos/illumos-gate@a3b2868063897ff0083dea538f55f9873eec981f

https://www.illumos.org/issues/8677
  We want to be able to run channel programs outside of synching context.
  This would greatly improve performance of channel program that just gather
  information, as we won't have to wait for synching context anymore.

  This feature should introduce the following:
  - A new command line flag in "zfs program" to specify our intention to
  run in open context.
  - A new flag/option within the channel program ioctl which selects the
  context.
  - Appropriate error handling whenever we try a channel program in
  open-context that contains zfs.sync* expressions.
  - Documentation for the new feature in the manual pages.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Chris Williamson <chris.williamson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>

6 years agoMFC r323002 (by emaste): zfs: do not advertise edonr which is not yet supported
mav [Sat, 17 Feb 2018 23:54:59 +0000 (23:54 +0000)]
MFC r323002 (by emaste): zfs: do not advertise edonr which is not yet supported

illumos 4185 ("add new cryptographic checksums to ZFS: SHA-512,
Skein, Edon-R") was intentionally merged only partially in r289422,
without adding support for skein, sha512 and edonr on FreeBSD.

Support for skein and sha512 was added later on, but edonr is still not
implemented in FreeBSD.

Prior to this commit zfs(8) correctly rejected edonr, but with an error
message that claimed support:

fk@r500 ~ $zfs set checksum=edonr tank
cannot set property for 'tank': 'checksum' must be one of 'on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein | edonr'

6 years agoMFC r321104 (by jhibbits): Make ZFS not crash on mount on 32-bit systems
mav [Sat, 17 Feb 2018 23:51:15 +0000 (23:51 +0000)]
MFC r321104 (by jhibbits): Make ZFS not crash on mount on 32-bit systems

ZPL_VERSION is unsigned long long, not an int.  With this change, a zpool
can be created on a 32-bit system (tested on powerpcspe) and mounted
correctly.

6 years agoMFC r319671:
mav [Sat, 17 Feb 2018 23:05:19 +0000 (23:05 +0000)]
MFC r319671:
SHA-512 and Skein have been supported by the boot loader for some time.

6 years agoMFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,
kib [Sat, 17 Feb 2018 18:00:01 +0000 (18:00 +0000)]
MFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,
328166,328177,328199,328202,328205,328468,328470,328624,328625,328627,
328628,329214,329297,329365:

Meltdown mitigation by PTI, PCID optimization of PTI, and kernel use of IBRS
for some mitigations of Spectre.

Tested by:      emaste, Arshan Khanifar <arshankhanifar@gmail.com>
Discussed with: jkim
Sponsored by: The FreeBSD Foundation

6 years agoBump the FreeBSD version after r329383 to indicate that the
hselasky [Sat, 17 Feb 2018 09:58:53 +0000 (09:58 +0000)]
Bump the FreeBSD version after r329383 to indicate that the
cmpxchg() macro is now fully functional in the LinuxKPI.

This is a direct commit.

Sponsored by:   Mellanox Technologies

6 years agoMFC r329264: libsa: Fix IP recv timeout
kevans [Sat, 17 Feb 2018 02:14:01 +0000 (02:14 +0000)]
MFC r329264: libsa: Fix IP recv timeout

[This is slightly modified to not set `t` in the middle of the loop so that
the connection will eventually timeout after MAXTMO]

readip() doesn't, at the moment, properly indicate to callers that it has
timed out. One can tell that it's timed out if errno == EAGAIN when it
returns, but this is not ideal. Restructure it a little bit to explicitly
set errno to ETIMEDOUT if we've exhausted tleft.

I found two places that care about where it timed out or not: sendrecv in
net.c and sendrecv_tftp. Both are structured to pass smaller timeout values
to readip while tracking a larger timeout. Neither of them were able to do
this properly with readip not indicating ETIMEDOUT, so fix it.

While here, straighten out the time (t/t1) usage in sendrecv_tftp.

This would have manifested itself in periodic failures to NFS/TFTP boot for
no apparent reason because MINTMO/MAXTMO were not actually being respected
properly. Problems were not reported with NFS, only TFTP.

6 years agoMFC r329009
brd [Fri, 16 Feb 2018 18:49:50 +0000 (18:49 +0000)]
MFC r329009

mountd(8): Produce vaguely meaningful error messages

Approved by: cem, will

6 years agoiw_cxgbe: Follow-up fix to r329017, which updated the code associated
np [Fri, 16 Feb 2018 18:23:27 +0000 (18:23 +0000)]
iw_cxgbe:  Follow-up fix to r329017, which updated the code associated
with QP flush.

This is a direct commit to stable/11.

Sponsored by: Chelsio Communications

6 years agoMFC r315718, r316031:
markj [Fri, 16 Feb 2018 16:41:19 +0000 (16:41 +0000)]
MFC r315718, r316031:
Add support for 8- and 16-bit atomic_(f)cmpset to x86.

6 years agoMFC r324610:
mjg [Fri, 16 Feb 2018 16:16:33 +0000 (16:16 +0000)]
MFC r324610:

    Reduce traffic on vm_cnt.v_free_count

    The variable is modified with the highly contended page free queue lock.
    It unnecessarily shares a cacheline with purely read-only fields and is
    re-read after the lock is dropped in the page allocation code making the
    hold time longer.

    Pad the variable just like the others and store the value as found with
    the lock held instead of re-reading.

    Provides a modest 1%-ish speed up in concurrent page faults.

Due to KBI constraints the field is not moved in this commit, only re-read is
avoided.

6 years agoMFC r327875,r327905,r327914:
mjg [Fri, 16 Feb 2018 16:07:58 +0000 (16:07 +0000)]
MFC r327875,r327905,r327914:

    mtx: use fcmpset to cover setting MTX_CONTESTED

===

    rwlock: try regular read unlock even in the hard path

    Saves on turnstile trips if the lock got more readers.

===

    sx: retry hard shared unlock just like in r327905 for rwlocks

6 years agoMFC r327874:
mjg [Fri, 16 Feb 2018 16:05:02 +0000 (16:05 +0000)]
MFC r327874:

    vfs: tidy up vdrop

    Skip vfs_refcount_release_if_not_last if the interlock is held and just
    go straight to refcount_release.

    While here do cosmetic rearrangement of _vhold to better show it contains
    equivalent behaviour.

6 years agoMFC 318090,319475: Use const with some read-only buffers in opencrypto APIs.
jhb [Thu, 15 Feb 2018 21:27:24 +0000 (21:27 +0000)]
MFC 318090,319475: Use const with some read-only buffers in opencrypto APIs.

318090:
Use const with some read-only buffers in opencrypto APIs.

- Mark the source buffer for a copyback operation as const in the kernel
  API.
- Use const with input-only buffers in crypto ioctl structures used with
  /dev/crypto.

319475:
Fix some new errors and a warning in cryptotest.

- Use a new 'char *key' to allocate storage for keys and assign the
  pointer to the session2_op 'const char *' members after the key is
  initialized.
- Mark the 'find' variable used in crfind() static so that crfind()
  doesn't return a pointer to stack garbage.

Sponsored by: Chelsio Communications

6 years agoMFC r328622: vmm/svm: post LAPIC interrupts using event injection
avg [Thu, 15 Feb 2018 17:09:48 +0000 (17:09 +0000)]
MFC r328622: vmm/svm: post LAPIC interrupts using event injection

PR: 215972

6 years agoMFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing
avg [Thu, 15 Feb 2018 15:33:17 +0000 (15:33 +0000)]
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected.  A new disk(9) flag is added to mark write protected
disks.  A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page.  We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037

6 years agoMFC r323350:
hselasky [Thu, 15 Feb 2018 09:12:07 +0000 (09:12 +0000)]
MFC r323350:
Remove unsafe access to the LinuxKPI file structure from ibcore.
selwakeup() is now done by the wake_up() family of functions.

Sponsored by: Mellanox Technologies

6 years agoMFC r325637:
hselasky [Thu, 15 Feb 2018 09:09:42 +0000 (09:09 +0000)]
MFC r325637:
Mark ipoib device as initialized on device open.

Set the IPOIB_FLAG_INITIALIZED on dev_open and clear it on dev_stop to
avoid a race between ipoib load and the underlying device driver.

The device module must dispatch the IB_EVENT_PORT_ACTIVE event before ipoib
module is loaded. Otherwise, the flush will fail since no one set the
IPOIB_FLAG_INITIALIZED.

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

6 years agoMFC r325805:
hselasky [Thu, 15 Feb 2018 09:07:37 +0000 (09:07 +0000)]
MFC r325805:
Set the default VNET in krping before calling ifunit_ref(). Else using IPv6
link-local addresses when VIMAGE is enabled will cause a so-called NULL
pointer dereferencing issue.

Sponsored by: Mellanox Technologies

6 years agoMFC r325806:
hselasky [Thu, 15 Feb 2018 09:05:29 +0000 (09:05 +0000)]
MFC r325806:
Make sure a valid VNET is set before trying to access the V_ip6_v6only
variable. Access the variable directly instead of going through the sysctl()
interface in the kernel.

Sponsored by: Mellanox Technologies

6 years agoMFC r325807:
hselasky [Thu, 15 Feb 2018 09:04:06 +0000 (09:04 +0000)]
MFC r325807:
Make sure the ib_wr_opcode enum is signed by adding a negative dummy element.
Different compilers may optimise the enum type in different ways. This ensures
coherency when range checking the value of enums in ibcore.

Sponsored by: Mellanox Technologies

6 years agoMFC r325724:
hselasky [Thu, 15 Feb 2018 09:00:11 +0000 (09:00 +0000)]
MFC r325724:
Implement missing KDGETMODE IOCTL in VT.

Obtained from: Johannes Lundberg <yohanesu75@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r328163:
hselasky [Thu, 15 Feb 2018 08:56:03 +0000 (08:56 +0000)]
MFC r328163:
Add new USB ID to U3G driver.

PR: 134299
Sponsored by: Mellanox Technologies

6 years agoMFC r328830:
hselasky [Thu, 15 Feb 2018 08:50:43 +0000 (08:50 +0000)]
MFC r328830:
Add new USB ID.

PR: 225641
Submitted by: Ryan <ryanwinter@outlook.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r328591:
hselasky [Thu, 15 Feb 2018 08:46:20 +0000 (08:46 +0000)]
MFC r328591:
Move the mlx5 core device pointer first in the mlx5en priv. This help simplify
checks to recognize own network devices when using mlx5ib. This patch fixes
an issues where mlx5ib fails to recognize mceX network devices for use with
RoCE.

Sponsored by: Mellanox Technologies

6 years agoMFC r328774:
hselasky [Thu, 15 Feb 2018 08:43:23 +0000 (08:43 +0000)]
MFC r328774:
Slightly bump the maximum OID path for loading tunable SYSCTLs.

Coming updates to the mlx5en(4) driver will require this.

Sponsored by: Mellanox Technologies

6 years agoMFC r327444, r327449, r327454
gonzo [Wed, 14 Feb 2018 23:51:44 +0000 (23:51 +0000)]
MFC r327444, r327449, r327454

r327444:
vt(4): add support for configurable console palette

Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a
number from 0 to 15. The value is either comma-separated list decimal
numbers ranging from 0 to 255 that represent values of red, green, and
blue components respectively (i.e. "128,128,128") or 6-digit hex triplet
commonly used to represent colors in HTML or xterm settings (i.e. #808080)

Each tunable overrides one of the 16 hardcoded palette codes and can be set
in loader.conf(5)

Reviewed by: bcr(docs), jilles, manu, ray
Differential Revision: https://reviews.freebsd.org/D13645

r327449:
Unbreak build broken by r327444

During review iterations function signature has changed in definition
but not in actual call. Fix call to match the definition.

Reported by: Herbert J. Skuhra
Pointyhat to: gonzo

r327454:
Fix GCC build broken by r32744

Indicate in function declaration that vt_palette_init does not take any arguments

6 years agoMFC r320387:
gonzo [Wed, 14 Feb 2018 21:39:10 +0000 (21:39 +0000)]
MFC r320387:

[arm] Use correct index value when checking range validity

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D9145

6 years agoMFC r314933-r314934
gonzo [Wed, 14 Feb 2018 21:14:28 +0000 (21:14 +0000)]
MFC r314933-r314934

r314933:
[spigen] make spigen device ready to be compiled as a module

- Add flag to indicate that device is opened by userland
- Replace "always fail" detach method with proper detach implementation

r314934:
[spigen] Add spigen module

spigen provides userland API to SPI bus. Make it available as a loadable
module so people using official ARM images can enabled it on devices like
BBB or RPi without re-building kernel

6 years agoMFC r308895 by manu:
gonzo [Wed, 14 Feb 2018 20:01:39 +0000 (20:01 +0000)]
MFC r308895 by manu:

Enable the use of spigen on FDT platform

6 years agoMFC r325321:
skra [Wed, 14 Feb 2018 15:14:20 +0000 (15:14 +0000)]
MFC r325321:

  Take into account race conditions in case of accessed or modified bit
  emulation in fast path of data/prefetch abort common routine. Process these
  bits only if related page table entries are consistent with provided abort
  info. In case of inconsistency, do nothing and let processor to signal new
  abort if still needed.

6 years agoAdd DT_VERS_1_13 to libdtrace to unbreak the build.
markj [Wed, 14 Feb 2018 14:29:11 +0000 (14:29 +0000)]
Add DT_VERS_1_13 to libdtrace to unbreak the build.

This is a direct commit to stable/11.

PR: 225889

6 years agoMFC r328971:
hselasky [Wed, 14 Feb 2018 09:53:23 +0000 (09:53 +0000)]
MFC r328971:
Fix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to
actually return the computed result instead of the input value.

This is a regression issue after r289572.

Found by: gcc6
Sponsored by: Mellanox Technologies

6 years agoMFC r328995:
markj [Wed, 14 Feb 2018 00:32:19 +0000 (00:32 +0000)]
MFC r328995:
Fix the WITH_SORT_THREADS build.

PR: 201664

6 years agoMFC r312667 (by pfg):
markj [Wed, 14 Feb 2018 00:31:37 +0000 (00:31 +0000)]
MFC r312667 (by pfg):
sort - Don't live-loop threads.

6 years agoMFC r327888, r327972, r327973:
markj [Tue, 13 Feb 2018 22:43:07 +0000 (22:43 +0000)]
MFC r327888, r327972, r327973:
Add "jid" and "jailname" variables to DTrace.

6 years agoMFC r328052: kldxref: handle modules with md_cval at end of allocated secs
emaste [Tue, 13 Feb 2018 22:40:33 +0000 (22:40 +0000)]
MFC r328052: kldxref: handle modules with md_cval at end of allocated secs

Attempting to retrieve an md_cval string from a kernel module with
kldxref would throw a offset error for modules created using lld, since
this value would be placed at the end of all allocated sections.

Add an ef_read_seg_string method to the ef interface, to allow reading
strings of varying size without attempting to read beyond the segment's
bounds.

PR: 224875
Submitted by: Mitchell Horne <mhorne063@gmail.com>
Sponsored by: The FreeBSD Foundation

6 years agoMFC r327503: kldxref: correct function names in warning messages
emaste [Tue, 13 Feb 2018 22:37:54 +0000 (22:37 +0000)]
MFC r327503: kldxref: correct function names in warning messages

Sponsored by: The FreeBSD Foundation

6 years agoMFC: r329022
jkim [Tue, 13 Feb 2018 21:14:27 +0000 (21:14 +0000)]
MFC: r329022

Remove an empty directory.

6 years agoMFC: r329024
jkim [Tue, 13 Feb 2018 21:11:27 +0000 (21:11 +0000)]
MFC: r329024

Remove c_rehash(1) to not confuse users.

6 years agoMFC 328917:
bryanv [Tue, 13 Feb 2018 15:55:31 +0000 (15:55 +0000)]
MFC 328917:

Correct structure name used in bus_map_resource(9) example

6 years agoMFC r325654:
hselasky [Tue, 13 Feb 2018 15:18:11 +0000 (15:18 +0000)]
MFC r325654:
Add API functions to modify the transport interface send object, TIS,
in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325658:
hselasky [Tue, 13 Feb 2018 15:16:10 +0000 (15:16 +0000)]
MFC r325658:
Make physical address of init segment available in the priv of mlx5 core.
This change is needed by mlx5ib(4).

Sponsored by: Mellanox Technologies

6 years agoMFC r325652:
hselasky [Tue, 13 Feb 2018 15:14:32 +0000 (15:14 +0000)]
MFC r325652:
Prevent mlx5 core from accessing host memory after shutdown by disabling
PCI busmaster.

Sponsored by: Mellanox Technologies

6 years agoMFC r325651:
hselasky [Tue, 13 Feb 2018 15:13:15 +0000 (15:13 +0000)]
MFC r325651:
Set ATOMIC endian mode in mlx5 core.

The hardware is capable of 2 requestor endianness modes for standard 8
byte atomics: BE (0x0) and host endianness (0x1). Read the supported
modes from hca atomic capabilities and configure HW to host endianness
mode if supported.

Sponsored by: Mellanox Technologies

6 years agoMFC r325649:
hselasky [Tue, 13 Feb 2018 15:11:00 +0000 (15:11 +0000)]
MFC r325649:
Make local variable 64-bits to avoid masking away bits in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325653:
hselasky [Tue, 13 Feb 2018 15:09:03 +0000 (15:09 +0000)]
MFC r325653:
Add API functions to set and query dropless port mode in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325650:
hselasky [Tue, 13 Feb 2018 15:07:39 +0000 (15:07 +0000)]
MFC r325650:
Add const keyword to input-only argument in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325648:
hselasky [Tue, 13 Feb 2018 15:05:23 +0000 (15:05 +0000)]
MFC r325648:
Implement support for decoding general port notification event in
the mlx5 core module.

Sponsored by: Mellanox Technologies

6 years agoMFC r325662:
hselasky [Tue, 13 Feb 2018 14:57:34 +0000 (14:57 +0000)]
MFC r325662:
Add more and update existing mlx5 core firmware structure definitions and bits.
This change is part of coming ibcore and mlx5ib updates.

Sponsored by: Mellanox Technologies

6 years agoMFC r325657:
hselasky [Tue, 13 Feb 2018 14:47:44 +0000 (14:47 +0000)]
MFC r325657:
Add API function to query port performance counters for infiniband and RoCE
traffic in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325656:
hselasky [Tue, 13 Feb 2018 14:46:29 +0000 (14:46 +0000)]
MFC r325656:
Add API functions to query and modify local loopback of multicast and
unicast traffic in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325655:
hselasky [Tue, 13 Feb 2018 14:45:05 +0000 (14:45 +0000)]
MFC r325655:
Add API function to query virtual port counters in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325638 and r325976:
hselasky [Tue, 13 Feb 2018 14:37:21 +0000 (14:37 +0000)]
MFC r325638 and r325976:
Refactor the flowsteering APIs used by mlx5en(4). This change is needed by
the coming ibcore and mlx5ib updates in order to support traffic redirection
to so-called raw ethernet QPs.

Remove unused E-switch related routines and files while at it.

Sponsored by: Mellanox Technologies

6 years agoMFC r328913:
kib [Tue, 13 Feb 2018 12:54:03 +0000 (12:54 +0000)]
MFC r328913:
Move signal trampolines out of locore.s into separate source file.

6 years agostand: Clean up some unintentional inconsistencies
kevans [Tue, 13 Feb 2018 04:28:13 +0000 (04:28 +0000)]
stand: Clean up some unintentional inconsistencies

This is a direct commit to stable/11 to address the following final
unintended inconsistencies between stable/11 and head:

- Some unused LIBSTAND= cruft left in efi/loader/Makefie
- A comment that flew in with unrelated changes
- An #include that may go away now that stand is basically self-contained

6 years agoRevert MFC r328911 from r329183
kevans [Tue, 13 Feb 2018 04:10:10 +0000 (04:10 +0000)]
Revert MFC r328911 from r329183

jhb@ had specified an MFC timer of 1-month, and I clobbered his efforts by
MFC'ing it way prematurely. Back out that part of r329183 so it may be MFC'd
when jhb is ready.

6 years agoMFC r328937: Fix queue length reporting in mps(4) and mpr(4).
mav [Tue, 13 Feb 2018 02:11:39 +0000 (02:11 +0000)]
MFC r328937: Fix queue length reporting in mps(4) and mpr(4).

Both drivers were found to report CAM bigger queue depth then they really
can handle.  It made them later under high load with many disks return
some of submitted requests back with CAM_REQUEUE_REQ status for later
resubmission.

6 years agoMFC Loader Fixes Final: r327612,r327703,r327704,r327878,r327879,r327881,
kevans [Mon, 12 Feb 2018 20:51:28 +0000 (20:51 +0000)]
MFC Loader Fixes Final: r327612,r327703,r327704,r327878,r327879,r327881,
r328007,r328029,r328030,r328031,r328061,r328156,r328169,r328288,r328289,
r328290,r328291,r328292,r328411,r328536,r328603,r328614,r328642,r328769,
r328779,r328780,r328781,r328782,r328783,r328806,r328808,r328826,r328835,
r328911,r328986,r328987,r328990,r328999,r329000,r329019,r329050,r329054,
r329060

r327612: Invent new #defines for the biospci_{read,write}_config function

r327703: Define __dmadat after #include'ing ufsread.c.

r327704: Fix printf missing format variables warnings.

r327878: Add GUID for UEFI boot manager variables.

r327879: Report the boot order and where we are in that boot order.

r327881: Allow this file to be included

r328007: Fix booting on some arm64 systems after r327879 by fixing the call
to utf8_to_ucs2

r328029: When returning an error and freeing allocated memory from
ucs2_to_utf8, NULL the return pointer.

r328030: Check the return value from utf8_to_ucs2 instead of whether or not
uv is NULL.

r328031: Need to free uv after we're done using it.

r328061: utf8_to_ucs2() should check for malloc failure

r328156: stand: Move sections around to fix stand/ build with ld.lld on
armv7

r328169: Remove extra copy of bootinfo.c. It's a bit rotted copy of the one
in efi/loader.

r328288: Fix some resource leaks.

r328289: Don't leak memory when displaying help.

r328290: On malloc failure, be sure to close the include file that triggered
it.

r328291: getenv does not return tainted data in the boot loader. Attempt to
clue Coverity into that fact.

r328292: There's no tainted data here, tag it as such to avoid false
positives.

r328411: loader.efi: add missing EFI GUIDs

r328536: loader: support for mixed-endianness ELF/loader and POWER8

r328603: Add missing non-POWERPC case to give the scr value something
non-zero.

r328614: Move libstand.3 to libsa.3. Update libsa.3 to include functions

r328642: Break out the interpreters (simple and forth) w/o ifdefs.

r328769: Centralize several variables.

r328779: Retire pnp.4th and the code needed only for 4th words used here.

r328780: These 4th words were an attempt to allow integration into the boot
loader scripts. However, that path won't be taken after all it
seems.

r328781: Remove pcibios forth support.

r328782: Now that we no longer conditionally compile some files outside of
ficl

r328783: Invent new LDR_INTERP for the loader interpreter to use.

r328806: We need more heap space to properly load newer powerpc kernels.

r328808: Implement strcoll as strcmp.

r328826: Make cross-endian loader changes apply only to powerpc

r328835: Fix regression introduced in r328806, preventing boot on many
platforms.

r328911: Ignore relocation tables for non-memory-resident sections.

r328986: Fix relative location of USB sources after recent move.

r328987: A more definitions to kernel emulation shim in order to build
stand/usb.

r328990: Move the stand/usb test loader into its own directory.

r328999: Fix indentation to FreeBSD standard for interp files

r329000: Move simple interpreter 'perform' into interp.c and call it

r329019: Move to tabs for indentation and to 8-space notches, per style(9).

r329050: Fix build of userboot.so

r329054: Set script.lang in the environment to either 'forth' or 'simple' to
reflect what scripting language was compiled into the loader.

r329060: loader: fix endianness conversion

PR: 225323

6 years agoCorrect date in ObsoleteFiles
kevans [Mon, 12 Feb 2018 19:50:43 +0000 (19:50 +0000)]
Correct date in ObsoleteFiles

Getting a little ahead of myself here- correct the date to today.

6 years agoMFC: r328695,r328720,r328784,r328795 share/examples/bhyve/vmrun.sh additions
rgrimes [Mon, 12 Feb 2018 19:08:17 +0000 (19:08 +0000)]
MFC: r328695,r328720,r328784,r328795 share/examples/bhyve/vmrun.sh additions
and cleanups

r328695:
Add option '-n' network device emulation type which has a default
of virtio-net
PR: 225558
Submitted by: Johannes Lundberg <johalun0@gmail.com>

r328720:
Add -n <network device emulation type> to usage synopsis
forgotten in r328695.

Fix long lines in usage.
Consistently use "default:" rather than "default is"

r328784:
Clean up long lines.

r328795:
Fold constants and unify vnc variable names.

Approved by: grehan (mentor)

PR: 225558

6 years agoMFC: r316746 Add UEFI support to vmrun.sh
rgrimes [Mon, 12 Feb 2018 18:52:59 +0000 (18:52 +0000)]
MFC: r316746 Add UEFI support to vmrun.sh

Adds:
 -E: Use UEFI mode
 -f: path to UEFI firmware image (default: path to uefi-edk2-bhyve package)
 -F: UEFI framebuffer size (default: w=1024,h=768)
 -L: IP to listen for VNC connections on (default: 127.0.0.1)
 -P: Port to listen for VNC connections on (default: 5900)
 -T: Enable tablnet device (for VNC)
 -v: Wait for VNC client before booting VM

Submitted by: Shawn Webb <shawn.webb@hardenedbsd.org>
Approved by: grehan(mentor),allanjude(original committer)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D10378

6 years agoMFC r328799:
brooks [Mon, 12 Feb 2018 18:40:19 +0000 (18:40 +0000)]
MFC r328799:

Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32.

Stop leaking kernel pointers though theses sysctls and make sure that the
padding in the structures is zeroed on allocation to avoid other leaks.

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

6 years agoMFC r327705,r328447: Fix BERI bootloader build
kevans [Mon, 12 Feb 2018 18:30:20 +0000 (18:30 +0000)]
MFC r327705,r328447: Fix BERI bootloader build

r327705: Use <stand.h> instead of <inttypes.h> and <stdio.h> in boot code.
r328447: BERI isn't BTX, so we don't have to provide exit().

6 years agoMFC Loader Fixes 2017q4p7: r324844,r326089,r326926,r326440,r326484,r326494,
kevans [Mon, 12 Feb 2018 17:44:35 +0000 (17:44 +0000)]
MFC Loader Fixes 2017q4p7: r324844,r326089,r326926,r326440,r326484,r326494,
r326588,r326708,r326784,r326914,r327390,r328446,r326090,r326143,r326144,
r326182,r326384,r326421,r326440,r326441,r326442,r326443,r326444,r326445,
r326446,r326447,r326448,r326484,r326485,r326486,r326487,r326488,r326490,
r326491,r326492,r326493,r326494,r326495,r326504,r326507,r326509,r326584,
r326585,r326586,r326587,r326588,r326589,r326590,r326591,r326592,r326593,
r326594,r326600,r326616,r326671,r326707,r326708,r326709,r326710,r326711,
r326712,r326714,r326720,r326768,r326772,r326784,r326792,r326812,r326854,
r326855,r326856,r326858,r326886,r326887,r326914,r326926,r326927,r326960,
r326961,r326962,r326963,r327351,r327453,r327390,r327523,r327524,r326489,
r327880,r328437,r328438,r328439,r328441,r328446,r328448,r328449,r328612,
r328613,r328615

While here, undo our libfdt hack of not including <stdlib.h> if we're
compiling _STANDALONE.

r324844: When building standalone, don't define errno. Let the definition from
stand.h override. This is similar to what we do in the kernel.

r326089: loader.efi: efipart does not recognize partitionless disks

r326090: net_parse_rootpath() has no parameters

r326143: Fix theoretical integer overflow issues. If the product here is

r326144: Mark the func pointer as __dead2. It looks up loader_main, which

r326182: Modify all FreeBSD bootloaders on PowerPC AIM (Book-S) systems

r326384: Use const pointers to avoid casting away constness.

r326421: loader.efi: efipart should exclude iPXE stub block protocol

r326440: Remove stale dependency on ufsread.c

r326441: Minor flags cleanup

r326442: Cleanup CFALGS usage here

r326443: We don't need both _STAND and _STANDALONE, use the latter.

r326444: Move geli to common DO32 stuff

r326445: Fix random() and srandom() prototypes to match the standard.

r326446: Undefine _STANDALONE since this is test code.

r326447: Tweaks to the beri boot loader so that it builds w/o warnings.

r326448: Fix all warnings related to geli and ZFS support on x86.

r326484: Const poison the propname.

r326485: Delcare md_load in libofw.h. Make all prototypes match for ofw

r326486: Include machine/md_var to pick up __syncicache prototype.

r326487: Cast mdp (a vm_offset_t) to void * to match prototype.

r326488: e_entry can be smaller than a pointer. Cast it to an intptr_t

r326490: Declare our strange brand of main().

r326491: Disconnet ps3 from the build. There's too many warnings to fix.

r326492: Cast void * pointer to char * so the arg matches the %s format.

r326493: Provide a md_load64 prototype.

r326494: Mark two things as unused (since they are only sometimes used)

r326495: Now it's safe to bump WARNS to 1.

r326504: Switch to proper MK_LOADER_GELI tests.

r326507: increase maximum size of zfsboot

r326509: loader.efi: add note about iPXE into the efipart.c

r326584: When building standalone, include stand.h rather than the kernel

r326585: Include ficl.h before anything else

r326586: No need to include the userland md5.h, the kernel one is just fine.

r326587: Use the kernel relative paths, rather than the userland relative
paths

r326588: Need to include skein in the include path

r326589: Make sure we include the right path for skein.h

r326590: Prefer stdint.h to inttypes.h

r326591: This isn't NetBSD specific code. Include these for any kernel /

r326592: Don't inherit CFLAGS. This a specialized test program.

r326593: Stop building with the standard system headers.

r326594: Now that we offer a semi-sane standards-ish set of #include files,
stop hacking includes with sed.

r326600: Since this is contrib code, create an upstreamable version of my

r326616: dhcp_try_rfc1048() is not used any more

r326671: Avoid setting -Wno-tentative-definition-incomplete-type with gcc.

r326707: Add partial support signal.h functioanlity. Pull in
machine/signal.h

r326708: Remove _KERNEL hack now that errno.h does the right thing when
built standalone.

r326709: Provide implementations for iscntrl, ispunct and isgraph.

r326710: Put the files we're copying over into a few variables and clean
hings up.

r326711: Const poison a couple of interfaces.

r326712: Create interp class.

r326714: boot1.c needs EFI_ZFS_BOOT too, so add it globally.

r326720: This path belongs in ficl/Makefile, not the common defines for
users

r326768: Fix a comment to be more accurate

r326772: Fix regression with lua import

r326784: Revert part of 362772. It was causing problems for includes

r326792: Attempt to unbreak buildworld

r326812: Revert r326792, r326784, r326772, r326712

r326854: libefi: make efichar.h more usable in stand code

r326855: Cargo cut a fix for the regressions r326585 caused.

r326856: Fix comments after bump in size.

r326858: Revert r326855: Cargo cut a fix for the regressions r326585 caused.

r326886: Panic in sbrk if setheap hasn't been called yet. This is preferable
o a mysterious crash

r326887: Remove the 'mini libstand in libstand' that util.[ch] provided.

r326914: Move loader-only defines to loader.mk from defs.mk

r326926: Move loader help file definitions to being 100% inside of
loader.mk.

r326927: libficl is only ever used in a loader (never a boot) program. Move
it.

r326960: Simplify things a little. The RETURN macro isn't required.

r326961: Interact is always called with NULL. Simplify code a little

r326962: Hoist btx include stuff to i386/Makefile.inc

r326963: No need to use relative paths like this here.

r327351: Fix ubldr. uboot/lib uses defines for the loader.

r327453: Add a validbcd() routine that uses the bcd2bin_data[] array

r327390: Garbage-collect loader.ps3. It is currently disconnected from the
build and kboot replaces.

r327523: Don't clobber system LDFLAGS for beri boot loaders.

r327524: Use 'extern uint8_t' instead of 'extern void' for external symbols.

r326489: Allow this file to be used in libsa without warning...

r327880: Move getsecs() prototype to stand.h from net.h so it can be used

r328437: Split panic routine

r328438: Implement abort() as a call to panic.

r328439: Provide abs form stdlib.h.

r328441: abort() should be marked __dead2 since it won't return.

r328446: Now that exit is __dead2, we need to tag ub_exit() as __dead2.

r328448: Make exit() never return until host_exit can be written.

r328449: Tag unreachable places as such. I left the while (1); in place

r328612: Move strtold wrapper from strtol.c to its own strtold.c.

r328613: Kill copies of strtol and strtoul.

r328615: Update stand.h for changes for strto*l

PR: 223969

6 years agoMFC r325718: Fix typo in filename.
kevans [Mon, 12 Feb 2018 15:48:12 +0000 (15:48 +0000)]
MFC r325718: Fix typo in filename.

Noticed by: Shawn Webb (again)

6 years agoMFC r326666:
hselasky [Mon, 12 Feb 2018 13:59:04 +0000 (13:59 +0000)]
MFC r326666:
mlx4: Remove redundant declarations to fix GCC build

These were made redundant in r325841.

Reviewed by: hselasky
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13401

6 years agoMFC r306486-r325841:
hselasky [Mon, 12 Feb 2018 13:56:57 +0000 (13:56 +0000)]
MFC r306486-r325841:
Update the mlx4, mlx4ib(4) and mlx4en(4) drivers to match FreeBSD-head
prior to the Linux 4.9 RoCE/infiniband upgrade.

Sponsored by: Mellanox Technologies

MFC r306486:
Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4
like other PCI network drivers. The sys/ofed directory is now mainly
reserved for generic infiniband code, with exception of the mthca driver.

- Add new manual page, mlx4en(4), describing how to configure and load
mlx4en.

- All relevant driver C-files are now prefixed mlx4, mlx4_en and
mlx4_ib respectivly to avoid object filename collisions when compiling
the kernel. This also fixes an issue with proper dependency file
generation for the C-files in question.

- Device mlxen is now device mlx4en and depends on device mlx4, see
mlx4en(4). Only the network device name remains unchanged.

- The mlx4 and mlx4en modules are now built by default on i386 and
amd64 targets. Only building the mlx4ib module depends on
WITH_OFED=YES .

Sponsored by: Mellanox Technologies

MFC r310425:
mlx: avoid use of __DATE__ to make build reproducible

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D8886

MFC r310488:
mlx(4): remove date from log message

Further to r310425, go one step further and just remove the date.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D8888

MFC r324200:
Implement SIOCGIFRSS{KEY,HASH} for the mlx4en(4) driver.

Differential Revision: https://reviews.freebsd.org/D12176
Sponsored by: Mellanox Technologies

MFC r324201:
Setup mbuf hash type properly when receiving IP packets in the mlx4en(4) driver.

Submitted by: sephe@
Differential Revision: https://reviews.freebsd.org/D12229
Sponsored by: Mellanox Technologies

MFC r324621:
mlx4: use enum constants instead of const vars for case exprs

Follow up from r324201 to fix compilation with gcc, which complains
about non-ICE case expressions.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D12675

MFC r325841:
Update the mlx4 core and mlx4en(4) modules towards Linux v4.9.

Background:
The coming ibcore update forces an update of mlx4ib(4) which in turn requires
an updated mlx4 core module. This also affects the mlx4en(4) module because
commonly used APIs are updated. This commit is a middle step updating the
mlx4 modules towards the new ibcore.

This change contains no major new features.

Changes in mlx4:
  a) Improved error handling when mlx4 PCI devices are
  detached inside VMs.
  b) Major update of codebase towards Linux 4.9.

Changes in mlx4ib(4):
  a) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Changes in mlx4en(4):
  a) Update flow steering code in mlx4en to use new APIs for
  registering MAC addresses and IP addresses.
  b) Update all statistics counters to be 64-bit.
  c) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Sponsored by: Mellanox Technologies

6 years agoMFC r328876:
ae [Mon, 12 Feb 2018 12:41:53 +0000 (12:41 +0000)]
MFC r328876:
  Modify ip6_get_prevhdr() to be able use it safely.

  Instead of returning pointer to the previous header, return its offset.
  In frag6_input() use m_copyback() and determined offset to store next
  header instead of accessing to it by pointer and assuming that the memory
  is contiguous.

  In rip6_input() use offset returned by ip6_get_prevhdr() instead of
  calculating it from pointers arithmetic, because IP header can belong
  to another mbuf in the chain.

  Reported by: Maxime Villard <max at m00nbsd dot net>

6 years agoMFC r328880:
kib [Mon, 12 Feb 2018 10:34:15 +0000 (10:34 +0000)]
MFC r328880:
On munlock(), unwire correct page.

6 years agoMFC r328505,r328659: stand/fdt improvements
kevans [Mon, 12 Feb 2018 05:55:44 +0000 (05:55 +0000)]
MFC r328505,r328659: stand/fdt improvements

r328505: stand/fdt: Check /compatible property on overlay if it exists

r328659: stand/fdt: Rip out FDT VA tracking

6 years agoMFC r326038,r326069,r326072: More stand simplification and fixes
kevans [Mon, 12 Feb 2018 01:17:06 +0000 (01:17 +0000)]
MFC r326038,r326069,r326072: More stand simplification and fixes

r326038: Move some more common stuff up to Makefile.inc.

r326069: Fix gptzfsboot for cases with GELI.

r326072: Unbreak riscv build in universe.

6 years agoMFC r325834,r325997,326502: Move sys/boot to stand/
kevans [Mon, 12 Feb 2018 01:08:44 +0000 (01:08 +0000)]
MFC r325834,r325997,326502: Move sys/boot to stand/

This is effectively a direct commit to stable/11, due to differences between
stable/11 and head. Changes to DTS in sys/boot/fdt/dts were often
accompanied by kernel changes. Many of these were also risc-v updates that
likely had many more dependencies to MFC.

Because of this, sys/boot/fdt/dts remains as-is while everything else in
sys/boot relocates to stand/.

r325834: Move sys/boot to stand. Fix all references to new location

r325997: Remove empty directories.

r326502: Document the sys/boot -> stand move in hier.7 and the top-level README.