]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r323394: newvers.sh: accept "git-svn-id:" at the start of a line only
emaste [Sat, 7 Oct 2017 20:17:03 +0000 (20:17 +0000)]
MFC r323394: newvers.sh: accept "git-svn-id:" at the start of a line only

This prevents incorrect subversion revision detection when "git svn" is
not being used to get the sources but git is available. Previously old
subversion revisions included in commit messages were favoured over the
more recent and correct revisions in git notes.

For example cf1f35574722 represents r315395 but was treated as r313908
which is referenced in the commit message. Commits following
r315395/cf1f35574722 but before another commit with a git-svn-id
reference in the commit message would be treated as r313908 as well.

Patch from PR updated to accommodate the initial four space indent in
`git log` ouptut.

PR: 221848
Submitted by: Fabian Keil
Obtained from: ElectroBSD

6 years agoMFC r323438: make-memstick.sh: use UFSv2
emaste [Sat, 7 Oct 2017 20:14:30 +0000 (20:14 +0000)]
MFC r323438: make-memstick.sh: use UFSv2

There's not much practical difference as far as install media is
concerned but newfs creates UFSv2 by default and it is sensible to use
the contemporary UFS version.

I also intend to change makefs to create UFSv2 by default (to match
newfs) so we'll want make-memstick.sh to be explicit, rather than
relying on the host tool's default.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r324143:
ngie [Sat, 7 Oct 2017 18:46:50 +0000 (18:46 +0000)]
MFC r324143:

Adjust r322633 to only apply to libexec/rtld-elf, and not usr.bin/ldd,
when running build32/install32

This unbreaks installing usr.bin/ldd as ldd32 when NO_RTLD is defined.

MFC with:       r322633

6 years agoMFC r319542,321003,321378
alc [Sat, 7 Oct 2017 18:36:42 +0000 (18:36 +0000)]
MFC r319542,321003,321378
  Eliminate duplication of the pmap and pv list unlock operations in
  pmap_enter() by implementing a single return path.  Otherwise, the
  duplication will only increase with the upcoming support for psind == 1.

  Extract the innermost loop of pmap_remove() out into its own function,
  pmap_remove_ptes().  (This new function will also be used by an upcoming
  change to pmap_enter() that adds support for psind == 1 mappings.)

  Add support for pmap_enter(..., psind=1) to the amd64 pmap.  In other words,
  add support for explicitly requesting that pmap_enter() create a 2MB page
  mapping.  (Essentially, this feature allows the machine-independent layer to
  create superpage mappings preemptively, and not wait for automatic promotion
  to occur.)

  Export pmap_ps_enabled() to the machine-independent layer.

  Add a flag to pmap_pv_insert_pde() that specifies whether it should fail or
  reclaim a PV entry when one is not available.

  Refactor pmap_enter_pde() into two functions, one by the same name, that is
  a general-purpose function for creating PDE PG_PS mappings, and another,
  pmap_enter_2mpage(), that is used to prefault 2MB read- and/or execute-only
  mappings for execve(2), mmap(2), and shmat(2).

6 years agoMFC r320980,321377
alc [Sat, 7 Oct 2017 18:08:37 +0000 (18:08 +0000)]
MFC r320980,321377
  Generalize vm_page_ps_is_valid() to support testing other predicates on
  the (super)page, renaming the function to vm_page_ps_test().

  In vm_page_ps_test(), always check that the base pages within the specified
  superpage all belong to the same object.  To date, that check has not been
  needed, but upcoming changes require it.

6 years agoMFC r321015
alc [Sat, 7 Oct 2017 17:32:39 +0000 (17:32 +0000)]
MFC r321015
  Style-only change: Consistently use the variable name "pdpg" throughout
  this file.  Previously, half of the pointers to a vm_page being used as
  a page directory page were named "pdpg" and the rest were named "mpde".

6 years agoMFC r323973,324087
alc [Sat, 7 Oct 2017 17:20:31 +0000 (17:20 +0000)]
MFC r323973,324087
  Optimize vm_page_try_to_free().  Specifically, the call to pmap_remove_all()
  can be avoided when the page's containing object has a reference count of
  zero.  (If the object has a reference count of zero, then none of its pages
  can possibly be mapped.)

  Address nearby style issues in vm_page_try_to_free(), and change its
  return type to "bool".

  Optimize vm_object_page_remove() by eliminating pointless calls to
  pmap_remove_all().  If the object to which a page belongs has no
  references, then that page cannot possibly be mapped.

6 years agoMFC r323656
alc [Sat, 7 Oct 2017 16:55:44 +0000 (16:55 +0000)]
MFC r323656
  Modify blst_leaf_alloc to take only the cursor argument.

  Modify blst_leaf_alloc to find allocations that cross the boundary between
  one leaf node and the next when those two leaves descend from the same
  meta node.

  Update the hint field for leaves so that it represents a bound on how
  large an allocation can begin in that leaf, where it currently represents
  a bound on how large an allocation can be found within the boundaries of
  the leaf.

  The first phase of blst_leaf_alloc currently shrinks sequences of
  consecutive 1-bits in mask until each has been shrunken by count-1 bits,
  so that any bits remaining show where an allocation can begin, or until
  all the bits have disappeared, in which case the allocation fails. This
  change amends that so that the high-order bit is copied, as if, when the
  last block was free, it was followed by an endless stream of free
  blocks. It also amends the early stopping condition, so that the shrinking
  of 1-sequences stops early when there are none, or there is only one
  unbounded one remaining.

  The search for the first set bit is unchanged, and the code path
  thereafter is mostly unchanged unless the first set bit is in a position
  that makes some of those copied sign bits matter. In that case, we look
  for a next leaf, and at what blocks it can provide, to see if a
  cross-boundary allocation is possible.

  The hint is updated on a successful allocation that clears the last bit,
  but it not updated on a failed allocation that leaves the last bit
  set. So, as long as the last block is free, the hint value for the leaf is
  large. As long as the last block is free, and there's a next leaf, a large
  allocation can begin here, perhaps. A stricter rule than this would mean
  that allocations and frees in one leaf could require hint updates to the
  preceding leaf, and this change seeks to leave the freeing code
  unmodified.

  Define BLIST_BMAP_MASK, and use it for bit masking in blst_leaf_free and
  blist_leaf_fill, as well as in blst_leaf_alloc.

  Correct a panic message in blst_leaf_free.

6 years agoMFC r324123: Add sysctl/tunable for maximal request time.
mav [Sat, 7 Oct 2017 09:47:31 +0000 (09:47 +0000)]
MFC r324123: Add sysctl/tunable for maximal request time.

6 years agoMFC r324114:
kib [Sat, 7 Oct 2017 08:44:08 +0000 (08:44 +0000)]
MFC r324114:
Update cpucontrol(8).

6 years agoMFC r324113:
kib [Sat, 7 Oct 2017 08:42:36 +0000 (08:42 +0000)]
MFC r324113:
Allow to disable default microcode updates search path with the new
'-n' option.

6 years agoMFC r324065
davidcs [Thu, 5 Oct 2017 18:38:42 +0000 (18:38 +0000)]
MFC r324065
Tx Ring Shadow Consumer Index Register needs to be cleared prior
to passing it's physical address to the FW during Tx Create Context.

6 years agoMFC r324026
davidcs [Thu, 5 Oct 2017 18:33:56 +0000 (18:33 +0000)]
MFC r324026
Fix delete all multicast addresses

Submitted by:Anand.Khoje@cavium.com

6 years agoMFC r323709:
gordon [Thu, 5 Oct 2017 17:02:21 +0000 (17:02 +0000)]
MFC r323709:
Revert tcpdump to using the source manpage instead of having a copy here.

This helps future maintainability of tcpdump so we don't forget to update
the manpage (like we have previously).

6 years agoMFC r324080:
kib [Thu, 5 Oct 2017 11:01:19 +0000 (11:01 +0000)]
MFC r324080:
Zero segment registers which contained invalid usermode selectors, when
returning to kernel.

6 years agoMFC r324079:
kib [Thu, 5 Oct 2017 11:00:04 +0000 (11:00 +0000)]
MFC r324079:
Do not return from interrupt using the POP_FRAME;iret instruction
sequence, always jump to doreti.

6 years agoMFC r324086: Alike to ZFS disable cache flush after first ENOTSUP error.
mav [Thu, 5 Oct 2017 10:24:34 +0000 (10:24 +0000)]
MFC r324086: Alike to ZFS disable cache flush after first ENOTSUP error.

6 years agoMFC r323578,r323769: dounmount: do not release the mount point's reference
avg [Thu, 5 Oct 2017 06:54:25 +0000 (06:54 +0000)]
MFC r323578,r323769: dounmount: do not release the mount point's reference
on the covered vnode

As long as mnt_ref is not zero there can be a consumer that might try
to access mnt_vnodecovered.  For this reason the covered vnode must not
be freed until mnt_ref goes to zero.
So, move the release of the covered vnode to vfs_mount_destroy.

6 years agoMFC r324066:
markj [Wed, 4 Oct 2017 15:47:16 +0000 (15:47 +0000)]
MFC r324066:
Use C99 initializers for DTrace provider methods.

6 years agoMFC r320892:
trasz [Wed, 4 Oct 2017 12:06:24 +0000 (12:06 +0000)]
MFC r320892:

Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in addition
to -y.  To me, fsck_y_enable means "try as hard as possible", and without
-R, it... well, doesn't.

6 years agoMFC r320803:
trasz [Wed, 4 Oct 2017 12:04:35 +0000 (12:04 +0000)]
MFC r320803:

Fix "mount -uw /" when the filesystem type doesn't match.

This basically makes "mount -uw /" work when the filesystem
mounted on / is NFS, but the one configured in fstab(5) is UFS,
which can happen when you forget to modify fstab.

Note that the whole special case ("else if (argv[0][0] == '/'")
is probably not needed anyway.  I'll take a look at removing it
altogether; for now this is a minimally intrusive fix.

6 years agoMFC r323263:
trasz [Wed, 4 Oct 2017 12:02:42 +0000 (12:02 +0000)]
MFC r323263:

Hint that the "-o emul" option for ps(1) shows the ABI.

6 years agoMFC r323228:
trasz [Wed, 4 Oct 2017 12:02:05 +0000 (12:02 +0000)]
MFC r323228:

Make ps(1) flag processes in capsicum(4) capability mode with "C".

6 years agoMFC r323225:
trasz [Wed, 4 Oct 2017 12:01:02 +0000 (12:01 +0000)]
MFC r323225:

Reflect realtime and idle priorities in ps(1) state flags, same like
we do for the usual nice values.  It could be argued that they should
use another set of indicators, since the underlying mechanism is
different, but they match the description in the manual page, and so
I think it's ok to not overcomplicate things.

PR: 81757

6 years agoMFC r321422:
trasz [Wed, 4 Oct 2017 11:59:53 +0000 (11:59 +0000)]
MFC r321422:

Improve the ktrace(1) man page to make it slightly more obvious that there
are _two_ options that control its behaviour wrt child processes; slightly
improve the example[1], and add Xrefs.

6 years agoMFC r323183:
trasz [Wed, 4 Oct 2017 11:58:52 +0000 (11:58 +0000)]
MFC r323183:

Make root_mount_rel(9) ignore NULL arguments, like it used to before r313351.
It would be better to fix API consumers to not pass NULL there - most of them,
such as gmirror, already contain the neccessary checks - but this is easier
and much less error-prone.

One known user-visible result is that it fixes panic on a failed "graid label".

6 years agoMFC r320734:
trasz [Wed, 4 Oct 2017 11:55:34 +0000 (11:55 +0000)]
MFC r320734:

Improve ddb(4) error reporting a bit.

6 years agoMFC r320740:
trasz [Wed, 4 Oct 2017 11:54:15 +0000 (11:54 +0000)]
MFC r320740:

Make ^w work in ddb(4).

6 years agoMFC r320733:
trasz [Wed, 4 Oct 2017 11:53:05 +0000 (11:53 +0000)]
MFC r320733:

Make ddb(4) a bit more user-friendly by improving "help".

6 years agoMFC r320741:
trasz [Wed, 4 Oct 2017 11:42:12 +0000 (11:42 +0000)]
MFC r320741:

Make ^c work in ddb(4).

6 years agoMFC r320363:
trasz [Wed, 4 Oct 2017 11:39:44 +0000 (11:39 +0000)]
MFC r320363:

Improve terminology in a comment.

6 years agoMFC r320360:
trasz [Wed, 4 Oct 2017 11:38:52 +0000 (11:38 +0000)]
MFC r320360:

Make resizewin(1) do flushing by using TCSAFLUSH instead of TCSANOW
followed by tcflush(3).  This works just as well and is more elegant.

6 years agoMFC r323791: MFV r323790: 8567 Inconsistent return value in zpool_read_label
avg [Wed, 4 Oct 2017 07:43:04 +0000 (07:43 +0000)]
MFC r323791: MFV r323790: 8567 Inconsistent return value in zpool_read_label

6 years agoMFC r323483: zfsctl_snapdir_lookup should be able to handle an uncovered vnode
avg [Wed, 4 Oct 2017 07:37:36 +0000 (07:37 +0000)]
MFC r323483: zfsctl_snapdir_lookup should be able to handle an uncovered vnode

6 years agoMFC r323481: zfsvfs_hold: assert that the busied filesystem can not be unmounted
avg [Wed, 4 Oct 2017 07:36:06 +0000 (07:36 +0000)]
MFC r323481: zfsvfs_hold: assert that the busied filesystem can not be unmounted

6 years agoMFC r321514, r322885, r323015, r323177
ed [Wed, 4 Oct 2017 07:35:01 +0000 (07:35 +0000)]
MFC r321514, r322885, r323015, r323177

This brings the CloudABI code more or less in sync with HEAD.

r321514:
Upgrade to the latest sources generated from the CloudABI specification.

The CloudABI specification has had some minor changes over the last half
year. No substantial features have been added, but some features that
are deemed unnecessary in retrospect have been removed:

- mlock()/munlock():

  These calls tend to be used for two different purposes: real-time
  support and handling of sensitive (cryptographic) material that
  shouldn't end up in swap. The former use case is out of scope for
  CloudABI. The latter may also be handled by encrypting swap.

  Removing this has the advantage that we no longer need to worry about
  having resource limits put in place.

- SOCK_SEQPACKET:

  Support for SOCK_SEQPACKET is rather inconsistent across various
  operating systems. Some operating systems supported by CloudABI (e.g.,
  macOS) don't support it at all. Considering that they are rarely used,
  remove support for the time being.

- getsockname(), getpeername(), etc.:

  A shortcoming of the sockets API is that it doesn't allow you to
  create socket(pair)s, having fake socket addresses associated with
  them. This makes it harder to test applications or transparently
  forward (proxy) connections to them.

  With CloudABI, we're slowly moving networking connectivity into a
  separate daemon called Flower. In addition to passing around socket
  file descriptors, this daemon provides address information in the form
  of arbitrary string labels. There is thus no longer any need for
  requesting socket address information from the kernel itself.

This change also updates consumers of the generated code accordingly.
Even though system calls end up getting renumbered, this won't cause any
problems in practice. CloudABI programs always call into the kernel
through a kernel-supplied vDSO that has the numbers updated as well.

Obtained from: https://github.com/NuxiNL/cloudabi

r322885:
Sync CloudABI compatibility against the latest upstream version (v0.13).

With Flower (CloudABI's network connection daemon) becoming more
complete, there is no longer any need for creating any unconnected
sockets. Socket pairs in combination with file descriptor passing is all
that is necessary, as that is what is used by Flower to pass network
connections from the public internet to listening processes.

Remove all of the kernel bits that were used to implement socket(),
listen(), bindat() and connectat(). In principle, accept() and
SO_ACCEPTCONN may also be removed, but there are still some consumers
left.

Obtained from: https://github.com/NuxiNL/cloudabi

r323015:
Complete the CloudABI networking refactoring.

Now that all of the packaged software has been adjusted to either use
Flower (https://github.com/NuxiNL/flower) for making incoming/outgoing
network connections or can have connections injected, there is no longer
need to keep accept() around. It is now a lot easier to write networked
services that are address family independent, dual-stack, testable, etc.

Remove all of the bits related to accept(), but also to
getsockopt(SO_ACCEPTCONN).

r323177:
Merge pipes and socket pairs.

Now that CloudABI's sockets API has been changed to be addressless and
only connected socket instances are used (e.g., socket pairs), they have
become fairly similar to pipes. The only differences on CloudABI is that
socket pairs additionally support shutdown(), send() and recv().

To simplify the ABI, we've therefore decided to remove pipes as a
separate file descriptor type and just let pipe() return a socket pair
of type SOCK_STREAM. S_ISFIFO() and S_ISSOCK() are now defined
identically.

6 years agoMFC r323768:
kib [Tue, 3 Oct 2017 11:00:34 +0000 (11:00 +0000)]
MFC r323768:
For unlinked files, do not msync(2) or sync on the vnode deactivation.

6 years agoMFC r324007, r324012, r324014
manu [Tue, 3 Oct 2017 08:29:46 +0000 (08:29 +0000)]
MFC r324007, r324012, r324014

r324007:
mountd: Replace malloc+strcpy to strdup

Reviewed by: bapt
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D12503

r324012:
mountd: Remove unneeded cast

Reported by: kib
X MFC With: r324007

r324014:
mountd: Avoid memory leak by freeing dp_dirp

Introduced in r324007, the data alloced by strdup was never free'ed.
While here, remove cast to caddr_t when freeing dp.

Reported by: bde
X MFC With: r324007

6 years agoMFC r324100:
bapt [Tue, 3 Oct 2017 08:14:25 +0000 (08:14 +0000)]
MFC r324100:

man(1): silent the output of mandoc when testing

This reduce the spam a user may face when mandoc tries to
figure out if it can renders a manpage or fallback on groff(1)

Reported by: bdrewery

6 years agoMFC 323994: Log signal number passed to PT_STEP requests in KTR_PTRACE traces.
jhb [Mon, 2 Oct 2017 18:03:55 +0000 (18:03 +0000)]
MFC 323994: Log signal number passed to PT_STEP requests in KTR_PTRACE traces.

6 years agoMFC r323433,r323793,r323915: MFV r323110: 8558 lwp_create() returns EAGAIN
avg [Mon, 2 Oct 2017 12:54:01 +0000 (12:54 +0000)]
MFC r323433,r323793,r323915: MFV r323110: 8558 lwp_create() returns EAGAIN
on system with more than 80K ZFS filesystems, and followups

r323433: MFV r323110: 8558 lwp_create() returns EAGAIN on system with more than 80K ZFS filesystems
r323793: MFV r323792: 8602 remove unused "dp_early_sync_tasks" field from "dsl_pool" structure
r323915: MFV r323914: 8661 remove "zil-cw2" dtrace probe

6 years agoMFC r323918: MFV r323917: 8648 Fix range locking in ZIL commit codepath
avg [Mon, 2 Oct 2017 12:44:06 +0000 (12:44 +0000)]
MFC r323918: MFV r323917: 8648 Fix range locking in ZIL commit codepath

This fixes a problem introduced in r315441, MFC of r308782.

6 years agoMFC: r323689
rmacklem [Sun, 1 Oct 2017 21:45:15 +0000 (21:45 +0000)]
MFC: r323689
Fix bogus FREAD with NFSV4OPEN_ACCESSREAD. No functional change.

The code in nfscl_doflayoutio() bogusly used FREAD instead of
NFSV4OPEN_ACCESSREAD. Since both happen to be defined as "1", this
worked and the patch doesn't result in a functional change.
Found by inspection during development of Flex File Layout support.

6 years agoMFC r323873, r324081: Unprotected modification of ng_iface(4)
eugen [Sun, 1 Oct 2017 19:39:27 +0000 (19:39 +0000)]
MFC r323873, r324081: Unprotected modification of ng_iface(4)
private data leads to kernel panic. Fix a race with per-node
read-mostly lock and refcounting for a hook.

PR: 220076
Tested by: peixoto.cassiano
Approved by: mav (mentor)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D12435

6 years agoMFC r323961
alc [Sun, 1 Oct 2017 16:57:08 +0000 (16:57 +0000)]
MFC r323961
  Since the page "frame" doesn't belong to a vm object, it can't be paged
  out.  Since it can't be paged out, it is never actually enqueued in a
  paging queue.  Nonetheless, passing PQ_INACTIVE to vm_page_unwire()
  creates the appearance that the page "frame" is being enqueued in the
  inactive queue.  As of r288122, we can avoid this false impression by
  passing PQ_NONE.

6 years agoMFC r323981
alc [Sun, 1 Oct 2017 16:29:20 +0000 (16:29 +0000)]
MFC r323981
  Modernize the use of vm_page_unwire().  Since r288122, vm_page_unwire()
  has returned TRUE when the wire count transitions to zero, eliminating
  the need for callers to inspect the page's wire count.

6 years agoMFV r323796: fix memory leak in g_bio zone introduced in r320452
avg [Sun, 1 Oct 2017 15:03:44 +0000 (15:03 +0000)]
MFV r323796: fix memory leak in g_bio zone introduced in r320452

I overlooked the fact that that ZIO_IOCTL_PIPELINE does not include
ZIO_STAGE_VDEV_IO_DONE stage.  We do allocate a struct bio for an ioctl
zio (a disk cache flush), but we never freed it.

This change splits bio handling into two groups, one for normal
read/write i/o that passes data around and, thus, needs the abd data
tranform; the other group is for "data-less" i/o such as trim and cache
flush.

PR: 222288

6 years agoMFC r323797: add vfs_zfs.abd_chunk_size tunable
avg [Sun, 1 Oct 2017 14:58:43 +0000 (14:58 +0000)]
MFC r323797: add vfs_zfs.abd_chunk_size tunable

It is reported that the default value of 4KB results in a substantial
memory use overhead (at least, on some configurations).  Using 1KB seems
to reduce the overhead significantly.

PR: 222377

6 years agoMFC r323522: slightly simplify zfs_vptocnp
avg [Sun, 1 Oct 2017 14:50:01 +0000 (14:50 +0000)]
MFC r323522: slightly simplify zfs_vptocnp

6 years agoMFC r321444,r321446:
ngie [Sat, 30 Sep 2017 20:31:37 +0000 (20:31 +0000)]
MFC r321444,r321446:

r321444:

Remove ${MTREE} and leverage etc/mtree/Makefile instead with
"make distribution".

This also fixes the fact that BSD.debug.dist was being installed if/when
${MK_DEBUG_FILES} != "no" before this commit.

r321446:

Unconditionally install etc/mtree/BSD.debug.dist again

r279248 unconditionally installed BSD.debug.dist for ease-of-developer-use.
Restore the previous behavior.

While here, add a comment to note that this is intentional to avoid accidental
future removal.

MFC with: r321444

6 years agoMFC r322441:
ngie [Sat, 30 Sep 2017 20:07:54 +0000 (20:07 +0000)]
MFC r322441:

Delete trailing whitespace

6 years agoMFC r322951:
ngie [Sat, 30 Sep 2017 20:06:44 +0000 (20:06 +0000)]
MFC r322951:

Respect MK_TCSH with build-tools and native-xtools

This helps reduce the WORLDTMP footprint slightly.

Based on a patch I submitted 5 years ago to GNATS.

PR: 174051
Relnotes: yes (anyone who cross-builds with MK_TCSH=yes will run into
     build failures if the host doesn't have tcsh(1))
Reminded by: Fabian Keil <fk@fabiankeil.de>

6 years agoMFC r323391
alc [Sat, 30 Sep 2017 19:54:30 +0000 (19:54 +0000)]
MFC r323391
  To analyze the allocation of swap blocks by blist functions, add a method
  for analyzing the radix tree structures and reporting on the number, and
  sizes, of maximal intervals of free blocks.  The report includes the number
  of maximal intervals, and also the number of them in each of several size
  ranges, from small (size 1, or 3 to 4) to large (28657 to 46367) with size
  boundaries defined by Fibonacci numbers.  The report is written in the test
  tool with the 's' command, or in a running kernel by sysctl.

  The analysis of the radix tree frequently computes the position of the lone
  bit set in a u_daddr_t, a computation that also appears in leaf allocation.
  That computation has been moved into a function of its own, and optimized
  for cases where an inlined machine instruction can replace the usual binary
  search.

6 years agoMFC r322459,322897
alc [Sat, 30 Sep 2017 19:23:49 +0000 (19:23 +0000)]
MFC r322459,322897
  The *_meta_* functions include a radix parameter, a blk parameter, and
  another parameter that identifies a starting point in the memory address
  block.  Radix is a power of two, blk is a multiple of radix, and the
  starting point is in the range [blk, blk+radix), so that blk can always be
  computed from the other two.  This change drops the blk parameter from the
  meta functions and computes it instead.  (On amd64, for example, this
  change reduces subr_blist.o's text size by 7%.)

  It also makes the radix parameters unsigned to address concerns that the
  calculation of '-radix' might overflow without the -fwrapv option.  (See
  https://reviews.freebsd.org/D11819.)

  Correct a regression in the previous change, r322459.  Specifically, the
  removal of the "blk" parameter from blst_meta_alloc() had the unintended
  effect of generating an out-of-range allocation when the cursor reaches
  the end of the tree if the number of managed blocks in the tree equals
  the so-called "radix" (which in the blist code is not the standard notion
  of what a radix is but rather the maximum number of leaves in a tree of
  the current height.)  In other words, only certain swap configurations
  were affected, which is why earlier testing did not reveal the problem.

6 years agoMFC r323868
alc [Sat, 30 Sep 2017 18:52:59 +0000 (18:52 +0000)]
MFC r323868
  Modernize calls to vm_page_unwire().  As of r288122, vm_page_unwire()
  accepts PQ_NONE as the specified queue and returns a Boolean indicating
  whether the page's wire count transitioned to zero.  Use these features
  in dev/drm2.

6 years agoMFC r323786
alc [Sat, 30 Sep 2017 18:32:00 +0000 (18:32 +0000)]
MFC r323786
  In r288122, we changed vm_page_unwire() so that it returns a Boolean
  indicating whether the page's wire count transitioned to zero.  Use that
  return value in zbuf_page_free() rather than checking the wire count.

6 years agoMFC r323785
alc [Sat, 30 Sep 2017 18:07:46 +0000 (18:07 +0000)]
MFC r323785
  Sync with amd64/arm/arm64/i386/mips pmap change r288256:

  Exploit r288122 to address a cosmetic issue.  Since PV chunk pages don't
  belong to a vm object, they can't be paged out.  Since they can't be paged
  out, they are never enqueued in a paging queue.  Nonetheless, passing
  PQ_INACTIVE to vm_page_unwire() creates the appearance that these pages
  are being enqueued in the inactive queue.  As of r288122, we can avoid
  this false impression by passing PQ_NONE.

6 years agoMFC 323631: Add an -a flag to getconf.
jhb [Sat, 30 Sep 2017 17:30:22 +0000 (17:30 +0000)]
MFC 323631: Add an -a flag to getconf.

When -a is specified, the name and value of all system or path
configuration values is reported to standard output.

Sponsored by: Chelsio Communications

6 years agoMFC r323864
kp [Sat, 30 Sep 2017 10:15:04 +0000 (10:15 +0000)]
MFC r323864

bridge: Set module version

This ensures that the loader will not load the module if it's also built in to
the kernel.

PR:             220860
Submitted by:   Eugene Grosbein <eugen@freebsd.org>

6 years agoBelatedely fill in the dates for clang 5.0.0 update in UPDATING and
dim [Fri, 29 Sep 2017 23:05:56 +0000 (23:05 +0000)]
Belatedely fill in the dates for clang 5.0.0 update in UPDATING and
ObsoleteFiles.inc.

Noticed by: garga

6 years agoMFC r323613:
markj [Thu, 28 Sep 2017 15:23:38 +0000 (15:23 +0000)]
MFC r323613:
Include _bitset.h to get BITSET_DEFINE, used to define struct slabbits.

6 years agoMFC r323290:
markj [Thu, 28 Sep 2017 15:21:47 +0000 (15:21 +0000)]
MFC r323290:
Speed up vm_page_array initialization.

6 years agoMFC r323880:
markj [Thu, 28 Sep 2017 15:18:20 +0000 (15:18 +0000)]
MFC r323880:
Simplify i915_gem_wire_page() and avoid unneeded page-busying.

6 years agoMFC r323813:
asomers [Wed, 27 Sep 2017 15:29:17 +0000 (15:29 +0000)]
MFC r323813:

MFV r323789:  8473 scrub does not detect errors on active spares

illumos/illumos-gate@554675eee75dd2d7398d960aa5c81083ceb8505a
https://github.com/illumos/illumos-gate/commit/554675eee75dd2d7398d960aa5c81083ceb8505a

https://www.illumos.org/issues/8473
Scrubbing is supposed to detect and repair all errors in the pool. However,
it wrongly ignores active spare devices. The problem can easily be
reproduced in OpenZFS at git rev 0ef125d with these commands:

truncate -s 64m /tmp/a /tmp/b /tmp/c
sudo zpool create testpool mirror /tmp/a /tmp/b spare /tmp/c
sudo zpool replace testpool /tmp/a /tmp/c
/bin/dd if=/dev/zero bs=1024k count=63 oseek=1 conv=notrunc of=/tmp/c
sync
sudo zpool scrub testpool
zpool status testpool # Will show 0 errors, which is wrong
sudo zpool offline testpool /tmp/a
sudo zpool scrub testpool
zpool status testpool # Will show errors on /tmp/c,
      # which should've already been fixed

FreeBSD head is partially affected: the first scrub will detect some errors, but the second scrub will detect more.

Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

Sponsored by: Spectra Logic Corp

6 years agoMFC r323194:
asomers [Wed, 27 Sep 2017 15:07:41 +0000 (15:07 +0000)]
MFC r323194:

Fix remounting ZFS filesystem with "zfs mount"

"zfs mount -o" passes a list of mount options directly to nmount(2) after
sanity checking them. In particular, zfs(8) will refuse to mount an already
existing file system unless "remount" is specified in the option list.
However, the "remount" option only exists in Illumos. FreeBSD's equivalent is
"update".

PR: 221985
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12233

6 years agoMFC r323193:
asomers [Wed, 27 Sep 2017 15:06:46 +0000 (15:06 +0000)]
MFC r323193:

Honor all options of "zfs mount -o"

The existing code in zmount incorrectly parses the comma-delimited option
string. The result is that nmount only honors the last option. AFAICT the
parsing has been broken ever since ZFS's initial import in change 168404.

PR: 222078
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12232

6 years agoMFC r322868:
asomers [Wed, 27 Sep 2017 15:05:49 +0000 (15:05 +0000)]
MFC r322868:

Fix 100.chksetuid and 110.neggrpperm for mountpoints with spaces

Also, fix them for mountpoints with tabs.

PR: 48325
Reported by: pguyot@kallisys.net, aaron@baugher.biz

6 years agoMFC r323544:
markj [Wed, 27 Sep 2017 14:19:47 +0000 (14:19 +0000)]
MFC r323544:
Fix a logic error in the item size calculation for internal UMA zones.

6 years agoMFC r323564:
markj [Wed, 27 Sep 2017 14:18:20 +0000 (14:18 +0000)]
MFC r323564:
Widen uk_pgoff, the slab header offset field.

PR: 218911

6 years agoMFC r322965:
ed [Wed, 27 Sep 2017 11:31:11 +0000 (11:31 +0000)]
MFC r322965:

  Make _Static_assert() work with GCC in older C++ standards.

  GCC only activates C11 keywords in C mode, not C++ mode. This means
  that when targeting an older C++ standard, we cannot fall back to using
  _Static_assert(). In this case, do define _Static_assert() as a macro
  that uses a typedef'ed array.

6 years agoMFC r323839:
ae [Wed, 27 Sep 2017 01:47:54 +0000 (01:47 +0000)]
MFC r323839:
  Use in_localip() function instead of unlocked access to addresses hash
  to determine that an address is our local.

  PR: 220078

6 years agoMFC r323836:
ae [Wed, 27 Sep 2017 01:46:14 +0000 (01:46 +0000)]
MFC r323836:
  Do not acquire IPFW_WLOCK when a named object is created and destroyed.

  Acquiring of IPFW_WLOCK is requried for cases when we are going to
  change some data that can be accessed during processing of packets flow.
  When we create new named object, there are not yet any rules, that
  references it, thus holding IPFW_UH_WLOCK is enough to safely update
  needed structures. When we destroy an object, we do this only when its
  reference counter becomes zero. And it is safe to not acquire IPFW_WLOCK,
  because noone references it. The another case is when we failed to finish
  some action and thus we are doing rollback and destroying an object, in
  this case it is still not referenced by rules and no need to acquire
  IPFW_WLOCK.

  This also fixes panic with INVARIANTS due to recursive IPFW_WLOCK acquiring.

  Sponsored by: Yandex LLC

6 years agoMFC r323824
davidcs [Tue, 26 Sep 2017 21:09:21 +0000 (21:09 +0000)]
MFC r323824
  1. ql_hw.c:
   In ql_hw_send() return EINVAL when TSO framelength exceeds max
   supported length by HW.(davidcs)
  2. ql_os.c:
   In qla_send() call bus_dmamap_unload before freeing mbuf or
   recreating dmmamap.(davidcs)
   In qla_fp_taskqueue() Add additional checks for IFF_DRV_RUNNING
   Fix qla_clear_tx_buf() call bus_dmamap_sync() before freeing
   mbuf.

Submitted by: David.Bachu@netapp.com

6 years agoMFC r323781
davidcs [Tue, 26 Sep 2017 21:05:40 +0000 (21:05 +0000)]
MFC r323781
Update minidump template for version 5.4.66

6 years agoMFC r323782
davidcs [Tue, 26 Sep 2017 21:02:19 +0000 (21:02 +0000)]
MFC r323782
Add sysctl "enable_minidump" to turn on/off automatic minidump retrieval

6 years agoMerge clang, llvm, lld, lldb, compiler-rt and libc++ 5.0.0 release.
dim [Tue, 26 Sep 2017 19:56:36 +0000 (19:56 +0000)]
Merge clang, llvm, lld, lldb, compiler-rt and libc++ 5.0.0 release.

MFC r309126 (by emaste):

  Correct lld llvm-tblgen dependency file name

MFC r309169:

  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.

MFC r312765:

  Pull in r276136 from upstream llvm trunk (by Wei Mi):

    Use ValueOffsetPair to enhance value reuse during SCEV expansion.

    In D12090, the ExprValueMap was added to reuse existing value during
    SCEV expansion. However, const folding and sext/zext distribution can
    make the reuse still difficult.

    A simplified case is: suppose we know S1 expands to V1 in
    ExprValueMap, and
      S1 = S2 + C_a
      S3 = S2 + C_b
    where C_a and C_b are different SCEVConstants. Then we'd like to
    expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is
    helpful when S2 is a complex SCEV expr and S2 has no entry in
    ExprValueMap, which is usually caused by the fact that S3 is
    generated from S1 after const folding.

    In order to do that, we represent ExprValueMap as a mapping from SCEV
    to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a}
    into the ExprValueMap when we create SCEV for V1. When S3 is
    expanded, it will first expand S2 to V1 - C_a because of S2->{V1,
    C_a} in the map, then expand S3 to V1 - C_a + C_b.

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

  This should fix assertion failures when building OpenCV >= 3.1.

  PR: 215649

MFC r312831:

  Revert r312765 for now, since it causes assertions when building
  lang/spidermonkey24.

  Reported by: antoine
  PR: 215649

MFC r316511 (by jhb):

  Add an implementation of __ffssi2() derived from __ffsdi2().

  Newer versions of GCC include an __ffssi2() symbol in libgcc and the
  compiler can emit calls to it in generated code.  This is true for at
  least GCC 6.2 when compiling world for mips and mips64.

  Reviewed by: jmallett, dim
  Sponsored by: DARPA / AFRL
  Differential Revision: https://reviews.freebsd.org/D10086

MFC r318601 (by adrian):

  [libcompiler-rt] add bswapdi2/bswapsi2

  This is required for mips gcc 6.3 userland to build/run.

  Reviewed by: emaste, dim
  Approved by: emaste
  Differential Revision: https://reviews.freebsd.org/D10838

MFC r318884 (by emaste):

  lldb: map TRAP_CAP to a trace trap

  In the absense of a more specific handler for TRAP_CAP (generated by
  ENOTCAPABLE or ECAPMODE while in capability mode) treat it as a trace
  trap.

  Example usage (testing the bug in PR219173):

  % proccontrol -m trapcap lldb usr.bin/hexdump/obj/hexdump -- -Cv -s 1 /bin/ls
  ...
  (lldb) run
  Process 12980 launching
  Process 12980 launched: '.../usr.bin/hexdump/obj/hexdump' (x86_64)
  Process 12980 stopped
  * thread #1, stop reason = trace
      frame #0: 0x0000004b80c65f1a libc.so.7`__sys_lseek + 10
  ...

  In the future we should have LLDB control the trapcap procctl itself
  (as it does with ASLR), as well as report a specific stop reason.
  This change eliminates an assertion failure from LLDB for now.

MFC r319796:

  Remove a few unneeded files from libllvm, libclang and liblldb.

MFC r319885 (by emaste):

  lld: ELF: Fix ICF crash on absolute symbol relocations.

  If two sections contained relocations to absolute symbols with the same
  value we would crash when trying to access their sections. Add a check that
  both symbols point to sections before accessing their sections, and treat
  absolute symbols as equal if their values are equal.

  Obtained from: LLD commit r292578

MFC r319918:

  Revert r319796 for now, it can cause undefined references when linking
  in some circumstances.

  Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>

MFC r319957 (by emaste):

  lld: Add armelf emulation mode

  Obtained from: LLD r305375

MFC r321369:

  Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
  5.0.0 (trunk r308421).  Upstream has branched for the 5.0.0 release,
  which should be in about a month.  Please report bugs and regressions,
  so we can get them into the release.

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

MFC r321420:

  Add a few more object files to liblldb, which should solve errors when
  linking the lldb executable in some cases.  In particular, when the
  -ffunction-sections -fdata-sections options are turned off, or
  ineffective.

  Reported by: Shawn Webb, Mark Millard

MFC r321433:

  Cleanup stale Options.inc files from the previous libllvm build for
  clang 4.0.0.  Otherwise, these can get included before the two newly
  generated ones (which are different) for clang 5.0.0.

  Reported by: Mark Millard

MFC r321439 (by bdrewery):

  Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm.

  The files are only ever generated to .OBJDIR, not to WORLDTMP (as a
  sysroot) and are only ever included from a compilation.  So using
  a beforebuild target here removes the file before the compilation
  tries to include it.

MFC r321664:

  Pull in r308891 from upstream llvm trunk (by Benjamin Kramer):

    [CodeGenPrepare] Cut off FindAllMemoryUses if there are too many uses.

    This avoids excessive compile time. The case I'm looking at is
    Function.cpp from an old version of LLVM that still had the giant
    memcmp string matcher in it. Before r308322 this compiled in about 2
    minutes, after it, clang takes infinite* time to compile it. With
    this patch we're at 5 min, which is still bad but this is a
    pathological case.

    The cut off at 20 uses was chosen by looking at other cut-offs in LLVM
    for user scanning. It's probably too high, but does the job and is
    very unlikely to regress anything.

    Fixes PR33900.

    * I'm impatient and aborted after 15 minutes, on the bug report it was
      killed after 2h.

  Pull in r308986 from upstream llvm trunk (by Simon Pilgrim):

    [X86][CGP] Reduce memcmp() expansion to 2 load pairs (PR33914)

    D35067/rL308322 attempted to support up to 4 load pairs for memcmp
    inlining which resulted in regressions for some optimized libc memcmp
    implementations (PR33914).

    Until we can match these more optimal cases, this patch reduces the
    memcmp expansion to a maximum of 2 load pairs (which matches what we
    do for -Os).

    This patch should be considered for the 5.0.0 release branch as well

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

  These fix a hang (or extremely long compile time) when building older
  LLVM ports.

  Reported by:    antoine
  PR:             219139

MFC r321719:

  Pull in r309503 from upstream clang trunk (by Richard Smith):

    PR33902: Invalidate line number cache when adding more text to
    existing buffer.

    This led to crashes as the line number cache would report a bogus
    line number for a line of code, and we'd try to find a nonexistent
    column within the line when printing diagnostics.

  This fixes an assertion when building the graphics/champlain port.

  Reported by: antoine, kwm
  PR: 219139

MFC r321723:

  Upgrade our copies of clang, llvm, lld and lldb to r309439 from the
  upstream release_50 branch.  This is just after upstream's 5.0.0-rc1.

MFC r322320:

  Upgrade our copies of clang, llvm and libc++ to r310316 from the
  upstream release_50 branch.

MFC r322326 (by emaste):

  lldb: Make i386-*-freebsd expression work on JIT path

  * Enable i386 ABI creation for freebsd
  * Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap
    syscall
  * Unlike linux, the last argument of mmap is actually 64-bit(off_t).
    This requires us to push an additional word for the higher order bits.
  * Prior to this change, ktrace dump will show mmap failures due to
    invalid argument coming from the 6th mmap argument.

  Submitted by: Karnajit Wangkhem
  Differential Revision: https://reviews.llvm.org/D34776

MFC r322360 (by emaste):

  lldb: Report inferior signals as signals, not exceptions, on FreeBSD

  This is the FreeBSD equivalent of LLVM r238549.

  This serves 2 purposes:

  * LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/
    SIGFPE the way it is suppose to be handled. Prior to this fix these
    signals will neither create a coredump, nor exit from the debugger
    or work for signal handling scenario.
  * eInvalidCrashReason need not report "unknown crash reason" if we have
    a valid si_signo

  llvm.org/pr23699

  Patch by Karnajit Wangkhem

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

  Submitted by: Karnajit Wangkhem
  Obtained from: LLVM r310591

MFC r322474 (by emaste):

  lld: Add `-z muldefs` option.

  Obtained from: LLVM r310757

MFC r322740:

  Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the
  upstream release_50 branch.

MFC r322855:

  Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
  the upstream release_50 branch.

  As of this version, lib/msun's trig test should also work correctly
  again (see bug 220989 for more information).

  PR: 220989

MFC r323112:

  Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from
  the upstream release_50 branch.  This corresponds to 5.0.0 rc4.

  As of this version, the cad/stepcode port should now compile in a more
  reasonable time on i386 (see bug 221836 for more information).

  PR: 221836

MFC r323245:

  Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
  5.0.0 release (upstream r312559).

  Release notes for llvm, clang and lld will be available here soon:
  <http://releases.llvm.org/5.0.0/docs/ReleaseNotes.html>
  <http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html>
  <http://releases.llvm.org/5.0.0/tools/lld/docs/ReleaseNotes.html>

  Relnotes: yes

6 years agoMFC r323355: MFV r323107: 8414 Implemented zpool scrub pause/resume
avg [Tue, 26 Sep 2017 09:34:18 +0000 (09:34 +0000)]
MFC r323355: MFV r323107: 8414 Implemented zpool scrub pause/resume

illumos/illumos-gate@1702cce751c5cb7ead878d0205a6c90b027e3de8
https://github.com/illumos/illumos-gate/commit/1702cce751c5cb7ead878d0205a6c90b027e3de8

FreeBSD note:  rather than merging the zpool.8 update I copied the zpool
scrub section from the illumos zpool.1m to FreeBSD zpool.8 almost
verbatim.  Now that the illumos page uses the mdoc format, it was an
easier option.  Perhaps the change is not in perfect compliance with the
FreeBSD style, but I think that it is acceptible.

https://www.illumos.org/issues/8414
  This issue tracks the port of scrub pause from ZoL: https://github.com/zfsonlinux/zfs/pull/6167
  Currently, there is no way to pause a scrub. Pausing may be useful when
  the pool is busy with other I/O to preserve bandwidth.

  Description

  This patch adds the ability to pause and resume scrubbing.  This is achieved
  by maintaining a persistent on-disk scrub state.  While the state is 'paused'
  we do not scrub any more blocks.  We do however perform regular scan
  housekeeping such as freeing async destroyed and deadlist blocks while paused.

  Motivation and Context

  Scrub pausing can be an I/O intensive operation and people have been asking
  for the ability to pause a scrub for a while. This allows one to preserve scrub
  progress while freeing up bandwidth for other I/O.

Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>

6 years agoMFC r323480: zfs_get_vfs: reference a requested filesystem instead of vfs_busy-ing it
avg [Tue, 26 Sep 2017 09:31:17 +0000 (09:31 +0000)]
MFC r323480: zfs_get_vfs: reference a requested filesystem instead of vfs_busy-ing it

Sponsored by: Panzura

6 years agoSynchronize most of libm with head as of r323004. This excludes a few
dim [Tue, 26 Sep 2017 09:01:56 +0000 (09:01 +0000)]
Synchronize most of libm with head as of r323004.  This excludes a few
arch-specific updates for powerpcspe, mips and riscv, for which support
has not been merged yet.

Bump __FreeBSD_version for the addition of cacoshl, cacosl, casinhl,
casinl, catanl, catanhl, sincos, sincosf, and sincosl.

MFC r305382 (by bde):

  Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
  versions of fmodf() amd fmodl() on i387.

  fmod is similar to remainder, and the C versions are 3 to 9 times
  slower than the asm versions on x86 for both, but we had the strange
  mixture of all 6 variants of remainder in asm and only 1 of 6
  variants of fmod in asm.

MFC r305384 (by bde):

  Disconnect the "optimized" asm variants of cos(), sin() and tan() from
  the build on i386.  Leave them in the source tree for regression tests.

  The asm functions were always much less accurate (by a factor of more
  than 10**18 in the worst case).  They were faster on old CPUs.  But
  with each new generation of CPUs they get relatively slower.  The
  double precision C version's average advantage is about a factor of 2
  on Haswell.

  The asm functions were already intentionally avoided in float and long
  double precision on i386 and in all precisions on amd64.  Float
  precision and amd64 give larger advantages to the C version.  The long
  double precision C code and compilers' understanding of long double
  precision are not so good, so the i387 is still slightly faster for
  long double precision, except for the unimportant subcase of huge args
  where the sub-optimal C code now somehow beats the i387 by about a
  factor of 2.

MFC r305385 (by bde):

  Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
  actually the amd64 version.

MFC r306409 (by emaste):

  libm: fix some unused variable (rcsid) and dangling else warnings

  s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
  WARNS setting.

  Reviewed by: ed
  Sponsored by: The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D8061

MFC r306410 (by emaste):

  libm: simplify i387 subdir logic with make's :S substitution

MFC r306527 (by emaste):

  libm: remove unused variables for LDBL_MANT_DIG != 113

  Sponsored by: The FreeBSD Foundation

MFC r306709 (by emaste):

  libm: remove unused variables

  Sponsored by: The FreeBSD Foundation

MFC r307066 (by br):

  Don't use fmaxl/fminl on platforms with no long double support,
  use fmax/fmin instead.

  This fixes fmaxmin test failure on MIPS64.

  Reviewed by: emaste
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision: https://reviews.freebsd.org/D8216

MFC r308172 (by emaste):

  libm: add braces around initialization of subobjects

  This cleans up a warning when building libm at higher WARNS levels and
  makes the intent more clear. By the C standard the values are assigned
  to subobject members in order so this change introduces no functional
  change. (6.7.9 20)

  Reviewed by: kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D8333

MFC r313761 (by mmokhi):

  Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
  to improve C11 conformance.

  PR: 216850 216851 216852 216856 216857 216858
  Submitted by: mmokhi
  Reported by: sgk@troutmask.apl.washington.edu
  Reviewed by: bde, mat, theraven
  Approved by: bde (src committer), mat (mentor)
  Differential Revision: https://reviews.freebsd.org/D9491

MFC r313863 (by mmokhi):

  Fix building of r313761 on platforms that
  `long double` is alias of `double` (MIPS, etc)

  PR: 216850 216851 216852 216856 216857 216858
  Reported by: emsate
  Reviewed by: bde emaste hselasky
  Approved by: bde emaste hselasky
  Differential Revision: https://reviews.freebsd.org/D9491

MFC r313864 (by mmokhi):

  Add documentations related to new APIs of r313761

  PR: 216850 216851 216852 216856 216857 216858
  Submitted by: sgk@troutmask.apl.washington.edu
  Reported by: sgk@troutmask.apl.washington.edu
  Reviewed by: bde emaste hselasky
  Approved by: bde emaste hselasky
  Differential Revision: https://reviews.freebsd.org/D9491

MFC r314950 (by ngie):

  Don't expect :test_large_inputs to fail with i386 anymore

  Recent changes (maybe a side-effect of the ATF-ification in r314649)
  invalidate the failure expectation.

  PR: 205446
  Sponsored by: Dell EMC Isilon

MFC r317349 (by pfg):

  msun: Remove trailing space in Sunsoft copyright statement.

  Submittedby: kargl

MFC r319047 (by mmel):

  Implement sincos, sincosf, and sincosl.
  The primary benefit of these functions is that argument
  reduction is done once instead of twice in independent
  calls to sin() and cos().

  * lib/msun/Makefile:
    . Add s_sincos[fl].c to the build.
    . Add sincos.3 documentation.
    . Add appropriate MLINKS.

  * lib/msun/Symbol.map:
    . Expose sincos[fl] symbols in dynamic libm.so.

  * lib/msun/man/sincos.3:
    . Documentation for sincos[fl].

  * lib/msun/src/k_sincos.h:
    . Kernel for sincos() function.  This merges the individual kernels
      for sin() and cos().  The merger offered an opportunity to re-arrange
      the individual kernels for better performance.

  * lib/msun/src/k_sincosf.h:
     . Kernel for sincosf() function.  This merges the individual kernels
       for sinf() and cosf(). The merger offered an opportunity to re-arrange
       the individual kernels for better performance.

  * lib/msun/src/k_sincosl.h:
     . Kernel for sincosl() function.  This merges the individual kernels
       for sinl() and cosl(). The merger offered an opportunity to re-arrange
       the individual kernels for better performance.

  * lib/msun/src/math.h:
    . Add prototytpes for sincos[fl]().

  * lib/msun/src/math_private.h:
    . Add RETURNV macros.  This is needed to reset fpsetprec on I386
      hardware for a function with type void.

  * lib/msun/src/s_sincos.c:
    . Implementation of sincos() where sin() and cos() were merged into
      one routine and possibly re-arranged for better performance.

  * lib/msun/src/s_sincosf.c:
    . Implementation of sincosf() where sinf() and cosf() were merged into
      one routine and possibly re-arranged for better performance.

  * lib/msun/src/s_sincosl.c:
    . Implementation of sincosl() where sinl() and cosl() were merged into
      one routine and possibly re-arranged for better performance.

  PR: 215977, 218300
  Submitted by: Steven G. Kargl <sgk@troutmask.apl.washington.edu>
  Differential Revision: https://reviews.freebsd.org/D10765

MFC r321457 (by ngie):

  Mark :reduction as an expected failure

  It fails with clang 5.0+.

  PR: 220989
  Reported by: Jenkins

MFC r322418 (by rlibby):

  lib/msun: avoid referring to broken LDBL_MAX

  LDBL_MAX is broken on i386:
  https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

  Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
  for some time, and newer versions of gcc are now warning that the
  "floating constant exceeds range of 'long double'".  Avoid this by
  referring to half the value of LDBL_MAX instead.

  Reviewed by: bde
  Approved by: markj (mentor)
  Sponsored by: Dell EMC Isilon

MFC r322435 (by rlibby):

  Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

  Either need a different way to spell HALF_LDBL_MAX, or a different way
  to spell LDBL_MAX_EXP, or a different approach.

  Reported by: ian

MFC r322921 (by ngie):

  Revert r321457

  It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

  PR: 220989

6 years agoMFC r323479,r323491: zfs: tighten debug versions of ZTOV and VTOZ
avg [Tue, 26 Sep 2017 08:43:43 +0000 (08:43 +0000)]
MFC r323479,r323491: zfs: tighten debug versions of ZTOV and VTOZ

Sponsored by: Panzura

6 years agoMFC r323252:
dab [Mon, 25 Sep 2017 20:04:14 +0000 (20:04 +0000)]
MFC r323252:

Add a new getty/gettytab capability to generate an initial message dynamically.

This modification adds a new gettytab(5) option (iM) to specify a
program to run that will generate the initial (banner) message that is
displayed before the login prompt. Such a capability is useful when
dynamic information is needed in the banner message that cannot be
supplied by the set of % substitution sequences available in the "im"
option.

Sponsored by: Dell EMC

6 years agoMFC r317801 (by trasz):
dab [Mon, 25 Sep 2017 19:06:01 +0000 (19:06 +0000)]
MFC r317801 (by trasz):

Fix markup in gettytab(5).

Approved by: vangyzen (mentor)
Sponsored by: Dell EMC

6 years agoMFC: r323840
jkim [Mon, 25 Sep 2017 18:26:31 +0000 (18:26 +0000)]
MFC: r323840

Remove an ancient comment about the existence of READ(16)/WRITE(16) for MMC.

6 years agoMFC r313107 (by danfe):
dab [Mon, 25 Sep 2017 17:39:53 +0000 (17:39 +0000)]
MFC r313107 (by danfe):
Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)

There is one capability explicitly documented in gettytab(5) as stupid: he.
And it is indeed.  It was meant to facilitate system hostname modification,
but is hardly usable in practice because it allows very limited editing
(e.g., it depends on a particular hostname length, making it non-generic).

Replace it with simple implementation that treats ``he'' as POSIX extended
regular expression which is matched against the hostname.  If there are no
parenthesized subexpressions in the pattern, entire matched string is used
as the final hostname.  Otherwise, use the first matched subexpression.
If the pattern does not match, the original hostname is not modified.

Using regex(3) gives more freedom, does not complicate the code very much,
and makes a lot more sense, in turn making ``he'' less stupid and actually
useful (e.g., it is now possible to obtain node or domain names from the
original hostname string, without knowing it in advance).

Approved by: vangyzen (mentor)
Sponsored by: Dell EMC

6 years agoMFC r323676:
markj [Sun, 24 Sep 2017 12:53:33 +0000 (12:53 +0000)]
MFC r323676:
Implement mmu_page_init for AIM platforms.

6 years agoMFC r323655:
oshogbo [Sat, 23 Sep 2017 12:32:11 +0000 (12:32 +0000)]
MFC r323655:

Add missing links to the nv man page.

6 years agoMFC r323654:
oshogbo [Sat, 23 Sep 2017 12:28:56 +0000 (12:28 +0000)]
MFC r323654:

Fix names of the array functions in the nv man page.

Submitted by: def@

6 years agoMFC r323474, r323553, r323691
ian [Fri, 22 Sep 2017 15:53:22 +0000 (15:53 +0000)]
MFC r323474, r323553, r323691

r323474:
Add a default implementation that returns ENODEV for start, repeat_start,
stop, read, and write methods.  Some controllers don't implement these
individual operations and have only a transfer method.  In that case, we
should return an indication that the device is present but doesn't support
the method, as opposed to the kobj default error ENXIO which makes it
look like the whole device is missing.  Userland tools such as i2c(8) can
use the differing return values to switch between the two different i2c
IO mechanisms.

r323553:
Defer attaching and probing iicbus and its children until interrupts are
available, in i2c controller drivers that require interrupts for transfers.

This is the result of auditing all 22 existing drivers that attach iicbus.
These drivers were the only ones remaining that require interrupts and were
not using config_intrhook to defer attachment.  That has led, over the
years, to various i2c slave device drivers needing to use config_intrhook
themselves rather than performing bus transactions in their probe() and
attach() methods, just in case they were attached too early.

r323691:
Give icee(4) a detach() method so it can be used as a module.  Add a
module makefile for it.

6 years agoMFC r323465:
ian [Fri, 22 Sep 2017 15:47:35 +0000 (15:47 +0000)]
MFC r323465:

Make i2c -s (device scan) work on hardware that supports only full xfers.

The existing scan code is based on sending an i2c START condition and if
there is no error it assumes there is a device at that i2c address.  Some
i2c controllers don't support sending individual start/stop signals on the
bus, they can only perform complete data transfers with start/stop handled
in the silicon.

This adds a fallback mechanism that attempts to read a single byte from each
i2c address.  It's less reliable than looking for an an ACK repsonse to a
start, because some devices will NAK an attempt to read that isn't preceeded
by a write of a register address.  Writing to devices to probe them is too
dangerous to even consider.  The user is told that a less-reliable scan is
being done, so even if the read-scan comes up empty too, it's still a vast
improvement over the old situation where it would just claim there were no
devices on the bus even though the devices were there and working fine.

If the i2c controller responds with a proper ENODEV (device doesn't support
operation) or an almost-proper EOPNOTSUPP, the START/STOP scan is switched
to a read-scan right away.  Most controllers respond with ENXIO or EIO if
they don't support START/STOP, so no quick-out is available.  For those,
if a scan of all 127 addresses and come up empty, the scan is re-done using
the read method.

Reported by: Maxim Filimonov <che@bein.link>

6 years agoMFC r323642:
ian [Fri, 22 Sep 2017 15:40:56 +0000 (15:40 +0000)]
MFC r323642:

Add a missing header file to SRCS to fix out-of-kernel builds.

PR: 222354
Submitted by: eugen@
Pointy hat: ian@

6 years agoMFC r323924:
gjb [Fri, 22 Sep 2017 14:40:04 +0000 (14:40 +0000)]
MFC r323924:
 Revert r323812 from release/tools/arm.subr, which has broken the
 build on arm/armv6 images.

Pointyhat: gjb (myself)
MFC note: releng/10.4 has broken because of this
Sponsored by: The FreeBSD Foundation

6 years agoMFC r323326:
kib [Fri, 22 Sep 2017 10:51:32 +0000 (10:51 +0000)]
MFC r323326:
Use IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
remapping.

6 years agoMFC r323325, r323450:
kib [Fri, 22 Sep 2017 10:49:04 +0000 (10:49 +0000)]
MFC r323325, r323450:
If IOAPIC has PCI binding, match the PCI device against MADT
enumerated IOAPIC.

6 years agoMFC r323616:
kib [Fri, 22 Sep 2017 10:45:51 +0000 (10:45 +0000)]
MFC r323616:
Batch freeing of the pages in vm_object_page_remove().

6 years agoMFC r323611: fastmatch.h: remove duplicate #defines
emaste [Fri, 22 Sep 2017 06:16:21 +0000 (06:16 +0000)]
MFC r323611: fastmatch.h: remove duplicate #defines

6 years agoMFC 323630: Avoid reusing the wrong buffer for a DDP AIO request.
jhb [Thu, 21 Sep 2017 23:10:59 +0000 (23:10 +0000)]
MFC 323630: Avoid reusing the wrong buffer for a DDP AIO request.

To optimize the case of ping-ponging between two buffers, the DDP code
caches the last two buffers used keeping the pages wired and page pods
stored in the NIC's RAM.  If a new aio_read() request uses one of the
same buffers, then the work of holding pages, etc. can be avoided.
However, the starting virtual address of an aio buffer was not saved,
only the page count, length, and initial page offset.  Thus, an
aio_read() request could match a different buffer in the address
space.  (Earlier during development vm_fault_hold_quick_pages() was
always called and the vm_page_t values were compared, but that was
eventually removed without being adequately replaced.)  Fix by storing
the starting virtual address and comparing that (along with other
fields) to determine if a buffer can be reused.

Sponsored by: Chelsio Communications

6 years agoMFC 323025: Read max_stack_flags from correct object.
jhb [Thu, 21 Sep 2017 20:59:36 +0000 (20:59 +0000)]
MFC 323025: Read max_stack_flags from correct object.

'obj' is not initialized here.

Sponsored by: DARPA / AFRL

6 years agoMFC r323439:
markj [Thu, 21 Sep 2017 12:37:12 +0000 (12:37 +0000)]
MFC r323439:
Provide an error message if KTR symbols in a vmcore cannot be resolved.

6 years agoMFC r323587: octeon sdk: initialize variable to quiet Clang warning
emaste [Thu, 21 Sep 2017 12:31:51 +0000 (12:31 +0000)]
MFC r323587: octeon sdk: initialize variable to quiet Clang warning

Clang complains "variable 'dummy' is uninitialized when used here".

Sponsored by: The FreeBSD Foundation

6 years agoMFC r323597:
kib [Thu, 21 Sep 2017 10:16:25 +0000 (10:16 +0000)]
MFC r323597:
Handle freeaddrinfo(NULL).