]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoImprove the way we calculate variance to reduce the rounding errors
phk [Fri, 18 Oct 2019 07:55:01 +0000 (07:55 +0000)]
Improve the way we calculate variance to reduce the rounding errors
when variance is small relative to data points.

Now [0, 1, 2] shows same standard deviation as [10000000000000, ...1, ...2]

Also:  Various nitpickery from my own tree.

4 years agopf: Must be in NET_EPOCH to call icmp_error
kp [Fri, 18 Oct 2019 03:36:26 +0000 (03:36 +0000)]
pf: Must be in NET_EPOCH to call icmp_error

icmp_reflect(), called through icmp_error() requires us to be in NET_EPOCH.
Failure to hold it leads to the following panic (with INVARIANTS):

  panic: Assertion in_epoch(net_epoch_preempt) failed at /usr/src/sys/netinet/ip_icmp.c:742
  cpuid = 2
  time = 1571233273
  KDB: stack backtrace:
  db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e0977920
  vpanic() at vpanic+0x17e/frame 0xfffffe00e0977980
  panic() at panic+0x43/frame 0xfffffe00e09779e0
  icmp_reflect() at icmp_reflect+0x625/frame 0xfffffe00e0977aa0
  icmp_error() at icmp_error+0x720/frame 0xfffffe00e0977b10
  pf_intr() at pf_intr+0xd5/frame 0xfffffe00e0977b50
  ithread_loop() at ithread_loop+0x1c6/frame 0xfffffe00e0977bb0
  fork_exit() at fork_exit+0x80/frame 0xfffffe00e0977bf0
  fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00e0977bf0

Note that we now enter NET_EPOCH twice if we enter ip_output() from pf_intr(),
but ip_output() will soon be converted to a function that requires epoch, so
entering NET_EPOCH directly from pf_intr() makes more sense.

Discussed with: glebius@

4 years agonvdimm_e820: Fix braino in size=all SPA hint
cem [Fri, 18 Oct 2019 03:01:21 +0000 (03:01 +0000)]
nvdimm_e820: Fix braino in size=all SPA hint

The sentinel value for "use the rest of the region," -1, isn't zero modulo
PAGE_SIZE.  Relax the check to permit the intended special value.

X-MFC-With: r353110
Sponsored by: Dell EMC Isilon

4 years agox86: Remove unused variable from r353712
cem [Fri, 18 Oct 2019 02:25:30 +0000 (02:25 +0000)]
x86: Remove unused variable from r353712

It was in my git tree (uncommitted) and didn't get carried over to SVN in
r353712.

X-MFC-With: r353712

4 years agox86: Fetch and save standard CPUID leaf 6 in identcpu
cem [Fri, 18 Oct 2019 02:18:17 +0000 (02:18 +0000)]
x86: Fetch and save standard CPUID leaf 6 in identcpu

Rather than a few scattered places in the tree.  Organize flag names in a
contiguous region of specialreg.h.

While here, delete deprecated PCOMMIT from leaf 7.

No functional change.

4 years agoFix build of LLVM RISC-V backend
mhorne [Fri, 18 Oct 2019 01:46:38 +0000 (01:46 +0000)]
Fix build of LLVM RISC-V backend

Reviewed by: dim
MFC with: r353358
Differential Revision: https://reviews.freebsd.org/D21963

4 years agoRemove obsolete, non-use of CLANG_NO_IAS.
brooks [Fri, 18 Oct 2019 00:00:17 +0000 (00:00 +0000)]
Remove obsolete, non-use of CLANG_NO_IAS.

CLANG_NO_IAS was removed in r351661.

4 years agogdb(4): Implement support for NoAckMode
cem [Thu, 17 Oct 2019 22:37:25 +0000 (22:37 +0000)]
gdb(4): Implement support for NoAckMode

When the underlying debugport transport is reliable, GDB's additional
checksums and acknowledgements are redundant.  NoAckMode eliminates the
the acks and allows us to skip checking RX checksums.  The GDB packet
framing does not change, so unfortunately (valid) checksums are still
included as message trailers.

The gdb(4) stub in FreeBSD advertises support for the feature in response to
the client's 'qSupported' request IFF the current debugport has the
gdb_dbfeatures flag GDB_DBGP_FEAT_RELIABLE set.  Currently, only netgdb(4)
supports this feature.

If the remote GDB client supports the feature and does not have it disabled
via a GDB configuration knob, it may instruct our gdb(4) stub to enter
NoAckMode.  Unless and until it issues that command, we must continue to
transmit acks as usual (and for now, we continue to wait until we receive
them as well, even if we know the debugport is on a reliable transport).

In the kernel sources, the sense of the flag representing the state of the
feature is reversed from that of the GDB command.  (I.e., it is
'gdb_ackmode', not 'gdb_noackmode.')  This is to avoid confusing double-
negative conditions.

For reference, see:
  * https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html
  * https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#QStartNoAckMode

Reviewed by: jhb, markj (both earlier version)
Differential Revision: https://reviews.freebsd.org/D21761

4 years agoAdd an ldscript for amd64 kernel modules.
markj [Thu, 17 Oct 2019 21:39:23 +0000 (21:39 +0000)]
Add an ldscript for amd64 kernel modules.

Use it to pad the text and read-only data sections to a 4KB boundary.
This will be used to enforce strict memory protections for some
sections of loadable kernel modules.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21970

4 years agoImplement NetGDB(4)
cem [Thu, 17 Oct 2019 21:33:01 +0000 (21:33 +0000)]
Implement NetGDB(4)

NetGDB(4) is a component of a system using a panic-time network stack to
remotely debug crashed FreeBSD kernels over the network, instead of
traditional serial interfaces.

There are three pieces in the complete NetGDB system.

First, a dedicated proxy server must be running to accept connections from
both NetGDB and gdb(1), and pass bidirectional traffic between the two
protocols.

Second, the NetGDB client is activated much like ordinary 'gdb' and
similarly to 'netdump' in ddb(4) after a panic.  Like other debugnet(4)
clients (netdump(4)), the network interface on the route to the proxy server
must be online and support debugnet(4).

Finally, the remote (k)gdb(1) uses 'target remote <proxy>:<port>' (like any
other TCP remote) to connect to the proxy server.

The NetGDB v1 protocol speaks the literal GDB remote serial protocol, and
uses a 1:1 relationship between GDB packets and sequences of debugnet
packets (fragmented by MTU).  There is no encryption utilized to keep
debugging sessions private, so this is only appropriate for local
segments or trusted networks.

Submitted by: John Reimer <john.reimer AT emc.com> (earlier version)
Discussed some with: emaste, markj
Relnotes: sure
Differential Revision: https://reviews.freebsd.org/D21568

4 years agoClean up some nits in link_elf_(un)load_file().
markj [Thu, 17 Oct 2019 21:25:50 +0000 (21:25 +0000)]
Clean up some nits in link_elf_(un)load_file().

- Remove a redundant assignment of ef->address.
- Don't return a Mach error number to the caller if vm_map_find() fails.
- Use ptoa() and fix style.

MFC after: 2 weeks
Sponsored by: Netflix

4 years agoBelatedly bump __FreeBSD_version for r353537 and related commits.
markj [Thu, 17 Oct 2019 20:46:33 +0000 (20:46 +0000)]
Belatedly bump __FreeBSD_version for r353537 and related commits.

At least one small update to the out-of-tree DRM drivers is required
now that cdev_pager_free_page() expects an xbusy page.

Discussed with: jeff, zeising

4 years agoAllow loader.efi to identify non-standard boot setup
sjg [Thu, 17 Oct 2019 20:40:06 +0000 (20:40 +0000)]
Allow loader.efi to identify non-standard boot setup

PATH_BOOTABLE_TOKEN can be set to a non-standard
path that identifies a device as bootable.

Reviewed by: kevans, bcran
Differential Revision:  https://reviews.freebsd.org/D22062

4 years agodebugnet(4): Add optional full-duplex mode
cem [Thu, 17 Oct 2019 20:25:15 +0000 (20:25 +0000)]
debugnet(4): Add optional full-duplex mode

It remains unattached to any client protocol.  Netdump is unaffected
(remaining half-duplex).  The intended consumer is NetGDB.

Submitted by: John Reimer <john.reimer AT emc.com> (earlier version)
Discussed with: markj
Differential Revision: https://reviews.freebsd.org/D21541

4 years agoRevert two parts of r353292 that enter epoch when processing vlan capabilities.
glebius [Thu, 17 Oct 2019 20:18:07 +0000 (20:18 +0000)]
Revert two parts of r353292 that enter epoch when processing vlan capabilities.
It could be that entering epoch isn't necessary here, but better take a
conservative approach.

Submitted by: kp

4 years agodebugnet(4): Infer non-server connection parameters
cem [Thu, 17 Oct 2019 20:10:32 +0000 (20:10 +0000)]
debugnet(4): Infer non-server connection parameters

Loosen requirements for connecting to debugnet-type servers.  Only require a
destination address; the rest can theoretically be inferred from the routing
table.

Relax corresponding constraints in netdump(4) and move ifp validation to
debugnet connection time.

Submitted by: John Reimer <john.reimer AT emc.com> (earlier version)
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D21482

4 years agoacpica: Fix for the fix, unfortunately
cem [Thu, 17 Oct 2019 19:53:55 +0000 (19:53 +0000)]
acpica: Fix for the fix, unfortunately

Follow-up to incomplete pedantic change in r353691 by actually fixing the
default implementation to match the interface type.  Mea culpa.

X-MFC-With: r353691, r339754

4 years agoAdd ddb(4) 'netdump' command to netdump a core without preconfiguration
cem [Thu, 17 Oct 2019 19:49:20 +0000 (19:49 +0000)]
Add ddb(4) 'netdump' command to netdump a core without preconfiguration

Add a 'X -s <server> -c <client> [-g <gateway>] -i <interface>' subroutine
to the generic debugnet code.  The imagined use is both netdump, shown here,
and NetGDB (vaporware).  It uses the ddb(4) lexer, with some new extensions,
to parse out IPv4 addresses.

'Netdump' uses the generic debugnet routine to load a configuration and
start a dump, without any netdump configuration prior to panic.

Loosely derived from work by: John Reimer <john.reimer AT emc.com>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D21460

4 years agoacpica: Match ID_PROBE default implementation to interface
cem [Thu, 17 Oct 2019 18:45:11 +0000 (18:45 +0000)]
acpica: Match ID_PROBE default implementation to interface

After r339754, the additional interface parameter was accidentally left out
of the default acpi_generic_id_probe implementation.  Apparently this does
not cause any real problems, so this fix is mostly stylistic.

No functional change intended.

X-MFC-With: r339754

4 years agoAdd a very limited DDB dumpon(8)-alike to MI dumper code
cem [Thu, 17 Oct 2019 18:29:44 +0000 (18:29 +0000)]
Add a very limited DDB dumpon(8)-alike to MI dumper code

This allows ddb(4) commands to construct a static dumperinfo during
panic/debug and invoke doadump(false) using the provided dumper
configuration (always inserted first in the list).

The intended usecase is a ddb(4)-time netdump(4) command.

Reviewed by: markj (earlier version)
Differential Revision: https://reviews.freebsd.org/D21448

4 years agodebugnet: Respond to broadcast ARP requests
cem [Thu, 17 Oct 2019 17:48:32 +0000 (17:48 +0000)]
debugnet: Respond to broadcast ARP requests

The in-tree netdump code has always ignored non-directed ARP requests, and
that seems to work most of the time for netdump.

In my work and testing on NetGDB, it seems like sometimes the remote FreeBSD
conversant (the non-panic system) will send broadcast-destination ARP
requests to the debugnet kernel; without this change, those are dropped and
the remote will see EHOSTDOWN "Host is down" errors from the userspace
interface of the network stack.

Discussed with: markj

4 years agodebugnet(4): Check hardware-validated UDP checksums
cem [Thu, 17 Oct 2019 17:19:16 +0000 (17:19 +0000)]
debugnet(4): Check hardware-validated UDP checksums

Similar to INET checksums, lazily validate UDP checksums when the driver has
already performed the check for us.  Like debugnet(4) INET checksums,
validation in software is left as future work.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D21745

4 years agoQuickly fix up r353683: enter the epoch before calling into netisr_dispatch().
glebius [Thu, 17 Oct 2019 17:02:50 +0000 (17:02 +0000)]
Quickly fix up r353683: enter the epoch before calling into netisr_dispatch().

4 years agoUpdate Conrad Meyer's email
emaste [Thu, 17 Oct 2019 16:38:44 +0000 (16:38 +0000)]
Update Conrad Meyer's email

cem is now a committer

Approved by: cem

4 years agoSplit out a more generic debugnet(4) from netdump(4)
cem [Thu, 17 Oct 2019 16:23:03 +0000 (16:23 +0000)]
Split out a more generic debugnet(4) from netdump(4)

Debugnet is a simplistic and specialized panic- or debug-time reliable
datagram transport.  It can drive a single connection at a time and is
currently unidirectional (debug/panic machine transmit to remote server
only).

It is mostly a verbatim code lift from netdump(4).  Netdump(4) remains
the only consumer (until the rest of this patch series lands).

The INET-specific logic has been extracted somewhat more thoroughly than
previously in netdump(4), into debugnet_inet.c.  UDP-layer logic and up, as
much as possible as is protocol-independent, remains in debugnet.c.  The
separation is not perfect and future improvement is welcome.  Supporting
INET6 is a long-term goal.

Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to
'debugnet_' or 'dn_' -- sorry.  I thought keeping the netdump name on the
generic module would be more confusing than the refactoring.

The only functional change here is the mbuf allocation / tracking.  Instead
of initiating solely on netdump-configured interface(s) at dumpon(8)
configuration time, we watch for any debugnet-enabled NIC for link
activation and query it for mbuf parameters at that time.  If they exceed
the existing high-water mark allocation, we re-allocate and track the new
high-water mark.  Otherwise, we leave the pre-panic mbuf allocation alone.
In a future patch in this series, this will allow initiating netdump from
panic ddb(4) without pre-panic configuration.

No other functional change intended.

Reviewed by: markj (earlier version)
Some discussion with: emaste, jhb
Objection from: marius
Differential Revision: https://reviews.freebsd.org/D21421

4 years agoigmp_v1v2_queue_report() doesn't require epoch.
glebius [Thu, 17 Oct 2019 16:02:34 +0000 (16:02 +0000)]
igmp_v1v2_queue_report() doesn't require epoch.

4 years agosnd_hda: style(9) whitespace fixup
emaste [Thu, 17 Oct 2019 14:58:03 +0000 (14:58 +0000)]
snd_hda: style(9) whitespace fixup

PR: 241299
Submitted by: Neel Chauhan

4 years agoswapon_check_swzone(): use already calculated static variables.
kib [Thu, 17 Oct 2019 13:49:47 +0000 (13:49 +0000)]
swapon_check_swzone(): use already calculated static variables.

Submitted by: ota@j.email.ne.jp
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22065

4 years agovt: remove comment that is not true since r259680
emaste [Thu, 17 Oct 2019 13:08:50 +0000 (13:08 +0000)]
vt: remove comment that is not true since r259680

r259680 added support to vt(4) for printing double-width characters.
Remove the comment that claims no support.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agodocument taskqueue_start_threads_in_proc
avg [Thu, 17 Oct 2019 06:58:07 +0000 (06:58 +0000)]
document taskqueue_start_threads_in_proc

While here, fix taskqueue_start_threads_cpuset that was documented under
old name of taskqueue_start_threads_pinned.

MFC after: 4 weeks

4 years agoprovide a way to assign taskqueue threads to a kernel process
avg [Thu, 17 Oct 2019 06:32:34 +0000 (06:32 +0000)]
provide a way to assign taskqueue threads to a kernel process

This can be used to group all threads belonging to a single logical
entity under a common kernel process.
I am planning to use the new interface for ZFS threads.

MFC after: 4 weeks

4 years agowbwd: small clean-ups and improvements
avg [Thu, 17 Oct 2019 06:21:09 +0000 (06:21 +0000)]
wbwd: small clean-ups and improvements

This change applies some suggestions by delphij from D21979.
A write-only variable is removed.
There is a diagnostic message if the driver does not recognize the chip.
A chained if-statement is converted to a switch.

MFC after: 3 weeks

4 years agoether: add older ethertype definitions for QinQ
philip [Thu, 17 Oct 2019 00:34:53 +0000 (00:34 +0000)]
ether: add older ethertype definitions for QinQ

Older network equipment used the ethertypes 0x9100, 0x9200, and 0x9300 for
outer VLANs, before standardisation introduced 0x88a8.

Submitted by:  Lutz Donnerhacke <lutz_donnerhacke.de>
Differential Revision: https://reviews.freebsd.org/D21846

4 years agoFormalize the use of linker scripts for kernel modules.
markj [Wed, 16 Oct 2019 22:19:56 +0000 (22:19 +0000)]
Formalize the use of linker scripts for kernel modules.

Automatically apply ldscript.kmod.${MACHINE_ARCH} if it exists.
We already have an i386-specific linker script; rename it accordingly.

Note that the linker script is applied when the object files are
partially linked.  (For amd64 this is also the final link.)

Reviewed by: imp, kib
Discussed with: jhb
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21887

4 years agoIntroduce pmap_change_prot() for amd64.
markj [Wed, 16 Oct 2019 22:12:34 +0000 (22:12 +0000)]
Introduce pmap_change_prot() for amd64.

This updates the protection attributes of subranges of the kernel map.
Unlike pmap_protect(), which is typically used for user mappings,
pmap_change_prot() does not perform lazy upgrades of protections.
pmap_change_prot() also updates the aliasing range of the direct map.

Reviewed by: kib
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21758

4 years agoUse KOBJMETHOD_END in the kernel linker.
markj [Wed, 16 Oct 2019 22:06:19 +0000 (22:06 +0000)]
Use KOBJMETHOD_END in the kernel linker.

MFC after: 1 week

4 years agoRemove page locking from pmap_mincore().
markj [Wed, 16 Oct 2019 22:03:27 +0000 (22:03 +0000)]
Remove page locking from pmap_mincore().

After r352110 the page lock no longer protects a page's identity, so
there is no purpose in locking the page in pmap_mincore().  Instead,
if vm.mincore_mapped is set to the non-default value of 0, re-lookup
the page after acquiring its object lock, which holds the page's
identity stable.

The change removes the last callers of vm_page_pa_tryrelock(), so
remove it.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21823

4 years agoMake all the gnop parameters optional in the request from userland,
chs [Wed, 16 Oct 2019 21:49:44 +0000 (21:49 +0000)]
Make all the gnop parameters optional in the request from userland,
filling in the same defaults that the current userland module uses.
This allows an old geom_nop.so userland module to work with a new kernel.

Approved by: imp (mentor)
Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21972

4 years agoAdd a new gctl_get_paraml_opt() interface to extract optional parameters from
chs [Wed, 16 Oct 2019 21:49:39 +0000 (21:49 +0000)]
Add a new gctl_get_paraml_opt() interface to extract optional parameters from
the request.  It is the same as gctl_get_paraml() except that the request
is not marked with an error if the parameter is not present.

Approved by: imp (mentor)
Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21972

4 years agoCorrect the range boundaries used by kern_mincore().
markj [Wed, 16 Oct 2019 21:47:58 +0000 (21:47 +0000)]
Correct the range boundaries used by kern_mincore().

Reported by: alc
Sponsored by: Netflix

4 years agoPort r353622 to sparc64 and arm v4.
kib [Wed, 16 Oct 2019 21:07:18 +0000 (21:07 +0000)]
Port r353622 to sparc64 and arm v4.

Noted by: alc
Reviewed by: alc, jeff, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D22056

4 years agolibbe(3): Fix destroy of imported BE w/ AUTOORIGIN
kevans [Wed, 16 Oct 2019 18:33:31 +0000 (18:33 +0000)]
libbe(3): Fix destroy of imported BE w/ AUTOORIGIN

Imported BE, much like the activated BE, will not have an origin that we can
fetch/examine for destruction. be_destroy should not return BE_ERR_NOORIGIN
for failure to get the origin property for BE_DESTROY_AUTOORIGIN, because
we don't really know going into it that there's even an origin to be
destroyed.

BE_DESTROY_NEEDORIGIN has been renamed to BE_DESTROY_WANTORIGIN because only
a subset of it *needs* the origin, so 'need' is too strong of verbiage.

This was caught by jenkins and the bectl tests, but kevans failed to run the
bectl tests prior to commit.

Reported by: lwhsu

4 years agoddb: Add support for disassembling 'crc32' on amd64
cem [Wed, 16 Oct 2019 18:27:27 +0000 (18:27 +0000)]
ddb: Add support for disassembling 'crc32' on amd64

4 years agoFix compile error introduced in r353658
erj [Wed, 16 Oct 2019 18:12:22 +0000 (18:12 +0000)]
Fix compile error introduced in r353658

"adapter" doesn't exist in ixl.

Reported by: O. Hartmann <ohartmann@walstatt.org>

4 years agoInstall bsd.compat.mk.
brooks [Wed, 16 Oct 2019 17:21:18 +0000 (17:21 +0000)]
Install bsd.compat.mk.

Reported by: glebius

4 years agoixl: report whether device received pause frames
erj [Wed, 16 Oct 2019 17:19:17 +0000 (17:19 +0000)]
ixl: report whether device received pause frames

From Jake:
When updating the device statistics, report whether or not we have
received any pause frames to the iflib stack. This allows the iflib
stack to avoid generating a Tx hang message while the device is paused.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: gallatin@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21870

4 years agoix: report isc_pause_frames during stat update
erj [Wed, 16 Oct 2019 17:16:32 +0000 (17:16 +0000)]
ix: report isc_pause_frames during stat update

From Jake:
Notify the iflib stack of whether we received any pause frames during
the timer window. This allows the stack to avoid reporting a Tx hang due
to the device being paused.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: gallatin@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21869

4 years agoe1000: correctly set isc_pause_frames only when XOFF increases
erj [Wed, 16 Oct 2019 17:13:46 +0000 (17:13 +0000)]
e1000: correctly set isc_pause_frames only when XOFF increases

From Jake:
The e1000 driver sets the iflib shared context isc_pause_frames value to
the number of received xoff frames. This is done so that the iflib
watchdog timer won't trigger a Tx Hang due to pause frames.

Unfortunately, the function simply sets it to the value of the xoffrxc
counter. Once the device has received a single XOFF packet, the driver
always reports that we received pause frames. This will prevent the Tx
hang detection entirely from that point on.

Fix this by assigning isc_pause_frames to a non-zero value if we
received any XOFF packets in the last timer interval.

We could attempt to calculate the total number of received packets by
doing a subtraction, but the iflib stack only seems to check if
isc_pause_frames is non-zero.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: gallatin@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21868

4 years agoEnsure lld respects the WITH/WITHOUT_SHARED_TOOLCHAIN option
dim [Wed, 16 Oct 2019 17:11:18 +0000 (17:11 +0000)]
Ensure lld respects the WITH/WITHOUT_SHARED_TOOLCHAIN option

Traditionally, toolchain components such as cc, as, and ld have been
built as static executables.  The WITH_SHARED_TOOLCHAIN option from
src.conf(5) is meant to link these as regular executables, e.g. using
shared libraries.

The build of ld.lld did not yet check this option.  Fix the Makefile so
it will do so now.

Reported by: Mike Cui <cuicui@gmail.com>
PR: 241257
MFC after: 3 days

4 years agodo_link_state_change() is executed in taskqueue context and in
glebius [Wed, 16 Oct 2019 16:32:58 +0000 (16:32 +0000)]
do_link_state_change() is executed in taskqueue context and in
general is allowed to sleep.  Don't enter the epoch for the
whole duration.  If some event handlers need the epoch, they
should handle that theirselves.

Discussed with: hselasky

4 years agoUpdate some comments; no functional changes. Some historical old comments
ian [Wed, 16 Oct 2019 16:26:35 +0000 (16:26 +0000)]
Update some comments; no functional changes.  Some historical old comments
in this driver indicate that the SD_CAPA register is write-once and after
being set one time the values in it cannot be changed.  That turns out not
to be the case -- the values written to it survive a reset, but they can
be rewritten/changed at any time.

4 years agoRevert r351218 (by manu). While the changes in r351218 appear to be (and
ian [Wed, 16 Oct 2019 16:19:21 +0000 (16:19 +0000)]
Revert r351218 (by manu).  While the changes in r351218 appear to be (and
should be) correct, they lead to the eMMC on a Beaglebone failing to work
in some situations.

The TI sdhci hardware is kind of strange.  The first device inherently
supports 1.8v and 3.3v and the abililty to switch between them, and the
other two devices must be set to 1.8v in the sdhci power control register to
operate correctly, but doing so actually makes them run at 3.3v (unless an
external level-shifter is present in the signal path).  Even the 1.8v on the
first device may actually be 3.3v (or any other value), depending on what
voltage is fed to the VDDS1-VDDS7 power supply pins on the am335x chip.

Another strange quirk is that the convention for am335x sdhci drivers in
linux and uboot and the am335x boot ROM seems to be to set the voltage in
the sdhci capabilities register to 3.0v even though the actual voltage is
3.3v.  Why this is done is a complete mystery to me, but it seems to be
required for correct operation.

If we had complete modern support for the am335x chip we could get the
actual voltages from the FDT data and the regulator framework.  But our
am335x code currently doesn't have any regulator framework support.
Reverting to the prior code will get the popular Beaglebone boards working
again.

This is part of the fix for PR 241301, but also requires r353651 for a
complete fix.

PR: 241301
Discussed with: manu

4 years agoRelax the sdhci(4) check that filters out the 1.8v voltage option unless
ian [Wed, 16 Oct 2019 16:03:19 +0000 (16:03 +0000)]
Relax the sdhci(4) check that filters out the 1.8v voltage option unless
the slot is flagged as 'embedded'.

The features related to embedded and shared slots were added in v3.0 of
the sdhci spec.  Hardware prior to v3 sometimes supported 1.8v on non-
removable devices in embedded systems, but had no way to indicate that
via the standard sdhci registers (instead they use out of band metadata
such as FDT data).

This change adds the controller specification version to the check for
whether to filter out the 1.8v selection.  On older hardware, the 1.8v
option is allowed to remain.  On 3.0 or later it still requires the
embedded-slot flag to remain.

This is part of the fix for PR 241301 (eMMC not detected on Beaglebone).
Changes to the sdhci_ti driver are also needed for a full fix.

PR: 241301

4 years agoClear PGA_WRITEABLE in moea_pvo_remove().
markj [Wed, 16 Oct 2019 15:50:12 +0000 (15:50 +0000)]
Clear PGA_WRITEABLE in moea_pvo_remove().

moea_pvo_remove() might remove the last mapping of a page, in which case
it is clearly no longer writeable.  This can happen via pmap_remove(),
or when a CoW fault removes the last mapping of the old page.

Reported and tested by: bdragon
Reviewed by: alc, bdragon, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22044

4 years agofix section number in zfs-program.8
avg [Wed, 16 Oct 2019 15:21:05 +0000 (15:21 +0000)]
fix section number in zfs-program.8

MFC after: 3 days

4 years agoattach itwd to the module build on x86
avg [Wed, 16 Oct 2019 15:01:44 +0000 (15:01 +0000)]
attach itwd to the module build on x86

MFC after: 19 days
X-MFC with: r353647

4 years agoitwd(4): driver for watchdog function in ITE Super I/O chips
avg [Wed, 16 Oct 2019 14:57:38 +0000 (14:57 +0000)]
itwd(4): driver for watchdog function in ITE Super I/O chips

The chips are commonly named with "IT" prefix.

MFC after: 19 days

4 years agobectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified
kevans [Wed, 16 Oct 2019 14:55:56 +0000 (14:55 +0000)]
bectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified

-o will force the origin to be destroyed unconditionally.
BE_DESTROY_AUTOORIGIN, on the other hand, will only destroy the origin if it
matches the format used by be_snapshot. This lets us clean up the snapshots
that are clearly not user-managed (because we're creating them) while
leaving user-created snapshots in place and warning that they're still
around when the BE created goes away.

4 years agowbwd: move to superio(4) bus
avg [Wed, 16 Oct 2019 14:46:04 +0000 (14:46 +0000)]
wbwd: move to superio(4) bus

This allows to remove a bunch of low level code.
Also, superio(4) provides safer interaction with other drivers
that work with Super I/O configuration registers.

Tested only on PCengines APU2:
superio0: <Nuvoton NCT5104D/NCT6102D/NCT6106D (rev. B+)> at port 0x2e-0x2f on isa0
wbwd0: <Nuvoton NCT6102 (0xc4/0x53) Watchdog Timer> at WDT ldn 0x08 on superio0

The watchdog output is incorrectly wired on that system and the watchdog
does not really do it its job, but the pulse can be seen with a signal
analyzer.

Reviewed by: delphij, bcr (man page)
MFC after: 19 days
Differential Revision: https://reviews.freebsd.org/D21979

4 years agolibbe(3): add needed bits for be_destroy to auto-destroy some origins
kevans [Wed, 16 Oct 2019 14:43:05 +0000 (14:43 +0000)]
libbe(3): add needed bits for be_destroy to auto-destroy some origins

New BEs can be created from either an existing snapshot or an existing BE.
If an existing BE is chosen (either implicitly via 'bectl create' or
explicitly via 'bectl create -e foo bar', for instance), then bectl will
create a snapshot of the current BE or "foo" with be_snapshot, with a name
formatted like: strftime("%F-%T") and a serial added to it.

This commit adds the needed bits for libbe or consumers to determine if a
snapshot names matches one of these auto-created snapshots (with some light
validation of the date/time/serial), and also a be_destroy flag to specify
that the origin should be automatically destroyed if possible.

A future commit to bectl will specify BE_DESTROY_AUTOORIGIN by default so we
clean up the origin in the most common case, non-user-managed snapshots.

4 years agomove nctgpio to superio(4) bus
avg [Wed, 16 Oct 2019 14:42:49 +0000 (14:42 +0000)]
move nctgpio to superio(4) bus

This is where it logically belongs.
The change allows to drop a bunch of low lewel code.

Reviewed by: gonzo
MFC after: 19 days
Differential Revision: https://reviews.freebsd.org/D21980

4 years agodwc3: Use a pair of ()'s around arguments for some macros
manu [Wed, 16 Oct 2019 13:53:53 +0000 (13:53 +0000)]
dwc3: Use a pair of ()'s around arguments for some macros

Reported by: hselasky
MFC after: 1 week
X-MFC-With: r353533

4 years agoUse tables to store the information to decode the arm64 ID registers.
andrew [Wed, 16 Oct 2019 13:30:28 +0000 (13:30 +0000)]
Use tables to store the information to decode the arm64 ID registers.

Arm updates these with each new architecture revision. To help keep them
updated use a collection of tables to hold the needed information to
decode these registers.

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

4 years agoStop leaking information from the kernel through timespec
andrew [Wed, 16 Oct 2019 13:21:01 +0000 (13:21 +0000)]
Stop leaking information from the kernel through timespec

The timespec struct holds a seconds value in a time_t and a nanoseconds
value in a long. On most architectures these are the same size, however
on 32-bit architectures other than i386 time_t is 8 bytes and long is
4 bytes.

Most ABIs will then pad a struct holding an 8 byte and 4 byte value to
16 bytes with 4 bytes of padding. When copying one of these structs the
compiler is free to copy the padding if it wishes.

In this case the padding may contain kernel data that is then leaked to
userspace. Fix this by copying the timespec elements rather than the
entire struct.

This doesn't affect Tier-1 architectures so no SA is expected.

admbugs: 651
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agobsd.compat.mk isn't setup to be included outside of Makefile.inc so comment it
imp [Wed, 16 Oct 2019 13:20:36 +0000 (13:20 +0000)]
bsd.compat.mk isn't setup to be included outside of Makefile.inc so comment it
out here until that's sorted out. Otherwise the build is broken. when
TARGET_ARCH isn't defined.

4 years agoMFV r353637: 10844 Serialize ZTHR operations to eliminate races
avg [Wed, 16 Oct 2019 09:29:01 +0000 (09:29 +0000)]
MFV r353637: 10844 Serialize ZTHR operations to eliminate races

illumos/illumos-gate@6a316e1f6d32750bb8fcf2558dcb17b90ca580fd
https://github.com/illumos/illumos-gate/commit/6a316e1f6d32750bb8fcf2558dcb17b90ca580fd

https://www.illumos.org/issues/10844
  ZoL 61c3391acc9 Serialize ZTHR operations to eliminate races

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>
Obtained from: illumos, ZoL
MFC after: 3 weeks

4 years agoMFV r353630: 10809 Performance optimization of AVL tree comparator functions
avg [Wed, 16 Oct 2019 09:20:08 +0000 (09:20 +0000)]
MFV r353630: 10809 Performance optimization of AVL tree comparator functions

illumos/illumos-gate@c4ab0d3f46036e85ad0700125c5a83cc139f55a3
https://github.com/illumos/illumos-gate/commit/c4ab0d3f46036e85ad0700125c5a83cc139f55a3

https://www.illumos.org/issues/10809
  Port ZoL ee36c709c3d Performance optimization of AVL tree comparator functions

This is a followup to r337567 that imported the ZoL commit directly into
FreeBSD.  It seems that at the time we did not have some of the earlier
changes, so some pieces of the ZoL change were not applicable.  Also,
the illumos version got a few style cleanups.  Some changes were missed
or incorrectly merged (e.g., vdev_cache_lastused_compare and
metaslab_rangesize_compare).

Obtained from: ZoL, illumos
MFC after: 25 days
X-MFC after: r353634

4 years agoFix panic in network stack due to use after free when receiving
hselasky [Wed, 16 Oct 2019 09:11:49 +0000 (09:11 +0000)]
Fix panic in network stack due to use after free when receiving
partial fragmented packets before a network interface is detached.

When sending IPv4 or IPv6 fragmented packets and a fragment is lost
before the network device is freed, the mbuf making up the fragment
will remain in the temporary hashed fragment list and cause a panic
when it times out due to accessing a freed network interface
structure.

1) Make sure the m_pkthdr.rcvif always points to a valid network
interface. Else the rcvif field should be set to NULL.

2) Use the rcvif of the last received fragment as m_pkthdr.rcvif for
the fully defragged packet, instead of the first received fragment.

Panic backtrace for IPv6:

panic()
icmp6_reflect() # tries to access rcvif->if_afdata[AF_INET6]->xxx
icmp6_error()
frag6_freef()
frag6_slowtimo()
pfslowtimo()
softclock_call_cc()
softclock()
ithread_loop()

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D19622
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoMFV r348596: 9689 zfs range lock code should not be zpl-specific
avg [Wed, 16 Oct 2019 09:04:53 +0000 (09:04 +0000)]
MFV r348596: 9689 zfs range lock code should not be zpl-specific

illumos/illumos-gate@7931524763ef94dc16989451dddd206563d03bb4

FreeBSD note: some tweaking was needed to avoid a conflict with
sys/rangelock.h.

Author: Matthew Ahrens <mahrens@delphix.com>
Obtained from: illumos
MFC after: 3 weeks

4 years agoVLAN_TRUNKDEV() requires epochification in ibcore after r353292.
hselasky [Wed, 16 Oct 2019 08:56:07 +0000 (08:56 +0000)]
VLAN_TRUNKDEV() requires epochification in ibcore after r353292.

Sponsored by: Mellanox Technologies

4 years agoReplace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore.
hselasky [Wed, 16 Oct 2019 08:55:29 +0000 (08:55 +0000)]
Replace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore.
This reduces the number of references to VLAN_TRUNKDEV() in ibcore.
Currently only VLAN is supported as a child interface in FreeBSD.
Remove superfluous RCU locking.

Sponsored by: Mellanox Technologies

4 years agoVLAN_DEVAT() requires epochification in ipoib after r353292.
hselasky [Wed, 16 Oct 2019 08:40:58 +0000 (08:40 +0000)]
VLAN_DEVAT() requires epochification in ipoib after r353292.

Sponsored by: Mellanox Technologies

4 years agoMFV r353628:
avg [Wed, 16 Oct 2019 07:57:58 +0000 (07:57 +0000)]
MFV r353628:

10842 Mutex leak in dsl_dataset_hold_obj()

illumos/illumos-gate@ad027c0ff9612bff8f47b43d8561da627f80cd29
https://github.com/illumos/illumos-gate/commit/ad027c0ff9612bff8f47b43d8561da627f80cd29

https://www.illumos.org/issues/10842
  ZoL d10b2f1d35b Mutex leak in dsl_dataset_hold_obj()

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Jorgen Lundman <lundman@lundman.net>
Obtained from: illumos, ZoL
MFC after: 15 days

4 years agofix wording / typos in r353625
avg [Wed, 16 Oct 2019 07:53:47 +0000 (07:53 +0000)]
fix wording / typos in r353625

Reported by: kib
MFC after: 4 weeks
X-MFC with: r353625, r353618

4 years agozfs: add a lame emulation of cv_wait_sig(9) in userland to fix r353618
avg [Wed, 16 Oct 2019 07:41:33 +0000 (07:41 +0000)]
zfs: add a lame emulation of cv_wait_sig(9) in userland to fix r353618

Not sure if we need anything better.
Maybe we should try to port illumos libfakekernel or provide something
similar natively.

MFC after: 4 weeks
X-MFC with: r353618

4 years agoMFV r353623: 10473 zfs(1M) missing cross-reference to zfs-program(1M)
avg [Wed, 16 Oct 2019 07:20:59 +0000 (07:20 +0000)]
MFV r353623: 10473 zfs(1M) missing cross-reference to zfs-program(1M)

illumos/illumos-gate@736e6700391d17ab1494985a80076fc185722699
https://github.com/illumos/illumos-gate/commit/736e6700391d17ab1494985a80076fc185722699

https://www.illumos.org/issues/10473

Author: Jason King <jason.king@joyent.com>
Obtained from: illumos
MFC after: 6 days

4 years agoFix assert in PowerPC pmaps after introduction of object busy.
kib [Wed, 16 Oct 2019 07:09:15 +0000 (07:09 +0000)]
Fix assert in PowerPC pmaps after introduction of object busy.

The VM_PAGE_OBJECT_BUSY_ASSERT() in pmap_enter() implementation should
be only asserted when the code is executed as result of pmap_enter(),
not when the same code is entered from e.g. pmap_enter_quick().  This
is relevant for all PowerPC pmap variants, because mmu_*_enter() is
used as the backend, and assert is located there.

Add a PowerPC private pmap_enter() PMAP_ENTER_QUICK_LOCKED flag to
indicate that the call is not from pmap_enter().  For non-quick-locked
calls, assert that the object is locked.

Reported and tested by: bdragon
Reviewed by: alc, bdragon, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D22041

4 years agoMFV r353619: 9691 fat zap should prefetch when iterating
avg [Wed, 16 Oct 2019 07:09:00 +0000 (07:09 +0000)]
MFV r353619: 9691 fat zap should prefetch when iterating

illumos/illumos-gate@52abb70e073c2a88808c0d66fd810ba8c5080572
https://github.com/illumos/illumos-gate/commit/52abb70e073c2a88808c0d66fd810ba8c5080572

https://www.illumos.org/issues/9691
  When iterating over a ZAP object, we're almost always certain to
  iterate over the entire object. If there are multiple leaf blocks, we
  can realize a performance win by issuing reads for all the leaf blocks
  in parallel when the iteration begins.
  For example, if we have 10,000 snapshots, "zfs destroy -nv
  pool/fs@1%9999" can take 30 minutes when the cache is cold. This
  change provides a >3x performance improvement, by issuing the reads
  for all ~64 blocks of each ZAP object in parallel.

Author: Matthew Ahrens <mahrens@delphix.com>
Obtained from: illumos
MFC after: 2 weeks

4 years agoMFV r353617: 9425 allow channel programs to be stopped via signals
avg [Wed, 16 Oct 2019 07:00:18 +0000 (07:00 +0000)]
MFV r353617: 9425 allow channel programs to be stopped via signals

illumos/illumos-gate@d0cb1fb92629bc0283c88d4719df7285c1612700
https://github.com/illumos/illumos-gate/commit/d0cb1fb92629bc0283c88d4719df7285c1612700

https://www.illumos.org/issues/9425
  Problem Statement
  ZFS Channel program scripts currently require a timeout, so that hung
  or long-running scripts return a timeout error instead of causing ZFS
  to get wedged.  This limit can currently be set up to 100 million Lua
  instructions. Even with a limit in place, it would be desirable to
  have a sys admin (support engineer) be able to cancel a script that is
  taking a long time.

  Proposed Solution
  Make it possible to abort a channel program by sending an interrupt
  signal.In the underlying txg_wait_sync function, switch the cv_wait to
  a cv_wait_sig to catch the signal. Once a signal is encountered, the
  dsl_sync_task function can install a Lua hook that will get called
  before the Lua interpreter executes a new line of code. The
  dsl_sync_task can resume with a standard txg_wait_sync call and wait
  for the txg to complete. Meanwhile, the hook will abort the script and
  indicate that the channel program was canceled. The kernel returns a
  EINTR to indicate that the channel program run was canceled.

FreeBSD note: the return value of cv_wait_sig() has inverted meaning
between us and illumos.

Author: Don Brady <don.brady@delphix.com>
Obtained from: illumos
MFC after: 4 weeks

4 years agoMFV r353615: 9485 Optimize possible split block search space
avg [Wed, 16 Oct 2019 06:43:22 +0000 (06:43 +0000)]
MFV r353615: 9485 Optimize possible split block search space

illumos/illumos-gate@a21fe349793c3805ec504bbe5e9acf06c2d63d7a
https://github.com/illumos/illumos-gate/commit/a21fe349793c3805ec504bbe5e9acf06c2d63d7a

https://www.illumos.org/issues/9485
  Port this commit from ZoL:
  https://github.com/zfsonlinux/zfs/commit/4589f3ae4c1bb435777da8640eb915f3c713b14d

Author: Brian Behlendorf <behlendorf1@llnl.gov>
Obtained from: illumos, ZoL
MFC after: 3 weeks

4 years agoMFV r353613: 10731 zfs: NULL pointer errors
avg [Wed, 16 Oct 2019 06:38:05 +0000 (06:38 +0000)]
MFV r353613: 10731 zfs: NULL pointer errors

FreeBSD already had these changes locally.
This commit removes a small formatting difference.

MFC after: 1 week

4 years agoMFC r353611: 10330 merge recent ZoL vdev and metaslab changes
avg [Wed, 16 Oct 2019 06:26:51 +0000 (06:26 +0000)]
MFC r353611: 10330 merge recent ZoL vdev and metaslab changes

illumos/illumos-gate@a0b03b161c4df3cfc54fbc741db09b3bdc23ffba
https://github.com/illumos/illumos-gate/commit/a0b03b161c4df3cfc54fbc741db09b3bdc23ffba

https://www.illumos.org/issues/10330
  3 recent ZoL changes in the vdev and metaslab code which we can pull over:
  PR 8324 c853f382db 8324 Change target size of metaslabs from 256GB to 16GB
  PR 8290 b194fab0fb 8290 Factor metaslab_load_wait() in metaslab_load()
  PR 8286 419ba59145 8286 Update vdev_is_spacemap_addressable() for new spacemap
  encoding

Author: Serapheim Dimitropoulos <serapheimd@gmail.com>
Obtained from: illumos, ZoL
MFC after: 2 weeks

4 years agoMFV r353608: 10165 libzpool: passing argument 1 to restrict-qualified parameter
avg [Wed, 16 Oct 2019 06:09:00 +0000 (06:09 +0000)]
MFV r353608: 10165 libzpool: passing argument 1 to restrict-qualified parameter

illumos/illumos-gate@f91fcf59ac2fd04f1816f3dcbc69a46d44276a65
https://github.com/illumos/illumos-gate/commit/f91fcf59ac2fd04f1816f3dcbc69a46d44276a65

https://www.illumos.org/issues/10165

Author: Toomas Soome <tsoome@me.com>
MFC after: 10 days

4 years agoMFV r353606: 10067 Miscellaneous man page typos
avg [Wed, 16 Oct 2019 06:05:18 +0000 (06:05 +0000)]
MFV r353606: 10067 Miscellaneous man page typos

https://www.illumos.org/issues/10067
  fileystem - man1m/zfs.1m man1m/boot.1m

Author: Peter Tribble <peter.tribble@gmail.com>
Obtained from: illumos
MFC after: 1 week

4 years agopowerpc/mpc85xx: Fix function type for fsl_pcib_error_intr()
jhibbits [Wed, 16 Oct 2019 03:03:59 +0000 (03:03 +0000)]
powerpc/mpc85xx: Fix function type for fsl_pcib_error_intr()

Since it's only called as an interrupt handler, fsl_pcib_eror_intr() should just
match the driver_intr_t type.

Reported by: bdragon

4 years agopowerpc: Add AmigaOne platform, a subclass of MPC85xx
jhibbits [Wed, 16 Oct 2019 00:38:50 +0000 (00:38 +0000)]
powerpc: Add AmigaOne platform, a subclass of MPC85xx

Summary:
The AmigaOne platform, encompassing the X5000 and A1222 at this time, is
based on the mpc85xx platform, but includes some things not listed in
the device tree.  Some custom devices, like CPLD, could be added to the
device tree with an overlay, or other means.  However, some cannot
easily be done, such as the power button interrupt.

The directory will also become a location to add AmigaOne platform drivers,
such as the aforementioned CPLD, and its children.

Reviewed by: bdragon
Differential Revision: https://reviews.freebsd.org/D21829

4 years agoFix including bsd.compat.mk outside Makefile.libcompat on mips64.
brooks [Tue, 15 Oct 2019 23:54:51 +0000 (23:54 +0000)]
Fix including bsd.compat.mk outside Makefile.libcompat on mips64.

Reported by: jhb, jenkins

4 years agoGeneralize ARM specific comments in devmap
kp [Tue, 15 Oct 2019 23:21:52 +0000 (23:21 +0000)]
Generalize ARM specific comments in devmap

The comments in devmap are very ARM specific, this generalizes them for other
architectures.

Submitted by: Nicholas O'Brien <nickisobrien_gmail.com>
Reviewed by: manu, philip
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D22035

4 years agoixgbe: Disable EEE for backplane X550EM_X
erj [Tue, 15 Oct 2019 21:56:19 +0000 (21:56 +0000)]
ixgbe: Disable EEE for backplane X550EM_X

From Zach:
Intel documentation indicates that backplane X550EM_X KR devices do not
support Energy Efficient Ethernet. Prior to this patch, X552 devices
(device ID 0x15AB) will crash the system when transitioning EEE state
via sysctl.

Signed-off-by: Zach Vargas <zvargas@xes-inc.com>
PR: 240320
Submitted by: Zach Vargas <zvargas@xes-inc.com>
Reviewed by: erj@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21673

4 years agoMissing from r353596.
glebius [Tue, 15 Oct 2019 21:32:38 +0000 (21:32 +0000)]
Missing from r353596.

4 years agoAdd the ability to link programs against a compat ABI.
brooks [Tue, 15 Oct 2019 21:27:06 +0000 (21:27 +0000)]
Add the ability to link programs against a compat ABI.

Linkage is controlled by two make knobs:
WANT_COMPAT - Prefer to link against the compat ABI.
NEED_COMPAT - Link against the compat ABI or fail to build.

Supported values are "32", "soft", and "any".  The latter meaning pick
the first[0] supported compat ABI.

This can be used to provide test binaries for compat ABIs or to link
ABI-specific programs.

[0] We currently support only one compat ABI at a time, but this may
change in the future and some code in this commit is structured to ease
that change.

Reviewed by: bdrewery, jhb
Obtained from: CheriBSD (in concept)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22023

4 years agoWhen assertion for a thread not being in an epoch fails also print all
glebius [Tue, 15 Oct 2019 21:24:25 +0000 (21:24 +0000)]
When assertion for a thread not being in an epoch fails also print all
entered epochs. Works with EPOCH_TRACE only.

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

4 years agoBuild compat libraries before "everything".
brooks [Tue, 15 Oct 2019 21:22:13 +0000 (21:22 +0000)]
Build compat libraries before "everything".

This is required for us to link programs against compat versions of
libraries.

Reviewed by: bdrewery, jhb
Sponsored by: DARPA, AFRL

4 years agoAllow OBJDIR to be overridden for LIB*DIR variables.
brooks [Tue, 15 Oct 2019 21:15:03 +0000 (21:15 +0000)]
Allow OBJDIR to be overridden for LIB*DIR variables.

This will allow us to link against internal libraries when building
programs for the system's LIBCOMPAT ABI.

Reviewed by: bdrewery
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

4 years agoRename top-level LIBCOMPAT to _LIBCOMPAT.
brooks [Tue, 15 Oct 2019 21:11:22 +0000 (21:11 +0000)]
Rename top-level LIBCOMPAT to _LIBCOMPAT.

This avoids a conflict with LIBCOMPAT defined in bsd.libnames.mk.

Reviewed by: bdrewery
Sponsored by: DARPA, AFRL

4 years agoMove the per-ARCH definitions to bsd.compat.mk.
brooks [Tue, 15 Oct 2019 21:08:49 +0000 (21:08 +0000)]
Move the per-ARCH definitions to bsd.compat.mk.

This is the first step if refactoring the definitions to allow programs
to be selectively linked against libcompat libraries.

Reviewed by: bdrewery
Sponsored by: DARPA, AFRL

4 years agoAdd copyrights that I forgot to add when splitting arb.h off from tree.h.
trasz [Tue, 15 Oct 2019 19:44:43 +0000 (19:44 +0000)]
Add copyrights that I forgot to add when splitting arb.h off from tree.h.
While here clean up the RCS tags.

Suggested by: lstewart
MFC after: 2 weeks
Sponsored by: Klara Inc, Netflix

4 years agoInstall an ACPI PCI bus notify handler.
jhb [Tue, 15 Oct 2019 19:12:09 +0000 (19:12 +0000)]
Install an ACPI PCI bus notify handler.

Rescan a PCI bus when the ACPI_NOTIFY_BUS_CHECK event is posted to a
PCI bus.

Reviewed by: scottl
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21948

4 years agoSupport hot insertion and removal of PCI devices on EC2.
jhb [Tue, 15 Oct 2019 19:04:39 +0000 (19:04 +0000)]
Support hot insertion and removal of PCI devices on EC2.

Install ACPI notify handlers on PCI devices with an _EJ0 method.  This
handler is invoked when devices are added or removed.

- When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus
  device.  Note that strictly speaking we only need to rescan the
  specified device, but BUS_RESCAN is what is available, so we rescan
  the entire bus.
- When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device
  associated with the ACPI handle, invoke the _EJ0 method, and then
  delete the device.

Eventually this might be changed to vector notify events to devd in
userspace where devctl can be used instead to permit more complex
actions such as graceful unmounting of filesystems.

Tested by: cperciva
Reviewed by: cperciva, imp, scottl
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21948

4 years agoExport pci_attach() and pci_detach().
jhb [Tue, 15 Oct 2019 18:58:01 +0000 (18:58 +0000)]
Export pci_attach() and pci_detach().

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21948