]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agopatch(1): Exit successfully if we're fed a 0-length patch
kevans [Fri, 1 Mar 2019 01:20:21 +0000 (01:20 +0000)]
patch(1): Exit successfully if we're fed a 0-length patch

This change is made in the name of GNU patch compatibility. If GNU patch is
fed a zero-length patch, it will exit successfully with no output. This is
used in at least one port to date (comms/wsjtx), and we break on this usage.

It seems unlikely that anyone relies on patch(1) calling their completely
empty patch garbage and failing, and GNU compatibility is a plus if it helps
with porting, so make the switch.

Reported by: db
MFC after: 2 weeks

5 years agoPrevent detaching driver if the attach is not finished
mw [Fri, 1 Mar 2019 01:18:39 +0000 (01:18 +0000)]
Prevent detaching driver if the attach is not finished

When the device is in attaching state, detach should return
EBUSY instead of success. In other case, there could be race
between attach and detach during the driver unloading.

If driver goes sleep and releases GIANT lock during attaching,
unloading module could start. In such case when attach continues
after module unload, page fault "supervisor read instruction,
page not present" occurred.

This patch works around the real issue, which is a locking
deficiency of the busses.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: imp
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D19375

5 years agoGEOM: Add fdt_slicer to the GEOM flashmap module for fdt-based platforms
jhibbits [Thu, 28 Feb 2019 23:00:47 +0000 (23:00 +0000)]
GEOM: Add fdt_slicer to the GEOM flashmap module for fdt-based platforms

geom_flashmap depends on a slicer being available in order to do any
work.  On fdt platforms this is provided by fdt_slicer, but this needs
to be available.  Often it's compiled into the kernel for platforms that
boot from the relevant media, but this is not always the case.  Add the
file to the geom_flashmap module so that it can be used on platforms
which don't always need this functionality available.

5 years agoDon't assume all children of a nexus are ports.
jhb [Thu, 28 Feb 2019 22:10:19 +0000 (22:10 +0000)]
Don't assume all children of a nexus are ports.

Specifically, ccr(4) devices are also children of cxgbe nexus devices.
Rather than making assumptions about the child device's softc, walk
the list of ports from the nexus' softc to determine if a child is a
port in t4_child_location_str().  This fixes a panic when detaching a
ccr device.

Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D19399

5 years agoAllow FIONBIO and FIOASYNC ioctls on POSIX shm descriptors.
markj [Thu, 28 Feb 2019 22:00:36 +0000 (22:00 +0000)]
Allow FIONBIO and FIOASYNC ioctls on POSIX shm descriptors.

They have no effect, as with filesystem file descriptors.
This improves compatibility with some existing userspace code.

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19330

5 years agoLimit 24xx adapters to only MSI interrupts by default.
mav [Thu, 28 Feb 2019 21:07:16 +0000 (21:07 +0000)]
Limit 24xx adapters to only MSI interrupts by default.

This was actually the known good configuration we used before.
Single MSI-X configuration doesn't even work there on my tests, just due
to lack of documentation not sure whether by design or I am doing something
wrong.

PR: 233654
MFC after: 1 week

5 years agobsd.nls.mk isn't optional.
bdrewery [Thu, 28 Feb 2019 20:48:18 +0000 (20:48 +0000)]
bsd.nls.mk isn't optional.

It is protected by MK_NLS.  If it should really be optional then
it needs to be documented as such in share/mk/bsd.README and
.sinclude used where needed.

This fixes a regression from r335011.

PR: 232527
Submitted by: jarrod@downtools.com.au
Reported by: ktullavik@gmail.com
MFC after: 3 days

5 years agoGrammar tweaks in ipfw manual page.
trhodes [Thu, 28 Feb 2019 20:43:03 +0000 (20:43 +0000)]
Grammar tweaks in ipfw manual page.

5 years agoInvalidate cache for the PDPTE page when using PAE paging but PAT is
kib [Thu, 28 Feb 2019 19:19:02 +0000 (19:19 +0000)]
Invalidate cache for the PDPTE page when using PAE paging but PAT is
not supported.

According to SDM rev. 69 vol. 3, for PDPTE registers loads:
- when PAT is not supported, access to the PDPTE page is performed as
  UC, see 4.9.1;
- when PAT is supported, the access is WB, see 4.9.2.

So potentially CPU might load stale memory as PDPTEs if both PAT and
self-snoop are not implemented.  To be safe, add total local cache
flush to pmap_cold() before initial load of cr3, and flush PDPTE page
in pmap_pinit(), if PAT is not implemented.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19365

5 years agoRemove references to pdwait4(2) and `CAP_PDWAIT` from rights(4)
ngie [Thu, 28 Feb 2019 18:12:14 +0000 (18:12 +0000)]
Remove references to pdwait4(2) and `CAP_PDWAIT` from rights(4)

@cem removed references to pdwait4(2) (a nonexistent syscall) in
r320058.

This change removes references to pdwait4(2) and `CAP_PDWAIT` in
rights(4) to not mislead the user into thinking that pdwait4(2)/`CAP_PDWAIT` is
actually implemented in the stock FreeBSD kernel.

The goal of this functionality was to simplify monitoring/manipulating
processes started with `pdfork`, et al, and avoid races with waiting on pids.
The syscall was never completed though--just discussed on the capsicum mailing
list back in 2015:
https://lists.cam.ac.uk/pipermail/cl-capsicum-discuss/2015-May/msg00012.html
. That being said, there are members of the project (@rwatson, etc) who
have longterm goals to implement this syscall to better secure pdfork(2)
calls.

PR: 235871
Reviewed by: emaste
Discussed with: rwatson
Approved by: emaste (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18950

5 years agoLimit 24xx adapters to only one MSI-X interrupt by default.
mav [Thu, 28 Feb 2019 15:36:03 +0000 (15:36 +0000)]
Limit 24xx adapters to only one MSI-X interrupt by default.

These are 4Gb/s and pretty old and slow now, so I see no reason to fight
for their performance over stability.

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

5 years agoAdd to isp(4) tunables to limit MSI/MSI-X usage.
mav [Thu, 28 Feb 2019 15:24:00 +0000 (15:24 +0000)]
Add to isp(4) tunables to limit MSI/MSI-X usage.

There are some problem reports possibly related to the new driver use of
multiple interrupts on older cards.  Hopefully this allow to workaround
them.

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

5 years agoAdd the hw.ncpu tunable to arm64.
andrew [Thu, 28 Feb 2019 14:40:43 +0000 (14:40 +0000)]
Add the hw.ncpu tunable to arm64.

This allows us to limit the number of CPUs to use, e.g. to debug problems
seen when enabling multiple clusters.

Reviewed by: manu
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19404

5 years agotruss: Add support for fsync(2) and fdatasync(2).
tmunro [Thu, 28 Feb 2019 09:13:41 +0000 (09:13 +0000)]
truss: Add support for fsync(2) and fdatasync(2).

The default handling showed the argument as hex.  Add explicit handling so
we can show it as decimal, since that's how we show file descriptors
everywhere else.

Approved by: mjg (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19295

5 years agocxgbe(4): Request high priority filter support explicitly, as required
np [Thu, 28 Feb 2019 05:45:14 +0000 (05:45 +0000)]
cxgbe(4): Request high priority filter support explicitly, as required
by recent firmwares.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoAdd SPDX tag.
imp [Thu, 28 Feb 2019 02:29:48 +0000 (02:29 +0000)]
Add SPDX tag.

5 years agoRename seq to seqc to avoid namespace clashes with Linux
mjg [Wed, 27 Feb 2019 22:56:55 +0000 (22:56 +0000)]
Rename seq to seqc to avoid namespace clashes with Linux

Linux generates the content of procfs files using a mechanism prefixed with
seq_*. This in particular came up with recent gcov import.

Sponsored by: The FreeBSD Foundation

5 years agovm: remove seq.h inclusion made obsolete by NUMA rewrite
mjg [Wed, 27 Feb 2019 22:42:29 +0000 (22:42 +0000)]
vm: remove seq.h inclusion made obsolete by NUMA rewrite

Sponsored by: The FreeBSD Foundation

5 years agoixgbe(4): Fix panic triggered by assertion from interrupt
erj [Wed, 27 Feb 2019 22:26:18 +0000 (22:26 +0000)]
ixgbe(4): Fix panic triggered by assertion from interrupt

r344162 exposed a bug in one of ixgbe's interrupt filters; they are never
supposed to return 0. Fix the interrupt filter to return the proper nonzero
return value.

Reported by: Oleg Ginzburg <olevole@olevole.ru>
MFC after: 1 week
Sponsored by: Intel Corporation

5 years agoUnconditionally support unmapped BIOs. This was another shim for
imp [Wed, 27 Feb 2019 22:16:59 +0000 (22:16 +0000)]
Unconditionally support unmapped BIOs. This was another shim for
supporting older kernels. However, all supported versions of FreeBSD
have unmapped I/Os (as do several that have gone EOL), remove it. It's
unlikely the driver would work on the older kernels anyway at this
point.

5 years agoRemove #ifdef code to support FreeBSD versions that haven't been
imp [Wed, 27 Feb 2019 22:05:01 +0000 (22:05 +0000)]
Remove #ifdef code to support FreeBSD versions that haven't been
supported in years. A number of changes have been made to the driver
that likely wouldn't work on those older versions that aren't properly
ifdef'd and it's project policy to GC such code once it is stale.

5 years agoFix armv6/armv7 build after the move from xhci_mv to generic_xhci
manu [Wed, 27 Feb 2019 22:01:39 +0000 (22:01 +0000)]
Fix armv6/armv7 build after the move from xhci_mv to generic_xhci

5 years agoRemove empty directories.
imp [Wed, 27 Feb 2019 21:52:08 +0000 (21:52 +0000)]
Remove empty directories.

5 years agoRefactor command ordering/blocking mechanism in CTL.
mav [Wed, 27 Feb 2019 21:29:21 +0000 (21:29 +0000)]
Refactor command ordering/blocking mechanism in CTL.

Replace long per-LUN queue of blocked commands, scanned on each command
completion and sometimes even twice, causing up to O(n^^2) processing cost,
by much shorter per-command blocked queues, scanned only when respective
command completes, and check only commands before the previous blocker,
reducing cost to O(n).

While there, unblock aborted commands to make them "complete" ASAP to be
removed from the OOA queue and so not waste time ordering other commands
against them.  Aborted commands that were not sent to execution yet should
have no visible side effects, so this is safe and easy optimization now,
comparing to commands already in processing, which are a still pain.

Together those two optimizations should fix quite pathological case, when
due to backend slowness CTL accumulated many thousands of blocked requests,
partially aborted by initiator and so supposedly not even existing, but
still wasting CTL CPU time.

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

5 years agodrm: Remove empty directories
manu [Wed, 27 Feb 2019 21:11:13 +0000 (21:11 +0000)]
drm: Remove empty directories

Discussed with:   imp

5 years agoxhci_mv: Move the driver to generic_xhci
manu [Wed, 27 Feb 2019 21:04:40 +0000 (21:04 +0000)]
xhci_mv: Move the driver to generic_xhci

Marvell XHCI is in fact generic-xhci, so move the driver and
add the compatible string.
While here, get and enable the phy if the dtb provide one.
The xhci bindings state that phys should be in a 'phys' property but
Marvell DTS uses 'usb-phy', only add support for 'usb-phy' for now.

Sponsored-by: Rubicon Communications, LCC ("Netgate")
5 years agousb_nop_xceiv: Add support for this pseudo device
manu [Wed, 27 Feb 2019 20:52:35 +0000 (20:52 +0000)]
usb_nop_xceiv: Add support for this pseudo device

This is a "fake" phy that handle regulator, clocks and reset gpio.
Only clock and regulator is supported for now.

Sponsored-by: Rubicon Communications, LCC ("Netgate")
5 years agoVarious cleanups to the management of multiple TCP stacks.
jhb [Wed, 27 Feb 2019 20:24:23 +0000 (20:24 +0000)]
Various cleanups to the management of multiple TCP stacks.

- Use strlcpy() with sizeof() instead of strncpy().

- Simplify initialization of TCP functions structures.

  init_tcp_functions() was already called before the first call to
  register a stack.  Just inline the work in the SYSINIT and remove
  the racy helper variable.  Instead, KASSERT that the rw lock is
  initialized when registering a stack.

- Protect the default stack via a direct pointer comparison.

  The default stack uses the name "freebsd" instead of "default" so
  this protection wasn't working for the default stack anyway.

Reviewed by: rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19152

5 years agoUpdate review requests for bhyve.
jhb [Wed, 27 Feb 2019 20:09:58 +0000 (20:09 +0000)]
Update review requests for bhyve.

- Explicitly mention the #bhyve group on Phabricator.
- Request reviews of the userland components (libvmmapi, bhyve,
  bhyvectl, and bhyveload).

Reviewed by: imp, rgrimes
Differential Revision: https://reviews.freebsd.org/D17848

5 years agoHave cryptocheck toggle kern.cryptodevallowsoft if necessary (this
sef [Wed, 27 Feb 2019 19:27:16 +0000 (19:27 +0000)]
Have cryptocheck toggle kern.cryptodevallowsoft if necessary (this
requires root access).

Reviewed by: cem, jhb
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D19372

5 years agortsol: Use vwarnx(3) to log messages to standard error.
markj [Wed, 27 Feb 2019 18:13:41 +0000 (18:13 +0000)]
rtsol: Use vwarnx(3) to log messages to standard error.

This ensures that the program name is included in the output, which
makes it easy to identify the source of error messages printed
during boot.

MFC after: 1 week

5 years agopoll.2: POLLNVAL is returned also for insufficient rights
emaste [Wed, 27 Feb 2019 17:52:22 +0000 (17:52 +0000)]
poll.2: POLLNVAL is returned also for insufficient rights

Reported by: "Bora Ã–zarslan" <borako.ozarslan@gmail.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agommc: dwmmc: Match on "rockchip,rk3288-dw-mshc" compatible
manu [Wed, 27 Feb 2019 17:30:28 +0000 (17:30 +0000)]
mmc: dwmmc: Match on "rockchip,rk3288-dw-mshc" compatible

This is the common denominator for rockchip compatible from RK3288 to RK3399.
The other compatible are generally present in the DTS but the controllers
are the same.

MFC after: 1 week

5 years agoarm64: rockchip: rk3399_clk: Add sd clock definitions
manu [Wed, 27 Feb 2019 17:29:38 +0000 (17:29 +0000)]
arm64: rockchip: rk3399_clk: Add sd clock definitions

MFC after: 1 week

5 years agoarm64: rockchip: clk_pll: Multiple improvement
manu [Wed, 27 Feb 2019 14:20:28 +0000 (14:20 +0000)]
arm64: rockchip: clk_pll: Multiple improvement

Remove the mode_val from the clock definition as it's a bit unreadable.
Use mode_shift to represent which bit control the mode in the register.
Simplify some case where we can avoid a register read before changing it.
Set the PLL back to normal mode after the PLL have stabilized.

Discussed with:  mmel
MFC after: 1 week

5 years agoFix a regression introduced in r344569
bapt [Wed, 27 Feb 2019 13:49:41 +0000 (13:49 +0000)]
Fix a regression introduced in r344569

Import a fix from illumos (thanks Toomas Soomas for pointing at it)

See https://www.illumos.org/issues/10205 for more details
Illumos commit: https://github.com/illumos/illumos-gate/commit/247b7da039fd88350c50e3d7fef15bdab6bef215

Submitted by: jack@gandi.net
Reported by: cy
Reviewed by: tsoome, cy, bapt
Obtained from: Illumos

5 years agoFix kldxref on PowerPC64
luporl [Wed, 27 Feb 2019 13:24:42 +0000 (13:24 +0000)]
Fix kldxref on PowerPC64

When using kldxref on kernel modules built with clang8 + lld8,
kldxref would be unable to find the modules metadata information,
because PowerPC64 was using the ef_nop.c implementation of
ef_reloc().

When GNU LD was used, it was also relocating the metadata section of
the .ko file. LLD does not do this, but only generate dynamic
relocations for it. With minor changes, ef_powerpc.c can now work
for PowerPC64 too.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D19370

5 years agoFix regression introduced in r344569
bapt [Wed, 27 Feb 2019 07:55:53 +0000 (07:55 +0000)]
Fix regression introduced in r344569

Reported by: cy
Tested by: cy
Submitted by: Fatih Acar <fatih@gandi.net>

5 years agolibcxgb4: Don't spam stderr. Write combining is not enabled by default
np [Wed, 27 Feb 2019 06:50:24 +0000 (06:50 +0000)]
libcxgb4: Don't spam stderr.  Write combining is not enabled by default
by the FreeBSD driver.

5 years agoAdd support to fdt_slicer for the new style partition data documented in
ian [Wed, 27 Feb 2019 04:58:18 +0000 (04:58 +0000)]
Add support to fdt_slicer for the new style partition data documented in
devicetree/bindings/mtd/partition.txt.

In the old style, all the children of the device node which did not have a
compatible property were the partitions.  In the new style, there is a child
node of the device which has a compatible string of "fixed-partitions", and
its children are the individual partitions.

Also, support the read-only property by setting the corresponding slice flag.

5 years agoChild nodes with a compatible property are not slices, according to the
ian [Wed, 27 Feb 2019 04:19:29 +0000 (04:19 +0000)]
Child nodes with a compatible property are not slices, according to the
devicetree/bindings/mtd/partitions.txt document, so just ignore them.

5 years agoRename some functions and variables to have shorter names, which allows
ian [Wed, 27 Feb 2019 04:16:32 +0000 (04:16 +0000)]
Rename some functions and variables to have shorter names, which allows
unwrapping multiple lines of code.  Also, convert some short multiline
comments into single-line comments.  Change old-school FALSE to false.

All in all, no functional changes, it's just more compact and readable.

5 years agopowerpc/mpc85xx: Synchronize timebase the platform correct way
jhibbits [Wed, 27 Feb 2019 03:30:49 +0000 (03:30 +0000)]
powerpc/mpc85xx: Synchronize timebase the platform correct way

Summary:
To safely synchronize timebase we need to disable the timebase on all
cores, set timebase, and resynchronize.  This adds two new devices, mutually
exclusive, which attach on the SoC simplebus, to freeze and unfreeze the
timebase.  The devices are singletons, and platform-specific, so no reason
to make them optional and in separate files.

This was found to be necessary for top(1) to work correctly on an AmigaOne
X5000 (P5020 SoC).  It also fixes bufdaemon and bufspacedaemon hangs at
shutdown.

Test Plan: Regression test on various Book-E hardware.

Reviewed by: nwhitehorn
Tested by: Brandon Bergren (git_bdragon.rtk0.net)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19208

5 years agoAdd a module dependency on fdt_slicer. Also, move the PNP_INFO to its more
ian [Tue, 26 Feb 2019 22:52:41 +0000 (22:52 +0000)]
Add a module dependency on fdt_slicer.  Also, move the PNP_INFO to its more
usual location, down near the DRIVER_MODULE() stuff.

5 years agoAdd a module dependency on fdt_slicer.
ian [Tue, 26 Feb 2019 22:52:08 +0000 (22:52 +0000)]
Add a module dependency on fdt_slicer.

5 years agoAdd manpages for at45d(4) and mx25l(4).
ian [Tue, 26 Feb 2019 22:50:01 +0000 (22:50 +0000)]
Add manpages for at45d(4) and mx25l(4).

5 years agoMake it possible to load fdt_slicer as a module (unloading works too fwiw).
ian [Tue, 26 Feb 2019 22:34:29 +0000 (22:34 +0000)]
Make it possible to load fdt_slicer as a module (unloading works too fwiw).

5 years agoUpdate a comment to reflect reality; no functional changes.
ian [Tue, 26 Feb 2019 22:07:59 +0000 (22:07 +0000)]
Update a comment to reflect reality; no functional changes.

5 years agoCompile fdt_slicer and geom_flashmap when the at45d device is included.
ian [Tue, 26 Feb 2019 22:06:25 +0000 (22:06 +0000)]
Compile fdt_slicer and geom_flashmap when the at45d device is included.

5 years agoAdd support for geom_flashmap by providing a getattr() for "SPI:device".
ian [Tue, 26 Feb 2019 20:50:49 +0000 (20:50 +0000)]
Add support for geom_flashmap by providing a getattr() for "SPI:device".

5 years agoModularize xz.
kib [Tue, 26 Feb 2019 19:55:03 +0000 (19:55 +0000)]
Modularize xz.

Embedded lzma decompression library becomes a module usable by other
consumers, in addition to geom_uzip.

Most important code changes are
- removal of XZ_DEC_SINGLE define, we need the code to work
  with XZ_DEC_DYNALLOC;
- xz_crc32_init() call is removed from geom_uzip, xz module handles
  initialization on its own.

xz is no longer embedded into geom_uzip, instead the depend line for
the module is provided, and corresponding kernel option is added to
each MIPS kernel config file using geom_uzip.

The commit also carries unrelated cleanup by removing excess "device geom_uzip"
in places which were missed in r344479.

Reviewed by: cem, hselasky, ray, slavash (previous versions)
Sponsored by: Mellanox Technologies
Differential revision: https://reviews.freebsd.org/D19266
MFC after: 3 weeks

5 years agoMerge OpenSSL 1.1.1b.
jkim [Tue, 26 Feb 2019 19:31:33 +0000 (19:31 +0000)]
Merge OpenSSL 1.1.1b.

5 years agoSet process title during zfs send.
sef [Tue, 26 Feb 2019 19:23:22 +0000 (19:23 +0000)]
Set process title during zfs send.

This adds a '-V' option to 'zfs send', which sets the process title once a
second to the progress information.

This code has been in FreeNAS for a long time now; this is just upstreaming
it here.  It was originially written by delphij.

Reviewed by: mav
Obtained from: iXsystems, Inc
Sponsored by: iXsystems, Inc
Differential Revision: https://reviews.freebsd.org/D19184

5 years agoAdd a missing return statement to g_concat_kernel_dump().
markj [Tue, 26 Feb 2019 18:30:51 +0000 (18:30 +0000)]
Add a missing return statement to g_concat_kernel_dump().

The error occurs when upper layers attempt an out-of-bounds write.

Submitted by: Noah Bergbauer <noah.bergbauer@tum.de>
MFC after: 1 week

5 years agoFix fasttrap_sig{trap,segv}().
markj [Tue, 26 Feb 2019 18:20:41 +0000 (18:20 +0000)]
Fix fasttrap_sig{trap,segv}().

- Don't leak the ksiginfo structure.
- Hold the proc lock when sending a signal in fasttrap_sigsegv().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoproccontrol(1) man page.
kib [Tue, 26 Feb 2019 17:46:19 +0000 (17:46 +0000)]
proccontrol(1) man page.

Reviewed by: 0mp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D19308

5 years agoprocctl(2): document ASLR knobs.
kib [Tue, 26 Feb 2019 17:41:41 +0000 (17:41 +0000)]
procctl(2): document ASLR knobs.

Reviewed by: 0mp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D19308

5 years agoprocctl(2): fix -width parameter to .Bl.
kib [Tue, 26 Feb 2019 17:35:06 +0000 (17:35 +0000)]
procctl(2): fix -width parameter to .Bl.

According to 0mp, macros are not expanded in the argument provided to
-width.  Use plain identifiers for width specification.

Noted and reviewed by: 0mp
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D19308

5 years agoRevert r344587.
markj [Tue, 26 Feb 2019 17:33:56 +0000 (17:33 +0000)]
Revert r344587.

The fasttrap_isa.h header is needed by libdtrace, not just the kernel.

5 years agoarm64: rockchip: rk3399_pll: Fix copy paste
manu [Tue, 26 Feb 2019 17:20:03 +0000 (17:20 +0000)]
arm64: rockchip: rk3399_pll: Fix copy paste

RK3399 PLLs don't have mode_reg, use the correct register.

MFC after: 1 week

5 years agoarm64: rockchip: rk3399_pll: Switch to slow mode when changing the freq
manu [Tue, 26 Feb 2019 17:08:51 +0000 (17:08 +0000)]
arm64: rockchip: rk3399_pll: Switch to slow mode when changing the freq

Like r344578 but for RK3399.
This solve some hangs when switching between frequency.

MFC after: 1 week

5 years agoRemove illumos-specific code from the x86 fasttrap_isa.c.
markj [Tue, 26 Feb 2019 16:34:43 +0000 (16:34 +0000)]
Remove illumos-specific code from the x86 fasttrap_isa.c.

The file has not been touched upstream in over a decade, and the nature
of the code means that a lot of FreeBSD-specific bits are required.  Remove
the dead code to improve readability.  No functional change intended.

Discussed with: cem
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoRemove stub fasttrap implementations.
markj [Tue, 26 Feb 2019 16:31:47 +0000 (16:31 +0000)]
Remove stub fasttrap implementations.

No platforms except i386, amd64 and powerpc implement fasttrap; the
fasttrap files for other arches do not contain any code and bloat
the output from cscope, so just remove them.

MFC after: 1 week

5 years agoScrap some debug printf's, unused for years.
mav [Tue, 26 Feb 2019 16:05:33 +0000 (16:05 +0000)]
Scrap some debug printf's, unused for years.

MFC after: 2 weeks

5 years agoarm64: rockchip: rk_pinctrl: Fix two banks in RK3328
manu [Tue, 26 Feb 2019 15:29:16 +0000 (15:29 +0000)]
arm64: rockchip: rk_pinctrl: Fix two banks in RK3328

The last two banks don't have 3 bits for the pin function but only 2.
This fixes eMMC on the Rock64.

MFC after: 1 week

5 years ago arm64: rockchip: rk805: Map the regulator
manu [Tue, 26 Feb 2019 13:18:14 +0000 (13:18 +0000)]
 arm64: rockchip: rk805: Map the regulator

No map function was provided before so every regulator lookup resolved
the regulator with id 1, as it uses the default mapper, which is wrong.
Correctly map the regulators.
While here remove some debug printfs and make them disable by default.

MFC after: 1 week

5 years agoarm64: rockchip: rk805: Add LDO regulators
manu [Tue, 26 Feb 2019 13:17:09 +0000 (13:17 +0000)]
arm64: rockchip: rk805: Add LDO regulators

Add the 3 LDO regulator found in the RK805 Power Management IC.

MFC after: 1 week

5 years agoarm64: rockchip: rk3328_pll: Multiple improvement
manu [Tue, 26 Feb 2019 13:16:05 +0000 (13:16 +0000)]
arm64: rockchip: rk3328_pll: Multiple improvement

RockChip clocks register have a write mask in the upper 16 bits, if a 1
is present the corresponding bit in the lower 16 ones is set.
Use this instead of always setting the mask to 0xFFFF0000.
This avoids a read of the register.
While here, when switching PLL frequency, first switch it to slow mode.
When set to slow mode the PLL clock will be the external oscillator.
Changing the PLL parameters while its output is used can cause hang (sometimes).

MFC after: 1 week

5 years agoarm64: rockchip: clk: ARM CLK improvement
manu [Tue, 26 Feb 2019 13:15:31 +0000 (13:15 +0000)]
arm64: rockchip: clk: ARM CLK improvement

RockChip clocks register have a write mask in the upper 16 bits, if a 1
is present the corresponding bit in the lower 16 ones is set.
Use this instead of always setting the mask to 0xFFFF0000.
This avoids a read of the register.
While here set the parent after changing its freqeuncy, this reduce the time
between changing the parent and changing the divider for the arm clock.

MFC after: 1 week

5 years agoarm64: rockchip: clk: rk_clk_composite: Properly use the mask bits
manu [Tue, 26 Feb 2019 13:14:49 +0000 (13:14 +0000)]
arm64: rockchip: clk: rk_clk_composite: Properly use the mask bits

RockChip clocks register have a write mask in the upper 16 bits, if a 1
is present the corresponding bit in the lower 16 ones is set.
Use this instead of always setting the mask to 0xFFFF0000.
This avoids a read of the register.
While here add some debug printf useful for debuging clock problems

MFC after: 1 week

5 years agoi386 PAE: avoid atomic for pte_store() where possible.
kib [Tue, 26 Feb 2019 09:45:44 +0000 (09:45 +0000)]
i386 PAE: avoid atomic for pte_store() where possible.

Instead carefully write upper word, and only than the lower word with
PG_V, for previously invalid ptes.  It provides some measurable system
time saving on buildworld.

Reviewed by: markj
Tested by: pho
Measured by: bde (early version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D19226

5 years agoAttempt to fix build breakage in r344458.
bde [Tue, 26 Feb 2019 09:44:10 +0000 (09:44 +0000)]
Attempt to fix build breakage in r344458.

Non-x86 arches use an inconsistently named header for the file containing
"pc" attributes, and the ifdef messes to include the right header were out
of date in the 2 files that I added to the MI files list.

Only amd64, arm, i386, mips, powerpc and sparc64 are supposed to support
syscons.  Only arm and mips were out of date in the ifdef.  Test
coverage for of syscons in arm is broken (turned off) in NOTES, but
syscons is in some other arm config files which universe detects as broken.
arm64 and riscv remain broken due to the opposite bug of not turning off
sc in NOTES, the same as before r344458 (see r344443).

The header is MD to contain possibly-non-"pc" encodings of attributes, but
since the attributes are essentially virtual in graphics mode and non-x86
arches only support graphics mode, the header has always been the same on
all arches except for different style bugs, so there should be only 1 MI
copy of it for syscons' use.  It was used in pcvt and still gives an an
API and an ABI, so it should be public and MI near or in sys/consio.h.

5 years agosysrc.8: Pet igor and mandoc
0mp [Tue, 26 Feb 2019 09:28:10 +0000 (09:28 +0000)]
sysrc.8: Pet igor and mandoc

Reviewed by: bcr
Approved by: bcr (doc)
Approved by: krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D19348

5 years agoImplement parallel mounting for ZFS filesystem
bapt [Tue, 26 Feb 2019 08:18:34 +0000 (08:18 +0000)]
Implement parallel mounting for ZFS filesystem

It was first implemented on Illumos and then ported to ZoL.
This patch is a port to FreeBSD of the ZoL version.
This patch also includes a fix for a race condition that was amended

With such patch Delphix has seen a huge decrease in latency of the mount phase
(https://github.com/openzfs/openzfs/commit/a3f0e2b569 for details).
With that current change Gandi has measured improvments that are on par with
those reported by Delphix.

Zol commits incorporated:
https://github.com/zfsonlinux/zfs/commit/a10d50f999511d304f910852c7825c70c9c9e303
https://github.com/zfsonlinux/zfs/commit/e63ac16d25fbe991a356489c86d4077567dfea21

Reviewed by: avg, sef
Approved by: avg, sef
Obtained from: ZoL
MFC after: 1 month
Relnotes: yes
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D19098

5 years agoEnable veriexec for loader
sjg [Tue, 26 Feb 2019 06:22:10 +0000 (06:22 +0000)]
Enable veriexec for loader

This relies on libbearssl and libsecureboot
to verify files read by loader in a maner equivalent
to how mac_veriexec

Note: disabled by default.
Use is initially expected to be by embeded vendors

Reviewed by: emaste, imp
Sponsored by: Juniper Networks
Differential Revision: D16336

5 years agoAdd verifying manifest loader for mac_veriexec
sjg [Tue, 26 Feb 2019 06:17:23 +0000 (06:17 +0000)]
Add verifying manifest loader for mac_veriexec

This tool will verify a signed manifest and load contents into
mac_veriexec for storage

Sponsored by: Juniper Networks
Differential Revision: D16575

5 years agoEnable build of libbearssl
sjg [Tue, 26 Feb 2019 06:11:01 +0000 (06:11 +0000)]
Enable build of libbearssl

Reviewed by: emaste
Sponsored by: Juniper Networks
Differential Revision: D16337

5 years agoAdd libsecureboot
sjg [Tue, 26 Feb 2019 06:09:10 +0000 (06:09 +0000)]
Add libsecureboot

Used by loader and veriexec
Depends on libbearssl

Reviewed by: emaste
Sponsored by: Juniper Networks
Differential Revision: D16335

5 years agoAdd libbearssl
sjg [Tue, 26 Feb 2019 05:59:22 +0000 (05:59 +0000)]
Add libbearssl

Disabled by default, used by loader and sbin/veriexec

Reviewed by: emaste
Sponsored by: Juniper Networks
Differential Revision: D16334

5 years agoFFS: allow sendfile(2) to work with block sizes greater than the page size
jah [Tue, 26 Feb 2019 04:56:10 +0000 (04:56 +0000)]
FFS: allow sendfile(2) to work with block sizes greater than the page size

Implement ffs_getpages_async(), which when possible calls the asynchronous
flavor of the generic pager's getpages function. When the underlying
block size is larger than the system page size, however, it will invoke
the (synchronous) buffer cache pager, followed by a call to the client
completion routine. This retains true asynchronous completion in the most
common (block size <= page size) case, which is important for the performance
of the new sendfile(2). The behavior in the larger block size case mirrors
the default implementation of VOP_GETPAGES_ASYNC, which most other
filesystems use anyway as they do not override the getpages_async method.

PR: 235708
Reported by: pho
Reviewed by: kib, glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19340

5 years agoFix incorrect assertion in vnode_pager_generic_getpages()
jah [Tue, 26 Feb 2019 04:50:46 +0000 (04:50 +0000)]
Fix incorrect assertion in vnode_pager_generic_getpages()

Reviewed by: kib, glebius
MFC after: 1 week

5 years agostand: Remove unused i386 EFI MD bits
kevans [Tue, 26 Feb 2019 03:37:12 +0000 (03:37 +0000)]
stand: Remove unused i386 EFI MD bits

r328169 removed the copy of bootinfo that would've made this somewhat
functional. However, this is irrelevant- earlier work in r292338 was done to
exit boot services in the MI bi_load() rather than having N copies of the
GetMemoryMap/ExitBootServices dance.

i386 never quite caught up to that; ldr_enter was still being called but
the prereq for that, ldr_bootinfo, was no longer. As a consequence, this
ExitBootServices() was being called with a mapkey=0, clearly bogus, and
reportedly breaking the boot in some instances.

Reported by: bcran
MFC after: 1 week

5 years agoifconfig: eliminate trailing whitespace
asomers [Tue, 26 Feb 2019 03:34:47 +0000 (03:34 +0000)]
ifconfig: eliminate trailing whitespace

Eliminate trailing whitespace on inet, inet6, and groups lines. I think the
"list txpower" command will still show some, but I'm not able to test that.

PR: 153731
Reported-by: Nikolay Denev <ndenev@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19004

5 years agoSet maximum bus clock speed from hints when attaching hinted spibus(4) children.
ian [Mon, 25 Feb 2019 23:49:58 +0000 (23:49 +0000)]
Set maximum bus clock speed from hints when attaching hinted spibus(4) children.

Some devices (such as spigen(4)) document that this works, but it appears that the
code to implement it never got added.

5 years agoImprove error handling: bail out if one of the files scheduled
sobomax [Mon, 25 Feb 2019 23:45:36 +0000 (23:45 +0000)]
Improve error handling: bail out if one of the files scheduled
to go to the FS image we are making cannot be read (e.g. EPERM).
Current behaviour when we issue waring but still proceeed and
return success is definitely not correct: masking out error
condition as well as making a slighly inconsistent FS where
attempt to access the file in question ends up in EBADF. See
linked DR for details.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18584

5 years agoAfter r344530, remove leading slashes from libprivateifconfig lines in
dim [Mon, 25 Feb 2019 22:11:44 +0000 (22:11 +0000)]
After r344530, remove leading slashes from libprivateifconfig lines in
ObsoleteFiles.inc.

5 years agoasmc: Add support for Mac mini 2,1
dab [Mon, 25 Feb 2019 21:59:01 +0000 (21:59 +0000)]
asmc: Add support for Mac mini 2,1

PR: 235798
Submitted by: Trev <fbsdbugs4@sentry.org>
Reported by: Trev <fbsdbugs4@sentry.org>
MFC after: 1 week

5 years agoAfter a crash, a file that extends into indirect blocks may end up
mckusick [Mon, 25 Feb 2019 21:58:19 +0000 (21:58 +0000)]
After a crash, a file that extends into indirect blocks may end up
shorter than its size resulting in a hole as its final block (which
is a violation of the invarients of the UFS filesystem).

Soft updates will always ensure that the file size is correct when
writing inodes to disk for files that contain only direct block
pointers. However soft updates does not roll back sizes for files
with indirect blocks that it has set to unallocated because their
contents have not yet been written to disk. Hence, the file can
appear to have a hole at its end because the block pointer has been
rolled back to zero when its inode was written to disk. Thus,
fsck_ffs calculates the last allocated block in the file. For files
that extend into indirect blocks, fsck_ffs checks for a size past
the last allocated block of the file and if that is found, shortens
the file to reference the last allocated block thus avoiding having
it reference a hole at its end.

Submitted by: Chuck Silvers <chs@netflix.com>
Tested by:    Chuck Silvers <chs@netflix.com>
MFC after:    1 week
Sponsored by: Netflix

5 years agoFix handling of rights on stdio streams, take two.
markj [Mon, 25 Feb 2019 19:47:27 +0000 (19:47 +0000)]
Fix handling of rights on stdio streams, take two.

Split the rights-limiting code into two cases: if one of the input
files isn't a regular file, use caph_limit_stream(3) instead of
open-coding the same logic; if both input files are regular files,
and the initial attempts to map them succeed, we limit the rights on
those files to CAP_MMAP_R.

Add a regression test for PR 234885.

PR: 234885
Reviewed by: delphij
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19216

5 years agoImprove vmem tuning for platforms without a direct map.
markj [Mon, 25 Feb 2019 19:22:13 +0000 (19:22 +0000)]
Improve vmem tuning for platforms without a direct map.

On platforms without a direct map (i.e., platforms without
UMA_MD_SMALL_ALLOC defined), the boundary tag allocator reserves a
number of tags for use when allocating a new slab of boundary tags,
as such platforms require free boundary tags in order to allocate
boundary tags.  r327899 increased the number of boundary tags required
for a KVA allocation in the worst case, and the aforementioned
reservation was not updated accordingly.  In some cases, this could
lead to a system hang.  Fix the problem by increasing this reservation.

Also reduce KVA_QUANTUM on systems lacking superpage support.
The previous import quantum (4MB with a 4KB page size) was quite large
for systems with limited KVA, and fragmentation in kernel_arena could
cause kernel memory allocation failures even with a substantial amount
of free KVA.

Reported and tested by: jhibbits
Reviewed by: alc, kib
No objections: jeff
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19337

5 years agoFix another bug introduced during the review process of r344140:
sef [Mon, 25 Feb 2019 19:14:16 +0000 (19:14 +0000)]
Fix another bug introduced during the review process of r344140:
the tag wasn't being computed properly due to chaning a >= comparison
to an == comparison.

Specifically:  CBC-MAC encodes the length of the authorization data
into the the stream to be encrypted/hashed.  For short data, this is
two bytes (big-endian 16 bit value); for larger data, it's 6 bytes
(a prefix of 0xff, 0xfe, followed by a 32-bit big-endian length).  And
there's a larger size, which is 10 bytes.  These extra bytes weren't
being accounted for with the post-review code.  The other bit that then came
into play was that OCF only calls the Update code with blksiz=16, which
meant that I had to ignore the length variable.  (It also means that it
can't be called with a single buffer containing the AAD and payload;
however, OCF doesn't do this for the software-only algorithsm.)

I tested with this script:

ALG=aes-ccm
DEV=soft

for aad in 0 1 2 3 4 14 16 24 30 32 34 36 1020
do
        for dln in 16 32 1024 2048 10240
        do
                echo "Testing AAD length ${aad} data length ${dln}"
                /root/cryptocheck -A ${aad} -a ${ALG} -d ${DEV} ${dln}
        done
done

Reviewed by: cem
Sponsored by: iXsystems Inc.

5 years agoIncrease ctfconvert buffer size
luporl [Mon, 25 Feb 2019 18:52:47 +0000 (18:52 +0000)]
Increase ctfconvert buffer size

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D19353

5 years agoUpgrade to OpenPAM Tabebuia.
des [Mon, 25 Feb 2019 18:41:16 +0000 (18:41 +0000)]
Upgrade to OpenPAM Tabebuia.

5 years agoRevert r344211: wlandebug: disable PIE to fix build failure
emaste [Mon, 25 Feb 2019 18:27:19 +0000 (18:27 +0000)]
Revert r344211: wlandebug: disable PIE to fix build failure

As of r344530 libifconfig is built as a standard INTERNALLIB and the
wlandebug PIE workaround from r344211 can be removed.

5 years agoRemove unintend change to capability.h from r344530
emaste [Mon, 25 Feb 2019 18:25:53 +0000 (18:25 +0000)]
Remove unintend change to capability.h from r344530

I expect to remove capability.h in the near future, but it should not
have been part of this commit.

5 years agoMake libifconfig INTERNALLIB
emaste [Mon, 25 Feb 2019 18:22:20 +0000 (18:22 +0000)]
Make libifconfig INTERNALLIB

Instead of PRIVATELIB + NO_PIC.  This avoids the need for the wlandebug
PIE special case added in r344211, and provides a stronger guarantee
against 3rd party software coming to depend on the API or ABI.

If / when we declare the API/ABI to be stable we can make it a normal
library.

Discussed with: bapt
Sponsored by: The FreeBSD Foundation

5 years agoFix a paste-o that broke the build on all arches.
ian [Mon, 25 Feb 2019 18:11:59 +0000 (18:11 +0000)]
Fix a paste-o that broke the build on all arches.

Reported by: many
Pointy hat: ian@

5 years agoarm64: rockchip: clk: Set the write mask when setting the clock mux
manu [Mon, 25 Feb 2019 17:40:00 +0000 (17:40 +0000)]
arm64: rockchip: clk: Set the write mask when setting the clock mux

RockChip clocks have a write mask in the upper 16bits of the mux register
which wasn't set in the set_mux function.
Also the wrong parent was tested instead of the real current one, when
switch parent, test with the current one before.

Pointy Hat:    manu
MFC after: 1 week

5 years agoResolve a name conflict when both SpiFlash and DataFlash devices are present.
ian [Mon, 25 Feb 2019 17:30:01 +0000 (17:30 +0000)]
Resolve a name conflict when both SpiFlash and DataFlash devices are present.

Both SpiFlash (mx25l) and DataFlash (at45d) drivers create a disk device
with a name of /dev/flash/spiN where N is the driver's unit number.  If
both types of devices are present in the same system, this creates a fatal
conflict that prevents attachment of whichever device attaches second
(because mx25l0 and at45d0 both try to create a spi0).

This gives each type of device a unique name (mx25lN or at45dN respectively)
and also adds an alias of spiN for compatibility.  When both device types
appear in the same system, only the first to attach gets the spiN alias.
When the second device attaches there is a non-fatal warning that the alias
can't be created, but both devices are still accessible via their primary
names (and there is no need for the spiN name to work for backwards
compatibility on such a system, because it has never been possible to use
the spiN names when both devices exist).

5 years agoAdd a metadata entry for the AT45DB641E chip. This chip has the same 3-byte
ian [Mon, 25 Feb 2019 16:40:10 +0000 (16:40 +0000)]
Add a metadata entry for the AT45DB641E chip.  This chip has the same 3-byte
jedec ID as its older cousin the AT45DB642D, but uses a different page size.
The only way to distinguish between the two chips is that the 2D chip has
0 bytes of extended ID info and the new 1E has 1 byte of extended ID.  The
actual value of the extended ID byte is all zeroes.  In other words, it's
the presence of the extended info that identifies this chip. (Presumably
a future upgrade might define non-zero values for the extended ID byte.)