RX checksum offloading on old Yukon controllers seem to cause more
problems.  Disable RX checksum offloading on controllers that don't
use new descriptor format but give chance to enable it with
ifconfig(8).


git-svn-id: svn://svn.freebsd.org/base/head@247382 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Clear the memory allocated to build the unwind tables. This fixes C++
exceptions on ARM EABI with static binaries.


git-svn-id: svn://svn.freebsd.org/base/head@247386 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
An inode block must not be blockingly read while cg block is owned.
The order is inode buffer lock -> snaplk -> cg buffer lock, reversing
the order causes deadlocks.

Inode block must not be written while cg block buffer is owned. The
FFS copy on write needs to allocate a block to copy the content of the
inode block, and the cylinder group selected for the allocation might
be the same as the owned cg block.  The reserved block detection code
in the ffs_copyonwrite() and ffs_bp_snapblk() is unable to detect the
situation, because the locked cg buffer is not exposed to it.

In order to maintain the dependency between initialized inode block
and the cg_initediblk pointer, look up the inode buffer in
non-blocking mode. If succeeded, brelse cg block, initialize the inode
block and write it.  After the write is finished, reread cg block and
update the cg_initediblk.

If inode block is already locked by another thread, let the another
thread initialize it.  If another thread raced with us after we
started writing inode block, the situation is detected by an update of
cg_initediblk.  Note that double-initialization of the inode block is
harmless, the block cannot be used until cg_initediblk is incremented.

Sponsored by:	The FreeBSD Foundation
In collaboration with:	pho
Reviewed by:	mckusick
MFC after:	1 month
X-MFC-note:	after r246877


git-svn-id: svn://svn.freebsd.org/base/head@247387 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The softdep freeblks workitem might hold a reference on the dquot.
Current dqflush() panics when a dquot with with non-zero refcount is
encountered.  The situation is possible, because quotas are turned off
before softdep workitem queue if flushed, due to the quota file writes
might create softdep workitems.

Make the encountering an active dquot in dqflush() not fatal, return
the error from quotaoff() instead.  Ignore the quotaoff() failures
when ffs_flushfiles() is called in the course of softdep_flushfiles()
loop, until the last iteration.  At the last loop, the quotas must be
closed, and because SU workitems should be already flushed, the
references to dquot are gone.

Sponsored by:	The FreeBSD Foundation
Reported and tested by:	pho
Reviewed by:	mckusick
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@247388 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make recursive getblk() slightly more useful.  Keep the buffer state
intact if getblk() is done on the already owned buffer.  Exit from
brelse() early when the lock recursion is detected, otherwise brelse()
might prematurely destroy the buffer under some circumstances.

Sponsored by:	The FreeBSD Foundation
Noted by:	mckusick
Tested by:	pho
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@247389 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
- Initialize GPIO_OE register based on pinmux configuration

Although AM335x TRM states that GPIO_OE register is not used and just
reflects pads configuration in practice it does control pin behavior
and shoiuld be set in addition to pinmux setup


git-svn-id: svn://svn.freebsd.org/base/head@247390 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix typo


git-svn-id: svn://svn.freebsd.org/base/head@247391 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Map libraries linked with -Ttext-segment=base_addr at base_addr.
Normal libraries have base address 0 and are unaffected by this change.

PR:		176216
Submitted by:	Damjan Jovanovic <damjan.jov@gmail.com>
Reviewed by:	kib
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@247396 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFV 247176, 247178, 247315:
Import metaslab_sync() speedup from vendor (illumos).

Illumos ZFS issues:
  3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread
  3564 spa_sync() spends 5-10% of its time in metaslab_sync() (when not
       condensing)
  3578 transferring the freed map to the defer map should be constant time
  3579 ztest trips assertion in metaslab_weight()

References:
  https://www.illumos.org/issues/3552
  https://www.illumos.org/issues/3564
  https://www.illumos.org/issues/3578
  https://www.illumos.org/issues/3579

MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@247398 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The .journal file needs to reside on the ROOTINO which must not extend
beyond direct blocks. A typo caused this check to fail.


git-svn-id: svn://svn.freebsd.org/base/head@247399 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge from vmobj-rwlock:
VM_OBJECT_LOCKED() macro is only used to implement a custom version
of lock assertions right now (which likely spread out thanks to
copy and paste).
Remove it and implement actual assertions.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
Tested by:	pho


git-svn-id: svn://svn.freebsd.org/base/head@247400 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
watchdogd(8) and watchdog(4) enhancements.

The following support was added to watchdog(4):
- Support to query the outstanding timeout.
- Support to set a software pre-timeout function watchdog with an 'action'
- Support to set a software only watchdog with a configurable 'action'

'action' can be a mask specifying a single operation or a combination of:
 log(9), printf(9), panic(9) and/or kdb_enter(9).

Support the following in watchdogged:
- Support to utilize the new additions to watchdog(4).
- Support to warn if a watchdog script runs for too long.
- Support for "dry run" where we do not actually arm the watchdog,
  but only report on our timing.

Sponsored by:   iXsystems, Inc.
MFC after:      1 month


git-svn-id: svn://svn.freebsd.org/base/head@247405 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add an implementation of open_memstream() and open_wmemstream().  These
routines provide write-only stdio FILE objects that store their data in a
dynamically allocated buffer.  They are a string builder interface somewhat
akin to a completely dynamic sbuf.

Reviewed by:	bde, jilles (earlier versions)
MFC after:	1 month


git-svn-id: svn://svn.freebsd.org/base/head@247411 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a potential race in returning setting errno when an
association goes down.
Reported by Mozilla in
https://bugzilla.mozilla.org/show_bug.cgi?id=845513

MFC after: 3 days


git-svn-id: svn://svn.freebsd.org/base/head@247412 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a typo that prevented booting a kernel that had virtual addresses in
the elf headers.


git-svn-id: svn://svn.freebsd.org/base/head@247413 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
fix this script so we don't expand the second $FreeBSD since svn thinks
the $ in $1 ends the keyword, and expands it...


git-svn-id: svn://svn.freebsd.org/base/head@247414 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
mdoc: add missing El.


git-svn-id: svn://svn.freebsd.org/base/head@247415 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
mdoc: begin sentence on new line.


git-svn-id: svn://svn.freebsd.org/base/head@247416 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove EOL whitespace.


git-svn-id: svn://svn.freebsd.org/base/head@247417 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add a reminder that the user should update boot block if they are upgrading
their existing system and use LZ4 compression for ZFS.

Suggested by:	mm
MFC after:	3 days


git-svn-id: svn://svn.freebsd.org/base/head@247422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f