Commit Graph

245310 Commits

Author SHA1 Message Date
Andriy Gapon
74032c5f3b 10842 Mutex leak in dsl_dataset_hold_obj()
illumos/illumos-gate@ad027c0ff9
ad027c0ff9

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

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Jorgen Lundman <lundman@lundman.net>
2019-10-16 07:54:32 +00:00
Andriy Gapon
b830d43356 fix wording / typos in r353625
Reported by:	kib
MFC after:	4 weeks
X-MFC with:	r353625, r353618
2019-10-16 07:53:47 +00:00
Andriy Gapon
6c95733814 10841 predictive prefetch disabled on new pools until export/reboot
illumos/illumos-gate@0ce4bbcb47
0ce4bbcb47

https://www.illumos.org/issues/10841
  ZoL 944a37248a predictive prefetch disabled on new pools until export/reboot

  When a pool is initially created (by `zpool create`), predictive
  prefetch is inadvertently disabled, until the pool is
  export/import-ed, or the machine is rebooted.

  When device removal was introduced, we added some code to disable
  predictive prefetching until indirect vdevs have been loaded.  This
  resulted in the "default state" of prefetch being disabled, until we
  proactively enable it after indirect vdevs are loaded.  Unfortunately
  this resulted in a few bugs where in some code paths we neglect to
  enable predictive prefetch.  The first of these was fixed by
  20507534d4

  This commit fixes another case where we also need to explicitly enable
  predictive prefetch, when the pool is initially created.

Author: Matthew Ahrens <mahrens@delphix.com>
2019-10-16 07:49:20 +00:00
Andriy Gapon
ba2bbaffcf 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
2019-10-16 07:41:33 +00:00
Andriy Gapon
c67a6b9c7f MFV r353623: 10473 zfs(1M) missing cross-reference to zfs-program(1M)
illumos/illumos-gate@736e670039
736e670039

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

Author: Jason King <jason.king@joyent.com>
Obtained from:	illumos
MFC after:	6 days
2019-10-16 07:20:59 +00:00
Andriy Gapon
a930c16fea 10473 zfs(1M) missing cross-reference to zfs-program(1M)
illumos/illumos-gate@736e670039
736e670039

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

Author: Jason King <jason.king@joyent.com>
2019-10-16 07:11:30 +00:00
Konstantin Belousov
2a499f92ba 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
2019-10-16 07:09:15 +00:00
Andriy Gapon
0c4f60b734 MFV r353619: 9691 fat zap should prefetch when iterating
illumos/illumos-gate@52abb70e07
52abb70e07

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
2019-10-16 07:09:00 +00:00
Andriy Gapon
f4902c2a07 9691 fat zap should prefetch when iterating
illumos/illumos-gate@52abb70e07
52abb70e07

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>
2019-10-16 07:02:02 +00:00
Andriy Gapon
9efb961d9a MFV r353617: 9425 allow channel programs to be stopped via signals
illumos/illumos-gate@d0cb1fb926
d0cb1fb926

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
2019-10-16 07:00:18 +00:00
Andriy Gapon
35b885b060 9425 allow channel programs to be stopped via signals
illumos/illumos-gate@d0cb1fb926
d0cb1fb926

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.

Author: Don Brady <don.brady@delphix.com>
2019-10-16 06:44:37 +00:00
Andriy Gapon
179e6dab09 MFV r353615: 9485 Optimize possible split block search space
illumos/illumos-gate@a21fe34979
a21fe34979

https://www.illumos.org/issues/9485
  Port this commit from ZoL:
  4589f3ae4c

Author: Brian Behlendorf <behlendorf1@llnl.gov>
Obtained from:	illumos, ZoL
MFC after:	3 weeks
2019-10-16 06:43:22 +00:00
Andriy Gapon
66c1f9ba9c 9485 Optimize possible split block search space
illumos/illumos-gate@a21fe34979
a21fe34979

https://www.illumos.org/issues/9485
  Port this commit from ZoL:
  4589f3ae4c

Author: Brian Behlendorf <behlendorf1@llnl.gov>
2019-10-16 06:40:47 +00:00
Andriy Gapon
7149963e95 MFV r353613: 10731 zfs: NULL pointer errors
FreeBSD already had these changes locally.
This commit removes a small formatting difference.

MFC after:	1 week
2019-10-16 06:38:05 +00:00
Andriy Gapon
0a48ec6f62 10731 zfs: NULL pointer errors
illumos/illumos-gate@dd328bf6d3
dd328bf6d3

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

Author: Toomas Soome <tsoome@me.com>
2019-10-16 06:34:58 +00:00
Andriy Gapon
6cb9ab2bad MFC r353611: 10330 merge recent ZoL vdev and metaslab changes
illumos/illumos-gate@a0b03b161c
a0b03b161c

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
2019-10-16 06:26:51 +00:00
Andriy Gapon
b7cab79de2 10330 merge recent ZoL vdev and metaslab changes
illumos/illumos-gate@a0b03b161c
a0b03b161c

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>
2019-10-16 06:18:37 +00:00
Andriy Gapon
c4dff1c256 10230 zfs mishandles partial writes
illumos/illumos-gate@b0ef425652
b0ef425652

https://www.illumos.org/issues/10230
  The trinity fuzzer calls pwritev with an iovec that has one or more entries
  which point to some initial valid data and then the rest point to addresses
  which are not mapped. This yields EFAULT once the write hits the invalid
  address, but we do successfully complete some amount of writing. The zfs_write
  code does not handle this properly. It loses track of the error return from
  dmu_write_uio_dbuf and it has an invalid ASSERT which does not account for the
  partial write case.

Author: Jerry Jelinek <jerry.jelinek@joyent.com>
2019-10-16 06:11:11 +00:00
Andriy Gapon
b399ca755a MFV r353608: 10165 libzpool: passing argument 1 to restrict-qualified parameter
illumos/illumos-gate@f91fcf59ac
f91fcf59ac

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

Author: Toomas Soome <tsoome@me.com>
MFC after:	10 days
2019-10-16 06:09:00 +00:00
Andriy Gapon
b75b64ae4b 10165 libzpool: passing argument 1 to restrict-qualified parameter aliases with argument 4
illumos/illumos-gate@f91fcf59ac
f91fcf59ac

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

Author: Toomas Soome <tsoome@me.com>
2019-10-16 06:07:21 +00:00
Andriy Gapon
fba547735c 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
2019-10-16 06:05:18 +00:00
Andriy Gapon
37c5efc4de 10067 Miscellaneous man page typos
illumos/illumos-gate@e61d7e85eb
e61d7e85eb

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

Author: Peter Tribble <peter.tribble@gmail.com>
2019-10-16 06:02:07 +00:00
Andriy Gapon
abd45f007a 10154 zfs: cast between incompatible function types
illumos/illumos-gate@c62757b2b8
c62757b2b8

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

Author: Toomas Soome <tsoome@me.com>
2019-10-16 05:47:30 +00:00
Justin Hibbits
d70b36edb5 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
2019-10-16 03:03:59 +00:00
Justin Hibbits
34ed25a82e 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
2019-10-16 00:38:50 +00:00
Brooks Davis
5626bc0afd Fix including bsd.compat.mk outside Makefile.libcompat on mips64.
Reported by:	jhb, jenkins
2019-10-15 23:54:51 +00:00
Kristof Provost
1d95443818 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
2019-10-15 23:21:52 +00:00
Eric Joyner
d61b6a41dd 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
2019-10-15 21:56:19 +00:00
Gleb Smirnoff
4b25d1f2e3 Missing from r353596. 2019-10-15 21:32:38 +00:00
Brooks Davis
6b53d51078 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
2019-10-15 21:27:06 +00:00
Gleb Smirnoff
bac060388f 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
2019-10-15 21:24:25 +00:00
Brooks Davis
5dab131339 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
2019-10-15 21:22:13 +00:00
Brooks Davis
bc4b1a1729 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
2019-10-15 21:15:03 +00:00
Brooks Davis
ad2dd70b44 Rename top-level LIBCOMPAT to _LIBCOMPAT.
This avoids a conflict with LIBCOMPAT defined in bsd.libnames.mk.

Reviewed by:	bdrewery
Sponsored by:	DARPA, AFRL
2019-10-15 21:11:22 +00:00
Brooks Davis
bbcf7edd98 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
2019-10-15 21:08:49 +00:00
Edward Tomasz Napierala
014931a858 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
2019-10-15 19:44:43 +00:00
John Baldwin
65db3aa8c4 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
2019-10-15 19:12:09 +00:00
John Baldwin
8c9861f575 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
2019-10-15 19:04:39 +00:00
John Baldwin
21d3196209 Export pci_attach() and pci_detach().
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21948
2019-10-15 18:58:01 +00:00
John Baldwin
f7f6b03a13 Use __FreeBSD_version to determine if gets() has been removed.
GCC compilers set __FreeBSD__ statically to a build-time determined
targeted version (which in ports always matches the build host's
version).  This means that when building any version (12 or 13, etc.)
of riscv or some other architecture via GCC on a 12.x host,
__FreeBSD__ will always be set to 12.  As a result, __FreeBSD__ cannot
be used to reliably detect the target FreeBSD version being built.
Instead, __FreeBSD_version from either <sys/param.h> (in the kernel)
or <osreldate.h> (in userland) should be used.

This changes the gets() test in libc++ to use __FreeBSD_version from
<osreldate.h>.

Reported by:	jenkins (riscv64 and amd64-gcc)
Reviewed by:	dim, imp
Differential Revision:	https://reviews.freebsd.org/D22034
2019-10-15 18:16:10 +00:00
Navdeep Parhar
693a9dfce2 cxgbe(4): An EQ update can be requested in a TX_PKTS2 work request.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2019-10-15 17:35:39 +00:00
John Baldwin
a2b282151f Use -march=octeon+ for OCTEON1.
External binutils requires octeon+ for saa.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D22033
2019-10-15 17:28:26 +00:00
Ruslan Bukin
a53a43d988 Fix dwmmc(4) driver attachment when ext_resources are not present.
Ignore only ENOENT (no DTS properties found) and ENODEV (driver not
present) non-zero return values from ext_resources.

Reviewed by:	manu
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22043
2019-10-15 17:24:21 +00:00
John Baldwin
6ed6d6931a Fix a write-only variable warning from external GCC.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D22032
2019-10-15 17:17:16 +00:00
John Baldwin
017128c99b Don't set the OUTPUT_FORMAT explicitly but let ld derive it.
This fixes an error with modern ld.bfd and is inline with the changes in
r215251 and r217612.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D22031
2019-10-15 17:14:30 +00:00
John Baldwin
64f1604a76 Update MIPS kernel builds to work with mips-gcc.
- Use a default -march of mips64 on N64 and N32 kernels.
- Set the endianness (via MIPS_ENDIAN) and ABI (via MIPS_ABI) in
  CFLAGS from MACHINE_ARCH.  ARCH_FLAGS now only sets a different
  -march value if needed.
- TRAMP_ARCH_FLAGS inherits MIPS_ENDIAN from MACHINE_ARCH but does
  not set the ABI since XLPN32 needs an N64 ABI for the trampoline
  loader.  When TRAMP_ARCH_FLAGS is used it must set both -march
  and -mabi.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D22030
2019-10-15 17:11:42 +00:00
Brooks Davis
7c8b268a12 rpcgen: make compiler arglist allocation dynamic
Limit argmax to an absurdly large value prevent overflow (no overflow
possible on FreeBSD due to ARG_MAX).

In CheriBSD we exceed the 19 non-NULL arguments in the static array.  Add
a simple size doubling allocator and increase the default to 32.

GC remnants of support for fixed arguments.

Reviewed by:	archardson (prior version), James Clarke (prior version)
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21971
2019-10-15 16:05:17 +00:00
Andriy Gapon
67f8ab8ebb fix up r353565, somehow a few files did not get committed
MFC after:	3 weeks
X-MFC with:	r353565
2019-10-15 15:52:01 +00:00
Gleb Smirnoff
237c1f932b Remove pfctlinput2(). It came from KAME and had never ever been in use. 2019-10-15 15:40:03 +00:00
Andriy Gapon
6f2721b907 MFV r353561: 10343 ZoL: Prefix all refcount functions with zfs_
illumos/illumos-gate@e914ace2e9
e914ace2e9

https://www.illumos.org/issues/10343
  On the openzfs feature/porting matrix, this is listed as:
  prefix to refcount funcs/types
  Having these changes will make it easier to share other work across the
  different ZFS operating systems.
  PR 7963 424fd7c3e Prefix all refcount functions with zfs_
  PR 7885 & 7932 c13060e47 Linux 4.19-rc3+ compat: Remove refcount_t compat
  PR 5823 & 5842 4859fe796 Linux 4.11 compat: avoid refcount_t name conflict

Author: Tim Schumacher <timschumi@gmx.de>
Obtained from:	illumos, ZoL
MFC after:	3 weeks
2019-10-15 15:09:36 +00:00