]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFV r354377: 10554 Implemented zpool sync command
Andriy Gapon [Thu, 7 Nov 2019 11:18:28 +0000 (11:18 +0000)]
MFV r354377: 10554 Implemented zpool sync command

illumos/illumos-gate@9c2acf00e275b6b2125a306f33cdddcc58393220
https://github.com/illumos/illumos-gate/commit/9c2acf00e275b6b2125a306f33cdddcc58393220

https://www.illumos.org/issues/10554
  During the port of MMP (illumos bug 10499) from ZoL, I found this
  earlier ZoL project is a prerequisite. Here is the original
  description.  This addition will enable us to sync an open TXG to the
  main pool on demand. The functionality is similar to 'sync(2)' but
  'zpool sync' will return when data has hit the main storage instead of
  potentially just the ZIL as is the case with the 'sync(2)' cmd.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>
MFC after: 3 weeks
Relnotes: possibly

4 years agoloader: implement fallback efi_devpath_to_name()
Toomas Soome [Thu, 7 Nov 2019 11:17:03 +0000 (11:17 +0000)]
loader: implement fallback efi_devpath_to_name()

UEFI 1.10 on macs does not seem to provide devpath to name translation,
provide our own (limited) version, so we can get information about commmon
devices.

MFC after: 1 week

4 years agoadd a note about nctgpio and wbwd move to superio
Andriy Gapon [Thu, 7 Nov 2019 07:21:23 +0000 (07:21 +0000)]
add a note about nctgpio and wbwd move to superio

4 years agoBack out encoder compilation to unbreak HEAD.
Phil Shafer [Thu, 7 Nov 2019 07:09:28 +0000 (07:09 +0000)]
Back out encoder compilation to unbreak HEAD.

4 years agoMerge commit 8e34dd941 from llvm git (by Sanjay Patel):
Dimitry Andric [Thu, 7 Nov 2019 06:59:09 +0000 (06:59 +0000)]
Merge commit 8e34dd941 from llvm git (by Sanjay Patel):

  [x86] avoid crashing when splitting AVX stores with non-simple type
  (PR43916)

  The store splitting transform was assuming a simple type (MVT), but
  that's not necessarily the case as shown in the test.

This should fix 'Assertion failed: (isSimple() && "Expected a
SimpleValueType!")' when building the security/openssl111 port targeting
a CPU that supports AVX, but not AVX2, such as sandybridge.

PR: 241747
MFC after: 1 month
X-MFC-With: r353358

4 years agoRevert r354238 as the issue has been fixed in r354418
Li-Wen Hsu [Thu, 7 Nov 2019 04:04:06 +0000 (04:04 +0000)]
Revert r354238 as the issue has been fixed in r354418

PR: 241562
Sponsored by: The FreeBSD Foundation

4 years agoImport libxo-1.3.0:
Phil Shafer [Thu, 7 Nov 2019 03:57:04 +0000 (03:57 +0000)]
Import libxo-1.3.0:
- move from "oxtradoc" to RST/Sphinx documentation
- new "csv" encoder, which allows path and leaf lists
- address warnings from PVS-Stdio tool
- add "xolint" detected errors to the documentation

4 years agoImport libxo 1.3.0
Phil Shafer [Thu, 7 Nov 2019 03:46:17 +0000 (03:46 +0000)]
Import libxo 1.3.0

4 years agoTCP timers are executed in callout context, so they need to enter network
Gleb Smirnoff [Thu, 7 Nov 2019 00:27:23 +0000 (00:27 +0000)]
TCP timers are executed in callout context, so they need to enter network
epoch to look into PCB lists.  Mechanically convert INP_INFO_RLOCK() to
NET_EPOCH_ENTER().  No functional change here.

4 years agoMechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in
Gleb Smirnoff [Thu, 7 Nov 2019 00:10:14 +0000 (00:10 +0000)]
Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in
TCP functions that are executed in syscall context.  No
functional change here.

4 years agoMechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER().
Gleb Smirnoff [Thu, 7 Nov 2019 00:08:34 +0000 (00:08 +0000)]
Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER().
Remove few outdated comments and extraneous assertions.  No
functional change here.

4 years agoFix the alignment of struct xunpcb on systems with >64-bit pointers.
Brooks Davis [Thu, 7 Nov 2019 00:07:54 +0000 (00:07 +0000)]
Fix the alignment of struct xunpcb on systems with >64-bit pointers.

Reviewed by: emaste
Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22268

4 years agoIf vm_pager_get_pages_async() returns an error synchronously we leak wired
Gleb Smirnoff [Wed, 6 Nov 2019 23:45:43 +0000 (23:45 +0000)]
If vm_pager_get_pages_async() returns an error synchronously we leak wired
and busy pages.  Add code that would carefully cleanups the state in case
of synchronous error return.  Cover a case when a first I/O went on
asynchronously, but second or N-th returned error synchronously.

In collaboration with: chs
Reviewed by: jtl, kib

4 years agoclang: Enable unwind tables on !amd64
Conrad Meyer [Wed, 6 Nov 2019 23:44:38 +0000 (23:44 +0000)]
clang: Enable unwind tables on !amd64

There doesn't seem to be much sense in defaulting "on" unwind tables on
amd64 and not on other arches.  It causes surprising differences between
platforms, such as the PR below.

Prior to this change, FreeBSD inherited the default implementation of the
method from the Gnu.h Generic_Elf => Generic_GCC parent class, which
returned true only for amd64 targets.  Override that and opt on always,
similar to, e.g., NetBSD.

PR: 241562
Reported by: lwhsu
Reviewed by: dim
Discussed with: emaste
MFC after: I'm not going to, but you should feel free
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D22252

4 years agoAdd FreeBSD 11.3
Sevan Janiyan [Wed, 6 Nov 2019 23:40:09 +0000 (23:40 +0000)]
Add FreeBSD 11.3

4 years agom_pulldown(): Change an if () panic() into a KASSERT().
Bjoern A. Zeeb [Wed, 6 Nov 2019 22:40:19 +0000 (22:40 +0000)]
m_pulldown(): Change an if () panic() into a KASSERT().

If we pass in a NULL mbuf to m_pulldown() we are in a bad situation
already.  There is no point in doing that check for production code.
Change the if () panic() into a KASSERT.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoloader.efi: HARDDRIVE_DEVICE_PATH may have subpaths
Toomas Soome [Wed, 6 Nov 2019 21:13:10 +0000 (21:13 +0000)]
loader.efi: HARDDRIVE_DEVICE_PATH may have subpaths

The macos does create Vendor Media devices on top of APFS container
(like partition table inside the partition), so we need to collect such
devices into respective device tree.

MFC after: 1 week

4 years agoMake linux(4) create /dev/shm. Linux applications often expect
Edward Tomasz Napierala [Wed, 6 Nov 2019 20:53:33 +0000 (20:53 +0000)]
Make linux(4) create /dev/shm.  Linux applications often expect
a tmpfs to be mounted there, and because they like to verify it's
actually a mountpoint, a symlink won't do.

Reviewed by: dchagin (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20333

4 years agomgb: Correct spello - recieve -> receive
Ed Maste [Wed, 6 Nov 2019 20:43:40 +0000 (20:43 +0000)]
mgb: Correct spello - recieve -> receive

Reported by: N. J. Mann
MFC with: r354410

4 years agoAdd mgb(4) (Microchip LAN783x PCIe NIC) man page
Ed Maste [Wed, 6 Nov 2019 19:52:31 +0000 (19:52 +0000)]
Add mgb(4) (Microchip LAN783x PCIe NIC) man page

Sponsored by: The FreeBSD Foundation

4 years agoIntroduce if_mgb driver for Microchip LAN743x PCIe NIC
Ed Maste [Wed, 6 Nov 2019 19:51:40 +0000 (19:51 +0000)]
Introduce if_mgb driver for Microchip LAN743x PCIe NIC

The Microchip LAN7430 is a PCIe 10/100/1000 Ethernet MAC with integrated
PHY, and the LAN7431 is a MAC with RGMII interface.

To be connected to the build after further testing and review.
Committing now so that changes like r354345 (adding a common
ETHER_IS_ZERO macro) will update this driver too.

Submitted by: Gerald ND Aryeetey <aryeeteygerald_rogers.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20079

4 years agolibstats: Improve ABI assertion.
Brooks Davis [Wed, 6 Nov 2019 19:44:44 +0000 (19:44 +0000)]
libstats: Improve ABI assertion.

On platforms where pointers are larger than 64-bits, struct statsblob
may be harmlessly padded out such that opaque[] always has some included
space.  Make the assertion more general by comparing to the offset of
opaque rather than the size of struct statsblob.

Discussed with: jhb, James Clarke
Reviewed by: trasz, lstewart
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22188

4 years agoRemove obsolete addition of MACHINE_CPUARCH
Warner Losh [Wed, 6 Nov 2019 18:54:04 +0000 (18:54 +0000)]
Remove obsolete addition of MACHINE_CPUARCH

In the past, we would add symbolic links for MACHINE_CPUARCH when it differed
from MACHINE. This was for pc98 only, however. All other architectures didn't
need this and it was really due to pc98 pulling from i386 rather than something
more intrinsic. At the time, we had the split we did to mimic what NetBSD did
for its 68k ports where many different kernels were possible for the same
architecture. Since then, both projects have moved away from this convention to
having a more generic MACHINE for each architecture. FreeBSD's new arm64/aarch64
breaks this old notion and so was an exception to the rule. So, we no longer
need to create this link for any old machine or any new machine, delete it
entirely.

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

4 years agoarm64: allwinner: a64: Do not init the video related clocks
Emmanuel Vadot [Wed, 6 Nov 2019 18:39:32 +0000 (18:39 +0000)]
arm64: allwinner: a64: Do not init the video related clocks

This should be handled by the video drivers and this break EFIFB
as this changes clock setup by the bootloader.

MFC after: 1 month

4 years agoConvert ksyms(4) to use an OBJT_PHYS object.
Mark Johnston [Wed, 6 Nov 2019 17:03:06 +0000 (17:03 +0000)]
Convert ksyms(4) to use an OBJT_PHYS object.

The pages stored in the ksyms object are not pageable.  Moreover, this
obviates the need to set OBJ_NOSPLIT.

Reviewed by: alc, kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22229

4 years agoblacklistd.conf.5: pluralization correction
Ed Maste [Wed, 6 Nov 2019 17:01:35 +0000 (17:01 +0000)]
blacklistd.conf.5: pluralization correction

Submitted by: bcr in review D22259
MFC with: r354399

4 years agoFix a race in release_page().
Mark Johnston [Wed, 6 Nov 2019 16:59:16 +0000 (16:59 +0000)]
Fix a race in release_page().

Since r354156 we may call release_page() without the page's object lock
held, specifically following the page copy during a CoW fault.
release_page() must therefore unbusy the page only after scheduling the
requeue, to avoid racing with a free of the page.  Previously, the
object lock prevented this race from occurring.

Add some assertions that were helpful in tracking this down.

Reported by: pho, syzkaller
Tested by: pho
Reviewed by: alc, jeff, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22234

4 years agoblacklist: update to NetBSD snapshot on 20191106
Ed Maste [Wed, 6 Nov 2019 16:21:35 +0000 (16:21 +0000)]
blacklist: update to NetBSD snapshot on 20191106

Cursory review: cem
MFC after: 3 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22259

4 years agoarm: allwinner: aw_mmc: Check if the regulator support the voltage
Emmanuel Vadot [Wed, 6 Nov 2019 14:58:25 +0000 (14:58 +0000)]
arm: allwinner: aw_mmc: Check if the regulator support the voltage

Don't blindy say that we support both 3.3V and 1.8V.
If we have a regulator for the data lines, check that the voltage is
supported before adding the signaling caps.
If we don't have a regulator, just assume that the data lines are 3.3V
This unbreak eMMC on some allwinner boards.

Reported by: ganbold
MFC after: 1 month
X-MFC-With: r354396

4 years agoregulator: Add regulator_check_voltage function
Emmanuel Vadot [Wed, 6 Nov 2019 14:55:24 +0000 (14:55 +0000)]
regulator: Add regulator_check_voltage function

This function will call the regnode_check_voltage method for a given regulator
and check if the desired voltage in reachable by it.
Also adds a default method that check the std_param and which should be enough
for most regulators and add it as the method for axp* rk805 and fixed regulators.

Reviewed by: mmel
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D22260

4 years agoIPv6 tests: test case for scapy bpf parsing bug
Bjoern A. Zeeb [Wed, 6 Nov 2019 14:43:35 +0000 (14:43 +0000)]
IPv6 tests: test case for scapy bpf parsing bug

PR: 239380
Reported by: lwhsu, CI system
MFC after: 3 weeks
Sponsored by: Netflix

4 years agoipv6 tests: cleanup
Bjoern A. Zeeb [Wed, 6 Nov 2019 14:30:56 +0000 (14:30 +0000)]
ipv6 tests:  cleanup

Remove mentions of fragmentation tests from extension header test.
Remove setting an MTU > IF_MAXMTU from the test cases to avoid warnings;
this was only possible in a local research tree.

MFC after: 2 weeks
Sponsored by: Netflix

4 years agoVendor import of NetBSD's external/bsd/blacklist @ 20191106
Ed Maste [Wed, 6 Nov 2019 14:09:52 +0000 (14:09 +0000)]
Vendor import of NetBSD's external/bsd/blacklist @ 20191106

Sponsored by: The FreeBSD Foundation

4 years ago10554 Implemented zpool sync command
Andriy Gapon [Wed, 6 Nov 2019 08:44:35 +0000 (08:44 +0000)]
10554 Implemented zpool sync command

illumos/illumos-gate@9c2acf00e275b6b2125a306f33cdddcc58393220
https://github.com/illumos/illumos-gate/commit/9c2acf00e275b6b2125a306f33cdddcc58393220

https://www.illumos.org/issues/10554
  During the port of MMP (illumos bug 10499) from ZoL, I found this
  earlier ZoL project is a prerequisite. Here is the original
  description.  This addition will enable us to sync an open TXG to the
  main pool on demand. The functionality is similar to 'sync(2)' but
  'zpool sync' will return when data has hit the main storage instead of
  potentially just the ZIL as is the case with the 'sync(2)' cmd.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>

4 years agozstd: Add an Xlist and document use during import
Conrad Meyer [Wed, 6 Nov 2019 06:50:02 +0000 (06:50 +0000)]
zstd: Add an Xlist and document use during import

No functional change.

4 years agopowerpc/booke: Fix pmap_mapdev_attr() for multi-TLB1 entry mappings
Justin Hibbits [Wed, 6 Nov 2019 04:40:12 +0000 (04:40 +0000)]
powerpc/booke: Fix pmap_mapdev_attr() for multi-TLB1 entry mappings

Also, fix pmap_change_attr() to ignore non-kernel mappings.

* Fix a masking bug in mmu_booke_mapdev_attr() which caused it to align
  mappings to the smallest mapping alignment, instead of the largest.  This
  caused mappings to be potentially pessimally aligned, using more TLB
  entries than necessary.
* Return existing mappings from mmu_booke_mapdev_attr() that span more than
  one TLB1 entry.  The drm-current-kmod drivers map discontiguous segments
  of the GPU, resulting in more than one TLB entry being used to satisfy the
  mapping.
* Ignore non-kernel mappings in mmu_booke_change_attr().  There's a bug in
  the linuxkpi layer that causes it to actually try to change physical
  address mappings, instead of virtual addresses.  amd64 doesn't encounter
  this because it ignores non-kernel mappings.

With this it's possible to use drm-current-kmod on Book-E.

4 years agofileargs_init() sets errno on failure.
Mark Johnston [Wed, 6 Nov 2019 01:42:30 +0000 (01:42 +0000)]
fileargs_init() sets errno on failure.

Sponsored by: The FreeBSD Foundation

4 years agoSwitch cache zones from early counters to real implementation.
Konstantin Belousov [Tue, 5 Nov 2019 21:38:48 +0000 (21:38 +0000)]
Switch cache zones from early counters to real implementation.

Early counter mock can be only used on BSP for amd64, when APs try to
update it that causes random memory corruption.

N.B.  This is a temporary patch to plug the corruption for now, while
a proper solution for handling cache zones in zone_foreach() is being
developed.

In collaboration with: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation, Mellanox Technologies

4 years agoloader: clean up the noise around log device
Toomas Soome [Tue, 5 Nov 2019 18:35:13 +0000 (18:35 +0000)]
loader: clean up the noise around log device

We are ignoring log device but we also do want to have clean code.

4 years agoloader: populate nvl with data even when label_txg is 0
Toomas Soome [Tue, 5 Nov 2019 18:07:30 +0000 (18:07 +0000)]
loader: populate nvl with data even when label_txg is 0

We actually do not use that data, at least not now, but we want to
avoid possible surprises.

4 years agoTemporarily disable sys.netinet6.exthdr on i386
Li-Wen Hsu [Tue, 5 Nov 2019 17:49:15 +0000 (17:49 +0000)]
Temporarily disable sys.netinet6.exthdr on i386

PR: 241493
Sponsored by: The FreeBSD Foundation

4 years agoRemove picobsd(8) via `make delete-old`
Enji Cooper [Tue, 5 Nov 2019 17:33:27 +0000 (17:33 +0000)]
Remove picobsd(8) via `make delete-old`

This completes the commit that removed picobsd(8) (r354346).

MFC after: never

4 years agoAdd vfs.zfs.zio.taskq_batch_pct tunable.
Alexander Motin [Tue, 5 Nov 2019 15:19:05 +0000 (15:19 +0000)]
Add vfs.zfs.zio.taskq_batch_pct tunable.

MFC after: 1 week

4 years agofix up r354333, make zfsproc visible to dtrace, rename to system_proc
Andriy Gapon [Tue, 5 Nov 2019 14:34:59 +0000 (14:34 +0000)]
fix up r354333, make zfsproc visible to dtrace, rename to system_proc

I overlooked the fact that zfsproc is required by dtrace modules that
use illumos compatible taskq KPI.  So, move the symbol definition to
the opensolaris module that provides compatibility support for both ZFS
and DTrace.  Also, rename zfsproc to system_proc to reflect that it is
not specific to ZFS.

Reported by: ae
MFC after: 5 weeks
X-MFC with: ae

4 years agoip6 tests: Add very simplistic extension header tests
Bjoern A. Zeeb [Tue, 5 Nov 2019 10:59:33 +0000 (10:59 +0000)]
ip6 tests: Add very simplistic extension header tests

Add a simple test case which can exercise some of the IPv6 extension
header code paths.  At the moment only a small set of extension headers
is implemented and no options to the ones which take them.
Also implements a "bad" case to make sure that error handling works.

The tests were used to test m_pullup() changes to the code paths while
removing the KAME PULLDOWN_TEST cases and related macros.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agofrag6 tests: set end to catch timeout as error
Bjoern A. Zeeb [Tue, 5 Nov 2019 10:53:55 +0000 (10:53 +0000)]
frag6 tests: set end to catch timeout as error

There are times when we have to wait for reply packets.  There are
either an ICMPv6 (error) reply or the expiration timeout.
In these cases synchonous ICMPv6 replies should arrive, always,
unless the packet is lost.  Due to errors experienced with the
test software sending an invlaid request on at least i386 (*) these
packets are not generated.  That means we are waiting for a long time
for the replies or even timeout the test case.

Manually set the "End" flag on these test cases as well, so they do
fail rather than timeout as the sniffer timeout happens.  This improves
debugging options, reflects the error properly, and saves time on each
test suit run.

(*) The real cause for that is still to be found (see the referenced PRs)

PR: 241493, 239380
MFC after: 2 weeks
Sponsored by: Netflix

4 years agoo OpenBSD 6.6 and FreeBSD 12.1 releases added.
Maxim Konovalov [Tue, 5 Nov 2019 08:53:40 +0000 (08:53 +0000)]
o OpenBSD 6.6 and FreeBSD 12.1 releases added.

4 years agoif_ixv: disable RSS configuration on 82599 and X540 VFs
Andriy Gapon [Tue, 5 Nov 2019 06:34:20 +0000 (06:34 +0000)]
if_ixv: disable RSS configuration on 82599 and X540 VFs

It is reported that those VFs share their RSS configuration with PF and,
thus, they cannot be configured independently.

Also:
- add missing opt_rss.h to if_ixv.c, otherwise RSS kernel option could
  not be seen
- do not enable IXGBE_FEATURE_RSS on the older VFs
- set flowid / hash type to M_HASHTYPE_NONE or M_HASHTYPE_OPAQUE_HASH
  (based on what the hardware reports) if IXGBE_FEATURE_RSS is not set

Reviewed by: nobody
MFC after: 4 weeks
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D21705

4 years agoarmv6, armv7: Switch to llvm-libunwind by default
Conrad Meyer [Tue, 5 Nov 2019 03:22:15 +0000 (03:22 +0000)]
armv6, armv7: Switch to llvm-libunwind by default

This could just be ${__TT} == "arm", except armv5 isn't slated for death
until EOY.

arm tinderbox builds.  Let's see what else shakes out.

4 years agoFix llvm-libunwind userspace build on ARM
Conrad Meyer [Tue, 5 Nov 2019 03:20:40 +0000 (03:20 +0000)]
Fix llvm-libunwind userspace build on ARM

GCC's libgcc exports a few ARM-specific symbols for ARM EABI, AEABI, or
EHABI or whatever it's called.  Export the same ones from LLVM-libunwind's
libgcc_s, on ARM.  As part of this, convert libgcc_s from a direct
Version.map to one constructed from component Symbol.map files.  This allows
the ARM-specific Symbol.map to be included only on ARM.

Fix ARM-only oddities in struct name/aliases in LLVM-libunwind to match
non-ARM definitions and ARM-specific expectations in libcxxrt /
libcompiler_rt.

No functional change intended for non-ARM architectures.

This commit does not actually flip the switch for ARM defaults from libgcc
to llvm-libunwind, but makes it possible (to compile, anyway).

4 years agoRemove picobsd build scripts and the remaining tinyware
Kyle Evans [Tue, 5 Nov 2019 02:30:41 +0000 (02:30 +0000)]
Remove picobsd build scripts and the remaining tinyware

Postings were sent to -arch@ on 2019/09/13 and 2019/10/01, proposing and
confirming a removal of these scripts on 2019/10/31, due to significant work
needed to bring this into the modern world and nobody having done this work
in the past couple of years. No objections or proposed work was raised in
response to these postings. The tinyware may see a resurrection into a
separate repo for archival purposes if any users of it show interest in
doing so.

MFC after: never

4 years agonet: add ETHER_IS_ZERO macro similar to ETHER_IS_BROADCAST
Eric Joyner [Tue, 5 Nov 2019 00:12:21 +0000 (00:12 +0000)]
net: add ETHER_IS_ZERO macro similar to ETHER_IS_BROADCAST

Some places in network code may need to verify that an ethernet address
is not the 'zero' address. Provide a standard macro ETHER_IS_ZERO for
this purpose, similar to the ETHER_IS_BROADCAST macro already available.

This patch also removes previous ETHER_IS_ZERO definitions in several
USB ethernet drivers, in favor of this centrally-located macro.

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

4 years agoiflib: properly release memory allocated for DMA
Eric Joyner [Mon, 4 Nov 2019 23:06:57 +0000 (23:06 +0000)]
iflib: properly release memory allocated for DMA

DMA memory allocations using the bus_dma.h interface are not properly
released in all cases for both Tx and Rx. This causes ~448 bytes of
M_DEVBUF allocations to be leaked.

First, the DMA maps for Rx are not properly destroyed. A slight attempt
is made in iflib_fl_bufs_free to destroy the maps if we're detaching.
However, this function may not be reliably called during detach. Indeed,
there is a comment "asking" if this should be moved out.

Fix this by moving the bus_dmamap_destroy call into iflib_rx_sds_free,
where we already sync and unload the DMA.

Second, the DMA tag associated with the ifr_ifdi descriptor DMA is not
released properly anywhere. Add a call to iflib_dma_free in
iflib_rx_structures_free.

Third, use of NULL as a canary value on the map pointer returned by
bus_dmamap_create is not valid. On some platforms, notably x86, this
value may be NULL. In this case, we fail to properly release the related
resources.

Remove the NULL checks on map values in both iflib_fl_bufs_free and
iflib_txsd_destroy.

With all of these fixes applied, the leaks to M_DEVBUF are squelched,
and iflib drivers now seem to properly cleanup when detaching.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: erj@, gallatin@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D22203

4 years agonet: prefer ETHER_ADDR_LEN over ETH_ADDR_LEN
Eric Joyner [Mon, 4 Nov 2019 22:57:36 +0000 (22:57 +0000)]
net: prefer ETHER_ADDR_LEN over ETH_ADDR_LEN

A couple of drivers and one place in if.c use ETH_ADDR_LEN, even though
net/ethernet.h provides an equivalent ETHER_ADDR_LEN definition.

Cleanup all of the locations which refer to ETH_ADDR_LEN to use the
standard ETHER_ADDR_LEN instead.

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

4 years agolibpmc: jevents: handle empty descriptoin
Ed Maste [Mon, 4 Nov 2019 22:52:02 +0000 (22:52 +0000)]
libpmc: jevents: handle empty descriptoin

PR: 241258
Reported by: sigsys @ gmail.com
Obtained from: github.com/andikleen/pmu-tools commit bb3c77ed61
MFC after: 3 days

4 years agoarm64 linuxulator: default to RW stack (no X)
Ed Maste [Mon, 4 Nov 2019 21:23:30 +0000 (21:23 +0000)]
arm64 linuxulator: default to RW stack (no X)

This matches Linux's default arm64 data / stack permissions.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoRemove an outdated assertion.
Brooks Davis [Mon, 4 Nov 2019 21:06:06 +0000 (21:06 +0000)]
Remove an outdated assertion.

The exclusive lock assertion became incorrect due to changes in lock
scope in r354155.

Discussed with: jeffr
Sponsored by: DARPA, AFRL

4 years agoMerge commit 97e362607 from llvm git (by Nemanja Ivanovic):
Dimitry Andric [Mon, 4 Nov 2019 19:38:07 +0000 (19:38 +0000)]
Merge commit 97e362607 from llvm git (by Nemanja Ivanovic):

  [PowerPC] Do not emit HW loop if the body contains calls to
  lrint/lround

  These two intrinsics are lowered to calls so should prevent the
  formation of CTR loops. In a subsequent patch, we will handle all
  currently known intrinsics and prevent the formation of HW loops if
  any unknown intrinsics are encountered.

  Differential revision: https://reviews.llvm.org/D68841

This should fix an "invalid CRT loop" assertion when building the
www/node port for powerpc64.

Requested by: Alfredo Dal'Ava JĂșnior <alfredo.junior@eldorado.org.br>
MFC after: 1 month
X-MFC-With: r353358

4 years agoAdd tunable to allow interrupts on hyperthreaded cores
Andrew Gallatin [Mon, 4 Nov 2019 19:30:19 +0000 (19:30 +0000)]
Add tunable to allow interrupts on hyperthreaded cores

Enabling interrupts on htt cores has benefits to workloads which are primarily
interrupt driven by increasing the logical cores available for interrupt handling.
The tunable is named machdep.hyperthreading_intr_allowed

Reviewed by: kib, jhb
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D22233

4 years agoIn nd6_timer() enter the network epoch earlier. The defrouter_del() may
Gleb Smirnoff [Mon, 4 Nov 2019 17:35:37 +0000 (17:35 +0000)]
In nd6_timer() enter the network epoch earlier.  The defrouter_del() may
call into leaf functions that require epoch.  Since the function is already
run in non-sleepable context, it should be safe to cover it whole with epoch.

Reported by: syzcaller

4 years agoEnable device class group attributes in the LinuxKPI.
Hans Petter Selasky [Mon, 4 Nov 2019 14:19:09 +0000 (14:19 +0000)]
Enable device class group attributes in the LinuxKPI.

Bump the __FreeBSD_version to force recompilation of
external kernel modules due to structure change.

Differential Revision: https://reviews.freebsd.org/D21564
Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoDocument contrib updates:
Cy Schubert [Mon, 4 Nov 2019 13:46:21 +0000 (13:46 +0000)]
Document contrib updates:

r354269:
sqlite3 is updated to sqlite3-3.30.1.

r351397:
WPA is updated from 2.8 to 2.9.

4 years agozfs: enable SPA_PROCESS on the kernel side
Andriy Gapon [Mon, 4 Nov 2019 13:30:37 +0000 (13:30 +0000)]
zfs: enable SPA_PROCESS on the kernel side

The purpose of this change is to group kernelthreads specific to a
particular ZFS pool under a kernel process.  There can be many dozens of
threads per pool.  This change improves observability of those threads.

This change consists of several subchanges:
1. illumos taskq_create_proc can now pass its process parameter to
taskqueue.  Also, use zfsproc instead of NULL for taskq_create.  Caveat:
zfsproc might not be initialized yet.  But in that case it is still NULL,
so not worse than before.

2. illumos sys/proc.h: kthread id is stored in t_did field, not t_tid.

3. zfs: enable SPA_PROCESS on the kernel side.  The change is a bit hairy
as newproc() is implemented privately to spa.c.  I couldn't think of a
better way to populate process name than to poke inside the argument for
the process routine.

4. illumos thread_create: allow assigning thread to process other than
zfsproc.

5. zfs: expose spa_proc to other users, assign sync and quiesce threads
to it.

Pool-specific threads created using (relatively new) zthr mechanism are
still assigned to the zfskern process rather than to a respective
zpool-xxx process.  I am going to address this a bit later.

Reviewed by: no one
MFC after: 5 weeks
Relnotes: perhaps
Differential Revision: https://reviews.freebsd.org/D9720

4 years agoloader: show APFS partition type name
Toomas Soome [Mon, 4 Nov 2019 12:20:19 +0000 (12:20 +0000)]
loader: show APFS partition type name

Add small visual aid in lsdev output.

4 years agopatch(1): give /dev/null patches special treatment
Kyle Evans [Mon, 4 Nov 2019 03:07:01 +0000 (03:07 +0000)]
patch(1): give /dev/null patches special treatment

We have a bad habit of duplicating contents of files that are sourced from
/dev/null and applied more than once... take the more sane (in most ways)
GNU route and complain if the file exists and offer reversal options.

This still falls short a little bit as selecting "don't reverse, apply
anyway" will still give you duplicated file contents. There's probably other
issues as well, but awareness is the first step to happiness.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21535

4 years ago[ig4] Try to workaround MIPS namespace pollution issue
Vladimir Kondratyev [Mon, 4 Nov 2019 02:29:58 +0000 (02:29 +0000)]
[ig4] Try to workaround MIPS namespace pollution issue

4 years agopowerpc/pmap: Make use of tlb1_mapin_region in pmap_mapdev_attr()
Justin Hibbits [Mon, 4 Nov 2019 00:35:40 +0000 (00:35 +0000)]
powerpc/pmap: Make use of tlb1_mapin_region in pmap_mapdev_attr()

tlb1_mapin_region() and pmap_mapdev_attr() do roughly the same thing -- map
a chunk of physical address space(memory or MMIO) into virtual, but do it in
differing ways.  Unify the code, settling on pmap_mapdev_attr()'s algorithm,
to simplify and unify the logic.  This fixes a bug with growing the kernel
mappings in mmu_booke_bootstrap(), where part of the mapping was not getting
done, leading to a hang when the unmapped VAs were accessed.

4 years agoMove the struct debug_monitor_state out of _KERNEL.
Andrew Turner [Sun, 3 Nov 2019 22:17:49 +0000 (22:17 +0000)]
Move the struct debug_monitor_state out of _KERNEL.

Some userland libraries incude machine/pcb.h and this needs the full
definition of struct debug_monitor_state. To allow this to work move
stuct debug_monitor_state out of the _KERNEL guard.

Sponsored by: DARPA, AFRL

4 years agoloader: allow booting from pool with log device
Toomas Soome [Sun, 3 Nov 2019 21:36:29 +0000 (21:36 +0000)]
loader: allow booting from pool with log device

Apparently people are using log with boot pool, so we can not just
error out there. Still we will need to investigate how to handle
log properly.

4 years agoloader: factor out label and uberblock load from vdev_probe, add MMP checks
Toomas Soome [Sun, 3 Nov 2019 21:19:52 +0000 (21:19 +0000)]
loader: factor out label and uberblock load from vdev_probe, add MMP checks

Clean up the label read.

4 years ago[ig4] Convert ithread interrupt handler to filter based one.
Vladimir Kondratyev [Sun, 3 Nov 2019 21:17:50 +0000 (21:17 +0000)]
[ig4] Convert ithread interrupt handler to filter based one.

4 years ago[ig4] Enable additional registers support on Appolo Lake controllers
Vladimir Kondratyev [Sun, 3 Nov 2019 21:17:01 +0000 (21:17 +0000)]
[ig4] Enable additional registers support on Appolo Lake controllers

To be inline with intel-lpss Linux driver

4 years ago[ig4] Add support for CannonLake controllers
Vladimir Kondratyev [Sun, 3 Nov 2019 21:16:06 +0000 (21:16 +0000)]
[ig4] Add support for CannonLake controllers

They are clocked at 216MHz rate, much higher than previous models.

PR: 240485
Submitted by: Neel Chauhan <neel@neelc.org>

4 years ago[ig4] Add generic resource methods to bus interface
Vladimir Kondratyev [Sun, 3 Nov 2019 21:15:01 +0000 (21:15 +0000)]
[ig4] Add generic resource methods to bus interface

That allows ig4 children to allocate IRQs

4 years ago[ig4] Minor improvement of write pipelining
Vladimir Kondratyev [Sun, 3 Nov 2019 21:14:08 +0000 (21:14 +0000)]
[ig4] Minor improvement of write pipelining

With leaving some data queued in the TX FIFO at the end of write cycle.

4 years ago[ig4] wait for bus stop condition after stop command issued
Vladimir Kondratyev [Sun, 3 Nov 2019 21:12:59 +0000 (21:12 +0000)]
[ig4] wait for bus stop condition after stop command issued

It gives better error detection and ig4 driver's lock coverage
in a pipelined write case

4 years ago[ig4] On SkyLake controllers issue reset on attach unconditionally.
Vladimir Kondratyev [Sun, 3 Nov 2019 21:10:47 +0000 (21:10 +0000)]
[ig4] On SkyLake controllers issue reset on attach unconditionally.

It is very helpful during debugging of I2C issues.
It is done only for SkyLakes due to lack of testing on other hardware.

4 years ago[ig4] Set STOP condition and flush TX/RX FIFOs on error
Vladimir Kondratyev [Sun, 3 Nov 2019 21:08:26 +0000 (21:08 +0000)]
[ig4] Set STOP condition and flush TX/RX FIFOs on error

if controller has not it done for us yet.

Reset controller when transfer abort is failed.

4 years ago[ig4] Improve error detection
Vladimir Kondratyev [Sun, 3 Nov 2019 21:07:12 +0000 (21:07 +0000)]
[ig4] Improve error detection

Handle error bits of INTR_STAT and TX_ABORT registers.

Move interrupt clearing from interrupt handler to polling loop to get
common execution path with polled mode.

Do not clear interrupts with reading of IG4_REG_CLR_INTR register as
interrupts, triggered during the period from reg_read(IG4_REG_INTR_STAT)
to reg_read(IG4_REG_CLR_INTR) will be missed.
Instead, read each IG4_REG_CLR_* register separately.

4 years ago[ig4] Convert polling loop from status-based to interrupt-based
Vladimir Kondratyev [Sun, 3 Nov 2019 21:06:06 +0000 (21:06 +0000)]
[ig4] Convert polling loop from status-based to interrupt-based

INTR_STAT register exposes more useful informaton then STA register does
e.g. it exposes error and I2C bus STOP conditions. Make it a main source
of I2C transfer state.

4 years ago[ig4] Use interrupts for waiting for empty TX FIFO
Vladimir Kondratyev [Sun, 3 Nov 2019 21:04:51 +0000 (21:04 +0000)]
[ig4] Use interrupts for waiting for empty TX FIFO

4 years ago[ig4] Convert last remaining usage of TX_NOTFULL status to TX_EMPTY
Vladimir Kondratyev [Sun, 3 Nov 2019 21:03:55 +0000 (21:03 +0000)]
[ig4] Convert last remaining usage of TX_NOTFULL status to TX_EMPTY

in ig4iic_read routine. It makes possible interrupt utilization while
waiting for empty space in TX FIFO.

4 years ago[ig4] Rewrite ig4iic_write routine to use TX_EMPTY status flag
Vladimir Kondratyev [Sun, 3 Nov 2019 21:03:07 +0000 (21:03 +0000)]
[ig4] Rewrite ig4iic_write routine to use TX_EMPTY status flag

rather than TX_NOTFULL. It makes possible interrupt utilization while
waiting for empty space in TX FIFO.

4 years ago[ig4] Remove dead code inherited from DragonflyBSD
Vladimir Kondratyev [Sun, 3 Nov 2019 21:01:53 +0000 (21:01 +0000)]
[ig4] Remove dead code inherited from DragonflyBSD

4 years ago[ig4] Add suspend/resume support
Vladimir Kondratyev [Sun, 3 Nov 2019 21:00:55 +0000 (21:00 +0000)]
[ig4] Add suspend/resume support

That is done with re-execution of controller initialization procedure
from resume handler.

PR: 238037

4 years ago[ig4] Implement burst mode for data reads
Vladimir Kondratyev [Sun, 3 Nov 2019 20:59:04 +0000 (20:59 +0000)]
[ig4] Implement burst mode for data reads

In this mode DATA_CMD register reads and writes are performed in
TX/RX FIFO-sized bursts to increase I2C bus utilization.

That reduces read time from 60us to 30us per byte when read data is fit
in to RX FIFO buffer in FAST speed mode in my setup.

4 years ago[ig4] Set clock registers based on controller model
Vladimir Kondratyev [Sun, 3 Nov 2019 20:57:59 +0000 (20:57 +0000)]
[ig4] Set clock registers based on controller model

IC clock rates are varied between different controller models so we have
to adjust timing registers in each case individually. Borrow intresting
constants and formulas from Intel specs, i2c-designware and lpss_intel
drivers and apply them to FreeBSD supported controller models.

Implement fetching of timing data via ACPI methods execution if available.

4 years ago[ig4] dump IG4_REG_COMP_PARAM1 and IG4_REG_COMP_VER registers unconditionally
Vladimir Kondratyev [Sun, 3 Nov 2019 20:56:53 +0000 (20:56 +0000)]
[ig4] dump IG4_REG_COMP_PARAM1 and IG4_REG_COMP_VER registers unconditionally

They appeared to be supported (although undocumented) on SkyLakes+ too.

4 years ago[cyapa] Postpone start of the polling thread until sleep is available
Vladimir Kondratyev [Sun, 3 Nov 2019 20:55:28 +0000 (20:55 +0000)]
[cyapa] Postpone start of the polling thread until sleep is available

After recent ig4 changes cyapa driver can be attached before timers
initialization is completed. Start polling thread from config_intrhook
to avoid busy loops in that case.

4 years ago[ig4] Do not wait until interrupts are enabled at attach stage
Vladimir Kondratyev [Sun, 3 Nov 2019 20:54:17 +0000 (20:54 +0000)]
[ig4] Do not wait until interrupts are enabled at attach stage

as the driver is fully functional on a cold boot through utilization of
polled mode.

As a side effect, ig4 children probe and attach methods can be called
earlier in the boot sequence, so now it is up to the child drivers
to wait for a kernel initialization completion if it is required.

4 years ago[ig4] Allow enabling of polled mode from iicbus allocation callback
Vladimir Kondratyev [Sun, 3 Nov 2019 20:53:13 +0000 (20:53 +0000)]
[ig4] Allow enabling of polled mode from iicbus allocation callback

If controller is allocated with IIC_NOWAIT option ig4 enables polled mode
for a period of allocation that makes possible to start I2C transfers
from the contexts where sleeping is not allowed e.g. from ithreads or
callouts.

4 years ago[ig4] Add support for polled mode
Vladimir Kondratyev [Sun, 3 Nov 2019 20:51:22 +0000 (20:51 +0000)]
[ig4] Add support for polled mode

Currently ig4 internally depends on it's own interrupts and uses mtx_sleep()
to wait for them. That means it can not be used from any context where
sleeping is disallowed e.g. on cold boot, from DDB/KDB, from other device
driver's interrupt handlers and so on.

This change replaces sleeps with busy loops in cold boot and DDB cases.

4 years ago[ig4] disable controller before initialization of clock counters
Vladimir Kondratyev [Sun, 3 Nov 2019 20:50:06 +0000 (20:50 +0000)]
[ig4] disable controller before initialization of clock counters

It is required by controller specifications.

4 years ago[ig4] Stop I2C controller after checking that it's kind of functional.
Vladimir Kondratyev [Sun, 3 Nov 2019 20:49:04 +0000 (20:49 +0000)]
[ig4] Stop I2C controller after checking that it's kind of functional.

Obtained from: DragonfliBSD (0b3eedb)

4 years ago[ig4] We actually need to set the Rx threshold register one smaller.
Vladimir Kondratyev [Sun, 3 Nov 2019 20:47:49 +0000 (20:47 +0000)]
[ig4] We actually need to set the Rx threshold register one smaller.

Setting the IG4_REG_RX_TL register to 1 was actually generating an
interrupt after 2 bytes were available in the Rx fifo. We need to set the
register to 0 to get an interrupt for 1 byte already.

Obtained from: DragonflyBSD (02f0bf2)

4 years ago[ig4] Ignore stray interrupts
Vladimir Kondratyev [Sun, 3 Nov 2019 20:46:20 +0000 (20:46 +0000)]
[ig4] Ignore stray interrupts

4 years ago[ig4] Reduce scope of io_lock
Vladimir Kondratyev [Sun, 3 Nov 2019 20:45:25 +0000 (20:45 +0000)]
[ig4] Reduce scope of io_lock

Now io_lock is used as condition variable to synchronize active process with
the interrupt handler. It is not used for tasks other than waiting for
interrupt and passing parameters to and from it's handler.

4 years ago[ig4] Do not wait for interrupts in set_controller() routine
Vladimir Kondratyev [Sun, 3 Nov 2019 20:44:16 +0000 (20:44 +0000)]
[ig4] Do not wait for interrupts in set_controller() routine

Specs shows no dedicated interrupt firing on disable of the controller.

Remove io lock acquisitions around set_controller() calls as they are
not needed anymore.

4 years ago[ig4] Drop driver's internal RX FIFO
Vladimir Kondratyev [Sun, 3 Nov 2019 20:43:02 +0000 (20:43 +0000)]
[ig4] Drop driver's internal RX FIFO

There is no need to read all controller's RX FIFO data to clear RX_FULL
bit in interrupt handler as interrupts are masked permanently since
previous commit.

4 years ago[ig4] Only enable interrupts when we want them. Otherwise keep mask at 0.
Vladimir Kondratyev [Sun, 3 Nov 2019 20:42:04 +0000 (20:42 +0000)]
[ig4] Only enable interrupts when we want them. Otherwise keep mask at 0.

This avoids possible interrupt storms, depending on the state of the I2C
controller before the driver attached.

During attaching this clears the interrupt mask.

Revert r338215 as this change makes it no-op.

Obtained from: DragonflyBSD (d7c8555)