freebsd.git
7 years agoPut a tentative import date in ObsoleteFiles.inc and UPDATING. github/projects/clang391-import
dim [Sat, 17 Dec 2016 18:35:17 +0000 (18:35 +0000)]
Put a tentative import date in ObsoleteFiles.inc and UPDATING.

7 years agoMerge ^/head r310169 through r310190.
dim [Sat, 17 Dec 2016 18:33:41 +0000 (18:33 +0000)]
Merge ^/head r310169 through r310190.

7 years agoSimplify interrupt mask programming in pl011 uart
jchandra [Sat, 17 Dec 2016 18:04:59 +0000 (18:04 +0000)]
Simplify interrupt mask programming in pl011 uart

Remove unused fields from uart_pl011_softc. Add an interrupt mask
field to the softc and use it to set the interrupt mask register.

There should be no functional change introduced here except in the
grab and ungrab functions. In these functions, we now disable and
enable all interrupts rather than just the receive interrupt.

7 years agoFix sscanf() format string to match an argument. This also fixes kernel
skra [Sat, 17 Dec 2016 18:03:03 +0000 (18:03 +0000)]
Fix sscanf() format string to match an argument. This also fixes kernel
build after r310171.

MFC after: 1 weeks

7 years agoRemove lib/libelf's manpages if MK_TOOLCHAIN == no
ngie [Sat, 17 Dec 2016 03:41:16 +0000 (03:41 +0000)]
Remove lib/libelf's manpages if MK_TOOLCHAIN == no

Add a comment to help figure out which set is lib/libelf's and which set
is lib/libelftc's

MFC after: 1 week

7 years agoInstall the lib/libelftc manpages
ngie [Sat, 17 Dec 2016 03:34:51 +0000 (03:34 +0000)]
Install the lib/libelftc manpages

Some other manpages, e.g. c++filt reference these

MFC after: 1 week

7 years agoMFV r310115,310184:
mm [Sat, 17 Dec 2016 02:07:08 +0000 (02:07 +0000)]
MFV r310115,310184:

Sync libarchive with vendor.

Vendor bugfixes (relevant to FreeBSD):
PR 830, 831, 833: Spelling fixes
OSS-Fuzz 227, 230, 239: Fix possible memory leak in archive_read_free()
OSS-Fuzz 237: Fix heap buffer overflow when reading invalid ar archives

MFC after: 1 week

7 years agoAdd vendor/libarchive/dist files missing in r310115
mm [Sat, 17 Dec 2016 02:01:05 +0000 (02:01 +0000)]
Add vendor/libarchive/dist files missing in r310115

7 years agoIn swp_pager_meta_free_all(), fix type of the index variable. Style.
kib [Fri, 16 Dec 2016 23:33:37 +0000 (23:33 +0000)]
In swp_pager_meta_free_all(), fix type of the index variable.  Style.

Noted and reviewed by: alc (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRevert r309339, thus re-instating r309314
matthew [Fri, 16 Dec 2016 23:05:47 +0000 (23:05 +0000)]
Revert r309339, thus re-instating r309314

The original problem with conflicting definitions of ${PKG_CMD} was
solved by r427523 in ports (see https://reviews.freebsd.org/D8677), so
this should be safe now.

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

7 years agoFix panic during lagg destruction with simultaneous status check
asomers [Fri, 16 Dec 2016 22:39:30 +0000 (22:39 +0000)]
Fix panic during lagg destruction with simultaneous status check

If you run "ifconfig lagg0 destroy" and "ifconfig lagg0" at the same time a
page fault may result. The first process will destroy ifp->if_lagg in
lagg_clone_destroy (called by if_clone_destroy). Then the second process
will observe that ifp->if_lagg is NULL at the top of lagg_port_ioctl and
goto fallback: where it will promptly dereference ifp->if_lagg anyway.

The solution is to repeat the NULL check for ifp->if_lagg

MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8512

7 years agoAvoid division by zero in the rare case that portsnap needs to fetch
cperciva [Fri, 16 Dec 2016 22:37:16 +0000 (22:37 +0000)]
Avoid division by zero in the rare case that portsnap needs to fetch
zero patches.  (This avoids two "dc: divide by zero" warnings.)

MFC after: 3 days

7 years agoHonor the CLK_SET_DRYRUN for the *set_freq function for allwinner clocks.
manu [Fri, 16 Dec 2016 21:58:48 +0000 (21:58 +0000)]
Honor the CLK_SET_DRYRUN for the *set_freq function for allwinner clocks.

Reviewed by: jmcneill
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8821

7 years agoEnable EARLY_AP_STARTUP on amd64 and i386 kernels by default.
jhb [Fri, 16 Dec 2016 21:10:37 +0000 (21:10 +0000)]
Enable EARLY_AP_STARTUP on amd64 and i386 kernels by default.

PR: 199321, 203682
MFC after: 2 months
Sponsored by: Netflix

7 years agoRemove extra DOF_SEC_XLIMPORT from the DOF_SEC_ISLOADABLE macro
gnn [Fri, 16 Dec 2016 20:44:14 +0000 (20:44 +0000)]
Remove extra DOF_SEC_XLIMPORT from the DOF_SEC_ISLOADABLE macro

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoAdd support for Ingenic JZ4780 SMBus controller.
jmcneill [Fri, 16 Dec 2016 20:04:56 +0000 (20:04 +0000)]
Add support for Ingenic JZ4780 SMBus controller.

Reviewed by: kan
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D8793

7 years agoAdd __scanflike attributes to the kernel's sscanf() and vsscanf()
dim [Fri, 16 Dec 2016 19:49:22 +0000 (19:49 +0000)]
Add __scanflike attributes to the kernel's sscanf() and vsscanf()
declarations.  This should help to catch future mismatches between
format strings and arguments.

MFC after: 1 week

7 years ago[spigen] Make "data" part of spigen_transfer optional
gonzo [Fri, 16 Dec 2016 19:09:57 +0000 (19:09 +0000)]
[spigen] Make "data" part of spigen_transfer optional

Make st_data part of spigen_transfer optional by letting pass zero length
and NULL pointer. SPI controller drivers handle this case fine.

MFC after: 1 week

7 years agoMerge ^/head r309817 through r310168.
dim [Fri, 16 Dec 2016 18:38:31 +0000 (18:38 +0000)]
Merge ^/head r309817 through r310168.

7 years agoMerge llvm, clang, lld, lldb, compiler-rt and libc++ 3.9.1 release
dim [Fri, 16 Dec 2016 18:30:53 +0000 (18:30 +0000)]
Merge llvm, clang, lld, lldb, compiler-rt and libc++ 3.9.1 release
r289601.

7 years agoretain cc.4.gz man page for Chelsio T6 NICs
lifanov [Fri, 16 Dec 2016 17:44:56 +0000 (17:44 +0000)]
retain cc.4.gz man page for Chelsio T6 NICs

This man page was removed in r225583 when cc.4 was renamed to mod_cc.4
With reintroduction of cc.4 "make installworld; make delete-old" was
no longer convergent.

Reported by: Trond Endrestøl
Reviewed by: np, matthew
Approved by: np, matthew (mentor)
Differential Revision: https://reviews.freebsd.org/D8816

7 years agoSwitch from stdatomic.h to atomic.h for kernel.
kib [Fri, 16 Dec 2016 17:41:20 +0000 (17:41 +0000)]
Switch from stdatomic.h to atomic.h for kernel.

Apparently stdatomic.h implementation for gcc 4.2 on sparc64 does not
work properly.  This effectively reverts r251803.

Reported and tested by: lidl
Discussed with: ed
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFix typo.
kib [Fri, 16 Dec 2016 14:23:08 +0000 (14:23 +0000)]
Fix typo.

MFC after: 3 days

7 years agoAdd support to read the _CLS entry if it's present. It is used by
andrew [Fri, 16 Dec 2016 10:40:00 +0000 (10:40 +0000)]
Add support to read the _CLS entry if it's present. It is used by
memory-mapped devices that are normally PCIe drives. Devices can then use
the existing pci_get_class, etc. accessors to query this data.

The ivar values are different enough from the existing ACPI and ISA values
to not conflict.

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

7 years agoAll armv6 platforms have the same implementation of platform_lastaddr.
andrew [Fri, 16 Dec 2016 10:31:13 +0000 (10:31 +0000)]
All armv6 platforms have the same implementation of platform_lastaddr.
Replace them with a default handler that returns devmap_lastaddr.

Reviewed by: mmel
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D8806

7 years agocxgbe(4): Fix typo in an unused macro.
np [Fri, 16 Dec 2016 06:30:07 +0000 (06:30 +0000)]
cxgbe(4): Fix typo in an unused macro.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agocxgbe(4): Changes to the default T6 firmware configuration file.
np [Fri, 16 Dec 2016 06:25:51 +0000 (06:25 +0000)]
cxgbe(4): Changes to the default T6 firmware configuration file.

- Disable features that are not supported or not used on FreeBSD.
- Increase the RSS table slice per interface.
- Increase the share of the TCAM reserved for filtering.

MFH: 2 weeks
Sponsored by: Chelsio Communications

7 years agoFix disassembly by adding back some deleted lines.
jhibbits [Fri, 16 Dec 2016 04:47:29 +0000 (04:47 +0000)]
Fix disassembly by adding back some deleted lines.

When importing for r309309, as part of conflict resolution, too much extra was
removed, resulting in bad disassembly for branches.  Correct this.

Also re-apply the 0->NULL change from r298052.

X-MFC-With: r309309

7 years agoBump FreeBSD_version .
adrian [Fri, 16 Dec 2016 04:44:46 +0000 (04:44 +0000)]
Bump FreeBSD_version .

7 years ago[net80211] sigh, course I would miss a commit from the 11ac prep commit.
adrian [Fri, 16 Dec 2016 04:44:14 +0000 (04:44 +0000)]
[net80211] sigh, course I would miss a commit from the 11ac prep commit.

7 years ago[net80211] start laying down the foundation for 11ac support.
adrian [Fri, 16 Dec 2016 04:43:31 +0000 (04:43 +0000)]
[net80211] start laying down the foundation for 11ac support.

This is a work in progress and some of this stuff may change;
but hopefully I'm laying down enough stuff and space in fields
to allow it to grow without another major recompile.

We'll see!

* Add a net80211 PHY type for VHT 2G and VHT 5G.

  Note - yes, VHT is supposed to be for 5GHZ, however some vendors
  (*cough* most of them) support some subset of VHT rate support
  in 2GHz.  No - not 80MHz wide channels, but at least some MCS8-9
  support, maybe some beamforming, and maybe some longer A-MPDU
  aggregates.  I don't want to even think about MU-MIMO on 2GHz.

* Add an ifmedia placeholder type for VHT rates.

* Add channel flags for VHT, VHT20/40U/40D/80/80+80/160
* Add channel macros for the above
* Add ieee80211_channel fields for the VHT information and flags,
  along with some padding (so this struct definitely grows.)
* Add a phy type flag for VHT - 'v'

* Bump the number of channels to a much higher amount - until we get
  something like the linux mac80211 chanctx abstraction (where the
  stack provides a current channel configuration via callbacks,
  versus the driver ever checking ic->ic_curchan or similar) we'll
  have to populate VHT+HT combinations.

Eg, there'll likely be a full set of duplicate VHT20/40 channels to match
HT channels.  There will also be a full set of duplicate VHT80 channels -
note that for VHT80, its assumed you're doing VHT40 as a base, so we
don't need a duplicate of VHT80 + 20MHz only primary channels, only
a duplicate of all the VHT40 combinations.

I don't want to think about VHT80+80 or VHT160 for now - and I won't,
as the current device I'm doing 11ac bringup on (QCA9880) only does
VHT80.

I'll likely revisit the channel configuration and scanning related
stuff after I get VHT20/40 up.

* Add vht flags and the basic MCS rate setup to ieee80211com, ieee80211vap
  and ieee80211_node in preparation for 11ac configuration.
  There is zero code that uses this right now.
* Whilst here, add some more placeholders in case I need to extend
  out things by some uint32_t flag sized fields.  Hopefully I won't!

What I haven't yet done:

* any of the code that uses this
* any of the beamforming related fields
* any of the MU-MIMO fields required for STA/AP operation
* any of the IE fields in beacon frame / probe request/response handling
  and the calculations required for shifting beacon contents around
  when the TIM grows/shrinks

This will require a full rebuild of net80211 related programs -
ifconfig, hostapd, wpa_supplicant.

7 years agoUse the right bitwise OR operation for clearing single-step at trap time.
jhibbits [Fri, 16 Dec 2016 04:38:53 +0000 (04:38 +0000)]
Use the right bitwise OR operation for clearing single-step at trap time.

DBCR0_IDM || DBCRO_IC yields 1, which in this register is DBCR0_FT, not what we
want.
Reported by: Mark Millard
MFC after: 2 weeks

7 years agoident(1): Capsicumify
cem [Fri, 16 Dec 2016 02:09:48 +0000 (02:09 +0000)]
ident(1): Capsicumify

Preopen input file list before entering Capsicum capability mode.

Feedback by: allanjude@, bapt@, emaste@ (earlier versions)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7918

7 years agoiconv(1): Capsicumify
cem [Fri, 16 Dec 2016 02:06:34 +0000 (02:06 +0000)]
iconv(1): Capsicumify

This takes the usual shortcut of only sandboxing the last input file.
It's a first cut and this program will be easy to adapt to sandbox all
files in the future.

iconv(1) has been changed to only open the conversion descriptor once,
since the input and output encodings are fixed over all inputs.
Instead, the descriptor is simply reset after each use (documented in
iconv(3) API).

Reviewed by: no one, unfortunately
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7917

7 years agohexdump(1): First cut capsicumification
cem [Fri, 16 Dec 2016 02:03:40 +0000 (02:03 +0000)]
hexdump(1): First cut capsicumification

For now, only enter the sandbox for the last file processed (including
stdin for zero-argument mode).

Sandboxing all inputs will require a little restructuring of the
program.

Feedback by: emaste@ (earlier versions)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7915

7 years agoktrdump(8): Capsicumify
cem [Fri, 16 Dec 2016 01:59:28 +0000 (01:59 +0000)]
ktrdump(8): Capsicumify

We restrict the (optional) input file and output files. It would be
nice to restrict the KVM files, but that's up to libkvm.

We wait until after kvm_nlist() is invoked to cap_enter() because
kldsym() isn't supported in the Capsicum sandbox.

Feedback from: emaste@ (earlier versions)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7921

7 years agoministat(1): Capsicumify
cem [Fri, 16 Dec 2016 01:51:12 +0000 (01:51 +0000)]
ministat(1): Capsicumify

Separate dataset opening from reading/parsing. The number of input
files is already capped to a small number, so just open all input files
before sandboxing.

Feedback from: allanjude@ (earlier version), emaste@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7925

7 years agodma-mbox-create: Restrict with Capsicum
cem [Fri, 16 Dec 2016 01:48:55 +0000 (01:48 +0000)]
dma-mbox-create: Restrict with Capsicum

The restriction here is pretty late and pretty minimal. We need a lot
of authority to open password databases, and don't do much after that
point.

Feedback from: lifanov at mail.lifanov.com (earlier version), emaste (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7988

7 years agoCapsicumify last(1)
cem [Fri, 16 Dec 2016 01:47:08 +0000 (01:47 +0000)]
Capsicumify last(1)

Reviewed by: ed (earlier version), emaste (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8001

7 years agovfprintf(3): Add support for kernel %b format
cem [Fri, 16 Dec 2016 01:44:50 +0000 (01:44 +0000)]
vfprintf(3): Add support for kernel %b format

This is a direct port of the kernel %b format.

I'm unclear on if (more) non-portable printf extensions will be a
problem. I think it's desirable to have userspace formats include all
kernel formats, but there may be competing goals I'm not aware of.

Reviewed by: no one, unfortunately
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8426

7 years agogelf_getphdr: Allow extended indices
cem [Fri, 16 Dec 2016 01:42:51 +0000 (01:42 +0000)]
gelf_getphdr: Allow extended indices

Needed for 'readelf -l' of extended phnum files.  (Parity with GNU
binutils.)

Reviewed by: no one, unfortunately
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8703

7 years agolibelf: Fix extended numbering detection
cem [Fri, 16 Dec 2016 01:39:06 +0000 (01:39 +0000)]
libelf: Fix extended numbering detection

Extended numbering is used for any of these fields overflowing.

Reviewed by: emaste@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8701

7 years agocapsicum_helpers: Add LOOKUP flag
cem [Fri, 16 Dec 2016 01:37:44 +0000 (01:37 +0000)]
capsicum_helpers: Add LOOKUP flag

Add a helper routine for opening a directory that is restricted to being
used for opening relative files as stdio streams.

I think this will really help basic adaptation of multi-file programs to
Capsicum. Rather than having each program initialize a rights object and
ioctl/fcntl arrays for their root fd for relative opens, consolidate in the
logical place.

Reviewed by: oshogbo@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8743

7 years agolibbfd: make sure variables are initialized before using them.
pfg [Fri, 16 Dec 2016 00:35:59 +0000 (00:35 +0000)]
libbfd: make sure variables are initialized before using them.

Initialize l_sec_contents to make sure that free(l_sec_contents) is called
on valid pointers.

Obtained from: OpenBSD (partial CVS rev 1.18)
MFC after: 5 days

7 years agolibbfd: drop unnecessary variable increment.
pfg [Fri, 16 Dec 2016 00:23:59 +0000 (00:23 +0000)]
libbfd: drop unnecessary variable increment.

Do not increment `s' before it is initialized. At the time
of the increment, `s' is otherwise unused anyway.

Obtained from: OpenBSD (CVS rev 1.11)

7 years ago[ar933x] don't waste memory/flash; drop the UMTX_CHAINS count down to 16.
adrian [Fri, 16 Dec 2016 00:04:32 +0000 (00:04 +0000)]
[ar933x] don't waste memory/flash; drop the UMTX_CHAINS count down to 16.

7 years agoAdd WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata
emaste [Thu, 15 Dec 2016 21:26:58 +0000 (21:26 +0000)]
Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata

The kernel builds reproducibly, except for the time, date, user, and
hostname baked into the kernel (reported at startup and via the
kern.version sysctl for uname).  Add a build knob to disable the
inclusion of this metadata.

Reviewed by: jhb
MFC after: 1 month
Relnotes: Yes
Sponsored by: Reproducible Builds World Summit 2, Berlin
Differential Revision: https://reviews.freebsd.org/D8809

7 years agoAdd -fPIC to the ubldr build. Without this the self relocation code will
andrew [Thu, 15 Dec 2016 17:36:54 +0000 (17:36 +0000)]
Add -fPIC to the ubldr build. Without this the self relocation code will
try to use an absolute address in a switch statement, jumping to an invalid
memory location.

Sponsored by: ABT Systems Ltd

7 years agoFix building arm64 kernel after r310117
manu [Thu, 15 Dec 2016 17:26:16 +0000 (17:26 +0000)]
Fix building arm64 kernel after r310117

Pointy hat: me

MFC after: 3 days

7 years agoFix ls_tests:o_flag with ZFS TMPDIR
asomers [Thu, 15 Dec 2016 16:13:52 +0000 (16:13 +0000)]
Fix ls_tests:o_flag with ZFS TMPDIR

Unlike UFS or TMPFS, ZFS sets uarch automatically whenever a file is
updated. The test must explicitly clear uarch to be portable across
filesystems. Also, it doesn't need to run as root.

PR: 215179
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8741

7 years agoAdd information about interrupts in the Allwinner padconf files and
manu [Thu, 15 Dec 2016 15:52:13 +0000 (15:52 +0000)]
Add information about interrupts in the Allwinner padconf files and
correct some pin numbering.

While here switch to my freebsd mail address in the copyright.

MFC after: 3 days

7 years agoDocument the existence of the {0, 6, ...} sysctl.
ed [Thu, 15 Dec 2016 15:45:11 +0000 (15:45 +0000)]
Document the existence of the {0, 6, ...} sysctl.

7 years agoUpdate vendor/libarchive to git to 30528ed7a9f479f1c363ee8cfa1c5eb4c7d9be10
mm [Thu, 15 Dec 2016 15:35:53 +0000 (15:35 +0000)]
Update vendor/libarchive to git to 30528ed7a9f479f1c363ee8cfa1c5eb4c7d9be10

Vendor bugfixes:

PR 826: OpenSSL 1.1 support
PR 830, 831, 833: Spelling fixes
OSS-Fuzz 227, 230, 239: Fix possible memory leak in archive_read_free()
OSS-Fuzz 237: Fix heap buffer overflow when reading invalid ar archives

7 years agonewvers.sh: correct typo in comment
emaste [Thu, 15 Dec 2016 15:14:02 +0000 (15:14 +0000)]
newvers.sh: correct typo in comment

Submitted by: lidl

7 years agoDirectly include openfirm.h rather than through fdt_common.h as none of the
andrew [Thu, 15 Dec 2016 13:31:44 +0000 (13:31 +0000)]
Directly include openfirm.h rather than through fdt_common.h as none of the
latter file is needed.

Sponsored by: ABT Systems Ltd

7 years agonewvers.sh: add option to eliminate kernel build metadata
emaste [Thu, 15 Dec 2016 12:57:03 +0000 (12:57 +0000)]
newvers.sh: add option to eliminate kernel build metadata

Build metadata (username, hostname, etc.) prevents the FreeBSD kernel
from building reproducibly. Add an option to disable inclusion of that
metadata but retain the release information and SVN/git VCS details.
See https://reproducible-builds.org/ for additional background.

Reviewed by: bapt
Obtained from: NetBSD
MFC after: 1 month
Sponsored by: Reproducible Builds World Summit 2, Berlin
Differential Revision: https://reviews.freebsd.org/D4347

7 years agoRevert r310023 for now.
mav [Thu, 15 Dec 2016 08:03:16 +0000 (08:03 +0000)]
Revert r310023 for now.

After another look my new variable mapping was not exactly right.

7 years agohyperv: Allow userland to ro-mmap reference TSC page github/projects/bsnmp-improved-ipv6-support
sephe [Thu, 15 Dec 2016 03:32:24 +0000 (03:32 +0000)]
hyperv: Allow userland to ro-mmap reference TSC page

This paves way to implement VDSO for the enlightened time counter.

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

7 years agocxgbe(4): Deal with compressed error vectors.
np [Thu, 15 Dec 2016 02:05:29 +0000 (02:05 +0000)]
cxgbe(4): Deal with compressed error vectors.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agoProvide introductory description of the default pager.
kib [Wed, 14 Dec 2016 23:36:32 +0000 (23:36 +0000)]
Provide introductory description of the default pager.

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

7 years agoRemove locking around accounting initialization of the default object.
kib [Wed, 14 Dec 2016 23:34:25 +0000 (23:34 +0000)]
Remove locking around accounting initialization of the default object.

The object is not yet fully constructed and must not be available to
other threads.  This makes default_pager_alloc() almost identical to
swap_pager_alloc_init().

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

7 years agoreaper: Make REAPER_KILL_SUBTREE actually work.
jilles [Wed, 14 Dec 2016 22:49:20 +0000 (22:49 +0000)]
reaper: Make REAPER_KILL_SUBTREE actually work.

MFC after: 2 weeks

7 years agoUse nmount(2) rather than the obsolete mount(2).
brooks [Wed, 14 Dec 2016 21:30:44 +0000 (21:30 +0000)]
Use nmount(2) rather than the obsolete mount(2).

Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8513

7 years agoAdd a free_iovec() function to reset iovec's.
brooks [Wed, 14 Dec 2016 21:26:43 +0000 (21:26 +0000)]
Add a free_iovec() function to reset iovec's.

The primary purpose is to call nmount() in a loop with new iovec's so
free_iovec takes arguments by reference and resets their values.

Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8513

7 years agoed(1): drop redundant parenthesis.
pfg [Wed, 14 Dec 2016 21:14:43 +0000 (21:14 +0000)]
ed(1): drop redundant parenthesis.

These were Left-over from the cleanup in r309936.

7 years agoMount filesystems without executable permissions since they should never
brooks [Wed, 14 Dec 2016 21:13:10 +0000 (21:13 +0000)]
Mount filesystems without executable permissions since they should never
be used.

Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8513

7 years agoifconfig: do not truncate SSID in verbose mode.
avos [Wed, 14 Dec 2016 21:12:43 +0000 (21:12 +0000)]
ifconfig: do not truncate SSID in verbose mode.

Fix 32-character SSID abbreviation for 'ifconfig -v wlan0 scan' command.

PR: 215301
Submitted by: <ms-freebsd-bugzilla@stoffnet.at>
MFC after: 4 days

7 years agoPut the undocumented df feature of mounting filesystems from device nodes
brooks [Wed, 14 Dec 2016 21:11:42 +0000 (21:11 +0000)]
Put the undocumented df feature of mounting filesystems from device nodes
under an ifdef.  Leave enabled.

Reviewed by: cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8513

7 years agoAdd adamw, feld and rene to the portmgr organization
rene [Wed, 14 Dec 2016 20:53:46 +0000 (20:53 +0000)]
Add adamw, feld and rene to the portmgr organization

7 years agoIn xbd_connect(), use correct scanf conversion specifiers for the
dim [Wed, 14 Dec 2016 19:28:19 +0000 (19:28 +0000)]
In xbd_connect(), use correct scanf conversion specifiers for the
feature_barrier and feature_flush variables.  Otherwise, adjacent
variables on the stack, such as sector_size, may be overwritten, with
disastrous results.

Note that I did not see a good reason to revert the addition of zero
checks introduced in r310013.  Better safe than sorry.

PR: 215209
Tested by: royger
MFC after: 3 days

7 years agoSkip a ustack test that triggers an assertion on INVARIANTS kernels.
markj [Wed, 14 Dec 2016 19:01:43 +0000 (19:01 +0000)]
Skip a ustack test that triggers an assertion on INVARIANTS kernels.

Reported by: ngie
Sponsored by: Dell EMC Isilon
X-MFC-With: r309698

7 years agoDon't run the MCA record refill task during boot.
markj [Wed, 14 Dec 2016 19:00:08 +0000 (19:00 +0000)]
Don't run the MCA record refill task during boot.

The MCA taskqueue is not initialized until some time after CMCIs are
enabled on the BSP.

Reviewed by: cem, jhb
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8783

7 years agoTidy up. Mostly, remove or replace stale comments. Most of the comments
alc [Wed, 14 Dec 2016 17:28:55 +0000 (17:28 +0000)]
Tidy up.  Mostly, remove or replace stale comments.  Most of the comments
in this file actually described the operation of the swap pager, not the
default pager.  Given that this is the wrong place to discuss the
implementation of the swap pager, it shouldn't come as a surprise that as
the swap pager evolved these comments became increasingly stale.  In
addition, apply some style fixes, like modernizing a few remaining old-
style function definitions.

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

7 years agoAdd new compatible string "allwinner,sun7i-a20-mmc".
manu [Wed, 14 Dec 2016 15:00:24 +0000 (15:00 +0000)]
Add new compatible string "allwinner,sun7i-a20-mmc".

New upstream DTS is using this now for A20 SoC.

MFC after: 3 days

7 years agoFix initialisation of mlx4_pci_table's .driver_data fields.
hselasky [Wed, 14 Dec 2016 14:13:44 +0000 (14:13 +0000)]
Fix initialisation of mlx4_pci_table's .driver_data fields.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8791
Sponsored by: Mellanox Technologies
Submitted by: Dexuan Cui <decui@microsoft.com>

7 years agoRevert accidental change made in r310056.
ed [Wed, 14 Dec 2016 13:35:33 +0000 (13:35 +0000)]
Revert accidental change made in r310056.

Because I had to cherry-pick some of my changes in r310051, I
accidentally made a typo when manually applying the rest in r310056.

7 years agoLet all FEATURE()s use the same Prometheus metric.
ed [Wed, 14 Dec 2016 13:05:04 +0000 (13:05 +0000)]
Let all FEATURE()s use the same Prometheus metric.

Without this change, every individual FEATURE() declaration would have
an individual metric in Prometheus. Though this wouldn't be harmful, it
would look very cluttered.

By letting it use a single metric with the name of the feature attached
as a label, it also becomes easier to search, as you can apply regex
matching, etc.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

7 years agoAdd a "device_index" label to all sysctls under dev.$driver.$index.
ed [Wed, 14 Dec 2016 13:03:01 +0000 (13:03 +0000)]
Add a "device_index" label to all sysctls under dev.$driver.$index.

This way it becomes possible to graph a property for all instances of a
single driver. For example, graphing the number of packets across all
USB controllers, the amount of dropped packets on all NICs, etc.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

7 years agoAttach a "thermal_zone" label to the ACPI thermal zone sysctls.
ed [Wed, 14 Dec 2016 13:00:27 +0000 (13:00 +0000)]
Attach a "thermal_zone" label to the ACPI thermal zone sysctls.

In order to make Prometheus do graphing/alerting on thermal sensors in a
generic fashion, we should attach the name of the thermal zone device as
a label. That way there is only a single metric for the temperature of a
thermal zone, with its name attached as a label.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

7 years agoAdd labels to sysctls related to clocks.
ed [Wed, 14 Dec 2016 12:56:58 +0000 (12:56 +0000)]
Add labels to sysctls related to clocks.

Sysctls like kern.eventtimer.et.*.quality currently embed the name of
the clock device. This is problematic for the Prometheus metrics
exporter for two reasons:

- Some of those clocks have dashes in their names, which Prometheus
  doesn't allow to be used in metric names.
- It doesn't allow for extracting the same property of all clocks on the
  system from within a single query.

Attach these nodes to have a label, so that the Prometheus metrics
exporter gives these metric a uniform name with the name of the clock
attached as a label.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

7 years agoAdd label annotations to CAM sysctls.
ed [Wed, 14 Dec 2016 12:53:33 +0000 (12:53 +0000)]
Add label annotations to CAM sysctls.

Under kern.cam we have certain sysctls that are per-device, such as the
ones under kern.cam.ada.[0-9]+.*. Add a "device_index" label annotation
to such sysctls, so that the Prometheus metrics exporter will give all
of those metrics the same name. The device number will be added to the
metric name as the "device_index" label.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

7 years agoAdd support for attaching aggregation labels to sysctl objects.
ed [Wed, 14 Dec 2016 12:47:34 +0000 (12:47 +0000)]
Add support for attaching aggregation labels to sysctl objects.

I'm currently working on writing a metrics exporter for the Prometheus
monitoring system to provide access to sysctl metrics. Prometheus and
sysctl have some structural differences:

- sysctl is a tree of string component names.
- Prometheus uses a flat namespace for its metrics, but allows you to
  attach labels with values to them, so that you can do aggregation.

An initial version of my exporter simply translated

    hw.acpi.thermal.tz1.temperature

to

    sysctl_hw_acpi_thermal_tz1_temperature_celcius

while we should ideally have

    sysctl_hw_acpi_thermal_temperature_celcius{thermal_zone="tz1"}

allowing you to graph all thermal zones on a system in one go.

The change presented in this commit adds support for accomplishing this,
by providing the ability to attach labels to nodes. In the example I
gave above, the label "thermal_zone" would be attached to "tz1". As this
is a feature that will only be used very rarely, I decided to not change
the KPI too aggressively.

Discussed on: hackers@
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

7 years agoProvide non-final but valid PCB pointer for thread0 for duration of
kib [Wed, 14 Dec 2016 11:40:31 +0000 (11:40 +0000)]
Provide non-final but valid PCB pointer for thread0 for duration of
hammer_time().  This makes assembler exception handlers not fault
itself when setting PCB flags, and allow normal kernel trap handler to
get control.  The pointer is reset after FPU parameters are obtained.

Set thread0.td_critnest to 1 for duration of hammer_time() as well.
In particular, page faults at that early stage panic immediately
instead of trying to call not yet operational VM to resolve it.

As result, faults during second half of the hammer_time() execution
have a chance to be reported instead of silent machine reboot or hang.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agocxgbe(4): Fix the tid range shown for T6 cards in misc.tids.
np [Wed, 14 Dec 2016 07:36:36 +0000 (07:36 +0000)]
cxgbe(4): Fix the tid range shown for T6 cards in misc.tids.

MFC after: 3 days

7 years agohyperv: Implement "enlightened" time counter, which is rdtsc based.
sephe [Wed, 14 Dec 2016 03:20:57 +0000 (03:20 +0000)]
hyperv: Implement "enlightened" time counter, which is rdtsc based.

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

7 years ago- Resize FreeBSD to the size of the OpenStack flavor (growfs).
gjb [Wed, 14 Dec 2016 03:01:15 +0000 (03:01 +0000)]
- Resize FreeBSD to the size of the OpenStack flavor (growfs).
- Speeds up the boot process by disabling sendmail.
- Allows an user to ssh as root with a public key.
- Make ssh(1) respond faster by disabling DNS lookups.
- Enable DHCP on the vtnet(4) interface.

Note: The CLOUDWARE list has not yet been changed to include the
OpenStack target by default yet.

Submitted by: Diego Casati
PR: 215258
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoAdd 'const' to fn_name's return type to remove a cast.
jhb [Wed, 14 Dec 2016 00:21:06 +0000 (00:21 +0000)]
Add 'const' to fn_name's return type to remove a cast.

7 years agoUse casts to force an unsigned comparison in db_search_symbol().
jhb [Wed, 14 Dec 2016 00:18:12 +0000 (00:18 +0000)]
Use casts to force an unsigned comparison in db_search_symbol().

On all of our platforms, db_expr_t is a signed integer while
db_addr_t is an unsigned integer value.  db_search_symbol used variables
of type db_expr_t to hold the current offset of the requested address from
the "best" symbol found so far.  This value was initialized to '~0'.
When a new symbol is found from a symbol table, the associated diff for the
new symbol is compared against the existing value as 'if (newdiff < diff)'
to determine if the new symbol had a smaller diff and was thus a closer
match.

On 64-bit MIPS, the '~0' was treated as a negative value (-1).  A lookup
that found a perfect match of an address against a symbol returned a diff
of 0.  However, in signed comparisons, 0 is not less than -1.  As a result,
DDB on 64-bit MIPS never resolved any addresses to symbols.  Workaround
this by using casts to force an unsigned comparison.

Probably the diff returned from db_search_symbol() and X_db_search_symbol()
should be changed to a db_addr_t instead of a db_expr_t as it is an
unsigned value (and is an offset of an address, so should fit in the same
size as an address).

Sponsored by: DARPA / AFRL

7 years agoRevert r309918 -- modern POSIX has deprecated -<#>/+<#> syntax
dteske [Tue, 13 Dec 2016 22:31:49 +0000 (22:31 +0000)]
Revert r309918 -- modern POSIX has deprecated -<#>/+<#> syntax

Special thanks to: jilles

7 years agoFix stack traces in DDB for the debugger thread.
jhb [Tue, 13 Dec 2016 22:30:48 +0000 (22:30 +0000)]
Fix stack traces in DDB for the debugger thread.

When the kernel debugger is entered, makectx() is called to store
appropriate state from the trapframe for the debugger into a global
kdb_pcb used as the thread context of the thread entering the
debugger.  Stack unwinders for DDB called via db_trace_thread() are
supposed to then use this saved context so that the stack trace for
the current thread starts at the location of the event that triggered
debugger entry.

MIPS was instead starting the stack trace of the current thread from
the context of db_trace_thread itself and unwinding back out through
the debugger to the original frame.  Fix a couple of things to bring
MIPS inline with other platforms:
- Fix makectx() to store the PC, SP, and RA in the right portion of
  the PCB used by db_trace_thread().
- Fix db_trace_thread() to always use kdb_thr_ctx() (and thus kdb_pcb
  for the debugger thread).
- Move the logic for tracing curthread from within the current
  function into db_trace_self() to match other architectures.

Sponsored by: DARPA / AFRL

7 years agoMFV: r309561
jkim [Tue, 13 Dec 2016 22:16:02 +0000 (22:16 +0000)]
MFV: r309561

Merge byacc 20161202.

7 years agoRemove an extra "break" which could incorrectly terminate an
hrs [Tue, 13 Dec 2016 20:55:46 +0000 (20:55 +0000)]
Remove an extra "break" which could incorrectly terminate an
STAILQ_FOREACH() loop when an AF_INET6 rule matched.

Spotted by: cem

7 years agocxgbe(4): Retire t4_bus_space_read_8 and t4_bus_space_write_8.
np [Tue, 13 Dec 2016 20:35:57 +0000 (20:35 +0000)]
cxgbe(4): Retire t4_bus_space_read_8 and t4_bus_space_write_8.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agoZero return value when counter_rate() switches over to next second and
glebius [Tue, 13 Dec 2016 20:11:45 +0000 (20:11 +0000)]
Zero return value when counter_rate() switches over to next second and
value is positive, but below the limit.

7 years agolinuxkpi: Fix not-found case of linux_pci_find_irq_dev
cem [Tue, 13 Dec 2016 19:58:21 +0000 (19:58 +0000)]
linuxkpi: Fix not-found case of linux_pci_find_irq_dev

Linux list_for_each_entry() does not neccessarily end with the iterator
NULL (it may be an offset from NULL if the list member is not the first
element of the member struct).

Reported by: Coverity
CID: 1366940
Reviewed by: hselasky@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8780

7 years agoUse register_t instead of uintptr_t for register values in backtraces.
jhb [Tue, 13 Dec 2016 19:36:05 +0000 (19:36 +0000)]
Use register_t instead of uintptr_t for register values in backtraces.

This fixes backtraces from DDB in n32 kernels as uintptr_t is only a
uint32_t.  In particular, the upper 32-bits of each register value were
treated as the register's value breaking both the output of register
values, but also the values of 'ra' and 'sp' required to walk up to the
previous frame.

Sponsored by: DARPA / AFRL

7 years agoFix remove_userlocal_code() for n32.
jhb [Tue, 13 Dec 2016 19:27:31 +0000 (19:27 +0000)]
Fix remove_userlocal_code() for n32.

n32 kernels use a 64-bit store to the TLS register rather than a 32-bit
store.

Sponsored by: DARPA / AFRL

7 years agoUse db_lookup_proc() in the DDB 'show procvm' command.
jhb [Tue, 13 Dec 2016 19:22:43 +0000 (19:22 +0000)]
Use db_lookup_proc() in the DDB 'show procvm' command.

This allows processes to be identified by PID as well as a pointer address.

MFC after: 2 weeks
Sponsored by: DARPA / AFRL

7 years agoFix bug in r309712, do not leak gem object pin count in case of error
kib [Tue, 13 Dec 2016 19:04:05 +0000 (19:04 +0000)]
Fix bug in r309712, do not leak gem object pin count in case of error
or retry.

Reported and tested by: Michael Butler <imb@protected-networks.net>
Sponsored by: The FreeBSD Foundation
MFC after: 16 days

7 years agoLanguage and mdoc cleanup.
brueffer [Tue, 13 Dec 2016 18:15:11 +0000 (18:15 +0000)]
Language and mdoc cleanup.