]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoRemove redundant source and object files.
jonathan [Sat, 9 Sep 2017 13:18:32 +0000 (13:18 +0000)]
Remove redundant source and object files.

Reviewed by: bdrewery, ngie
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12208

6 years agoOnly search the scope ID in ip6_find_dev() for IPv6 addresses which
hselasky [Sat, 9 Sep 2017 12:50:12 +0000 (12:50 +0000)]
Only search the scope ID in ip6_find_dev() for IPv6 addresses which
have a scope ID. Change size of the searched scope ID to the full
16-bits. There can typically be more than 255 interfaces.

Suggested by: ae @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoEnable compilation of Marvell NETA controller with arm64 GENERIC
mw [Sat, 9 Sep 2017 11:56:48 +0000 (11:56 +0000)]
Enable compilation of Marvell NETA controller with arm64 GENERIC

This patch enables network operation on Marvell Armada 3700 SoC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12259

6 years agoAdd support for Armada 3700 in the NETA driver
mw [Sat, 9 Sep 2017 11:54:04 +0000 (11:54 +0000)]
Add support for Armada 3700 in the NETA driver

This patch enables using NETA driver on Marvell Armada 3700 SoC
by introducing new compatible string, modifying clock source
obtaining and also excluding unnecessary parts.
The driver is added as a build option for arm64 platforms as well.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12258

6 years agoStore virtual address of buffer in mvneta_rx_ring
mw [Sat, 9 Sep 2017 11:49:36 +0000 (11:49 +0000)]
Store virtual address of buffer in mvneta_rx_ring

Now the virtual address of received buffer is taken from a software ring.
Thanks to this, we can use the NETA driver on 64 bits architecture and
avoid 32-bit buf_cookie descriptor field limitation.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12257

6 years agoAdd support for uart_mvebu driver arm64 GENERIC config
mw [Sat, 9 Sep 2017 11:46:34 +0000 (11:46 +0000)]
Add support for uart_mvebu driver arm64 GENERIC config

This patch enables console output on Armada 3700 SoCs
with kernel GENERIC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12251

6 years agoIntroduce UART driver module for Armada 3700
mw [Sat, 9 Sep 2017 11:42:32 +0000 (11:42 +0000)]
Introduce UART driver module for Armada 3700

This patch adds support for UART in Armada 3700 family.
It exposes both low-level UART interface, as well as
standard driver methods.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12250

6 years agoEnable compilation of Marvell EHCI driver in arm64 GENERIC
mw [Sat, 9 Sep 2017 11:16:10 +0000 (11:16 +0000)]
Enable compilation of Marvell EHCI driver in arm64 GENERIC

Enabled driver can be used on boards equipped with Marvell Armada 3700 SoC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12256

6 years agoAdd support for Armada 3700 EHCI
mw [Sat, 9 Sep 2017 11:06:58 +0000 (11:06 +0000)]
Add support for Armada 3700 EHCI

This patch reuses ehci_mv driver by adding a support for the new
compatible string and adding ehci_mv.c to list of available options
for arm64 platforms.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12255

6 years agoAdd support for AHCI in Armada 3700
mw [Sat, 9 Sep 2017 11:01:44 +0000 (11:01 +0000)]
Add support for AHCI in Armada 3700

This patch simply AHCI generic driver by extending compatible list.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12254

6 years agoMFV r323107: 8414 Implemented zpool scrub pause/resume
avg [Sat, 9 Sep 2017 11:00:07 +0000 (11:00 +0000)]
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>

MFC after: 2 weeks

6 years agoEnable compilation of Marvell XHCI driver in arm64 GENERIC
mw [Sat, 9 Sep 2017 10:58:45 +0000 (10:58 +0000)]
Enable compilation of Marvell XHCI driver in arm64 GENERIC

Enabled driver can be used on boards equipped with Marvell Armada
3700/7k/8k SoCs.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12253

6 years agoAdd support for xhci in Armada 3700 and 7k/8k
mw [Sat, 9 Sep 2017 10:54:13 +0000 (10:54 +0000)]
Add support for xhci in Armada 3700 and 7k/8k

This driver will be used by Marvell Armada 3700 and 7k/8k SoC families.
The same, generic xhci device also appears in Armada 380, so we are reusing
driver.

This patch also adds xhci_mv.c entry to the arm64 files list.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12252

6 years agoThe combination of IPv6 and SCTP is also supported.
tuexen [Sat, 9 Sep 2017 07:48:58 +0000 (07:48 +0000)]
The combination of IPv6 and SCTP is also supported.

MFC after: 1 week

6 years agoResolve IPv6 scope ID issues when using ip6_find_dev() in the LinuxKPI.
hselasky [Sat, 9 Sep 2017 07:21:27 +0000 (07:21 +0000)]
Resolve IPv6 scope ID issues when using ip6_find_dev() in the LinuxKPI.

Workaround problem that ifa_ifwithaddr() also matches the scope ID of
the IPv6 address when searching for a maching IPv6 address. For now
simply try all valid scope IDs until a match is found.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRemove unsafe access to the LinuxKPI file structure from ibcore.
hselasky [Sat, 9 Sep 2017 06:34:20 +0000 (06:34 +0000)]
Remove unsafe access to the LinuxKPI file structure from ibcore.
selwakeup() is now done by the wake_up() family of functions.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoProperly implement poll_wait() in the LinuxKPI. This prevents direct
hselasky [Sat, 9 Sep 2017 06:29:29 +0000 (06:29 +0000)]
Properly implement poll_wait() in the LinuxKPI. This prevents direct
use of the linux_poll_wakeup() function from unsafe contexts, which
can lead to use-after-free issues.

Instead of calling linux_poll_wakeup() directly use the wake_up()
family of functions in the LinuxKPI to do this.

Bump the FreeBSD version to force recompilation of external kernel modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoUnbreak :broken_pipe
ngie [Sat, 9 Sep 2017 06:24:21 +0000 (06:24 +0000)]
Unbreak :broken_pipe

- Capture exit code in pipeline and test in output.
- Drop awk use in favor of `sleep 2`. This helps guarantee the EPIPE
  behavior without the potential race.

6 years agoAdd more sanity checks to linux_fget() in the LinuxKPI. This prevents
hselasky [Sat, 9 Sep 2017 06:04:05 +0000 (06:04 +0000)]
Add more sanity checks to linux_fget() in the LinuxKPI. This prevents
returning pointers to file descriptors which were not created by the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix riscv and powerpc compilation after r323329.
mjg [Sat, 9 Sep 2017 05:56:04 +0000 (05:56 +0000)]
Fix riscv and powerpc compilation after r323329.

On these archs bzero is a C function, which triggers a compilation error
as the compiler tries to expand the macro.

6 years agoCheck result of seq call and save output via atf_check -o
ngie [Sat, 9 Sep 2017 05:50:47 +0000 (05:50 +0000)]
Check result of seq call and save output via atf_check -o

This ensures that seq outputting to ints will not fail as silently if there's
an error.

6 years agocxgbe(4): Fix a couple of problems in the sge_wrq data path.
np [Sat, 9 Sep 2017 05:12:14 +0000 (05:12 +0000)]
cxgbe(4): Fix a couple of problems in the sge_wrq data path.

- start_wrq_wr must not drain the wr_list if there are incomplete_wrs
  pending.  This can happen when a t4_wrq_tx runs between two
  start_wrq_wr.

- commit_wrq_wr must examine the cookie's pidx and ndesc with the
  queue's lock held.  Otherwise there is a bad race when incomplete WRs
  are being completed and commit_wrq_wr for the WR that is ahead in the
  queue updates the next incomplete WR's cookie's pidx/ndesc but the
  commit_wrq_wr for the second one is using stale values that it read
  without the lock.

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoThe purge option hasn't been implemented since 1994 when we imported this
gordon [Sat, 9 Sep 2017 03:09:02 +0000 (03:09 +0000)]
The purge option hasn't been implemented since 1994 when we imported this
code. I think it is safe to say it's not going to be. I'm also working to
de-orbit catman, so remove the reference in the manpage.

Reviewed by: allanjude

6 years agoClarify that the size option is in bytes by default, but also accepts the
ian [Sat, 9 Sep 2017 02:28:21 +0000 (02:28 +0000)]
Clarify that the size option is in bytes by default, but also accepts the
usual SI suffixes.

6 years agoAdd P5021 and P5040 conditions for LAW count check.
jhibbits [Sat, 9 Sep 2017 02:19:44 +0000 (02:19 +0000)]
Add P5021 and P5040 conditions for LAW count check.

P5040/P5021 have the same number of LAWs as P5020.  There may be a better way of
getting the count from the FDT (fsl,num-laws property on soc/corenet-law or
soc/ecm-law), but that's not supported everywhere, so we still need this check
for those other cases.

6 years agoAdd some more PVR and SVR defines
jhibbits [Sat, 9 Sep 2017 02:08:22 +0000 (02:08 +0000)]
Add some more PVR and SVR defines

These processors may not be supported yet, but add them for completion.

POWER9 is planned for support.  e300 may work (based on 603e core).
P5040/P5021 are similar to P5020, so should work as well.  One addition is
needed for P5040, to support the number of LAWs, and will be a separate commit.

6 years agoFix information leak in geli(8) integrity mode
cem [Sat, 9 Sep 2017 01:41:01 +0000 (01:41 +0000)]
Fix information leak in geli(8) integrity mode

In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several
physical sectors (e.g., 512 bytes) on the backing device.  Due to hash
overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors.
This means that only 288 bytes (256 data + 32 hash) of the last 512 byte
sector are used.

The memory allocation used to store the encrypted data to be written to the
physical sectors comes from malloc(9) and does not use M_ZERO.

Previously, nothing initialized the final physical sector backing each
logical sector, aside from the hash + encrypted data portion.  So 224 bytes
of kernel heap memory was leaked to every block :-(.

This patch addresses the issue by initializing the trailing portion of the
physical sector in every logical sector to zeros before use.  A much simpler
but higher overhead fix would be to tag the entire allocation M_ZERO.

PR: 222077
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: emaste
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12272

6 years agoRefactor interrupt allocation and deallocation. Add some extra
scottl [Fri, 8 Sep 2017 20:20:35 +0000 (20:20 +0000)]
Refactor interrupt allocation and deallocation.  Add some extra
diagnostics.  No other functional changes.

Sponsored by: Netflix

6 years agoAllow __builtin_memset instead of bzero for small buffers of known size
mjg [Fri, 8 Sep 2017 20:09:14 +0000 (20:09 +0000)]
Allow __builtin_memset instead of bzero for small buffers of known size

In particular this eliminates function calls and related register save/restore
when only few writes would suffice.

Example speed up can be seen in a fstat microbenchmark on AMD Ryzen cpus, where
the throughput went up by ~4.5%.

Thanks to cem@ for benchmarking and reviewing the patch.

MFC after: 1 week

6 years agoEnhance qpi.c to make it usable on all Core-microarchitecture Xeons.
kib [Fri, 8 Sep 2017 19:51:03 +0000 (19:51 +0000)]
Enhance qpi.c to make it usable on all Core-microarchitecture Xeons.

Scan all buses for CSR bus, not stopping on the first failed
match. Scan all slots for function 0 on the found bus, for instance on
IvyBridge the slot 0 is not decoded at all. Since the scan is quite
unsafe, and access to the buses is mostly useful for developers,
enable the csr buses scan with the tunable.

Current qpi.c makes too many assumptions about the uncore
configuration buses location and about slots occupied.  Also it
restricts itself only to Nehalem CPUs.  It is needed on all Core-based
Xeons.  On the 2600 v2 (IvyBridge) machine I have access to, the CSR
buses have numbers 31 (BSP socket) and 63 (second socket), and there
is no functions pci0.31.0.0 or pci0.63.0.0.  According to the CPU
datasheet, all devices on the uncore bus occupy slots >= 8.

Practically, the attach to config buses is required for the intel-pcm
pcm-memory.x tool to work, for instance.

Reviewed by: jhb (previous version)
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D12268

6 years agoUse IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
kib [Fri, 8 Sep 2017 19:45:37 +0000 (19:45 +0000)]
Use IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
remapping.

VT-d specification requires use of PCI rid as source id for IOAPICs
enumerated by PCI bus.  The values from the DMAR ACPI table should be
only used when IOAPIC is not on PCI.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Hardware provided by: Intel
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12205

6 years agoAdd an ioapic_get_rid() function to obtain PCIe TLP requester-id for
kib [Fri, 8 Sep 2017 19:39:20 +0000 (19:39 +0000)]
Add an ioapic_get_rid() function to obtain PCIe TLP requester-id for
the interrupt messages from given IOAPIC, if the IOAPIC can be
enumerated on PCI bus.

If IOAPIC has PCI binding, match the PCI device against MADT
enumerated IOAPIC.  Match is done first by registers window physical
address, then by IOAPIC ID as read from the APIC ID register.

PCI bsf address of the matched PCI device is the rid.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Hardware provided by: Intel
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12205

6 years agoAdd a constant specifying the min size of the IOAPIC registers window.
kib [Fri, 8 Sep 2017 19:25:11 +0000 (19:25 +0000)]
Add a constant specifying the min size of the IOAPIC registers window.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoTweak comment for install -S usage since it does not impact the build.
bdrewery [Fri, 8 Sep 2017 19:20:42 +0000 (19:20 +0000)]
Tweak comment for install -S usage since it does not impact the build.

The -S flag is currently ignored for builds since we filter through
tools/install.sh that is intended for both non-root and cross-builds.

Sponsored by: Dell EMC Isilon
X-MFC-With: r322565

6 years agoCorrect bintime32 declaration: uint32_t sec -> time32_t sec.
sobomax [Fri, 8 Sep 2017 18:32:13 +0000 (18:32 +0000)]
Correct bintime32 declaration: uint32_t sec -> time32_t sec.

Submitted by: jhb
MFC after: 1 month

6 years agoAdded support for displaying HW port stats using sysctl.
shurd [Fri, 8 Sep 2017 18:03:34 +0000 (18:03 +0000)]
Added support for displaying HW port stats using sysctl.

This provides port stats (updated once per second) in
dev.bnxt.X.port_stats for PFs.  VFs do not have access to the port stats.

Submitted by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Reviewed by: shurd, sbruno
Approved by: sbruno (mentor)
Sponsored by: Broadcom Limited
Differential Revision: https://reviews.freebsd.org/D11914

6 years agoFix intrhook release in MFI as well
scottl [Fri, 8 Sep 2017 17:51:19 +0000 (17:51 +0000)]
Fix intrhook release in MFI as well

6 years agoAs with r323317, hold off on releasing the intrhook during boot until
scottl [Fri, 8 Sep 2017 17:40:29 +0000 (17:40 +0000)]
As with r323317, hold off on releasing the intrhook during boot until
we're ready to accept probing from GEOM.  Untested, but the pattern is
the same as with aac.

6 years agoMove the intrhook release to later in the function so that GEOM knows to wait longer
scottl [Fri, 8 Sep 2017 16:52:59 +0000 (16:52 +0000)]
Move the intrhook release to later in the function so that GEOM knows to wait longer
for possible root devices to come online.  This fixes a race that seems to be
triggered by EARLY_AP_STARTUP.

Submitted by: cgull@glup.org

6 years agolibgeom: Remove redundant and duplicated code
cem [Fri, 8 Sep 2017 15:44:52 +0000 (15:44 +0000)]
libgeom: Remove redundant and duplicated code

In g_open(), g_device_path_open().

No functional change.

Sponsored by: Dell EMC Isilon

6 years agogeom_virstor: Remove wholly unnecessary g_metadata_store copy
cem [Fri, 8 Sep 2017 15:38:02 +0000 (15:38 +0000)]
geom_virstor: Remove wholly unnecessary g_metadata_store copy

Just code cleanup.  No functional change.

Sponsored by: Dell EMC Isilon

6 years agoAudit userspace geom code for leaking memory to disk
cem [Fri, 8 Sep 2017 15:08:17 +0000 (15:08 +0000)]
Audit userspace geom code for leaking memory to disk

Any geom class using g_metadata_store, as well as geom_virstor which
duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes
of userspace memory following the metadata block stored. This is most or all
geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath,
graid3, gshsec, gstripe, and geom_virstor).

PR: 222077 (comment #3)
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: des
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12269

6 years agoFix malloc() uses in em_get_regs().
kib [Fri, 8 Sep 2017 14:54:07 +0000 (14:54 +0000)]
Fix malloc() uses in em_get_regs().

Do not use malloc(M_NOWAIT), wait is possible there, and the malloc
failures where not checked.  Do not forget to free malloced memory.

Reported and tested by: pho
Approved by: sbruno
Sponsored by: The FreeBSD Foundation

6 years agoConsistently use tabs for indent.
kib [Fri, 8 Sep 2017 10:39:28 +0000 (10:39 +0000)]
Consistently use tabs for indent.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoNot all CPUs handle reading ID_AA64MMFR2_EL1 (e.g. qemu), disable it for now.
andrew [Fri, 8 Sep 2017 08:02:06 +0000 (08:02 +0000)]
Not all CPUs handle reading ID_AA64MMFR2_EL1 (e.g. qemu), disable it for now.

Sponsored by: DARPA, AFRL

6 years agonamecache: fold the unlock label into the only consumer
mjg [Fri, 8 Sep 2017 06:57:11 +0000 (06:57 +0000)]
namecache: fold the unlock label into the only consumer

No functional changes.

MFC after: 1 week

6 years agonamecache: factor out dot lookup into a dedicated function
mjg [Fri, 8 Sep 2017 06:51:33 +0000 (06:51 +0000)]
namecache: factor out dot lookup into a dedicated function

The intent is to move uncommon cases out of the way.

MFC after: 1 week

6 years agoAnnotate Giant with __exclusive_cache_line
mjg [Fri, 8 Sep 2017 06:46:24 +0000 (06:46 +0000)]
Annotate Giant with __exclusive_cache_line

6 years agoAnnotate global process locks with __exclusive_cache_line
mjg [Fri, 8 Sep 2017 06:46:02 +0000 (06:46 +0000)]
Annotate global process locks with __exclusive_cache_line

MFC after: 1 week

6 years agomca: Fix printf types from r323289 on i386
cem [Fri, 8 Sep 2017 01:06:35 +0000 (01:06 +0000)]
mca: Fix printf types from r323289 on i386

Reported by: Michael Butler <imb AT protected-networks.net>
Sponsored by: Dell EMC Isilon

6 years agoSpeed up vm_page_array initialization.
markj [Thu, 7 Sep 2017 21:43:39 +0000 (21:43 +0000)]
Speed up vm_page_array initialization.

We currently initialize the vm_page array in three passes: one to zero
the array, one to initialize the "order" field of each page (necessary
when inserting them into the vm_phys buddy allocator one-by-one), and
one to initialize the remaining non-zero fields and individually insert
each page into the allocator.

Merge the three passes into one following a suggestion from alc:
initialize vm_page fields in a single pass, and use vm_phys_free_contig()
to efficiently insert physical memory segments into the buddy allocator.
This reduces the initialization time to a third or a quarter of what it
was before on most systems that I tested.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D12248

6 years agox86 MCA: Helpfully, print why ECC thresholding is not enabled on AMD
cem [Thu, 7 Sep 2017 21:33:27 +0000 (21:33 +0000)]
x86 MCA: Helpfully, print why ECC thresholding is not enabled on AMD

Sponsored by: Dell EMC Isilon

6 years agox86 MCA: Enable AMD thresholding support on 17h
cem [Thu, 7 Sep 2017 21:31:07 +0000 (21:31 +0000)]
x86 MCA: Enable AMD thresholding support on 17h

17h supports MCA thresholding in the same way as 16h and earlier.
Supposedly a ScalableMca feature bit in CPUID 8000_0007:EBX must be set, but
that was not true for earlier models, so be careful about relying on it.

While here, document a missing bit in LS MCA MISC0.

Reviewed by: truckman
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12237

6 years agoStore AMD RAS Capabilities cpuid value and name flags
cem [Thu, 7 Sep 2017 21:29:51 +0000 (21:29 +0000)]
Store AMD RAS Capabilities cpuid value and name flags

Reviewed by: truckman
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12237

6 years agocpufreq(4) hwpstate: Yield CPU awaiting frequency change
cem [Thu, 7 Sep 2017 20:20:12 +0000 (20:20 +0000)]
cpufreq(4) hwpstate: Yield CPU awaiting frequency change

It doesn't seem necessary to busy the CPU while waiting to transition
into a different p-state.

PR: 221621 (related, but does not completely address)
Reviewed by: truckman
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12260

6 years agoFix the SVE ID field shift.
andrew [Thu, 7 Sep 2017 19:52:04 +0000 (19:52 +0000)]
Fix the SVE ID field shift.

Sponsored by: DARPA, AFRL

6 years agoAdd the ATS1E1 case to the ID_AA64MMFR1_EL1 decoding.
andrew [Thu, 7 Sep 2017 19:51:17 +0000 (19:51 +0000)]
Add the ATS1E1 case to the ID_AA64MMFR1_EL1 decoding.

Sponsored by: DARPA, AFRL

6 years agoFix indentation.
markj [Thu, 7 Sep 2017 19:15:31 +0000 (19:15 +0000)]
Fix indentation.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoUse the correct mask when printing undecoded fields from the
andrew [Thu, 7 Sep 2017 18:58:55 +0000 (18:58 +0000)]
Use the correct mask when printing undecoded fields from the
ID_AA64MMFR2_EL1 register.

Sponsored by: DARPA, AFRL

6 years agoFix an incorrectly used conditional causing a stack buffer overflow.
gordon [Thu, 7 Sep 2017 18:54:54 +0000 (18:54 +0000)]
Fix an incorrectly used conditional causing a stack buffer overflow.

Reported by: Thomas Jarosch of Intra2net AG
Reviewed by: emaste, jhb
Security: CVE-2017-1000249

6 years agoDocument some invariants for the XLC_ enum.
theraven [Thu, 7 Sep 2017 17:51:35 +0000 (17:51 +0000)]
Document some invariants for the XLC_ enum.

These can't be reordered without breaking other code.  Document that and add
some static asserts to ensure that anyone who tries gets build failures.

6 years agocrunchgen: quiet -Wmissing-prototypes
rlibby [Thu, 7 Sep 2017 17:20:47 +0000 (17:20 +0000)]
crunchgen: quiet -Wmissing-prototypes

Reviewed by: emaste (previous version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12107

6 years agoAdd basic tests for chflags, mkdir, rcp, and rmdir
asomers [Thu, 7 Sep 2017 16:54:47 +0000 (16:54 +0000)]
Add basic tests for chflags, mkdir, rcp, and rmdir

Add basic command line parsing test coverage for these utilities.  The tests
were automatically generated based on their man pages.  These tests can be
expanded by hand for more thorough coverage.  The aim is to generate very
basic amount of test coverage for all the utilities in the base system.

Submitted by: shivansh
Reviewed by: asomers, brooks
MFC after: 3 weeks
Sponsored by: Google, Inc (GSoC 2017)
Differential Revision: https://reviews.freebsd.org/D12036

6 years agoFix a mismerge, make sure PRINT_ID_AA64_MMFR2 has a unique value.
andrew [Thu, 7 Sep 2017 16:43:12 +0000 (16:43 +0000)]
Fix a mismerge, make sure PRINT_ID_AA64_MMFR2 has a unique value.

Sponsored by: DARPA, AFRL

6 years agoFix the value of ID_AA64ISAR1_DPB_SHIFT, the field is bits 3:0.
andrew [Thu, 7 Sep 2017 16:12:56 +0000 (16:12 +0000)]
Fix the value of ID_AA64ISAR1_DPB_SHIFT, the field is bits 3:0.

Sponsored by: DARPA, AFRL

6 years agoBe consistent and do return (1);
imp [Thu, 7 Sep 2017 15:46:44 +0000 (15:46 +0000)]
Be consistent and do return (1);

Noticed by: tsoome@
Sponsored by: Netflix

6 years agoAdd the ARMv8.2 ID register additions and use them to decode the register
andrew [Thu, 7 Sep 2017 15:45:56 +0000 (15:45 +0000)]
Add the ARMv8.2 ID register additions and use them to decode the register
values. As not all assemblers understand the new ID_AA64MMFR2_EL1 register
add a macro to access it. This seems to be safe for older CPUs to read this
new register, with them returning zero.

Sponsored by: DARPA, AFRL

6 years agoUppercase the special register names in identcpu to be more consistent with
andrew [Thu, 7 Sep 2017 15:30:13 +0000 (15:30 +0000)]
Uppercase the special register names in identcpu to be more consistent with
the other source files.

Sponsored by: DARPA, AFRL

6 years agoMake the bit mask of ARMv8 ID registers to print sparse to keep values
andrew [Thu, 7 Sep 2017 15:24:47 +0000 (15:24 +0000)]
Make the bit mask of ARMv8 ID registers to print sparse to keep values
close, but without having to change all values when new registers are added.

Sponsored by: DARPA, AFRL

6 years agoAdd more ARM Ltd parts to the list of knows CPUs.
andrew [Thu, 7 Sep 2017 15:02:57 +0000 (15:02 +0000)]
Add more ARM Ltd parts to the list of knows CPUs.

Submitted by: Jon Brawn <jon@brawn.org>

6 years agoHint that the "-o emul" option for ps(1) shows the ABI.
trasz [Thu, 7 Sep 2017 10:56:50 +0000 (10:56 +0000)]
Hint that the "-o emul" option for ps(1) shows the ABI.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoFix armv6 build
imp [Thu, 7 Sep 2017 07:30:24 +0000 (07:30 +0000)]
Fix armv6 build

We need to extend the -Wno-format hack to yet another Makefile to cope
with %S meaning (CHAR16 *) not (wchar_t *) in the context of the EFI
boot loaders.

Sponsored by: Netflix

6 years agoCreate efi utility printing routines
imp [Thu, 7 Sep 2017 07:30:19 +0000 (07:30 +0000)]
Create efi utility printing routines

Split out asciidump, utf8dump, bindump, and hexdump into a separate
file efiutil.c. Implement new efi_print_load_option for printing out
the EFI_LOADER_OPTION data structure used to specify different options
to the UEFI boot manager.

Sponsored by: Netflix

6 years agoImplement efidp_size
imp [Thu, 7 Sep 2017 07:30:14 +0000 (07:30 +0000)]
Implement efidp_size

efidp_size will return the size, in bytes, of a EFI device path
structure. This is a convenience wrapper in the same style as the
other linux routines. It's implemented by GetDevicePathSize from EDK2
we already needed for other things.

Sponsored by: Netflix

6 years agoucs2len
imp [Thu, 7 Sep 2017 07:30:05 +0000 (07:30 +0000)]
ucs2len

Rename boot1's wcslen to ucs2len, which we can't use in userland
because wchar in userland is unsigned, not short. Move it into
efichar.c. Also spell '* 2' as '* sizeof(efi_char)' and add 1 for the
trailing NUL to transition the FreeBSD boot env vars to being NUL
terminated on the same line...

Sponsored by: Netflix

6 years agocam(4): Fix some warnings
cem [Thu, 7 Sep 2017 07:24:22 +0000 (07:24 +0000)]
cam(4): Fix some warnings

When bcopy is treated as memcpy/memmove, Clang produces warnings that the
size argument doesn't match the type of the source.  This is true, it
doesn't match; we're aliasing the source.

Explicitly cast the source pointer to the expected type to remove the
warning.

No functional change.

Sponsored by: Dell EMC Isilon

6 years agoIn the recvmsg32() system call iterate over returned structure(s)
sobomax [Thu, 7 Sep 2017 04:29:57 +0000 (04:29 +0000)]
In the recvmsg32() system call iterate over returned structure(s)
and convert any messages of types SCM_BINTIME, SCM_TIMESTAMP,
SCM_REALTIME and SCM_MONOTONIC from 64-bit to its 32-bit
representation. Otherwise we either run out of user-supplied
buffer to copy those out resulting in the MSG_CTRUNC or simply
return values that the userland 32-bit code is not going
to parse correctly. This fixes at least two regression tests
failing to function properly in 32-bit compat mode:

    tools/regression/sockets/udp_pingpong
    tools/regression/sockets/unix_cmsg

PR:             kern/222039
MFC after: 30 days

6 years agoAdd D definitions for the named values in socket.h
gnn [Thu, 7 Sep 2017 03:05:16 +0000 (03:05 +0000)]
Add D definitions for the named values in socket.h

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

6 years agoAdd a new getty/gettytab capability to generate an initial message dynamically.
dab [Thu, 7 Sep 2017 00:20:17 +0000 (00:20 +0000)]
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.

Reviewed by: vangyzen, wblock, manpages
Approved by: vangyzen (mentor)
MFC after: 1 week
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D12108

6 years agobhnd: Remove unsupported USB core IDs from the bhnd_usb device table.
landonf [Wed, 6 Sep 2017 23:43:20 +0000 (23:43 +0000)]
bhnd: Remove unsupported USB core IDs from the bhnd_usb device table.

This resolves a SoC reset triggered by attempting to attach to the
BCM5365's USB 1.1 controller.

Approved by: adrian (mentor, implicit)

6 years agovxge: plug void casts from memcpy/memzero calls
mjg [Wed, 6 Sep 2017 21:38:07 +0000 (21:38 +0000)]
vxge: plug void casts from memcpy/memzero calls

Most of places using them did not have the cast in the first place.

No functional changes.

MFC after: 1 week

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Wed, 6 Sep 2017 21:21:13 +0000 (21:21 +0000)]
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
MFC after: 1 month
X-MFC-with: r321369

6 years agoSprinkle __read_frequently on few obvious places.
mjg [Wed, 6 Sep 2017 20:33:33 +0000 (20:33 +0000)]
Sprinkle __read_frequently on few obvious places.

Note that some of annotated variables should probably change their types
to something smaller, preferably bit-sized.

6 years agoIntroduce __read_frequently
mjg [Wed, 6 Sep 2017 20:32:49 +0000 (20:32 +0000)]
Introduce __read_frequently

While __read_mostly groups variables together, their placement is not
specified. In particular 2 frequently used variables can end up in
different lines.

This annotation is only expected to be used for variables read all the time,
e.g. on each syscall entry.

MFC after: 1 week

6 years agoStart annotating global _padalign locks with __exclusive_cache_line
mjg [Wed, 6 Sep 2017 20:28:18 +0000 (20:28 +0000)]
Start annotating global _padalign locks with __exclusive_cache_line

While these locks are guarnteed to not share their respective cache lines,
their current placement leaves unnecessary holes in lines which preceeded them.

For instance the annotation of vm_page_queue_free_mtx allows 2 neighbour
cachelines (previously separate by the lock) to be collapsed into 1.

The annotation is only effective on architectures which have it implemented in
their linker script (currently only amd64). Thus locks are not converted to
their not-padaligned variants as to not affect the rest.

MFC after: 1 week

6 years agobnxt: Update firmware header file with the latest one
shurd [Wed, 6 Sep 2017 20:19:30 +0000 (20:19 +0000)]
bnxt: Update firmware header file with the latest one

hsi_struct_def.h file contains all firmware (HWRM) data struct's, updated
that with the latest one which was released on 30'th Aug.

After this upgrade, HWRM version will be 1.8.1.5 (earlier it was 1.4.0).

Submitted by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Reviewed by: shurd, sbruno
Approved by: sbruno (mentor)
Sponsored by: Broadcom Limited
Differential Revision: https://reviews.freebsd.org/D12203

6 years agobnxt: Use correct firmware call for number of queues supported
shurd [Wed, 6 Sep 2017 20:14:34 +0000 (20:14 +0000)]
bnxt: Use correct firmware call for number of queues supported

1) Based on the suggestion from firmware team, derive
   scctx->isc_ntxqsets_max & scctx->isc_nrxqsets_max based on FUNC_QCFG
   (instead of FUNC_QCAPS).
2) Bump-up driver version to "1.0.0.2".

Submitted by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Reviewed by: shurd, sbruno
Approved by: sbruno (mentor)
Sponsored by: Broadcom Limited
Differential Revision: https://reviews.freebsd.org/D12128

6 years agoSkylake server core PMC support for hwpmc(4).
kib [Wed, 6 Sep 2017 17:19:48 +0000 (17:19 +0000)]
Skylake server core PMC support for hwpmc(4).

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Hardware provided by: Intel
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12221

6 years agoMinor style changes to make forthcoming code stand out less.
kib [Wed, 6 Sep 2017 17:14:23 +0000 (17:14 +0000)]
Minor style changes to make forthcoming code stand out less.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12221

6 years agoMake ps(1) flag processes in capsicum(4) capability mode with "C".
trasz [Wed, 6 Sep 2017 16:34:42 +0000 (16:34 +0000)]
Make ps(1) flag processes in capsicum(4) capability mode with "C".

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoAvoid keeping a dangling pointer when the mappings array is resized.
markj [Wed, 6 Sep 2017 16:24:34 +0000 (16:24 +0000)]
Avoid keeping a dangling pointer when the mappings array is resized.

Sponsored by: Dell EMC Isilon

6 years agoDo not leak empty swblk.
kib [Wed, 6 Sep 2017 16:18:53 +0000 (16:18 +0000)]
Do not leak empty swblk.

In swp_pager_meta_build(), if the requested operation results in
freeing the last swap pointer in the swblk, free the trie node.  Other
swap pager code does not expect to find completely empty swblk.

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoReflect realtime and idle priorities in ps(1) state flags, same like
trasz [Wed, 6 Sep 2017 16:18:06 +0000 (16:18 +0000)]
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
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoIn swp_pager_meta_build(), handle a race with other thread allocating
kib [Wed, 6 Sep 2017 16:16:11 +0000 (16:16 +0000)]
In swp_pager_meta_build(), handle a race with other thread allocating
swapblk for our index while we dropped the object lock.

Noted by: jeff
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAdd myself and mentorship status to committers files
shurd [Wed, 6 Sep 2017 15:07:53 +0000 (15:07 +0000)]
Add myself and mentorship status to committers files

I failed to do this when I got my ports bit, so do them both in one commit.

Reviewed by: sbruno (mentor)
Differential Revision: https://reviews.freebsd.org/D12226

6 years agoMake LACP based lagg work with interfaces (like 100Gbps and 25Gbps) that
np [Wed, 6 Sep 2017 14:36:35 +0000 (14:36 +0000)]
Make LACP based lagg work with interfaces (like 100Gbps and 25Gbps) that
report extended media types.

lacp_aggregator_bandwidth() uses the media to determine the speed of the
interface and returns 0 for IFM_OTHER without the bits in the extended
range.

Reported by: kbowling@
Reviewed by: eugen_grosbein.net, mjoras@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D12188

6 years agoAdd new USB quirk.
hselasky [Wed, 6 Sep 2017 13:59:57 +0000 (13:59 +0000)]
Add new USB quirk.

PR: 221775
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd support for generic backpressure indicator for ratelimited
hselasky [Wed, 6 Sep 2017 13:56:18 +0000 (13:56 +0000)]
Add support for generic backpressure indicator for ratelimited
transmit queues aswell as non-ratelimited ones.

Add the required structure bits in order to support a backpressure
indication with ratelimited connections aswell as non-ratelimited
ones. The backpressure indicator is a value between zero and 65535
inclusivly, indicating if the destination transmit queue is empty or
full respectivly. Applications can use this value as a decision point
for when to stop transmitting data to avoid endless ENOBUFS error
codes upon transmitting an mbuf. This indicator is also useful to
reduce the latency for ratelimited queues.

Reviewed by: gallatin, kib, gnn
Differential Revision: https://reviews.freebsd.org/D11518
Sponsored by: Mellanox Technologies

6 years agoFix typos. Stop claiming that two children are created.
kib [Wed, 6 Sep 2017 11:47:59 +0000 (11:47 +0000)]
Fix typos.  Stop claiming that two children are created.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoCheckpoint the next phase in debug message cleanup, this time focusing on
scottl [Wed, 6 Sep 2017 09:19:54 +0000 (09:19 +0000)]
Checkpoint the next phase in debug message cleanup, this time focusing on
error recovery messages.

Sponsored by: Netflix