FreeBSD_HEAD_i386 - Build #4293 - Fixed

From: <jenkins-admin_at_FreeBSD.org>
Date: Sat, 3 Dec 2016 22:59:19 +0000 (GMT)
FreeBSD_HEAD_i386 - Build #4293 - Fixed:

Build information: https://jenkins.FreeBSD.org/job/FreeBSD_HEAD_i386/4293/
Full change log: https://jenkins.FreeBSD.org/job/FreeBSD_HEAD_i386/4293/changes
Full build log: https://jenkins.FreeBSD.org/job/FreeBSD_HEAD_i386/4293/console

Change summaries:

309513 by adrian:
[camcontrol] init ts=0 to quieten gcc.

It "looks" like ts is set to something on success, and not modified on
error.

Checked on IRC with: cem

309504 by dteske:
Fix bug preventing limits(1) from being applied

PR:		misc/212493
Differential Revision:	https://reviews.freebsd.org/D8232
Submitted by:	girgen
Reviewed by:	adrian
MFC after:	3 days
X-MFC-to:	stable/11

309491 by rpokala:
Build smbios.ko as a module for amd64 and i386

For whatever reason, smapi, smbios, vpd are all under the "bios" directory.
smapi is only for i386, so the entire "bios" directory is only built for
i386. Break smapi out, and make only it i386-specific. Then, build the
"bios" directory for both amd64 and i386.

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

309490 by pfg:
Revert r253678, r253661:
Fix a segfault in ctfmerge(1) due to a bug in GCC.

The change was correct and the bug real, but upstream didn't adopt it
and we want to remain in sync. When/if upstream does something about it
we can bring their version.

The bug in question was fixed in GCC 4.9 which is now the default in
FreeBSD's ports. Our native gcc-4.2, which is still in use in some Tier-2
platforms also has a workaround so no end-user should be harmed by the
revert.

309486 by avos:
rtwn: fix bitmap size calculation.

Tested with RTL8188CE, STA mode.

309481 by avos:
rsu: fix frame processing in the Rx path (similar to r292207).

- Fill in Rx radiotap header correctly (for every packet in a chain;
not once per chain).
- Fix rate / flags fields in Rx radiotap.
- Add debug messages for discarded frames.
- Pass received control (< sizeof(struct ieee80211_frame)) frames
to net80211 (if allowed by device filter; cannot happen yet).

Tested with Asus USB-N10.

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

309480 by kevlo:
Fix logic error so the R92C_TDECTRL register value is updated correctly.

Reviewed by:	avos

309479 by avos:
rsu: remove unused structures / variables.

309478 by bdrewery:
DIRDEPS_BUILD: Fix '/' in group names creating a bad cookie.

This is reworking the change in r296585 but to still properly install
the files.  This limits the change to only the DIRDEPS_BUILD logic
for what it considers the name of the staging set, which is what the
cookie name is based off of.

Sponsored by:	Dell EMC Isilon
MFC after:	1 week

309477 by bdrewery:
Revert r296585.

This broke installing dtrace test files.  It was poorly tested.

Reported by:	markj
Pointyhat to:	bdrewery
MFC after:	1 week

309476 by bdrewery:
Create the /usr/lib/include symlink as relative.

This ugly code is done to avoid assuming LIBDIR is 2 components
deep.

Reported by:	jhb

309474 by ngie:
Don't build :strvis_locale if VIS_NOLOCALE is undefined

The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features
in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower
in conditionally running the test instead of backporting the newer version of
libc-vis

MFC after:	now

309472 by ngie:
Restore pathing for factor(1), which unnecessarily diverged in r278616

factor lives in /usr/games/, not /usr/bin, in NetBSD.

The correct way to handle this is do on-the-fly manipulation of the test
script via ATF_TESTS_SH_SED_<foo>, not by modify the pathing directly in
the test script.

This is being done to resolve an unnecessary conflict made when pulling
back ^/head_at_r309469 (contrib/netbsd-tests update) to ^/stable/10.

No functional change

MFC after:	now

309467 by adrian:
[ath] use the correct AMPDU frame limit for the given node, rather than the global config.

This is important in hostap, ibss, (11s at some magical future date, etc)
where different nodes may have smaller limits.

Oops!

MFC after:	1 week
Relnotes:	Yes

309465 by adrian:
[net80211] prepare for 11ac aware NICs that want to know per-vdev channel and centre frequencies.

* ic_freq is the centre of the primary channel, not the centre of the
  HT40/HT80/etc channel.  Add a method to access that.
* Add a method to access the centre of the primary channel, including
  knowing the centre of the 5/10/20/40/80, versus the primary channel.
  Ie, it's the centre of the 40, 80, 160MHz channel.
* Add a method to access the centre frequency of the secondary 80MHz
  channel - we don't support VHT yet, but when we do.
* Add methods to access the current channel and the per-dev desired
  channel.  Ideally drivers that do full offload with a per-vap channel
  configuration should use the vap channel, NOT ic_curchan.
  Non-offload drivers that require net80211 to change the channel should
  be accessing ic_curchan.

309464 by ngie:
Expect 01:main to fail

Changes were made to ZFS in the past year with respect to how ACLs
are handled, causing failures in this test. Mark it TODO so (hopefully)
someone more knowledgeable (like mav or trasz) will fix the code or the
test.

PR:	212323

309463 by ngie:
Expect :coredump_phnum to fail

The number of program headers on my system (GENERIC-NODEBUG) don't match the
expected (hardcoded) number in the test

PR:	215019

309462 by ngie:
Fix test coredump_phnum_test:coredump_phnum require.config specification

The requirement is set via `atf_set "require.config" "allow_sysctl_side_effects"',
not `atf_set "require.config" "allow_sysctl_side_effects"'

X-MFC with: r308177
Pointyhat to: cmeyer

309461 by loos:
Allow simultaneous access to switch device, there is no reason to prevent
it.

Remove bogus wrappers and use the kernel defaults.

While here, use DEVMETHOD_END.

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)

309460 by vangyzen:
thr_set_name(): silently truncate the given name as needed

Instead of failing with ENAMETOOLONG, which is swallowed by
pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
bytes.  This is more likely what the user wants, and saves the
caller from truncating it before the call (which was the only
recourse).

Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
so the user might find the documentation for this behavior.

Reviewed by:	jilles
MFC after:	3 days
Sponsored by:	Dell EMC

309451 by pfg:
Document undocumented indent(1) options badp/nbadp, bs/nbs, and lc.

Submitted by:	 Piotr Stefaniak
Differential Revision:	https://reviews.freebsd.org/D8690

309439 by pfg:
ext2fs: renumber the license clauses to avoid skipping #3.

This is to keep consistency with other files, and help license-checking
utilities determine the number of clauses that apply.

No functional change.

309425 by mjg:
vfs: provide fake locking primitives for the crossmp vnode

Since the vnode is only expected to be shared locked, we can save a
little overhead by only pretending we are locking in the first place.

Reviewed by:	kib
Tested by:	pho

309419 by pfg:
indent(1): Avoid out-of-bound accesses of array ps.p_stack.

Submitted by:	 Piotr Stefaniak

309418 by pfg:
indent(1): Avoid out-of-bound accesses of arrays.

ps.paren_indents:
When ps.paren_level was 0, this was accessing paren_indents[-1].

in_buffer:
This fragment checks if "*/" was read, but there's no guarantee that there
is more than one byte in the array (actually, this happens frequently for
the "{" in things like "int main(void) {").

Submitted by:	 Piotr Stefaniak

309417 by pfg:
indent(1): Remove an extra newline added in a previous commit.

It doesn't math the remaining of the case statement.

309416 by alc:
Eliminate a stale comment; vm_radix_prealloc() was replaced in r254141.

MFC after:	3 days

309415 by pfg:
indent(1): Optimize parser stack usage.

When special else-if processing is enabled (-ei), we can assume "else if"
and "if" to be equivalent for indentation purposes.
This reduction saves a lot of stack space in case of a long "if-else-if
... else-if" sequence;  with this change,
Postgres/src/bin/psql/tab-complete.c as of 9.6beta3
requires minimum of the stack length to be 31 instead of 444.

Submitted by:	 Piotr Sephaniak

309414 by rstone:
Revert r309372

The bug intended to be fixed by r309372 was already addressed by r296178,
so revert my change.

Reported by:	seph

309413 by imp:
Flag the vendor specific pages as such. This allows different decoding
for the same page number as different vendors encode vendor specific
pages differently.

309412 by imp:
dd is currently a bootstrap tool. It really doesn't have any business
being a bootstrap tool. However, for reproducible build output,
FreeBSD added dd status=none because it was otherwise difficult to
suppress the status information, but retain any errors that might
happen. There's no real reason that dd has to be a build tool, other
than we use status=none unconditional. Remove dd from a bootstrap tool
entirely by only using status=none when available. This may also help
efforts to build the system on non-FreeBSD hosts as well.

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

309411 by emaste:
Retire long-broken/unused static rtld support

rtld-elf has some vestigial support for building as a static executable.
r45501 introduced a partial implementation with a prescient note that it
"might never be enabled." r153515 introduced ELF symbol versioning
support, and removed part of the unused build infrastructure for static
rtld.

GNU ld populates rela relocation addends and GOT entries with the same
values, and rtld's run-time dynamic executable check relied on this.
Alternate toolchains may not populate the GOT entries, which caused
RTLD_IS_DYNAMIC to return false. Simplify rtld by just removing the
unused check.

If we want to restore static rtld support later on we ought to introduce
a build-time #ifdef flag.

PR:		214972
Reviewed by:	kan
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8687

309410 by n_hibma:
Fix man page:

- It should say 'read' in the I2CREAD section.
- last in the struct indicates the last command in a sequence, not the
  reverse.

Reviewed by:	imp
MFC after:	3 days

309409 by n_hibma:
More typos in strings.

Submitted by:	bde
MFC after:	3 days

309408 by julian:
Changes to allow the patching of packets with an offset (and other changes.. see man page)

PR:	206185
Submitted by:	Dmitry Vagin <daemon-hammer_at_ya.ru>
MFC after:	 1 week
Relnotes:	yes (also ng_checksum node)

309407 by julian:
A little light wordsmithing only.

Sponsored by:	FreeBSD

309406 by hselasky:
Remove useless NULL checks.

NULL is not returned when allocating memory passing the M_WAITOK flag.

Submitted by:		trasz _at_
Differential Revision:  https://reviews.freebsd.org/D5772
Sponsored by:           Mellanox Technologies
MFC after:		1 week

309405 by mm:
MFV r309403:

Sync libarchive with vendor.

Vendor bugfixes:
Fix for heap-buffer-overflow in archive_le16dec()
Fix for heap-buffer-overflow in uudecode_bidder_bid()
Reworked fix for compatibility with archives created by Perl Archive::Tar

MFC after:	1 week

309404 by hselasky:
Fix return value from ng_uncallout().

callout_stop() recently started returning -1 when the callout is already
stopped, which is not handled by the netgraph code. Properly filter
the return value. Netgraph callers only want to know if the callout
was cancelled and not draining or already stopped.

Discussed with:		julian, glebius
MFC after:		2 weeks

309400 by hselasky:
Fix for endless recursion in the ACPI GPE handler during boot.

When handling a GPE ACPI interrupt object the EcSpaceHandler()
function can be called which checks the EC_EVENT_SCI bit and then
recurse on the EcGpeQueryHandler() function. If there are multiple GPE
events pending the EC_EVENT_SCI bit will be set at the next call to
EcSpaceHandler() causing it to recurse again via the
EcGpeQueryHandler() function. This leads to a slow never ending
recursion during boot which prevents proper system startup, because
the EC_EVENT_SCI bit never gets cleared in this scenario.

The behaviour is reproducible with the ALASKA AMI in combination with
a newer Skylake based mainboard in the following way:

Enter BIOS and adjust the clock one hour forward. Save and exit the
BIOS. System fails to boot due to the above mentioned bug in
EcGpeQueryHandler() which was observed recursing multiple times.

This patch adds a simple recursion guard to the EcGpeQueryHandler()
function and also also adds logic to detect if new GPE events occurred
during the execution of EcGpeQueryHandler() and then loop on this
function instead of recursing.

Reviewed by:		jhb
MFC after:		2 weeks

309397 by tuexen:
Fix the handling of  TCP FIN-segments in the CLOSED state

When a TCP segment with the FIN bit set was received in the CLOSED state,
a TCP RST-ACK-segment is sent. When computing SEG.ACK for this, the
FIN counts as one byte. This accounting was missing and is fixed by this
patch.

Reviewed by:		hiren
MFC after:		1 month
Sponsored by:		Netflix, Inc.
Differential Revision:	https://svn.freebsd.org/base/head

309394 by marcel:
Fix use-after-free bugs in pfsync(4)

Use after free happens for state that is deleted. The reference
count is what prevents the state from being freed. When the
state is dequeued, the reference count is dropped and the memory
freed. We can't dereference the next pointer or re-queue the
state.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8671

309393 by araujo:
Use memset(3) instead of bzero(3).

Obtained from:	OpenBSD (r1.12, r1.20, r1.18 and r1.37)

309392 by araujo:
String terminators are called NUL, not NULL, also the variable
mentioned in the comment is p and not u.

Obtained from:	OpenBSD (r1.34)

309382 by pfg:
indent(1): Do not define opchar unless it will be used.

"opchar" is only used once depending on "undef" macro being defined.
Conditionalize it in the same way.

Submitted by:	Piotr Sephaniak

309380 by pfg:
indent(1): Fix indent's confusion about custom FreeBSD macros.

Teach indent(1) about storage-class specifiers. Don't assume
"in_parameter_declaration" state if "in_decl" hasn't been set. Don't set
"in_decl" for storage-class specifiers.

That set of changes helps with recognizing the difference between file
scope declarations like this:

static LIST_HEAD(, alq) ald_active;
static int ald_shuttingdown = 0;
struct thread *ald_thread;

and old style function declarators like this:

static int
do_execve(td, args, mac_p)
	struct thread *td;
	struct image_args *args;
	struct mac *mac_p;
{

Unfortunately, at the same time this change makes indent(1) require
explicit int in declarations like "static a;", in order to understand that
it's part of a declaration. On the other hand, declarations like in the
first example are no longer indented as if ald_shuttingdown and ald_thread
were parameters of a function named LIST_HEAD.

Submitted by:	 Piotr Stefaniak

309374 by ken:
Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support.

This adds support to camcontrol(8) and libcam(3) for getting and setting
the time on SCSI protocol drives.  This is more commonly found on tape
drives, but is a SPC (SCSI Primary Commands) command, and may be found
on any device that speaks SCSI.

The new camcontrol timestamp subcommand allows getting the current device
time or setting the time to the current system time or any arbitrary time.

sbin/camcontrol/Makefile:
	Add timestamp.c.

sbin/camcontrol/camcontrol.8:
	Document the new timestamp subcommand.

sbin/camcontrol/camcontrol.c:
	Add the timestamp subcommand to camcontrol.

sbin/camcontrol/camcontrol.h:
	Add the timestamp() function prototype.

sbin/camcontrol/timestamp.c:
	Timestamp setting and reporting functionality.

sys/cam/scsi/scsi_all.c:
	Add two new CCB building functions, scsi_set_timestamp() and
	scsi_report_timestamp().  Also, add a new helper function,
	scsi_create_timestamp().

sys/cam/scsi/scsi_all.h:
	Add CDB and parameter data for the the set and report timestamp
	commands.

	Add function declarations for the new CCB building and helper
	functions.

Submitted by:	Sam Klopsch
Sponsored by:	Spectra Logic
MFC After:	2 weeks

309373 by bdrewery:
Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired.

This uses the same fix as r294894 did for the mlock test.  The code from
that commit is moved into a common object file which PROGS supports
building first.

Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8689

309372 by rstone:
Fix a false positive in a buf_ring assert

buf_ring contains an assert that checks whether an item being
enqueued already exists on the ring.  There is a subtle bug in
this assert.  An item can be returned by a peek() function and
freed, and then the consumer thread can be preempted before
calling advance().  If this happens the item appears to still be
on the queue, but another thread may allocate the item from the
free pool and wind up trying to enqueue it again, causing the
assert to trigger incorrectly.

Fix this by skipping the head of the consumer's portion of the
ring, as this index is what will be returned by peek().

Sponsored by:	Dell EMC Isilon
MFC After:	1 week
Differential Revision:	https://reviews.freebsd.org/D8685
Reviewed by:	hselasky

309369 by tsoome:
libstand: dosfs cstyle cleanup for return keyword.

Reviewed by:	bapt, imp, allanjude
Approved by:	imp (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8678

309367 by vangyzen:
locale: enable more warnings; fix them

Do not set WARNS, so it gets the current default of 6.
Fix the warnings by sprinkling static, const, or strdup.
Make some constant data tables const.  Fix whitespace.

MFC after:	1 week
Sponsored by:	Dell EMC

309366 by cem:
capsicum_helpers: Squash errors from closed fds

Squash EBADF from closed stdin, stdout, or stderr in caph_limit_stdio().
Any program used during special shell scripts may commonly be forked
from a parent process with closed standard stream.  Do the common sense
thing for this common use.

Reported by:	Iblis Lin <iblis AT hs.ntnu.edu.tw>
Reviewed by:	oshogbo_at_ (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8657

309365 by alc:
During vm_page_cache()'s call to vm_radix_insert(), if vm_page_alloc() was
called to allocate a new page of radix trie nodes, there could be a call to
vm_radix_remove() on the same trie (of PG_CACHED pages) as the in-progress
vm_radix_insert().  With the removal of PG_CACHED pages, we can simplify
vm_radix_insert() and vm_radix_remove() by removing the flags on the root of
the trie that were used to detect this case and the code for restarting
vm_radix_insert() when it happened.

Reviewed by:	kib, markj
Tested by:	pho
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8664

309364 by vangyzen:
locale: fix buffer management

Also, handle signed and unsigned chars, and more gracefully handle
invalid input.

Submitted by:	bde in response to r309331
MFC after:	1 week
Sponsored by:	Dell EMC

309363 by mm:
MFC r309362:

Sync libarchive with vendor.
Small improvements, style fixes, bugfixes.
Restores compatibility with tar archives created with Perl Archive::Tar (1)

MFC after:	1 week
Reported by:	Matthew Seaman <matthew_at_freebsd.org> (1)

309361 by danfe:
- Mention mismatching numbers in MSR vs. ACPI _PSS count warning: seeing
  actual numbers would help debugging (also, `MSR' and `ACPI' are standard
  abbreviations and thus should be properly capitalized)
- Rephrase unsupported AMD CPUs message and wrap as an overly long line:
  `sorry' 1) is wrongly spelled after period (starts with a small letter)
  and 2) carries emotional "tinge" that is unnecessary and even bogus in
  debug message; `implemented' is not the best word as `supported' suits
  better in this context
- Improve readability when reporting resulted P-state transition (debug)

Approved by:	jhb

309360 by emaste:
EFI loaders: parse rela relocations on amd64

Prior to this change the loader self relocation code interpreted amd64's
rela relocations as if they were rel relocations, discarding the addend.
This "works" because GNU ld 2.17.50 stores the addend value in both the
r_addend field of the relocation (as expected) and at the target of the
relocation.

Other linkers, and possibly other versions of GNU ld, won't have this
behaviour, so interpret the relocations correctly.

Reported by:	George Rimar
Reviewed by:	andrew
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8681

309357 by n_hibma:
Speling fixes and fix line endings for err_msg output.

In some cases there was not \n, in other cases there was.

309356 by peter:
Update from subversion 1.9.4 to 1.9.5.

This includes a security fix for a component that we do not build, and
two potentially useful client side fixes for reintegrate merges and tree
conflict handling.  See CHANGES for full details.

309353 by sephe:
hyperv/hn: Add 'options RSS' support.

Reviewed by:	adrian
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8676

309352 by imp:
Finish incomplete comments in prior revision. I was going to fix this
after I tested it, but didn't.

309351 by imp:
Revert the 'performance' setting to 'NONE' from C2. C2 has issues with
USB in places, as well as having the potential for reducing
performance. Since this is used even when powerd isn't enabled, these
two problems can cause on servers. Supermicro X9 motherboards, for
example, have problems with the virtual IPMI USB keyboards and mice
attaching and detaching repeatedly. Since there are issues on some
CPUs with C2, fail safe by defaulting to not altering it.

MFC After: 3 days

309350 by imp:
If the kenv variable rc_debug is set, turn on rc_debug.

309349 by imp:
Simplify test.

309348 by sephe:
hyperv/hn: Don't hold txdesc, if no BPFs are attached.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8675

309347 by loos:
MDIO_PHYACCESS_ACK is only valid for read access, remove it from
miibus_writereg.

Reduce the DELAY() between reads while waiting for MII access.

Spotted by:	yongari
Sponsored by:	Rubicon Communications, LLC (Netgate)

309346 by sephe:
hyperv/hn: Add HN_DEBUG kernel option.

If bufring is used for per-TX ring descs, don't update "available"
counter, which is only used to help debugging.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8674

309345 by loos:
The RX_FREEBUFFER registers are a write to increment field.

Writing the full queue size to it every time was makeing it overflow with a
lot of bogus values.

This fixes the interrupt storms on irq 40.

Sponsored by:	Rubicon Communications, LLC (Netgate)

309344 by cem:
Remove a death threat from the FreeBSD sources

Reported by:	koobs_at_, araujo_at_, linimon_at_, bjk_at_, emaste_at_, jhb_at_, ngie_at_, cem_at_
Maintainer timeout:	des_at_

309343 by pfg:
indent(1): Don't unnecessarily add a blank before a comment ends.

pr_comment() did avoid adding surplus space character when a comment
contained it at the end. Now it's also paying attention to tabs.

Taken from:	 Piotr Stefaniak

309342 by pfg:
indent(1): Don't ignore newlines after comments that follow braces.

indent.c has a special loop that stores tokens from between an if () and
the next statement into a buffer. The loop ignored all newlines, but that
resulted in not calling dump_line() when it was needed to produce the
final line of the buffered up comment.

Taken from:	 Piotr Stefaniak

309341 by pfg:
indent(1): Avoid out of bound access of array in_buffer

Work-around a somewhat complex interaction within the code. From
Piotr's commit [1]:

When pr_comment() calls dump_line() for the first line of a multiline
comment, it doesn't include any indentation - it starts with the "/*".
This is consistent for both boxed and not boxed comments. Where the logic
diverges is in how it treats the rest of the lines of the comment. For box
comments indent assumes that it must not change anything, so lines are
dumped as they were, including the indentation where it exists. For the
rest of comments, it will first remove the indentation to store plain text
of the comment and then add it again where indent thinks it's appropriate
-- this is part of comment re-indenting process.

For continuations of multi-line comments, the code that handles comments
in dump_line() will use pad_output() to create indentation from the
beginning of the line (what indent calls the first column) and then write
string pointed by s_com afterwards. But if it's a box comment, the string
will include original indentation, unless it's the first line of the
comment. This is why tab characters from s_com have to be considered when
calculating how much padding is needed and the "while (*com_st == '\t')
com_st++, target += 8;" does that.

In dump_line(), /target/ is initially set to ps.com_col, so it always
assumes that indentation needs to be produced in this function, regardless
of which line of a box comment it is. But for the first line of a box
comment it is not true, so pr_comment() signals it by setting
ps.n_comment_delta, the negative comment delta, to a negative number which
is then added to /target/ in dump_line() on all lines except the first
one, so that the function produces adequate indentation in this special
case.

The bug was in how that negative offset was calculated: pr_comment() used
count_spaces() on in_buffer, which pr_comment() expected to contain
non-null terminated sequence of characters, originating from whatever
originally was on the left side of the comment. Understanding that
count_spaces() requires a string, pr_comment() temporarily set buf_ptr[-2]
to 0 in hope that it would nul-terminate the right thing in in_buffer and
calling count_spaces() would be safe and do the expected thing. This was
false whenever buf_ptr would point into save_com, an entirely different
char array than in_buffer.

The short-term fix is to recognize whether buf_ptr points into in_buffer
or save_com.

Reference:
[1]
https://github.com/pstef/freebsd_indent/commit/ea486a2aa3b056b146bdfbb8e94843159750f200

Taken from:	 Piotr Stefaniak

309339 by gjb:
Revert r309314, which breaks installing ports.

Requested by:	antoine
Differential Revision:	https://reviews.freebsd.org/D8120 (related)
Sponsored by:	The FreeBSD Foundation

309338 by cem:
ioat(4): Fix 'bogus completion_pending' KASSERT

Fix ioat_release to only set is_completion_pending if DMAs were actually
queued.  Otherwise, the spurious flag could trigger an assert in the
reset path on INVARIANTS kernels.

Reviewed by:	bdrewery, Suraj Raju _at_ Isilon
Sponsored by:	Dell EMC Isilon

309332 by dim:
Cleanup old debug dirs in delete-old-dirs target

Any .debug or .symbols files under /usr/lib/debug which correspond to
OLD_FILES entries in ObsoleteFiles.inc are also automatically cleaned up
by the delete-old target.  Make this also apply to any OLD_DIRS entries.

Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D8683

309331 by vangyzen:
Include limits.h for CHAR_MAX

This was needed on stable/10.  Apparently, sys/param.h supplies CHAR_MAX
on head.  Include limits.h anyway, for consistency, and because C says so.

Sponsored by:	Dell EMC

309328 by andrew:
Fix the PCI host generic FDT driver to call into the common code and not
recurse into itself.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309327 by andrew:
Fix the alloc function the ThunderX PCIe driver calls, the previous
function may not exist when FDT is removed from the kernel.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309326 by rwatson:
Clarify warning message when failing to configure audit on user login:
when au_user_mask() fails, it's not a failure to set the audit mask,
but to calculate the audit mask -- and hence a condfiguration-file
issue (of some sort).

MFC after:	3 days
Sponsored by:	DARPA, AFRL

309324 by andrew:
Mark the Alpine ethernet driver as FDT only. It calls
alpine_serdes_resource_get which is defined in an FDT only file.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309323 by andrew:
Move the FDT specific parts of the GIC diver softc to the FDT attachment.
This allows the driver to be built in a kernel with no FDT support, e.g.
on arm64 with just ACPI.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309322 by andrew:
Only include FDT headders when building for FDT.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309321 by mav:
Add `gmirror create` subcommand, alike to gstripe, gconcat, etc.

It is quite specific mode of operation without storing on-disk metadata.
It can be useful in some cases in combination with some external control
tools handling mirror creation and disks hot-plug.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.

309320 by sephe:
hyperv/storvsc: Don't use timedwait.

The timeout is unnecessary.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8656

309319 by sephe:
hypver/vmbus: Remove extra assertion.

It is asserted by vmbus_chan_gpadl_connect() now.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8660

309318 by sephe:
hyperv/hn: Allow TX to share event taskqueues.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8659

309316 by sephe:
hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8658

309314 by matthew:
Allow a user-overridable setting 'PKG_CMD' to control the command used
to create a repo during 'make packages'

This would have been useful for a situation I found myself in where
pkg(8) had been upgraded to a version that wanted the FBSD_1.5 ABI
version but libc.so.7 had not been upgraded, and only provided
FBSD_1.4. I found I needed to update libc in order to run pkg, and I
also needed to use pkg to update libc... Which is why pkg-static
exists, but there's currently no way to tell the build system to use
pkg-static instead of pkg.

This creates a variable PKG_CMD, default value 'pkg', that can be
overridden from the command line.

Reviewed by:	gjb
Approved by:	gjb
Differential Revision:	https://reviews.freebsd.org/D8120

309311 by sephe:
hyperv/hn: Allow multiple TX taskqueues.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8655

309310 by sephe:
hyperv/hn: Nuke the unused TX taskqueue CPU binding tunable.

It was an experimental tunable, and is now deemed to be road blocker
for further changes.  Time to retire it.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8654

309309 by jhibbits:
Bring the powerpc DDB disassembler into the 21st century

Bring in the most recent copy of NetBSD's db_disasm, to fix bugs and add more
instructions.

* Fix several bugs in the disassembler, most notably the disassembly of the
  rlwi* instructions, the original reason for bringing in this change.
* Add more registers to the SPR list
* Add more instructions to the opcode table

Obtained from:	NetBSD
MFC after:	2 weeks

309308 by mjg:
vfs: fix a whitespace nit in r309307

309307 by mjg:
vfs: avoid VOP_ISLOCKED in the common case in lookup

309306 by emaste:
netmap: add cast to fix powerpc64 LINT kernel

Attempt to fix powerpc64 LINT kernel broken by r308000. Netmap's use of
a uint64_t wchan seems odd, but in the interest of minimizing this
change just cast through uintptr_t to silence the compiler warning.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8669

309302 by np:
cxgbe(4): Include firmware for T6 cards in the driver.  Update all
firmwares to 1.16.12.0.

Obtained from:	Chelsio Communications
MFC after:	3 days
Sponsored by:	Chelsio Communications

309300 by mm:
MFV r309299:
Sync libarchive with vendor.

Important vendor bugfixes (relevant to FreeBSD):
#821: tar -P cannot extract hardlinks through symlinks
#825: Add sanity check of tar "uid, "gid" and "mtime" fields

PR:		213255
Reported by:	Tijl Coosemans <tilj_at_FreeBSD.org>
MFC after:	1 week

309298 by emaste:
libm: remove duplicate version script entries

These symbols already appear in the common lib/msun/Symbol.map.
Duplicate entries produce an error with LLVM's LLD linker.

Reviewed by:	br
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8627

309297 by mav:
Make SES status updates more aggressive.

 - On control request update all status pages, since they may also be
affected if user enables/disables enclosure slots.
 - Periodically update element descriptors too, since there is some
hardware where they are changed dynamically.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.

309296 by andrew:
We only use the cpu0 variable in the FDT code.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309295 by avg:
bhyve: stability and performance improvement for dbgport

The TCP server implementation in dbgport does not track clients, so it
may try to write to a disconected socket resulting in SIGPIPE.
Avoid that by setting SO_NOSIGPIPE socket option.

Because dbgport emulates an I/O port to guest, the communication is done
byte by byte.  Reduce latency of the TCP/IP transfers by using
TCP_NODELAY option.  In my tests that change improves performance of
kgdb commands with lots of output (e.g. info threads) by two orders of
magnitude.

A general note.  Since we have a uart emulation in bhyve, that can be
used for the console and gdb access to guests.  So, bvmconsole and bvmdebug
could be de-orbited now.  But there are many existing deployments that
still dependend on those.

Discussed with:	julian, jhb
MFC after:	2 weeks
Sponsored by:	Panzura

309294 by kadesai:
This patch upgrades driver version to 06.712.04.00-fbsd

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309293 by kadesai:
This patch will add code to refire IOCTL commands after OCR.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309292 by kadesai:
This patch will unblock SYNCHRONIZE_CACHE command to firmware, i.e. don't block the SYNCHRONIZE_CACHE command at driver instead of
passing it to firmware for all Gen3 controllers.
For Thunderbolt controller, keep the legacy behavior i.e. return the SYNCHRONIZE_CACHE command with success status from driver itself.

There is Sysctl parameter 'block_sync_cache' is provided to enable customers either to block/unblock these commands to facilitate
legacy behavior if there is a compatibility issue. Default value for module parameter is to unblock this command.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309291 by kadesai:
Wait for AEN task to be completed(if in queue) before resetting the controller
and return without processing event in AEN thread, if controller reset is in progress.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309290 by kadesai:
This patch will add task management support in driver. Below is high level description:
If a SCSI IO times out, then before initiating OCR, now the driver will try to send a
target reset to the particular target for which the IO is timed out. If that also fails,
then the driver will initiate OCR.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309289 by kadesai:
Process outstanding reply descriptors from all the reply descriptor post queues before initiating OCR.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309288 by kadesai:
Clean up reference to AEN command if abort AEN is succesful as the command is aborted.
Did the same by setting sc->aen_cmd = NULL when aborting AEN is successful.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309287 by kadesai:
Update controller properties(read OCR capability bit) when MR_EVT_CTRL_PROP_CHANGED recieved.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309286 by kadesai:
Add sanity check in IO and IOCTL path not to process command further if controller is in
HW_CRITICAL_ERROR.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309285 by kadesai:
Use a variable to indicate Gen3 controllers and remove all PCI ids based
checks used for gen3 controllers.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309284 by kadesai:
Problem statement:
MFI linked list in megaraid_sas driver is used for mfi-mpt pass-through commands.
This list can be corrupted due to many possible race conditions in driver and
eventually we may see kernel panic.

One example -
MFI frame is freed from calling process as driver send command via polling method and interrupt
for that command comes after driver free mfi frame (actually even after some other context reuse
the mfi frame). When driver receive MPT frame in ISR, driver will be using the index of MFI and
access that MFI frame and finally in-used MFI frames list will be corrupted.

High level description of new solution -
Free MFI and MPT command from same context.
Free both the command either from process (from where mfi-mpt pass-through was called) or from
ISR context. Do not split freeing of MFI and MPT, because it creates the race condition which
will do MFI/MPT list.

Submitted by:   Sumit Saxena <sumit.saxena_at_broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai_at_broadcom.com>
MFC after:  3 days
Sponsored by:   Broadcom Limited/AVAGO Technologies

309283 by andrew:
Mark the Broadcom code as FDT only, there is no ACPI support for the
Raspberry Pi 3.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309282 by mav:
Explicitly initialize cdai.flags.

In SES driver uninitialized value caused unreliable physpath reporting.

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

309281 by oleg:
Fix 'ipfw delete set N':
do not emit meaningless 'rule 0 not found' warning if set was already empty.

MFC after:	1 week

309276 by jchandra:
Fix interrupt clear in pl011 uart receive function

Clear the interrupt state before reading the input char from the
input FIFO. In the current code there is a window between the read
to the data register and the write to the the ICR, during which an
input char will not cause an interrupt.

This fixes the issue by which the serial port input on QEMU freezes
when using the emulated pl011 serial port.

309274 by jhb:
Use the correct name for the GCC macro indicating max_align_t is defined.

MFC after:	3 days

309271 by imp:
Trying to autodetect legacy setups lead to problems when people
overrode the disk image creation routine. For now, just always bring
in the legecy defines / routines.

309270 by cognet:
Add a FREEBSD-Xlist file for CK.

309269 by des:
Use malloc()ed buffers instead of stack buffers in gr_copy() and pw_copy().
This allows pw(8) to operate on passwd and group files with longer lines
than could be accomodated by a stack buffer.  It doesn't take more than a
few hundred users to exceed 8192 bytes in /etc/group.

MFC after:	3 weeks
Sponsored by:	The University of Oslo

309268 by cognet:
Hook CK to the kernel build.

309267 by cognet:
Add FreeBSD-specific files.

309266 by cognet:
Import Concurrency Kit in the kernel.
CK is a toolkit providing different lockfree algorithms/data structures.
More information can be found here : www.concurrencykit.org

309262 by dim:
Fix packaging for clang, lldb and lld 3.9.0

During the upgrade of clang/llvm etc to 3.9.0 in r309124, the PACKAGE
directive in the usr.bin/clang/*.mk files got dropped accidentally.

Restore it, with a few minor changes and additions:
* Correct license in clang.ucl to NCSA
* Add PACKAGE=clang for clang and most of the "ll" tools
* Put lldb in its own package
* Put lld in its own package

Reviewed by:	gjb, jmallett
X-MFC-With:	309124
Differential Revision: https://reviews.freebsd.org/D8666

309257 by ae:
Rework ip_tryforward() to use FIB4 KPI.

Tested by:	olivier
Obtained from:	Yandex LLC
MFC after:	1 month
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D8526

309256 by adrian:
[ath] force wake the hardware if we see a missed beacon.

This adds a workaround to incorrectly behaving APs (ie, FreeBSD APs) which
don't beacon out exactly when they should (at TBTT multiples of beacon
intervals.)

It forces the hardware awake (but leaves it in network-sleep so self
generated frames still state that the hardware is asleep!) and will
remain awake until the next sleep transition driven by net80211.

That way if the beacons are just at the wrong interval, we get a much
better chance of hearing more consecutive beacons before we go to sleep,
thus not constantly disconnecting.

Tested:

* AR9485, STA mode, against a misbehaving FreeBSD AP.

309253 by adrian:
[ath] revert the previous commit, after reading the 802.11-2012 spec a bit more.

The 802.11-2012 spec talks about this - section 10.1.3.2 - Beacon Generation
in Infrastructure Networks.  So yes, we should be expecting beacons to be
going out in multiples of intval.

Silly adrian.

So:

* fix the FreeBSD APs that are sending beacons at incorrect TBTTs (target
  beacon transmit time); and
* yes indeed we will have to wake up out of network sleep until we sync
  a beacon.

309252 by mav:
Add more ASMedia PCI IDs from different sources.

Exact device names are not clear, but its better then nothing at all.

MFC after:	1 month

309251 by mav:
Process port interrupt even is PxIS register is zero.

ASMedia ASM1062 AHCI chips with some fancy firmware handling PMP inside
seems sometimes forgeting to set bits in PxIS, causing command timeouts.
Removal of this check fixes the issue by the theoretical cost of slightly
higher CPU usage in some odd cases, but this is what Linux does too.

MFC after:	1 month

309250 by avg:
MFV r309249: 3821 Race in rollback, zil close, and zil flush

Note: there was a merge conflict resolved by me.

illumos/illumos-gate_at_43297f973a3543e7403ac27076490ab958a94b15
https://github.com/illumos/illumos-gate/commit/43297f973a3543e7403ac27076490ab958a94b15

https://www.illumos.org/issues/3821
  We recently had nodes with some of the latest zfs bits panic on us in a
  rollback-heavy environment. The following is from my preliminary analysis:
  Let's look at where we died:
  > $C
  ffffff01ea6b9a10 taskq_dispatch+0x3a(0, fffffffff7d20450, ffffff5551dea920, 1)
  ffffff01ea6b9a60 zil_clean+0xce(ffffff4b7106c080, 7e0f1)
  ffffff01ea6b9aa0 dsl_pool_sync_done+0x47(ffffff4313065680, 7e0f1)
  ffffff01ea6b9b70 spa_sync+0x55f(ffffff4310c1d040, 7e0f1)
  ffffff01ea6b9c20 txg_sync_thread+0x20f(ffffff4313065680)
  ffffff01ea6b9c30 thread_start+8()
  If we dig in we can find that this dataset corresponds to a zone:
  > ffffff4b7106c080::print zilog_t zl_os->os_dsl_dataset->ds_dir->dd_myname
  zl_os->os_dsl_dataset->ds_dir->dd_myname = [ "8ffce16a-13c2-4efa-a233-
  9e378e89877b" ]
  Okay so we have a null taskq pointer. That only happens during the calls to
  zil_open and zil_close. If we poke around we can see that we're actually in
  midst of a rollback:
  > ::pgrep zfs | ::printf "0x%x %s\\n" proc_t . p_user.u_psargs
  0xffffff43262800a0 zfs rollback zones/15714eb6-f5ea-469f-ac6d-
  4b8ab06213c2_at_marlin_init
  0xffffff54e22a1028 zfs rollback zones/8ffce16a-13c2-4efa-a233-
  9e378e89877b_at_marlin_init
  0xffffff4362f3a058 zfs rollback zones/0ddb8e49-ca7e-42e1-8fdc-
  4ac4ba8fe9f8_at_marlin_init
  0xffffff5748e8d020 zfs rollback zones/426357b5-832d-4430-953e-
  10cd45ff8e9f_at_marlin_init
  0xffffff436b867008 zfs rollback zones/8f36bf37-8a9c-4a44-995c-
  6d1b2751e6f5_at_marlin_init
  0xffffff4381ad4090 zfs rollback zones/6c8eca18-fbd6-46dd-ac24-
  2ed45cd0da70_at_marlin_init

Reviewed by: Matthew Ahrens <mahrens_at_delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel_at_delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov_at_delphix.com>
Reviewed by: Andriy Gapon <avg_at_FreeBSD.org>
Approved by: Richard Lowe <richlowe_at_richlowe.net>
Author: George Wilson <george.wilson_at_delphix.com>

MFC after:	3 weeks

309248 by andrew:
Fix ISS_DATA_DFSC_MASK, it should include all bits in the field.

309246 by adrian:
[ath] wake up the hardware from power-save before doing transmit completion checking.

This was being done in the pre-AR9380 case, but not for AR9380 and later.
When powersave in STA mode is enabled, this may have lead to the transmit
completion code doing this:

* call the task, which doesn't wake up the hardware
* complete the frames, which doesn't touch the hardware
* schedule pending frames on the hardware queue, which DOES touch the
  hardware, and this will be ignored

This would show up in the logs like this:

(with debugging enabled):
Nov 27 23:03:56 lovelace kernel: Q1[  0] (nseg=1) (DS.V:0xfffffe011bd57300 DS.P:0x49b57300) I: 168cc117 L:00000000 F:0005
...
(in general, doesn't require debugging enabled):
Nov 27 23:03:56 lovelace kernel: ath_hal_reg_write: reg=0x00000804, val=0x49b57300, pm=2

That register is a EDMA TX FIFO register (queue 1), and the val is the descriptor
being written.

Whilst here, make sure the software queue gets kicked here.

Tested;

* AR9485, STA mode + powersave

309245 by sephe:
hyperv/vmbus: Use poll/cancel APIs to wait for the CHOPEN response.

Since hypervisor does not respond CHOPEN to a revoked channel.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8636

309244 by sephe:
hyperv/vmbus: Add exec cancel support for message Hypercall API.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8635

309243 by delphij:
Plug another leak with malformed IPv6 address.

MFC after:	2 weeks

309242 by sephe:
hyperv/vmbus: Add result polling support for message Hypercall API.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8634

309241 by delphij:
Don't leak 'str' when we see a malformed IPv6 address.

MFC after:	2 weeks

309240 by sephe:
hyperv/vmbus: Add result polling support for xact API.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8633

309239 by delphij:
style(9).

MFC after:	2 weeks

309238 by delphij:
Plug a potential memory leak.

MFC after:	2 weeks

309237 by sephe:
hyperv/vmbus: Stringent GPADL parameter assertion.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8632

309236 by sephe:
hyperv/vmbus: Make sure that the allocated GPADL is not zero.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8631

309235 by sephe:
hyperv/hn: Simplify RSS indirect table fixup API

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8630

309234 by delphij:
pages and psize are always assigned, so there is no need to initialize
them as zero.

MFC after:	2 weeks

309233 by delphij:
Eliminate variables that are computed, assigned but never
used.

MFC after:	2 weeks

309232 by delphij:
Fix an obvious typo.

MFC after:	2 weeks

309231 by sephe:
hyperv/hn: Fix vmbus_chan_subidx usage.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8629

309230 by sephe:
hyperv/hn: Enable multi-packet RNDIS message support by default.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8621

309229 by sephe:
hyperv/hn: Fix attach error handling

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8620

309228 by sephe:
hyperv/hn: Fix multi-packet RNDIS message aggregation size setting.

Just in case that no chimney sending buffer can be used.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8619

309227 by sephe:
hyperv/hn: Fix detach error handling.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8613

309226 by sephe:
hyperv/hn: Utilize vmbus_chan_xact_wait

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8612

309225 by sephe:
hyperv/vmbus: Add supportive transaction wait function.

This function supports channel revocation properly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8611

309224 by sephe:
hyperv/vmbus: Zero out GPADL if error happens.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8601

309223 by adrian:
[ath] fix target beacon interval programming for STA mode when in powersave.

This bug has been bugging me for quite some time.  I finally sat down
with enough coffee to figure it out.

The short of it - rounding up to the next intval multiple of the TSF value
only works if the AP is transmitting all its beacons on an interval of
the TSF.  If it isn't - for example, doing staggered beacons on a multi-VAP
setup with a single hardware TSF - then weird things occur.

The long of it -

When powersave is enabled, the MAC and PHY are partially powered off.
They can't receive any packets (or transmit, for that matter.)
The target beacon timer programming will wake up the MAC/PHY just before
the beacon is supposed to be received (well, strictly speaking, at DTIM
so it can see the TIM - traffic information map - telling the STA whether
any traffic is there for it) and it happens automatically.

However, this relies on the target beacon time being programmed correctly.
If it isn't then the hardware will wake up and not hear any beacons -
and then it'll be asleep for said beacons.  After enough of this, net80211
will give up and assume the AP went away.

This should fix both TSFOOR interrupts and disconnects from APs with powersave
enabled.

The annoying bit is that it only happens if APs stagger things or start
on a non-zero TSF.  So, this would sometimes be fine and sometimes not be
fine.

What:

* I don't know (yet) why the code rounds up to the next intval.
  For now, just disable rounding it and trust the value we get.

TODO:

* If we do see a beacon miss in STA mode then we should transition
  out of sleep for a while so we can hear beacons to resync against.
  I'd love a patch from someone to enable that particular behaviour.
  Note - that doesn't require that net80211 brings the chip out of
  sleep state - only that we wake the chip up through to full-on and
  then let it go to sleep again when we've seen a beacon.  The wifi
  stack and AP can still completely just stay believing we're in sleep
  mode.

Tested:

* AR9485, STA mode, powersave enabled

MFC after:	1 week
Relnotes:	Yes

309222 by adrian:
[ath] include logging of TU versions of the TSF values.

The beacon programming side of things deals in TUs and 1/8th TUs, so
it's good to se the TU value here when debugging beaconing issues.

309220 by pfg:
indent(1): Properly handle the wide string literal and wide char constant L.

indent(1) treated the "L" in "L'a'" as if it were an identifier and forced
a space character after it, breaking valid code.

PR:		143090
MFC after:	2 weeks

309219 by pfg:
indent(1): fix regression introduced in r303596.

Multi-line comments are always block comments in KNF. Restore properly,
handling the case when a long one-liner gets wrapped and becomes a
multi-line comment.

Obtained from:	Piotr Stefaniak

309217 by pfg:
indent(1): minor off-by-one error.

This was introduced in r303571.

Obtianed from:	Piotr Stefaniak

309216 by bapt:
Properly initialize nextp

MFC after:	1 day

309215 by adrian:
[ath] Begin to lay the groundwork for btcoex related ioctl controls.

309214 by avos:
rsu: add support for hardware multicast filter setup.

The algorithm is the same as in rtwn(4).

Tested with Asus USB-N10 (STA) + RTL8188CUS (AP).

309212 by dim:
Add a few missed clang 3.9.0 files to OptionalObsoleteFiles.

X-MFC-With:	309149

309211 by hselasky:
Fix spelling.

309210 by avos:
rsu: various scanning fixes.

- Set IEEE80211_FEXT_SCAN_OFFLOAD flag; firmware can send null data
frames when associated.
- Check IEEE80211_SCAN_ACTIVE scan flag instead of IEEE80211_F_ASCAN
ic flag; the last is never set since r170530.
- Eliminate software scan (net80211) <-> site_survey (driver) race:
 * override ic_scan_curchan and ic_scan_mindwell pointers so net80211
will not try to finish scanning automatically;
 * inform net80211 about current status via ieee80211_cancel_scan()
and ieee80211_scan_done();
 * remove corresponding workaround from rsu_join_bss().

Now the driver can associate to an AP with hidden SSID.

Tested with Asus USB-N10.

309209 by kib:
NFSv4 client tracks opens, and the track records are only dropped when
the vnode is inactivated.  This contradicts with the nullfs caching
which keeps upper vnode around, as consequence keeping the use
reference to lower vnode.

Add a filesystem flag to request nullfs to not cache when mounted over
that filesystem, and set the flag for nfs v4 mounts.

Reported by:	asomers
Reviewed by:	rmacklem
Tested by:	asomers, rmacklem
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

309204 by alc:
The function vm_page_cache() no longer exists.  Remove its man page.

309203 by alc:
Recursion on the free page queue mutex occurred when UMA needed to allocate
a new page of radix trie nodes to complete a vm_radix_insert() operation
that was requested by vm_page_cache().  Specifically, vm_page_cache()
already held the free page queue lock when UMA tried to acquire it through
a call to vm_page_alloc().  This code path no longer exists, so there is no
longer any reason to allow recursion on the free page queue mutex.

Improve nearby comments.

Reviewed by:	kib, markj
Tested by:	pho
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8628

309202 by landonf:
bhnd(4): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.


- Defined an abstract NVRAM I/O API (bhnd_nvram_io), decoupling NVRAM/SPROM
  parsing from the actual underlying NVRAM data provider (e.g. CFE firmware
  devices).
- Defined an abstract NVRAM data API (bhnd_nvram_data), decoupling
  higher-level NVRAM operations (indexed lookup, data conversion, etc) from
  the underlying NVRAM file format parsing/serialization.
- Implemented a new high-level bhnd_nvram_store API, providing indexed
  variable lookup, pending write tracking, etc on top of an arbitrary
  bhnd_nvram_data instance.
- Migrated all bhnd(4) NVRAM device drivers to the common bhnd_nvram_store
  API.
- Implemented a common bhnd_nvram_val API for parsing/encoding NVRAM
  variable values, including applying format-specific behavior when
  converting to/from the NVRAM string representations.
- Dropped the now unnecessary bhnd_nvram driver, and moved the
  broadcom/mips-specific CFE NVRAM driver out into sys/mips/broadcom.
- Implemented a new nvram_map file format:
        - Variable definitions are now defined separately from the SPROM
          layout. This will also allow us to define CIS tuple NVRAM
          mappings referencing the common NVRAM variable definitions.
        - Variables can now be defined within arbitrary named groups.
        - Textual descriptions and help information can be defined inline
          for both variables and variable groups.
        - Implemented a new, compact encoding of SPROM image layout
          offsets.
- Source-level (but not build system) support for building the NVRAM file
  format APIs (bhnd_nvram_io, bhnd_nvram_data, bhnd_nvram_store) as a
  userspace library.

The new compact SPROM image layout encoding is loosely modeled on Apple
dyld compressed LINKEDIT symbol binding opcodes; it provides a compact
state-machine encoding of the mapping between NVRAM variables and the SPROM
image offset, mask, and shift instructions necessary to decode or encode
the SPROM variable data.

The compact encoding reduces the size of the generated SPROM layout data
from roughly 60KB to 3KB. The sequential nature SPROM layout opcode tables
also simplify iteration of the SPROM variables, as it's no longer
neccessary to iterate the full NVRAM variable definition table, but
instead simply scan the SPROM revision's layout opcode table.

Approved by:    adrian (mentor)
Differential Revision:  https://reviews.freebsd.org/D8645

309201 by scottl:
Add a missing header

309200 by markj:
Launder VPO_NOSYNC pages upon vnode deactivation.

As of r234483, vnode deactivation causes non-VPO_NOSYNC pages to be
laundered. This behaviour has two problems:

1. Dirty VPO_NOSYNC pages must be laundered before the vnode can be
   reclaimed, and this work may be unfairly deferred to the vnlru process
   or an unrelated application when the system is under vnode pressure.
2. Deactivation of a vnode with dirty VPO_NOSYNC pages requires a scan of
   the corresponding VM object's memq for non-VPO_NOSYNC dirty pages; if
   the laundry thread needs to launder pages from an unreferenced such
   vnode, it will reactivate and deactivate the vnode with each laundering,
   potentially resulting in a large number of expensive scans.

Therefore, ensure that all dirty pages are laundered upon deactivation,
i.e., when all maps of the vnode are removed and all references are
released.

Reviewed by:	alc, kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8641

309199 by rmacklem:
Use November instead of the abbreviation.

Requested by:	Ed Shouten
MFC after:	2 weeks

309198 by rmacklem:
Document the -E flag for nfsstat.
This is a content change.

Reviewed by:	bcr
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8626

309197 by rmacklem:
Add a -E flag to nfsstat.c so that it prints out the NFSv4.1
procedure/operation counts.
It also avoids clipping the counts at 9 digits.

Reviewed by:	bcr (doc parts)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8626

309196 by avos:
rsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13).

Without this fix firmware ignores all but first 32 commands
(= almost everything (except plain Tx / Rx) stops working).

Tested with ASUS USB-N10.

309195 by ian:
Add an ethernet0 alias pointing to the /aix/usb/hub/ethernet node.  This
is required for u-boot to locate the ethernet node when it's doing fixup
of the mac-address property when the user has overridden the default addr.

309194 by bapt:
initialize *nextp which could be left uninitialized in case the configuration
file cannot be open/read

Reported by:	Coverity via cem
MFC after:	2 days
CID:		1365665

309192 by sevan:
Fix null dereference when running out of nodes during rename.

PR:		212370
Submitted by:	Sascha Wildner <swildner AT gmail>
Reviewed by:	bcr (mentor)
Approved by:	bapt
Obtained from:	NetBSD
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8643

309191 by rakuco:
fdt: Expect strchr() to return a const char*

In C, strchr(3) returns a char*, whereas C++ defines two overloads:
* const char *strchr(const char*, int)
* char *strchr(char*, int)

Building fdt.cc (with the WITHOUT_GPL_DTC knob set) with libc++ 3.9.0 (imported
in r309124) was failing because libc++ r260377 added the first overload to
string.h, leading to failures such as:

    fdt.cc:1638:8: error: cannot initialize a variable of type 'char *' with an
    rvalue of type 'const char *'

Just define val as a const char* to fix it.

Upstreamed in https://github.com/davidchisnall/dtc/pull/14

Reviewed by:	emaste
Approved by:	emaste

309190 by manu:
PLL3 have a fractional mode where an explicit frequency (297Mhz or 270)
can be selected for it. If the desired frequency is one of those two, use
this mode instead of the integer one.
When calculating the PLL3 freq for the dotclock, check if it is a multiple
of the fracional frequencies.

MFC after:	2 weeks

309189 by kib:
Fix automatic eventtimer hardware selection when ARAT
(APIC-Timer-always-running) is not implemented.

If machine has ncpus >= 8 and non-FSB interrupt routing from HPET,
default HPET eventtimer quality 450 is reduced by 100, i.e. it is
350. On the other hand, LAPIC default quality is 600 and it is reduced
by 200 if ARAT is not reported. We end up with HPET quality 350 <
LAPIC quality 400, despite ARAT is not set.  Then, since deep Cx
states are active by default, eventtimer fail.

E.g., on Nehalem Core i7 CPU and X58 chipset, LAPIC only works in
C0/C1/C1E and HPET does not implement FSB mode, which otherwise
requires manual switch to HPET to get working system.

Set LAPIC eventtimer quality to 100 if no ARAT.
While there, do not ignore deadlint TSC mode for LAPIC timer if ARAT
is not implemented.  If user manually selected LAPIC eventtimer on
such CPU, there is no reason to not use deadline if available and not
disabled administratively.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

309188 by br:
Don't build Ingenic kernels until we have non-static FDT support
for them.

Sponsored by:	DARPA, AFRL

309187 by ae:
Fix ICMPv6 Time Exceeded error message translation.

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC

309184 by delphij:
style(9) indent changes, no actual code change.

MFC after:	2 weeks

309179 by pfg:
ext2: avoid possible overflow when calculating malloc size.

This is inspired on r308064 for case of reloading UFS.

MFC after:	1 week

309174 by emaste:
netipsec: fix build after 309144

Reported by:	rakuco

309171 by rmacklem:
Stop "nfsstat -z" from clearing counts of NFSv4 state structures.

The "-z" option on nfsstats was erroneously zeroing out the counts
of NFSv4 state structures. These counts will normally go back down
to zero as state is released. When zeroed out by "-z", these counts
can go negative. This patch fixes this problem.

MFC after:	2 weeks

309169 by dim:
Get rid of separate Subversion mergeinfo properties for llvm-dwarfdump
and llvm-lto.  The mergeinfo confuses Subversion enormously, and these
directories will just use the mergeinfo for llvm itself.

309167 by jhibbits:
Add an isync to after mtsrin, required by the MPC750 errata

MPC750 User Manual Errata (rev 1) adds a note to C.4.2.2 noting that mtsr,
mtsrin, and mtmsr all require a isync after the instruction and before data
address translation uses any of the segment registers.  This should make FreeBSD
run correctly on the G3 again.

Reported by:	Mark Millard
MFC after:	1 week

309151 by emaste:
Use explicit 0x200000 instead of MAXPAGESIZE for the amd64 kernel physaddr

MAXPAGESIZE is not well defined by the GNU ld documentation.
Different linkers, and different versions of the same linker, use
different MAXPAGESIZE values. Current versions of GNU gold and LLVM's
lld use 4K. When set to 4K the kernel panics at boot due to an issue
with x86bios.

Here we want the kernel physaddr to be the amd64 superpage size, so use
that value (2MB) explicitly. With this change GNU gold and LLVM lld can
link a working amd64 kernel.

PR:		214718 (x86bios)
Differential Revision:	https://reviews.freebsd.org/D8610

309150 by dim:
Bump FREEBSD_CC_VERSION again for r309147 and 309149.

309149 by dim:
Pull in r283060 from upstream llvm trunk (by Hal Finkel):

  [PowerPC] Refactor soft-float support, and enable PPC64 soft float

  This change enables soft-float for PowerPC64, and also makes
  soft-float disable all vector instruction sets for both 32-bit and
  64-bit modes. This latter part is necessary because the PPC backend
  canonicalizes many Altivec vector types to floating-point types, and
  so soft-float breaks scalarization support for many operations. Both
  for embedded targets and for operating-system kernels desiring
  soft-float support, it seems reasonable that disabling hardware
  floating-point also disables vector instructions (embedded targets
  without hardware floating point support are unlikely to have Altivec,
  etc. and operating system kernels desiring not to use floating-point
  registers to lower syscall cost are unlikely to want to use vector
  registers either). If someone needs this to work, we'll need to
  change the fact that we promote many Altivec operations to act on
  v4f32. To make it possible to disable Altivec when soft-float is
  enabled, hardware floating-point support needs to be expressed as a
  positive feature, like the others, and not a negative feature,
  because target features cannot have dependencies on the disabling of
  some other feature. So +soft-float has now become -hard-float.

  Fixes PR26970.

Pull in r283061 from upstream clang trunk (by Hal Finkel):

  [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float

  Enable soft-float support on PPC64, as the backend now supports it.
  Also, the backend now uses -hard-float instead of +soft-float, so set
  the target features accordingly.

  Fixes PR26970.

Reported by:	Mark Millard
PR:		214433

309148 by jhb:
Permit timed sleeps for threads other than thread0 before timers are working.

The callout subsystem already handles early callouts and schedules
the first clock interrupt appropriately based on the currently pending
callouts.  The one nit to fix was that callouts scheduled via C_HARDCLOCK
during early boot could fire too early once timers were enabled as the
per-CPU base time is always zero until timers are initialized.  The change
in callout_when() handles this case by using the current uptime as the
base time of the callout during bootup if the per-CPU base time is zero.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Netflix

309147 by dim:
Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek):

  [PPC] Set SP after loading data from stack frame, if no red zone is
  present

  Follow-up to r280705: Make sure that the SP is only restored after
  all data is loaded from the stack frame, if there is no red zone.

  This completes the fix for
  https://llvm.org/bugs/show_bug.cgi?id=26519.

  Differential Revision: https://reviews.llvm.org/D24466

Reported by:    Mark Millard
PR:             214433

309146 by fabient:
Update r309143 to prevent false sharing.

Reported by:	mjg
Approved by:	so
MFC after:	1 month

309145 by andrew:
Fix the TLB conflict abort value. This should be a no-op as we don't use
this value in the code.

309144 by fabient:
IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.

Since the previous algorithm, based on bit shifting, does not scale
with large replay windows, the algorithm used here is based on
RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting.
The replay window will be fast to be updated, but will cost as many bits
in RAM as its size.

The previous implementation did not provide a lock on the replay window,
which may lead to replay issues.

Reviewed by:	ae
Obtained from:	emeric.poupon_at_stormshield.eu
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D8468

309143 by fabient:
In a dual processor system (2*6 cores) during IPSec throughput tests,
we see a lot of contention on the arc4 lock, used to generate the IV
of the ESP output packets.

The idea of this patch is to split this mutex in order to reduce the
contention on this lock.

Reviewed by:	delphij, markm, ache
Approved by:	so
Obtained from: emeric.poupon_at_stormshield.eu
MFC after: 1 month
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D8130

309142 by emaste:
Add WITH_LLD_AS_LD build knob

If set it installs LLD as /usr/bin/ld.  LLD (as of version 3.9) is not
capable of linking the world and kernel, but can self-host and link many
substantial applications. GNU ld continues to be used for the world and
kernel build, regardless of how this knob is set.

It is on by default for arm64, and off for all other CPU architectures.

Sponsored by:	The FreeBSD Foundation

309140 by sephe:
hyperv/vmbus: Add a simplified version of channel close.

So that the caller can know the channel close error and react accordingly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8600

309139 by sephe:
hyperv/vmbus: Propagate close error.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8599

309138 by sephe:
hyperv/vmbus: Always try disconnect/free bufring memory upon channel close

While I'm here, minor wording and style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8598

309136 by sephe:
hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8570

309135 by sephe:
hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.

So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8569

309134 by sephe:
hyperv/vmbus: No stranded bufring GPADL is allowed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8568

309133 by sephe:
hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8567

309132 by sephe:
hyperv/vmbus: Don't close unopened channels.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8566

309131 by sephe:
hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8565

309129 by sephe:
hyperv/vmbus: Minor style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8564

309128 by sephe:
hyperv/vmbus: Commit the GPADL id only after the connection succeeds.

Minor style change.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8563

309127 by dexuan:
hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined

vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	3 days
Sponsored by:	Microsoft

309126 by emaste:
Correct lld llvm-tblgen dependency file name

309124 by dim:
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
release, and add lld 3.9.0.  Also completely revamp the build system for
clang, llvm, lldb and their related tools.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

Release notes for llvm, clang and lld are available here:
<http://llvm.org/releases/3.9.0/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/clang/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/lld/docs/ReleaseNotes.html>

Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan
Beich for their help.

Relnotes:	yes
MFC after:	1 month

309121 by jceel:
virtio_console: handle short writes to an Unix domain socket gracefully.

writev() can do a short write.  Retrying it results in a very convoluted
and complex code, so we iterate over iovec and do regular stream_write()
instead.

Approved by:	trasz
Sponsored by:	iXsystems, Inc.

309120 by jceel:
Allow opening virtio-console ports from the host side before guest
enumerates them.

Approved by:	trasz
Sponsored by:	iXsystems, Inc.

309119 by avg:
virtio_pci: fix announcement of MSI-X interrupts for queues

Queues that do not need interrupts - for instance, output queues - do
not have a corresponding entry in vtpci_msix_vq_interrupts.
So, it was wrong to increment a pointer into that array when iterating
over such a queue.

I ran into this bug while trying to use virtio_console(4) that allocates
a lot of queues with every other being an output queue without an
interrupt handler (if MultiplePorts feature is negotiated).

MFC after:	2 weeks

309116 by avg:
virtio_console: correctly determine presense of payload and its length

MFC after:	2 weeks

309114 by jhibbits:
Fix the build post-r309017 for MPC85XX/MPC85XXSPE

r309017 removed two fields from struct vmmeter, which is embedded in struct
pcpu.  This caused the struct size to change, triggering the CTASSERT in
sys/pcpu.h.  Add the extra 8 bytes back in as padding.

309113 by loos:
Add the etherswitch(4) support for TI CPSW.

Adds VLAN and port management abilities for etherswitchcfg(8).

The code is conditionally enabled for now, because it is not necessary on
single ethernet use cases.

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)

309112 by gonzo:
[bytgpio] Fix pc98 build by disabling bytgpio module for this platform

Reported by:	dim

309111 by mjg:
wait: avoid relocking the child if proc_to_reap returns 1

proc_to_reap would always unlock. However, if it returned 1, kern_wait6
would immediately lock it again. Save the dance.

Reviewed by:	kib

309109 by des:
Add a warning against modifying this code without understanding it, and
an example of how not to make it more portable.  I've had this lying
around uncommitted since 2009...

309100 by brueffer:
Sync the rtwn(4) entry with the manpage.

309099 by avg:
MFV r308990: 7181 race between zfs_mount and zfs_ioc_rollback

illumos/illumos-gate_at_90f2c094b3822f4825f21cef2c2faf7d03b55139
https://github.com/illumos/illumos-gate/commit/90f2c094b3822f4825f21cef2c2faf7d03b55139

https://www.illumos.org/issues/7181
  zfsvfs_setup() is called in both zfs_mount and zfs_resume_fs paths.
  dmu_objset_set_user(zfsvfs->z_os, zfsvfs) is called early in zfsvfs_setup()
  before the setup is actually completed,
  thus an under-constructed zfsvfs becomes visible.
  Additionally, there is nothing to serialize the two call paths. As a result two
  threads can step on each other's toes.
  assertion failed: zilog->zl_clean_taskq == NULL, file:
  ../../common/fs/zfs/zil.c, line: 1772

  > $c
  vpanic()
  0xfffffffffbdf6928()
  zil_open+0x45(ffffff1bbc5dd000, fffffffff7993880)
  zfsvfs_setup+0x84(ffffffb378d77000, 0)
  zfs_resume_fs+0x132(ffffffb378d77000, ffffffb37ddcf000)
  zfs_ioc_rollback+0x96(ffffffb37ddcf000, ffffff01dcdc4cd0, ffffff01aa091000)
  zfsdev_ioctl+0x215(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  cdev_ioctl+0x39(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  spec_ioctl+0x60(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368, ffffff0004b59e58)
  fop_ioctl+0x55(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368, ffffff0004b59e58)
  ioctl+0x9b(7, 5a19, 80465f8)
  sys_syscall32+0x1f7()

  > ffffff1bbc5dd000::print objset_t os_zil
  os_zil = 0xffffff1c053cf7c0
  > 0xffffff1c053cf7c0::print zilog_t zl_clean_taskq

Reviewed by: Matthew Ahrens <mahrens_at_delphix.com>
Approved by: Gordon Ross <gordon.w.ross_at_gmail.com>
Author: Andriy Gapon <andriy.gapon_at_clusterhq.com>

MFC after:	2 weeks

309098 by avg:
MFV r308988: 7199, 7200 dsl_dataset_rollback_sync may try to free
already free blocks

7199 dsl_dataset_rollback_sync may try to free already free blocks
7200 no blocks must be born in a txg after a snaphot is created

illumos/illumos-gate_at_bfaed0b91e57062c38bc16b4f89db3c8f0052a9b
https://github.com/illumos/illumos-gate/commit/bfaed0b91e57062c38bc16b4f89db3c8f0052a9b

https://www.illumos.org/issues/7199
  dsl_dataset_rollback_sync may try to free already freed blocks when it calls
  dsl_destroy_head_sync_impl to destroy a temporary clone.
  That happens if a snapshot to which we are rolling back and from which the
  clone is created has some ZIL records.

https://www.illumos.org/issues/7200
  No new blocks must be born in a dataset in the same TXG after a snapshot of the
  dataset is taken.
  Those blocks would have the same blk_birth as the dataset's ds_prev_snap_txg
  and as such they would be presumed to belong o the snapshot while in fact they
  do not.
  All the datasets must be clean before sync tasks are run, so the described
  scenario may happen only if one of the sync tasks dirties the dataset and
  another sync task takes its snapshot.
  Then, there will be another sync pass because of the dirty data and the new
  blocks will be born in the same TXG when the data is written out.
  It seems that almost all of the existing sync tasks modify only MOS and do not
  dirty any objsets.
  The only exception that I've been able to identify so far is the rollback which
  can modify an objset when it zeroes out the objset's ZIL.

Reviewed by: Matthew Ahrens <mahrens_at_delphix.com>
Reviewed by: Brad Lewis <brad.lewis_at_delphix.com>
Approved by: Gordon Ross <gordon.w.ross_at_gmail.com>
Author: Andriy Gapon <andriy.gapon_at_clusterhq.com>

MFC after:	3 weeks

309097 by avg:
MFV r308987: 7180 potential race between zfs_suspend_fs+zfs_resume_fs
and zfs_ioc_rename

illumos/illumos-gate_at_690041b9caf801816f2d0bac90bc7cecefb73523
https://github.com/illumos/illumos-gate/commit/690041b9caf801816f2d0bac90bc7cecefb73523

https://www.illumos.org/issues/7180
  If a filesystem is not unmounted while the rename is being performed, then, for
  example, a concurrect zfs rollback may call zfs_suspend_fs followed by
  zfs_resume_fs on the same filesystem.
  The latter takes the filesystem's name as an argument. If the filesystem name
  changes as a result of the rename, then dmu_objset_hold(osname, zfsvfs, &os)
  call in zfs_resume_fs would fail resulting in a kernel panic.
  So far I have been able to reproduce this problem on FreeBSD where zfs rename
  has -u option that skips the unmounting before doing the renaming.
  But I think that in theory the same problem can occur on illumos as well,
  because the unmounting is done in userland before invoking the rename ioctl and
  there could be a race with, e.g., zfs mount.
  panic: solaris assert: dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os) == 0 (0x2
  == 0x0), file: /usr/devel/svn/head/sys/cddl/contrib/opensolaris/uts/common/fs/
  zfs/zfs_vfsops.c, line: 2210
  KDB: stack backtrace:
  db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004df30710
  vpanic() at vpanic+0x182/frame 0xfffffe004df30790
  panic() at panic+0x43/frame 0xfffffe004df307f0
  assfail3() at assfail3+0x2c/frame 0xfffffe004df30810
  zfs_resume_fs() at zfs_resume_fs+0xb9/frame 0xfffffe004df30860
  zfs_ioc_rollback() at zfs_ioc_rollback+0x61/frame 0xfffffe004df308a0
  zfsdev_ioctl() at zfsdev_ioctl+0x65c/frame 0xfffffe004df30940
  devfs_ioctl_f() at devfs_ioctl_f+0x156/frame 0xfffffe004df309a0
  kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe004df30a00
  sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe004df30ae0
  amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df30bf0
  Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df30bf0

Reviewed by: Matt Ahrens <mahrens_at_delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov_at_delphix.com>
Approved by: Richard Lowe <richlowe_at_richlowe.net>

MFC after:	2 weeks

309096 by avg:
MFV r308989: 6428 set canmount=off on unmounted filesystem tries to
unmount children

This is a cosmetic and bookkeeping change as the actual change is
already in FreeBSD.
See r297521, r304520, r308985.

309095 by martymac:
Fix path for per-user nsmb.conf file

~/nsmb.conf, as erroneously introduced by r214387, is never used. Fix the man
page to specify that ~/.nsmbrc is used instead.

PR:		210652
Submitted by:	ganael.laplanche_at_corp.ovh.com
Approved by:	gjb (doceng_at_)

309094 by avg:
MFV r308986: 6412 zfs receive: -u can be ignored sometimes

This is a record only change, the actual change is in FreeBSD since
r297520.

309093 by avg:
firewire: initialize tag label to -1 in fw_xfer_alloc()

Zero can be confused for a potentially valid value.
For example, if I load and unload sbp driver I get a lot of messages
like the following:

fw_tl_free: the xfer is not in the queue (tlabel=0, flag=0x0)
send: dst=0x00 tl=0x00 rt=0 tcode=0x0 pri=0x0 src=0x000
recv: dst=0x01 tl=0x21 rt=1 tcode=0x1 pri=0x0 src=0xffc0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe04464407e0
fw_tl_free() at fw_tl_free+0x18d/frame 0xfffffe0446440820
fw_xfer_unload() at fw_xfer_unload+0xca/frame 0xfffffe0446440840
fw_xferlist_remove() at fw_xferlist_remove+0x2f/frame 0xfffffe0446440870
sbp_detach() at sbp_detach+0x1e0/frame 0xfffffe04464408e0
device_detach() at device_detach+0x80/frame 0xfffffe0446440900
devclass_driver_deleted() at devclass_driver_deleted+0x6a/frame 0xfffffe0446440940
devclass_delete_driver() at devclass_delete_driver+0x7d/frame 0xfffffe0446440980
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe04464409d0
module_unload() at module_unload+0x32/frame 0xfffffe04464409f0
linker_file_unload() at linker_file_unload+0x24b/frame 0xfffffe0446440a40
kern_kldunload() at kern_kldunload+0xbc/frame 0xfffffe0446440a70
amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe0446440bf0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe0446440bf0

MFC after:	2 weeks

309092 by avg:
fwohci: report whether PhysicalUpperBound register is implemented

Please see section 5.15 of 1394 OHCI Specification.
If the register is not implemented, then the physical response unit is
limited to the first 4GB of the physical memory.
In that case the non-cooperative debugging over firewire (using /dev/fwmem)
can not be expected to work if a target has more RAM than that.
The method is described in gdb.4 and the Developer's Handbook.

It seems that most of the consumer hardware does not implement
PhysicalUpperBound register.

MFC after:	1 week

309090 by avg:
further fix zfs_lock() diagnostics

It was very wrong to look at the vnode and znode internals without
having locked the vnode first.

Reported by:	pho
Tested by:	pho
MFC after:	1 week
X-MFC with:	r308887

309085 by sephe:
hyperv/hn: Fix primary channel revocation

Since hypervisor will not drain the TX bufring, once the channels are
revoked:
- Setup vmbus orphan handler properly.
- Make sure that suspension will not wait the TX bufring draining
  forever.
- GC the pending TX descs on detach path, before freeing the busdma
  stuffs.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8559

309084 by manu:
Enable the SPI1 and SPI2 node for Olimex A20 SOM EVB.
This was missed in r309079.

309083 by sephe:
hyperv/vmbus: Fix the multi-channel revoking on vmbus side.

- Reference count the sub-channel when channel offer message is
  processed, so that immediate rescind message on the same channel
  will not race sub-channel open on driver side.
- Drop the above reference when sub-channel is closed, this closely
  mimics the hypervisor's reaction when primary channel is closed
  on the VM side.  No drivers use sub-channel after primary channel
  is closed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8546

309082 by dexuan:
share/man/man4/Makefile: Only install Hyper-V man pages on amd64 and i386

We shouldn't install them on the architectures not supported by Hyper-V.

And, hv_ata_pci_disengage.4.gz should be removed from all architectures:
1) It should have only applied to Hyper-V;
2) For Hyper-V platforms (amd64 and i386), the related driver was removed by
r306426 | sephe | 2016-09-29 09:41:52 +0800 (Thu, 29 Sep 2016),
because now we have a better mechanism to disble the ata driver for hard
disks when the VM runs on Hyper-V.

Reviewed by:	sephe, andrew, jhb
Approved by:	sephe (mentor)
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8572

309081 by sephe:
hyperv/vmbus: Fix the primary channel revoking on vmbus side.

Drivers can now use vmbus_chan_{is_revoked,set_orphan,unset_orphan}() and
vmbus_xact_ctx_orphan() to fix their attach/detach DEVMETHODs for revoked
primary channels.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8545

309080 by sephe:
hyperv/vmbus: Implement orphan support for transaction API

It will be used to fix the primary channel revocation support.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8525

309079 by manu:
Enable the SCL and SDA i2c line for DDC.
This is an undocumented register that we need to set if we do not want to
rely on u-boot or other bootloader.

309078 by shurd:
Add new device IDs

Add device IDs for new hardware, sort the device IDs, add comment
regarding fragice NPAR/VF detection.

Approved by:	davidch
MFC after:	6 days
Sponsored by:	Broadcom Limited

309076 by gonzo:
[rpi3] Move SOC_BRCM_BCM2837 from UP config to SMP one

Now that BCM283x source are buildable with SMP option it cam be moved to
GENERIC SMP config. SMP itself does not work on RPi3 yet due to lack of
PSCI monitor which is work in progress at the moment

309074 by gonzo:
[rpi3] Fix SMP build for FreeBSD/arm64

309073 by shurd:
Fix version string

This is no longer on github, but in FreeBSD base.

Approved by:	davidch
MFC after:	6 days
Sponsored by:	Broadcom Limited

309070 by avos:
rtwn.4: fix hostapd(8) man page section.

309069 by gnn:
Add tunable to disable destructive dtrace

Submitted by:	Joerg Pernfuss <code.jpe_at_gmail.com>
Reviewed by:	rstone, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8624

309068 by jhb:
Fix _mips_rtld_bind() to handle ELF filters.

MIPS does not use the common _rtld_bind() to handle runtime binding.
Instead, it uses a private _mips_rtld_bind().  Update _mips_rtld_bind()
to include the changes made to _rtld_bind() in r216695 and r218476 to
support upgrading the read-locked rtld_bind_lock to a write lock when
an object with a filter is encountered.

While here, add a 'where' variable to track the location of the fixup
in the GOT to make the code flow more closely match _rtld_bind().

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

309067 by mjg:
cache: ensure that the number of bucket locks does not exceed hash size

The size can be changed by side effect of modifying kern.maxvnodes.

Since numbucketlocks was not modified, setting a sufficiently low value
would give more locks than actual buckets, which would then lead to
corruption.

Force the number of buckets to be not smaller.

Note this should not matter for real world cases.

Reported and tested by:	pho

309066 by brueffer:
Fix various mdoc issues reported by mandoc -Tlint.

309065 by brueffer:
Fix various mdoc issues reported by mandoc -Tlint.

309064 by manu:
Enable UEXT related nodes for Olimex A20 SOM

UEXT are Universal EXTension connector from Olimex. They embed i2c, spi
and uart pins along power in one connector and are found on most,
if not all, Olimex boards.
The Olimex A20 SOM EVB have two UEXT connector so enable the nodes found on
those two connectors.

Patch has been applied upstream, in the meantime add the nodes to our custom
DTS.

309063 by manu:
Test that the emac device is enabled in probe function

MFC after:	3 days

309062 by markj:
Release laundered vnode pages to the head of the inactive queue.

The swap pager enqueues laundered pages near the head of the inactive queue
to avoid another trip through LRU before reclamation. This change adds
support for this behaviour to the vnode pager and makes use of it in UFS and
ext2fs. Some ioflag handling is consolidated into a common subroutine so
that this support can be easily extended to other filesystems which make use
of the buffer cache. No changes are needed for ZFS since its putpages
routine always undirties the pages before returning, and the laundry
thread requeues the pages appropriately in this case.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D8589

309060 by brueffer:
Fix comment typo.

PR:		208484
Submitted by:	madpilot
MFC after:	1 week

309059 by misha:
- Add myself (misha) as a ports committer
- Update mentor/mentee relationships

Approved by:	jpaetzel (mentor)

309055 by br:
Split MALTA board config to big and little endian versions.

This fixes compilation after r308807 ("Pass MACHINE_ARCH on
command line for MIPS kernels.")

Sponsored by:	DARPA, AFRL

309053 by br:
Increase pcpu size to 512 so it become both denominator
of PAGE_SIZE and aligned to CACHE_LINE_SIZE.

This fixes CTASSERT.

Sponsored by:	DARPA, AFRL

309051 by des:
Remove debugging code.

309048 by andrew:
Mark cpu_find_cpu0_fdt as FDT only. It's only called when this is set, and
the kernel is using FDT.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309046 by andrew:
Remove the unneeded ofw_cpu_reg function signature, it's not used in this
file.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309039 by sephe:
hyperv/vmbus: Merge free/active locks.

These functions are only used by management stuffs, so there are
no needs to introduce extra complexity.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8524

309035 by julian:
This little BSD licensed library has been kicking around for years.
It allows one to trivially convert an absolute path to a relative path
and the reverse. The test programs themselves are very useful in scripts
but the real use comes shortly with the -r and -a arguments to ln.
These are sometimes known as the --relative and --absolute flags and
can force a symlink to be relative when you only have an absolue path.
Another place these are sometimes used is to add -a and -r args to 'realpath'.
Incredibly useful in Makefiles.

I was going to just add the files in with 'ln' but a library makes more sense.
The test programs may come out in their own right some day for scripting.

released under a BSD 2-clause:
 * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
 * Copyright (c) 1999 Tama Communications Corporation. All rights reserved.

The test directry does not conform to any framework.
Not connected to build.
doc people may want to play with the manual pages.

Obtained from:  https://www.tamacom.com/pathconvert.html  Shigio Yamaguchi.
MFC after: 1 month
Relnotes:       yes
Sponsored by:   Panzura, Tama Communications Corporation

309030 by sephe:
hyperv/vmbus: Set a mark on the revoked channel.

This will be used to fix device detach DEVMETHOD for revoked primary
channel.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8522

309029 by manu:
Do not attempt to disable/release clock if it had not been enabled.
While here fix a style(9) issue.

MFC after:	1 week

309028 by shurd:
Add missing break to switch statement

Minimal impact, would allow selection of LR media when KR is connected.

Reported by:	Coverity
Approved by:	davidch
MFC after:	7 days
Sponsored by:	Broadcom Limited

309027 by brooks:
Allocate a struct ifreq rather than using a (wrong) computed size for
the BIOCSETIF ioctl.

The kernel always copies an entire struct ifreq and IPv4 addresses will
always fit in an ifreq.

On systems with pointers larger than 64-bits, the computed size will be
less than the size of struct ifreq, potentially resulting in the kernel
attempting to copyin memory from outside the allocation.

Reviewed by:	jhb
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8445

309026 by jilles:
open(2): Clarify non-POSIX error when opening a symlink with O_NOFOLLOW.

We return [EMLINK] instead of [ELOOP] when trying to open a symlink with
O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished. Code
like cmp -h and xz takes advantage of this.

PR:		214633
Reviewed by:	kib, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8586

309025 by phk:
Pass the correct size argument to ioctl(DIOCGSECTORSIZE)

309022 by andrew:
Add the missing DEVMETHOD_ENDs to the arm64 nexus ACPI and FDT drivers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309019 by dab:
Add myself (dab) as a src committer and vangyzen as my mentor.

Approved by:	vangyzen (mentor)

309018 by br:
Revert r306186 ("Adjust the sopt_val pointer on bigendian systems").

This logic doesn't work with bigger sopt_valsize (e.g. when ipfw
passing 2048 bytes rule).

Reported by:	adrian
Sponsored by:	DARPA, AFRL

309017 by alc:
Remove PG_CACHED-related fields from struct vmmeter, because they are no
longer used.  More precisely, they are always zero because the code that
decremented and incremented them no longer exists.

Bump __FreeBSD_version to mark this change.

Reviewed by:	kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8583

309016 by andrew:
Only build acpi_timer.c on x86, it fails on arm64 as it attempts to access
an invalid address. It is also unneeded on arm64 as we use the ARM Generic
Timer driver.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

309014 by adrian:
[net80211] high oops on the high seas, or "god damnit compilers, it's 2016 and you're supposed to save me from this."

TODO:

* drink real coffee before committing in the morning, or there's a high
  risk of more obviously self-evident commits being turned into attempts
  at humour.

Reported by:	cem, Coverity CID 1366219

309006 by emaste:
remove unnecessary vm includes from setproctitle

vm headers were needed only for the PS_STRINGS fallback, which was
removed in r297888.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

308996 by des:
Refactor fetch_connect() and fetch_bind() to improve readability and avoid
repeating the same DNS lookups.

MFC after:	3 weeks

308995 by kib:
On error, bread(9) zeroes buffer pointer, do not dereference it.
See r294954 for the bread(9) change and r297401 for similar cd9660 fix.

Reported and tested by:	Joshua Kinard <kumba_at_gentoo.org>
PR:	214705
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

308985 by avg:
revert r304520, set canmount=on is not supposed to mount the filesystem

Not sure where I got the idea that it should.

See https://github.com/openzfs/openzfs/pull/218

Reported by:	mahrens
Pointyhat to:	avg
MFC after:	5 days

308980 by kib:
Use buffer pager for NFS.

The pager, due to its construction, implements clustering for the
page-ins.  In particular, buildworld load demonstrates reduction of
the READ RPCs from 39k down to 24k.  No change in real or CPU time was
observed.

Discussed with, and measured by:	bde
No objections from:	rmacklem
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

308973 by kib:
Minor cleanup, remove unneeded XXX comments and unused re-define.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

308969 by kib:
Restore vnode pager statistic for buffer pagers.

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8585

308965 by andrew:
Split out the FDT parts of the pmu driver to make way for adding ACPI
support.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308958 by delphij:
Replay r304721 in contrib/ so the change won't get lost across import.

308957 by delphij:
MFV r308954:

ntp 4.2.8p9.

Approved by:	so

308956 by adrian:
[net80211] Only send out a probe request if we see an unknown IBSS node that matches our SSID.

308953 by jkim:
Merge ACPICA 20161117.

308952 by adrian:
[net80211] store references to VHT and related IEs.

This just stores pointers to the IE; it doesn't yet parse anything.

Note: it blows out the size of ieee80211_node, so this will require
ye olde kernel/modules recompile.

308951 by adrian:
[ath] obey the peer A-MPDU density and max-size.

* Obey the peer A-MPDU density if it's larger than the currently configured
  one.

* Pay attention to the peer A-MPDU max-size and don't assume we can transmit
  a full A-MPDU (64k!) if the peer announces smaller values.

Relnotes:	ath(4): Fix A-MPDU transmit; obey A-MPDU density and max size.

308950 by adrian:
[net80211] Remove extra \n.

308949 by adrian:
[net80211] flesh out more IBSS 11n support

* Pepper comments around which describe what state(s) we're in when faking
  up 11n nodes.
* By default don't fake it up as 11n until we properly negotiate the 11n
  capabilities using probe request/response frames.
* Send a probe request with our HT information, as the 802.11-2012 spec
  suggests.
* Reassociate with the driver if we've been promoted.

This is done because although learning a peer via beacons can learn 11n
state, learning peers via hearing probe frames and broadcast frames
does not.  Thus, sometimes you end up with an 11n peer in the peer
table and sometimes you don't.

Note that the probe request/response exchange may not actually succeed.
Ideally we'd put the peer into some blocking state until we've exchanged
probe request/reponse to learn capabilities, or we timeout and just
stay non-11n.

This is more an experiment to get 11n IBSS nodes actually discovering
each other and be able to transmit.  There are other issues that creep
up which I'll attempt to address in future commits.

Tested:

* AR9380 NICs in 11n mode.

Reviewed by:	avos
Differential Revision:	https://reviews.freebsd.org/D8365

308948 by jhb:
Initialize 'ticks' earlier in boot after 'hz' is set.

This avoids the time-warp after kthreads have started running and the
required fixup to td_slptick and td_blktick in the EARLY_AP_STARTUP
case.  Now, 'ticks' is initialized before any kthreads are created or
any context switches are performed.

Tested by:	gavin
MFC after:	2 weeks
Sponsored by:	Netflix

308947 by rwatson:
Audit 'fd' and 'cmd' arguments to fcntl(2), and when generating BSM,
always audit the file-descriptor number and vnode information for all
fnctl(2) commands, not just locking-related ones.  This was likely an
oversight in the original adaptation of this code from XNU.

MFC after:	3 days
Sponsored by:	DARPA, AFRL

308945 by gjb:
Set the 'vital' flag on the runtime and jail packages.

The default pkg(8) from pkg.freebsd.org requires libjail.so,
so mark the jail package as vital along with the runtime
package to avoid errors when libjail.so is removed.  This is
a no-op for systems with WITHOUT_JAIL in src.conf(5) and pkg(8)
built from the Ports Collection.

In order to make this work without marking packages such as
the jail-lib32, for example, the jail.ucl file needed to be
split out into separate files similarly to the runtime-*.ucl
files.

Glanced at by:	brd
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation

308944 by hiren:
r308942 broke kernel build.
Add acpi_if.h to module makefile to fix it.

Submitted by:	peter

308943 by hiren:
For RTT calculations mid-session, we explicitly ignore ACKs with tsecr of 0 as
many borken middle-boxes tend to do that. But during 3whs, in syncache_expand(),
we don't do that which causes us to send a RST to such a client. Relax this
constraint by only using tsecr to compare against timestamp that we sent when it
is not 0. As a result, we'd now accept the final ACK of 3whs with tsecr of 0.

Reviewed by:	    jtl, gnn
Sponsored by:	    Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D8552

308942 by gonzo:
[bytgpio] Add module for bytgpio(4)

MFC after:	3 days

308941 by gonzo:
[bytgpio] Add bytgpio(4) man page with general description of the driver

MFC after:	3 days

308940 by gonzo:
[bytgpio] prepare bytgpio(4) for modularization

- Add detach method
- module should depend on gpiobus, not gpio

308939 by andrew:
Include the missing accommon.h from the ACPI uart code.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308938 by andrew:
Add support to find the arm64 serial using the ACPI tables. This uses the
Serial Port Console Redirection Table to find the device to use.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308937 by mizhka:
[etherswitch] add ukswitch hint that is phy offset at mdio register

This patch allows to specify PHY register offset for ukswitch. For instance,
switch MAICREL KS8995XA connected via MDIO to SoC, but PHY register starts
at 1. So hint for this case is: hint.ukswitch.0.phyoffset=1

No change/effect if hint is not set.

Submitted by:	Hiroki Mori <yamori813_at_yahoo.co.jp>
Reviewed by:	adrian, mizhka
Approved by:	adrian(mentor)
Differential Revision:	https://reviews.freebsd.org/D8584

308936 by andrew:
Mark virtio_mmio as FDT only, it lacks an ACPI attachment.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308935 by andrew:
Mark uart_dev_snps.c as FDT only, it doesn't have and ACPI bindings.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308934 by andrew:
Mark extres as FDT only. Much of this assumes FDT and fails to build
without it.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308933 by andrew:
Mark the Allwinner drivers as FDT only. These are mobile and embedded parts
so are unlikely to use ACPI.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation

308931 by andrew:
To allow for an ACPI attachment to the generic PCIe driver split off the
FDT attachment to a new file. A separate ACPI attachment will then be added
to allow arm64 servers with ACPI to use it over FDT.

This should also help with merging this with the ofwpci driver, with
further work needed to remove restrictions this driver places on resource
allocation.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7319

308928 by br:
Add PDMA controller registers.

Obtained from:	X1000 IoT Application Processor Programming Manual
Sponsored by:	DARPA, AFRL

308927 by br:
Move FDT option to the main SoC file and mark boards config
as NO_UNIVERSE.

Pointed out by:	andrew
Sponsored by:	DARPA, AFRL

308926 by sbruno:
Add Intel Atom Cherryview SOC HSUART support

PR:	207910
Submitted by:	johannes_at_brilliantservice.co.jp
MFC after:	1 week

308925 by kib:
Adjust r308689 to make rtld compilable with either in-tree or
(hopefully) stock gcc 4.2.1 on i386 and other arches.

In particular:
- Do not use %ebx in the asm constraints on i386, since rtld is
  compiled with -fPIC and gcc cannot handle GOT-base register reload
  (clang and newer gcc can).
- Avoid direct use of [static N] construct in the function
  declaration/definion.  In-tree gcc was patched to support this, but
  stock 4.2.1 cannot handle the feature.

Requested by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

308923 by br:
Disable superpages reservations as we don't have implemented them yet.

Requested by:	Alan Cox <alc_at_rice.edu>
Sponsored by:	DARPA, AFRL

308922 by andrew:
Add an arm64 specific uart cpu driver. As arm64 may use ACPI to find the
uart we need to handle both it and FDT, and as such we need to have an
architecture specific driver.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7796

308921 by andrew:
Add accelerated AES with using the ARMv8 crypto instructions. This is based
on the AES-NI code, and modified as needed for use on ARMv8. When loaded
the driver will check the appropriate field in the id_aa64isar0_el1
register to see if AES is supported, and if so the probe function will
signal the driver should attach.

With this I have seen up to 2000Mb/s from the cryptotest test with a single
thread on a ThunderX Pass 2.0.

Reviewed by:	imp
Obtained from:	ABT Systems Ltd
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8297

308913 by kevlo:
Update struct r12a_rom.

Reviewed by:	avos

308909 by sephe:
hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse.

Just in case, the # of TX/RX rings is changed upon synthetic parts
re-attach.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8520

308908 by sephe:
hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO.

They are still disabled by default.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8490

308907 by sephe:
hyperv/hn: Fix WITNESS warnings

And re-enable SIOCADDMULTI/SIOCDELMULTI, after WITNESS warning is fixed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8489

308906 by sephe:
hyperv/vmbus: Support transction result busy-wait.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8488

308905 by sephe:
hyperv/hn: Implement RNDIS multi-packet message support.

Currently, it is only applied to packet sent through chimney sending
buffers.  Not enabled by default yet.

This one gives 20%~30% performance boost for non-TSO usage in both
bit/packet rate tests and nginx performance test.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8560

308904 by vangyzen:
Fix error reporting from wcstof()

When wcstof() skipped initial space and then parsing failed, it set
endptr to the first non-space character.  Fix it to correctly report
failure by setting endptr to the beginning of the input string.
The fix is from theraven_at_, who fixed this bug in wcstod() and
wcstold() in r227753.

While I'm here:

Move assignments out of declarations in wcstod() and wcstold().
This is against my personal preference, but it is our agreed style(9).

Set endptr correctly on malloc() failure in all three functions.

Remove an incorrect comment:  This is pointer arithmetic,
so the code was not actually making that assumption.

wcstold() advanced the wcp pointer beyond leading whitespace
and then reset it back to the beginning of the string.
Do not reset it.  This seems to have no functional effect,
since strtold_l() also skips leading whitespace.  I'm making
the change to keep this function consistent with wcstof() and
wcstod(), and because the C11 spec prescribes the use of iswspace()
to skip leading space.

Reported by:	libc++ unit test for std::stof(std::wstring)
MFC after:	8 days
Sponsored by:	Dell EMC

308903 by jmcneill:
Build and install nanopi-neo.dts and orangepi-plus-2e.dts

308902 by jmcneill:
Add dts for Xunlong Orange Pi Plus 2E.

308901 by jmcneill:
Add dts for FriendlyARM NanoPi NEO.

308900 by jmcneill:
Add dtsi for FreeBSD-specific Allwinner H3 nodes.

308899 by gonzo:
[FDT] Remove empty wrapper for upstream am335x-evm.dts

Remove empty wrapper for sys/gnu version of am335x-evm.dts located in
sys/boot/fdt, with current include paths priority it's recursive #include
and current build system can find file in sys/gnu when generating dtb

Reported by:	Jared McNeill

308898 by gonzo:
[bytgpio] Fix USB disconnect event after listsing pins on gpioc2

- Do not set input flag when reading value from GPIO pin, it is not
  required and for gpioc2(S5 bank) setting both input and output flags
  leads to some kind of electric interference (curren drop?) that
  causes USB devices to disconnect

- Check pad configuration when attaching device and provide IN/OUT
  capabilities only for pads that are configured as GPIO. Do not let
  user code to configure or change value of non-GPIO pads. There is
  no information for NC bank in intel's datasheet so for now function
  check is ignored for pins in it

Reported by:	Frank H.
MFC after:	3 days

308897 by manu:
Add spigen to the ARMv6 GENERIC kernel

308896 by jilles:
rc.subr: $(ps -p $$ -o jid=) is always 0, so do not fork ps for it.

The JID keyword writes 0 for a process also in the host system or in the
same jail.

308895 by manu:
Enable the use of spigen on FDT platform

MFC after:	2 weeks

308887 by avg:
fix unsafe modification of zfs_vnodeops when DIAGNOSTIC is enabled

The idea was to avoid a false assertion in zfs_lock, but it was
implemented very dangerously and incorrectly.

Reported by:	pho
Tested by:	pho
MFC after:	1 week

308877 by phk:
Attempt package build even if dependencies seems to be missing

308874 by jhibbits:
Actually bump __FreeBSD_version

308873 by jhibbits:
Fix buildworld for powerpc.

vmpage requires struct pmap to exist and contain a pm_stats field.  As of
r308817, either AIM or BOOKE is required to be set in order to get their
respective pmap structs.  Rather than expose them both, or try to unify them
unnecessarily, add a third option which contains only a pm_stats field, and
change the two existing pmap structures to place the common fields at the
beginning of the struct.  This actually fixes the stats collection by libkvm on
AIM hardware, because before it was accessing a possibly different offset, which
would cause it to read garbage.

Bump __FreeBSD_version to denote this ABI change, so that ports which depend on
libkvm can be rebuilt.

308872 by kan:
Use ofw_gpiobus instead of plain gpiobus for CI20

Requesed by: mmel

308871 by rmacklem:
Modify umount so that it does not do an Unmount RPC for NFSv4 mounts
and uses TCP for the Unmount RPC if the mount is over TCP.
Without this patch, umount does an Unmount RPC over UDP for all NFS mounts.

Suggested by:	cperciva
Reviewed by:	cperciva
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8503

308869 by imp:
i386 turns out to not have __uint128_t. So confusingly use 64-bit math
instead. Since we're little endian, we can get away with it. Also,
since the counters in quesitons would require billions of iops for
tens of billions of seconds to overflow, and since such data rates are
unlikely for people using i386 for a while, that's OK. The fastest
cards today can't do even a million IOPs.

Noticed by: dim_at_
Sponsored by: Netflix, Inc

308860 by adrian:
[dd] Revert the capsicum bits for now until it gets fixed.

dd is a bootstrap tool and that header isn't installed as part of the
bootstrap environment for previous releases (eg freebsd-10.)

We'll figure it out in post and then re-commit it.

308859 by br:
Enable SMP on Ingenic JZ4780.

It is required to proceed full cache flush before we can use wait
instruction on multicore, so use nop instead for now.

Submitted by:	kan
Sponsored by:	DARPA, AFRL

308858 by br:
Restore dd changes included accidentally in r308857.

308857 by br:
Bring in support for Ingenic XBurst JZ4780 and
X1000 systems on chips.

Imgtec CI20 and Ingenic CANNA boards supported.

Submitted by:	Alexander Kabaev <kan_at_FreeBSD.org>
Reviewed by:	Ruslan Bukin <br_at_FreeBSD.org>
Sponsored by:	DARPA, AFRL

308856 by imp:
Decode the Intel-specific Additional SMART data page (0xca) and print
it in human readable form. Include a pointer to the public spec that
was followed to implement this in the code. Samsung also implements
page 0xca on some of their drives, but the format is slighly
different, so the code skips printing zero keys. Samsung's log page
has additional, unknown data after the end of Intel defined data which
isn't displayed.

Supported by: Netfix, Inc

308855 by imp:
Implement HGST Log page 0xc1, as documented in the HGST SN100 and
SN150 product manuals. Subpage 0x32 is documented, but not implemented.

Sponsored by: Netflix, Inc

308854 by imp:
Print Intel's expanded Temperature log page.

Sponsored by: Netflix, Inc

308853 by imp:
Add log pages that Intel SSDs provide. It turns out that many of these
are widely implemented beyond just Intel drives.

Sponsored by: Netflix, Inc

308852 by imp:
Add log pages defined through NVM Express 1.2.1.

Sponsored by: Netflix, Inc

308851 by imp:
Expand the SMART / Health Information Log Page (Page 02) printout
based on NVM Express 1.2.1 Standard.

Sponsored by: Netflix, Inc

308850 by imp:
Print numbers instead of hex values for smart data. The full 128-bit
number is printed, even though you'd need like a billion IOPs for a 10
billion seconds to overflow the 64-bit counters (~300 years).

Sponsored by: Netflix, Inc

308849 by imp:
Use a table for pages we know the size of. We have a special case for
the error log since it isn't a fixed size.

Sponsored by: Netflix, Inc

308848 by imp:
Remove check for valid log pages. Let the drive tell us which pages
are valid or not. While many pages are reserved in the standard, that
doesn't make them invalid and future versions of the standard may
define then.

Sponsored by: Netflix, Inc

308847 by br:
Add XBurst CPU option.

Submitted by:	kan
Sponsored by:	DARPA, AFRL

308846 by br:
Move intrng includes to the main MIPS includes file.

Sponsored by:	DARPA, AFRL

308845 by br:
Account for bigger secondary data cache line size.

Secondary data cache line size can be bigger than
primary data cache line size, so use biggest value
as a minimum alignment.

Submitted by:	kan
Sponsored by:	DARPA, AFRL

308843 by tsoome:
loader: smbios version check is not correct

The version check for sku and family values is not correct, as this data is
valid for version 2.4+, that also includes version 3.0 and above.

Reported by:	Dan McDonald
Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8578

308841 by br:
Add receiver timeout interrupt enable bit implemented in some
system on chips.

Submitted by:	kan
Sponsored by:	DARPA, AFRL

308840 by cognet:
The only remaining offender that used ti_chip() without checking for
compatibility first was the gpio code, so change that, and re-assert
that the TI chip is a known chip

308839 by br:
Add Ingenic XBurst coprocessor 0 extra bits.

Submitted by:	kan
Sponsored by:	DARPA, AFRL

308837 by cognet:
Don't panic if it's not a TI chip, this code can be called when it is not.

308836 by cognet:
Don't attempt to get the chip revision if it's not a supported TI chip

308835 by br:
Identify Ingenic CPUs.

Submitted by:	kan
Sponsored by:	DARPA, AFRL

308834 by br:
Add Ingenic X1000 DTS files (unofficial).

This is based on JZ4780 due to missing original X1000 parts.

Sponsored by:	DARPA, AFRL

308833 by jmcneill:
On H3, initialize alarm and shutdown trip points and do temperature
conversion as it is done in the BSP.

308832 by tuexen:
Ensure that TCP state changes to state-closing are reported via dtrace.
This does not cover state changes from TIME-WAIT.

Reviewed by:		gnn
MFC after:		3 weeks
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D8443

308830 by andrew:
Make fdt_is_compatible a static function. It's only used in fdt_common.c.

Sponsored by:	ABT Systems Ltd

308828 by cognet:
Move the pandaboard initialization from the probe to the attach method.
Use ofw_bus_node_is_compatible instead of fdt_is_compatible, as the
later is deprecated.

Suggested by:	andrew

308827 by tsoome:
lsdev device name section headers should be printed by dv_print callback.

lsdev command does walk over devsw list, prints list element name and
will use dv_print() callback to print the device list.
Unfortunately this approach will add unneeded noise when there are no
particular devices detected.

To remove "empty" device section headers, the dv_print() callback
should print the header instead.

In addition, fixed dv_print callback for md module.

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D8551

308826 by avg:
zfs: fix up after the removal of PG_CACHED pages in r308691

PR:		214629
Reported by:	mshirk_at_daemon-security.com
Reviewed by:	alc
Tested by:	Shawn Webb <shawn.webb_at_hardenedbsd.org>
X-MFC with:	308691

308825 by kevlo:
For RTL8812AU:
- The Tx power (diff) values should be signed
- Fix an off by one error when reading Tx power (diff) values

Reviewed by:	avos, adrian
Differential Revision:	https://reviews.freebsd.org/D8571

308824 by vangyzen:
locale: fix display of "grouping" and "mon_grouping" values

The "grouping" and "mon_grouping" values are arrays of one-byte
integers, not arrays of ASCII characters.  Display them in a format
similar to GNU and MacOS.

MFC after:	3 days
Sponsored by:	Dell EMC

308823 by adrian:
[net80211] handle hardware encryption offload in the receive path

* teach the crypto modules about receive offload - although I have
  to do some further reviewing in places where we /can't/ have an RX key
* teach the RX data path about receive offload encryption - check the flag,
  handle NULL key, do decap and checking as appropriate.

Tested:

* iwn(4), STA mode
* ath(4), STA and AP mode
* ath10k port, STA mode (hardware encryption)

Reviewed by:	avos
Differential Revision:	https://reviews.freebsd.org/D8533

308822 by cognet:
Resolv the remaining conflicting symbols between omap4 and am335x, and
add omap4/pandaboard into the GENERIC kernel.

308821 by jhb:
MFamd64: Various fatal page fault fixes.

- If a page fault is triggered due to reserved bits in a PTE, treat it
  as a fatal fault and panic.
- If PG_NX is in use, report whether a fatal page fault is due to an
  instruction fetch or a data access.
- If a fatal page fault is due to reserved bits in a PTE, report that as
  the page fault type rather than a protection violation.

MFC after:	1 month

308820 by jhb:
Report page faults due to reserved bits in PTEs as a separate fault type.

Rather than reporting a page fault due to a bad PTE as a protection
violation with the "rsv" flag, treat these faults as a separate type of
fault altogether.

MFC after:	1 month
Received on Sat Dec 03 2016 - 21:59:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:09 UTC