]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoImport bmake-20170720
Simon J. Gerraty [Mon, 24 Jul 2017 04:38:05 +0000 (04:38 +0000)]
Import bmake-20170720

Includes fix for compat handling of interrupts.

6 years agohyperv/hn: Ignore LINK_SPEED_CHANGE status.
Sepherosa Ziehau [Mon, 24 Jul 2017 04:00:43 +0000 (04:00 +0000)]
hyperv/hn: Ignore LINK_SPEED_CHANGE status.

This status will be reported if the backend NIC is wireless; it's not
useful.  Due to the high frequency of the reporting, this could be
pretty annoying; ignore it.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11651

6 years agorndis: Add LINK_SPEED_CHANGE status
Sepherosa Ziehau [Mon, 24 Jul 2017 03:59:50 +0000 (03:59 +0000)]
rndis: Add LINK_SPEED_CHANGE status

Reviewed by: hselasky
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11650

6 years agohyperv/hn: Export VF list and VF-HN mapping
Sepherosa Ziehau [Mon, 24 Jul 2017 03:52:32 +0000 (03:52 +0000)]
hyperv/hn: Export VF list and VF-HN mapping

The VF-HN map will be used later on to implement "transparent VF".

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11618

6 years agoethernet: Add ethernet interface attached event and devctl notification.
Sepherosa Ziehau [Mon, 24 Jul 2017 03:32:10 +0000 (03:32 +0000)]
ethernet: Add ethernet interface attached event and devctl notification.

ifnet_arrival_event may not be adequate under certain situation; e.g.
when the LLADDR is needed.  So the ethernet ifattach event is announced
after all necessary bits are setup.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11617

6 years agoImport bmake-20170720
Simon J. Gerraty [Mon, 24 Jul 2017 00:52:52 +0000 (00:52 +0000)]
Import bmake-20170720

compat.c: pass SIGINT etc onto child and wait for it to exit
before we self-terminate.

6 years agonet80211: do not allow to unload rate control module if it is still in use.
Andriy Voskoboinyk [Sun, 23 Jul 2017 22:38:00 +0000 (22:38 +0000)]
net80211: do not allow to unload rate control module if it is still in use.

Keep 'nrefs' counter up-to-date, so 'kldunload wlan_amrr' with 1+ active
wlan(4) interface will not lead to kernel panic.

MFC after: 5 days

6 years agoAdd common code to support realtime clocks that store year without century.
Ian Lepore [Sun, 23 Jul 2017 21:28:00 +0000 (21:28 +0000)]
Add common code to support realtime clocks that store year without century.

Most realtime clocks store the year as 2 BCD digits.  Some add a century bit
to extend the range another hundred years.  Every clock driver has its own
code to determine the century and pass a full year value to clock_ct_to_ts().
Now clock drivers can just convert BCD to bin and store the result in the
clocktime struct and let the common code figure out the century.  Clocks
with a century bit can just add 100 to year if the century bit is on.

6 years agoChange my email address to wulf@FreeBSD.org in copyright headers.
Vladimir Kondratyev [Sun, 23 Jul 2017 20:41:58 +0000 (20:41 +0000)]
Change my email address to wulf@FreeBSD.org in copyright headers.

Approved by: gonzo (mentor)
MFC after: 2 weeks

6 years agoevdev: Macroize common locking sequences
Vladimir Kondratyev [Sun, 23 Jul 2017 20:35:26 +0000 (20:35 +0000)]
evdev: Macroize common locking sequences

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks

6 years agoevdev: style(9), sort headers alphabetically
Vladimir Kondratyev [Sun, 23 Jul 2017 20:32:54 +0000 (20:32 +0000)]
evdev: style(9), sort headers alphabetically

Pointed out by: bde
Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks

6 years agoindent(1): better alignment of comments on code.
Piotr Pawel Stefaniak [Sun, 23 Jul 2017 20:25:53 +0000 (20:25 +0000)]
indent(1): better alignment of comments on code.

If aligning the beginning of a comment to -cn would mean no space between
code and the comment, align it to the next tab stop.

6 years agoAddress a compilation warning on some architectures that was introduced
Alan Cox [Sun, 23 Jul 2017 19:35:14 +0000 (19:35 +0000)]
Address a compilation warning on some architectures that was introduced
by the previous change, r321386.

Reported by: ian
MFC after: 10 days
X-MFC after: r321386

6 years agoAdd myself (mw) as a src committer and cognet as my mentor.
Marcin Wojtas [Sun, 23 Jul 2017 19:00:28 +0000 (19:00 +0000)]
Add myself (mw) as a src committer and cognet as my mentor.

Reviewed by: cognet (mentor)
Approved by: cognet (mentor)

6 years agocxgbe(4): Install the firmware bundled with the driver to the card if it
Navdeep Parhar [Sun, 23 Jul 2017 18:10:47 +0000 (18:10 +0000)]
cxgbe(4): Install the firmware bundled with the driver to the card if it
doesn't seem to have one.  This lets the driver recover automatically
from incomplete firmware upgrades (panic, reboot, power loss, etc. in
the middle of an upgrade).

MFC after: 2 weeks
Sponsored by: Chelsio Communications

6 years agoDon't use incorrect hardcoded path to ksh -- use /usr/bin/env
Enji Cooper [Sun, 23 Jul 2017 17:57:00 +0000 (17:57 +0000)]
Don't use incorrect hardcoded path to ksh -- use /usr/bin/env
to find ksh instead

MFC after: 1 month

6 years agoUtilize pmap_enter(..., psind=1) in vm_fault_soft_fast() on amd64. (The
Alan Cox [Sun, 23 Jul 2017 16:28:13 +0000 (16:28 +0000)]
Utilize pmap_enter(..., psind=1) in vm_fault_soft_fast() on amd64.  (The
Differential Revision discusses the benefits of this change.)

Add a function, vm_reserv_to_superpage(), that returns the superpage
containing the specified base page.

Reviewed by: kib, markj
Tested by: pho
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D11556

6 years agoo Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to
Marius Strobl [Sun, 23 Jul 2017 16:11:47 +0000 (16:11 +0000)]
o Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to
  sdhci(4), mmc(4) and mmcsd(4). For the most part, this consists of:
  - Correcting and extending the infrastructure for negotiating and
    enabling post-DDR52 modes already added as part of r315598. In
    fact, HS400ES now should work as well but hasn't been activated
    due to lack of corresponding hardware.
  - Adding support executing standard SDHCI initial tuning as well
    as re-tuning as required for eMMC HS200/HS400 and the fast UHS-I
    SD card modes. Currently, corresponding methods are only hooked
    up to the ACPI and PCI front-ends of sdhci(4), though. Moreover,
    sdhci(4) won't offer any modes requiring (re-)tuning to the MMC/SD
    layer in order to not break operations with other sdhci(4) front-
    ends. Likewise, sdhci(4) now no longer offers modes requiring the
    set_uhs_timing method introduced in r315598 to be implemented/
    hooked up (previously, this method was used with DDR52 only, which
    in turn is only available with Intel controllers so far, i. e. no
    such limitation was necessary before). Similarly for 1.2/1.8 V VCCQ
    support and the switch_vccq method.
  - Addition of locking to the IOCTL half of mmcsd(4) to prevent races
    with detachment and suspension, especially since it's required to
    immediately switch away from RPMB partitions again after an access
    to these (so re-tuning can take place anew, given that the current
    eMMC specification v5.1 doesn't allow tuning commands to be issued
    with a RPMB partition selected). Therefore, the existing part_mtx
    lock in the mmcsd(4) softc is additionally renamed to disk_mtx in
    order to denote that it only refers to the disk(9) half, likewise
    for corresponding macros.

  On the system where the addition of DDR52 support increased the read
  throughput to ~80 MB/s (from ~45 MB/s at high speed), HS200 yields
  ~154 MB/s and HS400 ~187 MB/s, i. e. performance now has more than
  quadrupled compared to pre-r315598.

  Also, with the advent of (re-)tuning support, most infrastructure
  necessary for SD card UHS-I modes up to SDR104 now is also in place.
  Note, though, that the standard SDHCI way of (re-)tuning is special
  in several ways, which also is why sending the actual tuning requests
  to the device is part of sdhci(4). SDHCI implementations not following
  the specification, MMC and non-SDHCI SD card controllers likely will
  use a generic implementation in the MMC/SD layer for executing tuning,
  which hasn't been written so far, though.

  However, in fact this isn't a feature-only change; there are boards
  based on Intel Bay Trail where DDR52 is problematic and the suggested
  workaround is to use HS200 mode instead. So far exact details are
  unknown, however, i. e. whether that's due to a defect in these SoCs
  or on the boards.

  Moreover, due to the above changes requiring to be aware of possible
  MMC siblings in the fast path of mmc(4), corresponding information
  now is cached in mmc_softc. As a side-effect, mmc_calculate_clock(),
  mmc_delete_cards(), mmc_discover_cards() and mmc_rescan_cards() now
  all are guaranteed to operate on the same set of devices as there no
  longer is any use of device_get_children(9), which can fail in low
  memory situations. Likewise, mmc_calculate_clock() now longer will
  trigger a panic due to the latter.

o Fix a bug in the failure reporting of mmcsd_delete(); in case of an
  error when the starting block of a previously stored erase request
  is used (in order to be able to erase a full erase sector worth of
  data), the starting block of the newly supplied bio_pblkno has to be
  returned for indicating no progress. Otherwise, upper layers might
  be told that a negative number of BIOs have been completed, leading
  to a panic.

o Fix 2 bugs on resume:
  - Things done in fork1(9) like the acquisition of an SX lock or the
    sleepable memory allocation are incompatible with a MTX_DEF taken.
    Thus, mmcsd_resume() must not call kproc_create(9), which in turn
    uses fork1(9), with the disk_mtx (formerly part_mtx) held.
  - In mmc_suspend(), the bus is powered down, which in the typical
    case of a device being selected at the time of suspension, causes
    the device deselection as part of the bus acquisition by mmc(4) in
    mmc_scan() to fail as the bus isn't powered up again before later
    in mmc_go_discovery(). Thus, power down with the bus acquired in
    mmc_suspend(), which will trigger the deselection up-front.

o Fix a memory leak in mmcsd_ioctl() in case copyin(9) fails. [1]

o Fix missing variable initialization in mmc_switch_status(). [2]

o Fix R1_SWITCH_ERROR detection in mmc_switch_status(). [3]

o Handle the case of device_add_child(9) failing, for example due to
  a memory shortage, gracefully in mmc(4) and sdhci(4), including not
  leaking memory for the instance variables in case of mmc(4) (which
  might or might not fix [4] as the latter problem has been discovered
  independently).

o Handle the case of an unknown SD CSD version in mmc_decode_csd_sd()
  gracefully instead of calling panic(9).

o Again, check and handle the return values of some additional function
  calls in mmc(4) instead of assuming that everything went right or mark
  non-fatal errors by casting the return value to void.

o Correct a typo in the Linux IOCTL compatibility; it should have been
  MMC_IOC_MULTI_CMD rather than MMC_IOC_CMD_MULTI.

o Now that we are reaching ever faster speeds (more improvement in this
  regard is to be expected when adding ADMA support to sdhci(4)), apply
  a few micro-optimizations like predicting mmc(4) and sdhci(4) debugging
  to be off or caching erase sector and maximum data sizes as well support
  of block addressing in mmsd(4) (instead of doing 2 indirections on every
  read/write request for determining the maximum data size for example).

Reported by: Coverity
CID: 1372612 [1], 1372624 [2], 1372594 [3], 1007069 [4]

6 years agoindent(1): rename the profile file.
Piotr Pawel Stefaniak [Sun, 23 Jul 2017 15:07:52 +0000 (15:07 +0000)]
indent(1): rename the profile file.

Currently, indent's testing mechanism will attempt to apply options from
a file named ${test}.pro - and this test's filename is comments.0.

6 years agoindent(1): don't produce unnecessary blank lines.
Piotr Pawel Stefaniak [Sun, 23 Jul 2017 14:33:04 +0000 (14:33 +0000)]
indent(1): don't produce unnecessary blank lines.

Don't force a blank line between an opening brace and a block comment -- not
even if -bbb (blank lines before block comments) is on.

6 years agoindent(1): don't produce unneeded space character in function declarators.
Piotr Pawel Stefaniak [Sun, 23 Jul 2017 14:04:45 +0000 (14:04 +0000)]
indent(1): don't produce unneeded space character in function declarators.

6 years ago[ar933x] make carambola2 work again!
Adrian Chadd [Sun, 23 Jul 2017 07:10:41 +0000 (07:10 +0000)]
[ar933x] make carambola2 work again!

* Add in the hints needed for AR933x ath(4) support - this is the nicer way
  that allows ath to be a module;
* ATH_EEPROM_FIRMWARE is also required for all AR933x chipsets.

Tested:

* Carambola2, AR933x

6 years ago[ar933x] re-add the ar71xx_apb device for AR933x.
Adrian Chadd [Sun, 23 Jul 2017 07:02:10 +0000 (07:02 +0000)]
[ar933x] re-add the ar71xx_apb device for AR933x.

This prevents the console from working!

Tested:

* carambola2, AR933x

6 years agoAdd support for pmap_enter(..., psind=1) to the amd64 pmap. In other words,
Alan Cox [Sun, 23 Jul 2017 06:33:58 +0000 (06:33 +0000)]
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).

Submitted by: Yufeng Zhou <yz70@rice.edu> (an earlier version)
Reviewed by: kib, markj
Tested by: pho
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D11556

6 years agoIn vm_page_ps_test(), always check that the base pages within the specified
Alan Cox [Sun, 23 Jul 2017 05:54:56 +0000 (05:54 +0000)]
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.  (See the Differential Revision.)

Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11556

6 years agolinuxkpi compiler.h: avoid gcc -Wunused-value in dummy expressions
Ryan Libby [Sat, 22 Jul 2017 21:29:44 +0000 (21:29 +0000)]
linuxkpi compiler.h: avoid gcc -Wunused-value in dummy expressions

It looks like the __acquire and __release macros are for the consumption
of static analysis tools and have no semantic effect.  Transform the
definitions from constant expressions to empty statements in order to
avoid -Wunused-value from gcc.

Likewise avoid future warnings for __chk_{user,io}_ptr, but with a cast
to void, because it looks like some linux kernel code may use those in
expression contexts.

Reviewed by: hselasky, markj
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11695

6 years agoDo not allocate struct kinfo_vmobject on stack.
Konstantin Belousov [Sat, 22 Jul 2017 13:33:06 +0000 (13:33 +0000)]
Do not allocate struct kinfo_vmobject on stack.

Its size is 1184 bytes.

Noted by: eugen
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoHandle WITH/WITHOUT_PF in libsysdecode
Kristof Provost [Sat, 22 Jul 2017 12:51:19 +0000 (12:51 +0000)]
Handle WITH/WITHOUT_PF in libsysdecode

Only filter out the PF ioctls if we're building without pf support.
Until now those were always filtered out, so truss did not show symbolic
names for pf ioctls.

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

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
Dimitry Andric [Sat, 22 Jul 2017 11:08:25 +0000 (11:08 +0000)]
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 after: 2 months

6 years agoUse the "tree" word in ps(1) -d option description, to make it easier
Edward Tomasz Napierala [Sat, 22 Jul 2017 10:38:44 +0000 (10:38 +0000)]
Use the "tree" word in ps(1) -d option description, to make it easier
to find.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoStyle(9) whitespace fix.
Dmitry Chagin [Sat, 22 Jul 2017 09:03:40 +0000 (09:03 +0000)]
Style(9) whitespace fix.

MFC after: 1 week

6 years agoFix top(1) output when zfs.ko is loaded but ZFS is not in use.
Mark Johnston [Fri, 21 Jul 2017 23:53:48 +0000 (23:53 +0000)]
Fix top(1) output when zfs.ko is loaded but ZFS is not in use.

Reviewed by: allanjude
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D11693

6 years agoMerge ^/head r321307 through r321350.
Dimitry Andric [Fri, 21 Jul 2017 18:54:34 +0000 (18:54 +0000)]
Merge ^/head r321307 through r321350.

6 years agoSet tentative merge dates, bump __FreeBSD_version.
Dimitry Andric [Fri, 21 Jul 2017 18:53:43 +0000 (18:53 +0000)]
Set tentative merge dates, bump __FreeBSD_version.

6 years agoImprove publication of the newly allocated snapdata.
Konstantin Belousov [Fri, 21 Jul 2017 18:42:35 +0000 (18:42 +0000)]
Improve publication of the newly allocated snapdata.

For freshly allocated snapdata, Lock sn_lock in advance, so
si_snapdata readers see the locked snapdata and not race.

For existing snapdata, if the thread was put to sleep waiting for
sn_lock, re-read si_snapdata.  This either closes the race or makes
the reliance on LK_DRAIN less important.

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

6 years agoUnlock correct lock in ffs_snapblkfree().
Konstantin Belousov [Fri, 21 Jul 2017 18:36:17 +0000 (18:36 +0000)]
Unlock correct lock in ffs_snapblkfree().

It is possible for ffs_snapblkfree() to race and lock snaplock while
the devvp snapdata is instantiated, but no snapshots exist.  In this
case the loop over snapshots in ffs_snapblkfree() is not executed, and
the local variable vp is left initialized to NULL.

Unlock using &sn->sn_lock and not vp->v_vnlock.  For the inodes on the
snapshot list, the locks are same.

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

6 years agoAccount for lock recursion when transfering snaplock to the vnode lock
Konstantin Belousov [Fri, 21 Jul 2017 18:28:27 +0000 (18:28 +0000)]
Account for lock recursion when transfering snaplock to the vnode lock
in ffs_snapremove().

Apparently ffs_snapremove() may be called with the snap lock recursed,
at least one trace demonstrated this when snapshot vnode was unlinked
while synced.  It was inactivated from the syncer thread.

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

6 years agoPull in r295886 from upstream clang trunk (by Richard Smith):
Dimitry Andric [Fri, 21 Jul 2017 17:59:54 +0000 (17:59 +0000)]
Pull in r295886 from upstream clang trunk (by Richard Smith):

  PR32034: Evaluate _Atomic(T) in-place when T is a class or array type.

  This is necessary in order for the evaluation of an _Atomic
  initializer for those types to have an associated object, which an
  initializer for class or array type needs.

This fixes an assertion when building recent versions of LinuxCNC.

Reported by: trasz
PR: 220883
MFC after: 1 week

6 years agoDo not update stats counter in SWI context. Defer to the already existing
Sean Bruno [Fri, 21 Jul 2017 17:42:54 +0000 (17:42 +0000)]
Do not update stats counter in SWI context.  Defer to the already existing
admin thread.

Submitted by: Matt Macy <mmacy@mattmacy.io>
Sponsored by: Limelight Networks

6 years ago__pcpu: gcc -Wredundant-decls
Ryan Libby [Fri, 21 Jul 2017 17:11:36 +0000 (17:11 +0000)]
__pcpu: gcc -Wredundant-decls

Pollution from counter.h made __pcpu visible in amd64/pmap.c.  Delete
the existing extern decl of __pcpu in amd64/pmap.c and avoid referring
to that symbol, instead accessing the pcpu region via PCPU_SET macros.
Also delete an unused extern decl of __pcpu from mp_x86.c.

Reviewed by: kib
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11666

6 years agoRespect INSTALL_AS_USER for FILES.
Bryan Drewery [Fri, 21 Jul 2017 16:14:35 +0000 (16:14 +0000)]
Respect INSTALL_AS_USER for FILES.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoProperly set userid for truncate_test.
Bryan Drewery [Fri, 21 Jul 2017 16:14:06 +0000 (16:14 +0000)]
Properly set userid for truncate_test.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoImplement SIGEV_THREAD notifications for lio_listio(2)
Alan Somers [Fri, 21 Jul 2017 15:09:24 +0000 (15:09 +0000)]
Implement SIGEV_THREAD notifications for lio_listio(2)

Our man pages have always indicated that this was supported, but in fact the
feature was never implemented for lio_listio(2).

Reviewed by: jhb, kib (earlier version)
MFC after: 20 days
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11680

6 years agoAdd warning flags for GCC 7.1.0 compiler.
Ruslan Bukin [Fri, 21 Jul 2017 14:50:32 +0000 (14:50 +0000)]
Add warning flags for GCC 7.1.0 compiler.

Sponsored by: DARPA, AFRL

6 years agoFix style: change spaces to tabs.
Ruslan Bukin [Fri, 21 Jul 2017 14:14:47 +0000 (14:14 +0000)]
Fix style: change spaces to tabs.

Sponsored by: DARPA, AFRL

6 years agoMake truss(1) cross-reference dtrace(1) and bump .Dd.
Edward Tomasz Napierala [Fri, 21 Jul 2017 13:58:51 +0000 (13:58 +0000)]
Make truss(1) cross-reference dtrace(1) and bump .Dd.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoUse more usual formatting for the EXAMPLES section of truss(1).
Edward Tomasz Napierala [Fri, 21 Jul 2017 13:50:59 +0000 (13:50 +0000)]
Use more usual formatting for the EXAMPLES section of truss(1).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoUse more usual formatting for the EXAMPLES section of ktrace(1).
Edward Tomasz Napierala [Fri, 21 Jul 2017 13:27:25 +0000 (13:27 +0000)]
Use more usual formatting for the EXAMPLES section of ktrace(1).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoRemove stack guard option from hardening menu.
Bartek Rutkowski [Fri, 21 Jul 2017 08:50:22 +0000 (08:50 +0000)]
Remove stack guard option from hardening menu.

Since kib's change the stack guard is now ON by default,
this option in hardening menu of bsdinstall is no longer needed.

Submitted by: Bartlomiej Rutkowski <robak@FreeBSD.org>
Reviewed by: bapt
Approved by: bapt
MFC after: 1 day
Sponsored by: Pixeware LTD
Differential Revision: https://reviews.freebsd.org/D11686

6 years agoFix getsockopt() for listening sockets when using SO_SNDBUF, SO_RCVBUF,
Michael Tuexen [Fri, 21 Jul 2017 07:44:43 +0000 (07:44 +0000)]
Fix getsockopt() for listening sockets when using SO_SNDBUF, SO_RCVBUF,
SO_SNDLOWAT, SO_RCVLOWAT. Since r31972 it only worked for non-listening
sockets.

Sponsored by: Netflix, Inc.

6 years agoRestore the changes done in r313982: Replace zero with NULL for pointers.
Luiz Otavio O Souza [Fri, 21 Jul 2017 03:59:56 +0000 (03:59 +0000)]
Restore the changes done in r313982: Replace zero with NULL for pointers.

Spotted by: Harry Schmalzbauer
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

6 years agoCompile the atomic64 emulation for powerpcspe
Justin Hibbits [Fri, 21 Jul 2017 03:48:09 +0000 (03:48 +0000)]
Compile the atomic64 emulation for powerpcspe

With this, ZFS builds for and runs (not quite stablely) on powerpcspe.

6 years agoUpdate netmap_user.h with the current version of netmap. This file should
Luiz Otavio O Souza [Fri, 21 Jul 2017 03:42:09 +0000 (03:42 +0000)]
Update netmap_user.h with the current version of netmap.  This file should
have been committed together with r319881.

MFC after: 1 week
MFC with: r319881
Pointy hat to: loos

6 years agoAdd cpufreq support for P1022 and MPC8536
Justin Hibbits [Fri, 21 Jul 2017 03:40:05 +0000 (03:40 +0000)]
Add cpufreq support for P1022 and MPC8536

P1022 and MPC8536  include a 'jog' feature for clock control
(jog being a slower form of run mode).  This is done by changing the
PLL multiplier, and cannot be done if any core is in doze or sleep mode.

6 years agoDo not allow the use of the loopback interface in netmap.
Luiz Otavio O Souza [Fri, 21 Jul 2017 03:28:35 +0000 (03:28 +0000)]
Do not allow the use of the loopback interface in netmap.

The generic support in netmap send the packets using if_transmit() and the
loopback do not support packets coming from if_transmit()/if_start().

This avoids the use of the loopback interface and the subsequent crash that
happens when the application send packets to the loopback interface.

Details in: https://github.com/luigirizzo/netmap/issues/322
Reported by: Vincenzo Maffione <v.maffione@gmail.com>
Sponsored by: Rubicon Communications, LLC (Netgate)

6 years agoFix a couple of typos in a comment.
Luiz Otavio O Souza [Fri, 21 Jul 2017 03:04:55 +0000 (03:04 +0000)]
Fix a couple of typos in a comment.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

6 years agoAdd regression test for recent regex(3) breakage
Kyle Evans [Fri, 21 Jul 2017 01:35:55 +0000 (01:35 +0000)]
Add regression test for recent regex(3) breakage

BREs recently became prematurely sensitive to the branching operator, which
outright broke expressions that used it instead of failing silently. Test
that \| is matching a literal | for the time being.

Reviewed by: cem, emaste, ngie
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D11577

6 years agor320062 introduced a bug when doing NFSv4.1 mounts against some non-FreeBSD servers.
Rick Macklem [Fri, 21 Jul 2017 00:14:43 +0000 (00:14 +0000)]
r320062 introduced a bug when doing NFSv4.1 mounts against some non-FreeBSD servers.

r320062 used nm_rsize, nm_wsize to set the maximum request/response sizes for
the NFSv4.1 session. If rsize,wsize are not specified as options, the
value of nm_rsize, nm_wsize is 0 at session creation, resulting in
values for request/response that are too small.
This patch fixes the problem. A workaround is to specify rsize=N,wsize=N
mount options explicitly, so they are set before session creation.
This bug only affects NFSv4.1 mounts against some non-FreeBSD servers.

MFC after: 1 week

6 years agoRevert r321308. I'll commit a better fix soon.
Rick Macklem [Thu, 20 Jul 2017 23:59:47 +0000 (23:59 +0000)]
Revert r321308. I'll commit a better fix soon.

6 years agor320062 introduced a bug when doing NFSv4.1 mounts against some non-FreeBSD servers.
Rick Macklem [Thu, 20 Jul 2017 23:15:50 +0000 (23:15 +0000)]
r320062 introduced a bug when doing NFSv4.1 mounts against some non-FreeBSD servers.

r320062 used nm_rsize, nm_wsize to set the maximum request/response sizes for
the NFSv4.1 session. If rsize,wsize are not specified as options, the
value of nm_rsize, nm_wsize is 0 at session creation, resulting in
values for request/response that are too small.
This patch fixes the problem. A workaround is to specify rsize=N,wsize=N
mount options explicitly, so they are set before session creation.
This bug only affects NFSv4.1 mounts against some non-FreeBSD servers.

MFC after: 1 week

6 years agoMerge ^/head r321239 through r321306.
Dimitry Andric [Thu, 20 Jul 2017 20:37:23 +0000 (20:37 +0000)]
Merge ^/head r321239 through r321306.

6 years agoFix printf format warning in iflib.c
Dimitry Andric [Thu, 20 Jul 2017 20:28:31 +0000 (20:28 +0000)]
Fix printf format warning in iflib.c

Clang 5.0.0 got better warnings about printf format strings using %zd,
and this leads to the following -Werror warning on e.g. arm:

    sys/net/iflib.c:1517:8: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat]
                                              sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize);
                                              ^~~~~~~~~~~~~~~~~~~~
    sys/net/iflib.c:1517:41: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat]
                                              sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize);
                                                                               ^~~~~~~~~~~~~~~~~~~~~~~

Fix this by casting bus_size_t arguments to uintmax_t, and using %ju
instead.

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

6 years agoFix printf format warning in zfs_module.c
Dimitry Andric [Thu, 20 Jul 2017 20:27:19 +0000 (20:27 +0000)]
Fix printf format warning in zfs_module.c

Clang 5.0.0 got better warnings about print format strings using %zd,
and this leads to the following -Werror warning on e.g. arm:

    sys/boot/efi/boot1/zfs_module.c:186:18: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'off_t' (aka 'long long') [-Werror,-Wformat]
                        "(%lu)\n", st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status));
                                   ^~~~~~~~~~

Fix this by casting off_t arguments to intmax_t, and using %jd instead.

Reviewed by: tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D11678

6 years agoadd arm64 objcopy output target for embedfs
Ed Maste [Thu, 20 Jul 2017 18:22:49 +0000 (18:22 +0000)]
add arm64 objcopy output target for embedfs

PR: 220877
Submitted by: David NewHamlet
MFC after: 1 week

6 years agoAdd myself and mentor line to committers-src.dot.
Matt Joras [Thu, 20 Jul 2017 18:14:27 +0000 (18:14 +0000)]
Add myself and mentor line to committers-src.dot.

Approved by: rstone (mentor)
Differential Revision: https://reviews.freebsd.org/D11672

6 years agoacpidump: add GIC ITS srat type
Ed Maste [Thu, 20 Jul 2017 17:36:17 +0000 (17:36 +0000)]
acpidump: add GIC ITS srat type

From ACPI 6.2, 5.2.16.5

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoacpidump: add ACPI NFIT (NVDIMM Firmware Interface Table)
Ed Maste [Thu, 20 Jul 2017 17:31:27 +0000 (17:31 +0000)]
acpidump: add ACPI NFIT (NVDIMM Firmware Interface Table)

Submitted by: Guangyuan Yang <yzgyyang@outlook.com>
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11479

6 years agoRemove some private symbols from librt
Alan Somers [Thu, 20 Jul 2017 16:24:29 +0000 (16:24 +0000)]
Remove some private symbols from librt

Private functions like __aio_read and _aio_read were exposed in
FBSDprivate_1.0 by r169090, even though they've never been used outside of
librt. Also, remove some weak references from r156136 that have never
resolved.

Reviewed by: kib
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11649

6 years agoacpidump: use C99 designated initializers
Ed Maste [Thu, 20 Jul 2017 15:52:36 +0000 (15:52 +0000)]
acpidump: use C99 designated initializers

Submitted by: Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11659

6 years agodate: avoid crash on invalid time
Ed Maste [Thu, 20 Jul 2017 15:28:48 +0000 (15:28 +0000)]
date: avoid crash on invalid time

localtime(3) returns NULL when passed an invalid time_t but date(1)
previously did not handle it. Exit with an error in that case.

PR: 220828
Reported by: Vinícius Zavam
Reviewed by: cem, kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11660

6 years agoDeal with listening socket correctly.
Michael Tuexen [Thu, 20 Jul 2017 14:50:13 +0000 (14:50 +0000)]
Deal with listening socket correctly.

6 years agoFix the explicit EOR mode. If the final messages is not complete, send
Michael Tuexen [Thu, 20 Jul 2017 11:09:33 +0000 (11:09 +0000)]
Fix the explicit EOR mode. If the final messages is not complete, send
an ABORT.
Joint work with rrs@
MFC after: 1 week

6 years agohyperv/storvsc: Force SPC3 for CDROM attached.
Sepherosa Ziehau [Thu, 20 Jul 2017 07:13:26 +0000 (07:13 +0000)]
hyperv/storvsc: Force SPC3 for CDROM attached.

This unbreaks the CDROM attaching on GEN2 VMs.  On GEN1 VMs, CDROM is
attached to emulated ATA controller.

PR: 220790
Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11634

6 years agoefi: restrict visibility of EFIABI_ATTR-declared functions
Ryan Libby [Thu, 20 Jul 2017 06:47:06 +0000 (06:47 +0000)]
efi: restrict visibility of EFIABI_ATTR-declared functions

In-tree gcc (4.2) doesn't understand __attribute__((ms_abi))
(EFIABI_ATTR).  Avoid declaring functions with that attribute when the
compiler is detected to be gcc < 4.4.

Reviewed by: kib, imp (previous version)
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11636

6 years agoprocstat(8): clarify program usage
Enji Cooper [Thu, 20 Jul 2017 05:43:48 +0000 (05:43 +0000)]
procstat(8): clarify program usage

- Visualize mutually exclusive options and their corresponding
  arguments.
- Try to make the subtleties that are expressed in the code, and
  potentially in the manpages, more apparent.

6 years agoSome trivial style(9) fixes
Enji Cooper [Thu, 20 Jul 2017 04:32:06 +0000 (04:32 +0000)]
Some trivial style(9) fixes

- Delete trailing whitespace.
- Fix leading indentation (convert single column spaces to tabs).
- Convert "[Ff]all through" to "FALLTHROUGH", per implicit project
  style/spelling.

Reviewed by: sbruno
Differential Revision: D11665

6 years agoClean up leading whitespace (convert single column spaces to hard tabs)
Enji Cooper [Thu, 20 Jul 2017 00:40:03 +0000 (00:40 +0000)]
Clean up leading whitespace (convert single column spaces to hard tabs)

MFC after: now

6 years agoDecode FreeBSD11 fstatat calls.
Mark Johnston [Wed, 19 Jul 2017 23:34:28 +0000 (23:34 +0000)]
Decode FreeBSD11 fstatat calls.

6 years agoRestore igb(4) code dropped during iflib conversion
Sean Bruno [Wed, 19 Jul 2017 22:41:22 +0000 (22:41 +0000)]
Restore igb(4) code dropped during iflib conversion
 - restore newer code for vf, i350, i210, i211
 - restore dmac init code for i354 and i350
 - restore WUC/WUFC update
 - check for igb mac type before attempting trying to assert
   a media changed event.
 - handle link events for igb(4) and em(4) devices differently
   and appropriately for their respective model types.

Submitted by: Matt Macy <mmacy@mattmacy.io>
Sponsored by: Limelight Networks

6 years agoInclude ARCH_FLAGS in CFLAGS when building modules.
Brooks Davis [Wed, 19 Jul 2017 22:06:35 +0000 (22:06 +0000)]
Include ARCH_FLAGS in CFLAGS when building modules.

Without this change, modules will match the default compiler
configuration which may not be the same as the kernel values.

Reviewed by: imp
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11633

6 years agoDon't cache mbuf pointers if the number of descriptors is greater than
Sean Bruno [Wed, 19 Jul 2017 21:18:04 +0000 (21:18 +0000)]
Don't cache mbuf pointers if the number of descriptors is greater than
the number of buffers.

Submitted by: Matt Macy <mmacy@mattmacy.io>
Sponsored by: Limelight Networks

6 years agoUpdate the nfsv4 man page to reflect recent changes to support
Rick Macklem [Wed, 19 Jul 2017 20:57:41 +0000 (20:57 +0000)]
Update the nfsv4 man page to reflect recent changes to support
the newer RFCs (5661 and 7530). The main man changes are for the
case of "numbers in strings" for user/groups that RFC7530 allows
and avoids use of nfsuserd(8).

This is a content change.

Reviewed by: trasz (earlier version)
MFC after: 1 week

6 years agoAdd pctrie_init() and vm_radix_init() to initialize generic pctrie and
Konstantin Belousov [Wed, 19 Jul 2017 20:52:47 +0000 (20:52 +0000)]
Add pctrie_init() and vm_radix_init() to initialize generic pctrie and
vm_radix trie.

Existing vm_radix_init() function is renamed to vm_radix_zinit().
Inlines moved out of the _ headers.

Reviewed by: alc, markj (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11661

6 years agocron(8) manpage updates
Enji Cooper [Wed, 19 Jul 2017 19:53:07 +0000 (19:53 +0000)]
cron(8) manpage updates

- Document /etc/cron.d and /usr/local/etc/cron.d under FILES.
- Reword documentation for -n: add appropriate soft-stop and remove
  contraction to appease igor.

MFC after: 3 days

6 years agoMerge ^/head r320994 through r321238.
Dimitry Andric [Wed, 19 Jul 2017 19:43:10 +0000 (19:43 +0000)]
Merge ^/head r320994 through r321238.

6 years agoMerge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
Dimitry Andric [Wed, 19 Jul 2017 19:41:41 +0000 (19:41 +0000)]
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
build glue.

6 years agoFix trivial whitespace bug introduced in usage message changes for -n
Enji Cooper [Wed, 19 Jul 2017 19:38:25 +0000 (19:38 +0000)]
Fix trivial whitespace bug introduced in usage message changes for -n
support (r304570).

MFC after: now

6 years agoRaise the watchdog timer interval to 2 ticks, there by guaranteeing
David C Somayajulu [Wed, 19 Jul 2017 19:08:37 +0000 (19:08 +0000)]
Raise the watchdog timer interval to 2 ticks, there by guaranteeing
that it fires between 1ms and 2ms. `
Treat two consecutive occurrences of Heartbeat failures as a legitimate
Heartbeat failure

MFC after:3 days

6 years agoDisable stack growth when accessed by AIO daemons.
Konstantin Belousov [Wed, 19 Jul 2017 19:00:32 +0000 (19:00 +0000)]
Disable stack growth when accessed by AIO daemons.

Commit message for r321173 incorrectly stated that the change disables
automatic stack growth from the AIO daemons contexts, with explanation
that this is currently prevents applying wrong resource limits.  Fix
this by actually disabling the growth.

Noted by: alc
Reviewed by: alc, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAllow matches of truncated version strings.
Mark Johnston [Wed, 19 Jul 2017 18:41:16 +0000 (18:41 +0000)]
Allow matches of truncated version strings.

Long objdir paths make it easy to hit the version string length limit in
kernel dump headers. The build number and timestamp are unlikely to be
truncated and ought to be sufficient to protect against false positives.

Discussed with: jhb
MFC after: 1 week

6 years agoUse more flexible expression for replacing t_diff in
Enji Cooper [Wed, 19 Jul 2017 18:30:16 +0000 (18:30 +0000)]
Use more flexible expression for replacing t_diff in
contrib/netbsd-tests/usr.bin/diff/t_diff.sh with the name of the script via
`basename $0`.

This was a change I forgot to port over from
^/head/gnu/usr.bin/diff/tests/Makefile@r272787.

6 years agobsdinstall: improve checksum mismatch error for snapshots
Ed Maste [Wed, 19 Jul 2017 18:25:52 +0000 (18:25 +0000)]
bsdinstall: improve checksum mismatch error for snapshots

The usual case of a mismatched checksum for installer snapshots
(e.g., -CURRENT, -ALPHA*) is that a newer snapshot has been built and
the old install sets have been replaced.  Provide a specific error
message for checksum mismatches there that suggests looking for a newer
snapshot.

Submitted by: Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11641

6 years agozfs: Fix a typo in the delay_min_dirty_percent sysctl description
Ed Maste [Wed, 19 Jul 2017 18:17:41 +0000 (18:17 +0000)]
zfs: Fix a typo in the delay_min_dirty_percent sysctl description

The description is FreeBSD-specific and was added in r266497
to fix PR189865.

PR: 220825
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agoRemove unused function swap_pager_isswapped().
Konstantin Belousov [Wed, 19 Jul 2017 17:28:46 +0000 (17:28 +0000)]
Remove unused function swap_pager_isswapped().

Noted by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoUpdate targets/pseudo/tests/Makefile.depend after recent additions/subtractions
Enji Cooper [Wed, 19 Jul 2017 16:45:57 +0000 (16:45 +0000)]
Update targets/pseudo/tests/Makefile.depend after recent additions/subtractions
from the FreeBSD test suite.

MFC after: 3 days
MFC with: r316603

6 years agoClean up :coredump_phnum
Enji Cooper [Wed, 19 Jul 2017 16:23:02 +0000 (16:23 +0000)]
Clean up :coredump_phnum

- Use "atf_check -x 'cmd1 | cmd2'" instead of "cmd1 | atf_check cmd2". The
  two forms are idiomatically similar, but subtly different in the sense of
  what program invokes the other, and there could be unwanted side effects
  of the latter idiom dealing with forking, pipes, etc.
- Remove chmod and instead source coredump_phnum_restore_state.sh directly.
  This avoids the need to check the result of the chmod call.
- Fix indentation in an if-block (4 column space indentation -> hard tab).

6 years agoRemove expected failure for :coredump_phnum
Enji Cooper [Wed, 19 Jul 2017 16:08:08 +0000 (16:08 +0000)]
Remove expected failure for :coredump_phnum

The testcase no longer fails on ^/head because readelf has established parity
with binutils' copy of readelf.

This issue is not seen on Jenkins because
`test_suites.FreeBSD.allow_sysctl_side_effects` isn't set in kyua.conf on
the CI host, i.e., the test is skipped.

PR: 215019
Tested with: binutils (amd64-binutils-2.28,1); elftoolchain (r3561M)

6 years agoFix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.
Kenneth D. Merry [Wed, 19 Jul 2017 15:39:01 +0000 (15:39 +0000)]
Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.

mps_wait_command() and mpr_wait_command() were using getmicrotime() to
determine elapsed time when checking for a timeout in polled mode.
getmicrotime() isn't guaranteed to monotonically increase, and that
caused spurious timeouts occasionally.

Switch to using getmicrouptime(), which does increase monotonically.
This fixes the spurious timeouts in my test case.

Reviewed by: slm, scottl
MFC after: 3 days
Sponsored by: Spectra Logic

6 years agoRemove dead code that was killed by r320975
Alan Somers [Wed, 19 Jul 2017 15:22:10 +0000 (15:22 +0000)]
Remove dead code that was killed by r320975

Reported by: Coverity
CID: 1377977
MFC after: 15 days
X-MFC-With: 320975
Sponsored by: Spectra Logic Corp

6 years agoAvoid shadowed variables.
Michael Tuexen [Wed, 19 Jul 2017 15:12:23 +0000 (15:12 +0000)]
Avoid shadowed variables.

MFC after: 1 week