]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoExtend descriptions and comments about the need to create /etc/pf.conf.
bcr [Tue, 12 Mar 2019 20:08:37 +0000 (20:08 +0000)]
Extend descriptions and comments about the need to create /etc/pf.conf.

FreeBSD removed the default /etc/pf.conf file in previous releases, but
the documentation kept mentioning it like any other file present in the
system.  Change pf.conf(5) to mention in the description of the default
ruleset location that this file needs to be created manually. Also, the
default rc.conf file had it's comment extended a bit to let people know
that this file does not exist by default.

PR:     231977
Submitted by:     koobs@
Reviewed by:     kp@, 0mp@
Approved by:     kp@
MFC after:     10 days
Differential Revision: https://reviews.freebsd.org/D19530

5 years agoFix still installing ipfilter rc.d files even when WITHOUT_IPFILTER
cy [Tue, 12 Mar 2019 19:34:33 +0000 (19:34 +0000)]
Fix still installing ipfilter rc.d files even when WITHOUT_IPFILTER
is specified.

When WITHOUT_IPFILTER is specified, delete-old-files fails to delete
the optional rc.d files from above. Fix this.

WITHOUT_IPFILTER fails to delete the ipfilter.5 optional file during
delete-old-files. Fix this.

Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

5 years agohwpmc/core: Adopt to upcoming Skylake TSX errata.
kib [Tue, 12 Mar 2019 19:33:25 +0000 (19:33 +0000)]
hwpmc/core: Adopt to upcoming Skylake TSX errata.

The forthcoming microcode update will fix a TSX bug by clobbering PMC3
when TSX instructions are executed (even speculatively).  There is an
alternate mode where CPU executes all TSX instructions by aborting
them, in which case PMC3 is still available to OS.  Any code that
correctly uses TSX must be ready to handle abort anyway.

Since it is believed that FreeBSD population of hwpmc(4) users is
significantly larger than the population of TSX users, switch the
microcode into TSX abort mode whenever a pmc is allocated, and back to
bug avoidance mode when the last pmc is deallocated.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoThis is an additional fix for bug report 230962. When using
mckusick [Tue, 12 Mar 2019 19:08:41 +0000 (19:08 +0000)]
This is an additional fix for bug report 230962. When using
extended attributes, the kernel can panic with either "ffs_truncate3"
or with "softdep_deallocate_dependencies: dangling deps".

The problem arises because the flushbuflist() function which is
called to clear out buffers is passed either the V_NORMAL flag to
indicate that it should flush buffer associated with the contents
of the file or the V_ALT flag to indicate that it should flush the
buffers associated with the extended attribute data. The buffers
containing the extended attribute data are identified by having
their BX_ALTDATA flag set in the buffer's b_xflags field. The
BX_ALTDATA flag is set on the buffer when the extended attribute
block is first allocated or when its contents are read in from the
disk.

On a busy system, a buffer may be reused for another purpose, but
the contents of the block that it contained continues to be held
in the main page cache. Each physical page is identified as holding
the contents of a logical block within a specified file (identified
by a vnode). When a request is made to read a file, the kernel first
looks for the block in the existing buffers.  If it is not found
there, it checks the page cache to see if it is still there. If
it is found in the page cache, then it is remapped into a new
buffer thus avoiding the need to read it in from the disk.

The bug is that when a buffer request made for an extended attribute
is fulfilled by reconstituting a buffer from the page cache rather
than reading it in from disk, the BX_ALTDATA flag was not being
set. Thus the flushbuflist() function would never clear it out and
the "ffs_truncate3" panic would occur because the vnode being cleared
still had buffers on its clean-buffer list. If the extended attribute
was being updated, it is first read, then updated, and finally
written. If the read is fulfilled by reconstituting the buffer
from the page cache the BX_ALTDATA flag was not set and thus the
dirty buffer would never be flushed by flushbuflist(). Eventually
the buffer would be recycled. Since it was never written it would
have an unfinished dependency which would trigger the
"softdep_deallocate_dependencies: dangling deps" panic.

The fix is to ensure that the BX_ALTDATA flag is set when a buffer
has been reconstituted from the page cache.

PR:           230962
Reported by:  2t8mr7kx9f@protonmail.com
Reviewed by:  kib
Tested by:    Peter Holm
MFC after:    1 week
Sponsored by: Netflix

5 years agoAdd register number, CPUID bits, and print identification for TSX
kib [Tue, 12 Mar 2019 18:59:01 +0000 (18:59 +0000)]
Add register number, CPUID bits, and print identification for TSX
force abort errata.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoRemove useless version check.
kib [Tue, 12 Mar 2019 18:57:11 +0000 (18:57 +0000)]
Remove useless version check.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoRevert r308867 (which was originally committed in the clang390-import
dim [Tue, 12 Mar 2019 18:19:44 +0000 (18:19 +0000)]
Revert r308867 (which was originally committed in the clang390-import
project branch):

  Work around LLVM PR30879, which is about a bad interaction between
  X86 Call Frame Optimization on i386 and libunwind, by disallowing the
  optimization for i386-freebsd12.

  This should fix some instances of broken exception handling when
  frame pointers are omitted, in particular some unittests run during
  the build of editors/libreoffice.

  This hack will be removed as soon as upstream has implemented a more
  permanent fix for this problem.

And indeed, after r345018 and r345019, which updated LLVM libunwind to
the most recent version, the above workaround is no longer needed.  The
upstream commit which fixed this is:

  https://llvm.org/viewvc/llvm-project?view=revision&revision=292723

Specifically, 32 bit (i386-freebsd) executables optimized with omitted
frame pointers and Call Frame Optimization should now behave correctly
when a C++ exception is thrown, and the stack is unwound.

Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=30879
PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoisci(4): Use controller->lock for busdma tags.
kib [Tue, 12 Mar 2019 16:49:08 +0000 (16:49 +0000)]
isci(4): Use controller->lock for busdma tags.

isci(4) uses deferred loading.  Typically on amd64 and i386 non-PAE
the tag does not create any restrictions, but on i386 PAE-tables but
non-PAE configs callbacks might be used.

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

5 years agoMove libunwind out of contrib/llvm/projects.
jhb [Tue, 12 Mar 2019 16:41:17 +0000 (16:41 +0000)]
Move libunwind out of contrib/llvm/projects.

Move LLVM's libunwind to its own contrib/ directory similar to other
runtime libraries like libc++ and libcxxrt.

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

5 years agostand: Improve some debugging experience
kevans [Tue, 12 Mar 2019 16:21:39 +0000 (16:21 +0000)]
stand: Improve some debugging experience

Some of these files using <FOO>_DEBUG defined a DEBUG() macro to serve as a
debug-printf. -DDEBUG is useful to enable some debugging output across
multiple ELF/common parts, so switch the DEBUG-as-printf macros over to
something more like DPRINTF that is more commonly used for this kind of
thing and less likely to conflict.

userboot/elf64_freebsd debugging also assumed %llx for uint64; use PRIx64
instead.

MFC after: 1 week

5 years agoDrop unused 'p' argument to nfsv4_strtogid().
trasz [Tue, 12 Mar 2019 15:07:47 +0000 (15:07 +0000)]
Drop unused 'p' argument to nfsv4_strtogid().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDrop unused 'p' argument to nfsv4_gidtostr().
trasz [Tue, 12 Mar 2019 15:05:11 +0000 (15:05 +0000)]
Drop unused 'p' argument to nfsv4_gidtostr().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDrop unused 'p' argument to nfsv4_strtouid().
trasz [Tue, 12 Mar 2019 15:02:52 +0000 (15:02 +0000)]
Drop unused 'p' argument to nfsv4_strtouid().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDrop unused 'p' argument to nfsv4_uidtostr().
trasz [Tue, 12 Mar 2019 14:59:08 +0000 (14:59 +0000)]
Drop unused 'p' argument to nfsv4_uidtostr().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDrop unused 'p' argument to nfsrv_getuser().
trasz [Tue, 12 Mar 2019 14:53:53 +0000 (14:53 +0000)]
Drop unused 'p' argument to nfsrv_getuser().

Reviewed by: rmacklem
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19455

5 years agocamcontrol.8: Bump date after r345051
0mp [Tue, 12 Mar 2019 09:43:11 +0000 (09:43 +0000)]
camcontrol.8: Bump date after r345051

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

5 years agoUpdate driver version to 07.709.04.00-fbsd
kadesai [Tue, 12 Mar 2019 09:29:46 +0000 (09:29 +0000)]
Update driver version to 07.709.04.00-fbsd

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  Ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoAllocated MFI frames should be same as MPT frames reserved for DCMDs
kadesai [Tue, 12 Mar 2019 09:29:01 +0000 (09:29 +0000)]
Allocated MFI frames should be same as MPT frames reserved for DCMDs

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  Ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoports.7: Add an example of how to use flavors
0mp [Tue, 12 Mar 2019 09:27:37 +0000 (09:27 +0000)]
ports.7: Add an example of how to use flavors

At the moment the manual page is not documenting how to build
a flavored package. Let's start documenting flavors with
an example of a typical use case.

Reported by: cem, dim
Reviewed by: bcr, cem, mat, matthew
Approved by: cem (src)
Differential Revision: https://reviews.freebsd.org/D19531

5 years agofw_outstanding"(outstanding IOs at firmware level) counter gets screwed up when R1...
kadesai [Tue, 12 Mar 2019 09:24:58 +0000 (09:24 +0000)]
fw_outstanding"(outstanding IOs at firmware level) counter gets screwed up when R1 fastpath
writes are running. Some of the cases which are not handled properly in driver are:

1. With R1 fastpath supported, single write from CAM layer can consume 2 MPT frames
at driver/firmware level for fastpath qualification(if fw_outstanding < controller Queue Depth).
Due to this driver has to throttle IOs coming from CAM layer as well as second fastpath
write(of R1 write) against Adapter Queue Depth.
If "fw_outstanding" reaches to adapter queue depth, driver should return IOs from CAM layer with
device busy status.While allocating second MPT frame(corresponding to R1 FP write) also, driver
should ensure fw_outstanding should not exceed adapter QD.

2. For R1 fastpath writes completion, driver decrements "fw_oustanding" counter without
really returning MPT frame to free pool. It may cause IOs(with heavy IOs running, consuming whole
adapter Queue Depth) consuming MPT frames reserved for DCMDs(management commands) and
DCMDs(internal and sent by application) not getting MPT frame will start failing.

Below is one test case to hit the issue described above-
1. Run heavy IOs (outstanding IOs should hit adapter Queue Depth).
2. Run management tool (Broadcom's storcli tool) querying adapter in loop (run command- "storcli64 /c0 show" in loop).
3. Management tool's requests would start failing due to non-availability of free MPT frames as all frames would be consumed by IOs.

Fix: Increment/decrement of "fw_outstanding" counter should be in sync with MPT frame get/return.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  Ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agofreebsd-update: restore old exit code when no updates are available locally
gahr [Tue, 12 Mar 2019 08:31:43 +0000 (08:31 +0000)]
freebsd-update: restore old exit code when no updates are available locally

This unbreaks ezjail and iocell, which get into an endless loop trying to
figure out how many times "freebsd-update install" needs to be called.

PR: 229346
Submitted by: Mike Cole <mcole36@gmail.com>
Approved by: bapt
MFC after: 1 week

5 years ago`make buildworld' should display the build time in seconds
wosch [Tue, 12 Mar 2019 07:40:38 +0000 (07:40 +0000)]
`make buildworld' should display the build time in seconds

PR: 224433
Reviewed by: emaste, @bdrewery
Approved by: cem
Differential Revision: https://reviews.freebsd.org/D13911

5 years agoTweak wording a little.
imp [Tue, 12 Mar 2019 06:01:43 +0000 (06:01 +0000)]
Tweak wording a little.

Submitted by: peterj@

5 years agoFix botched merge with 355066
imp [Tue, 12 Mar 2019 05:10:41 +0000 (05:10 +0000)]
Fix botched merge with 355066

When merging from Netflix's tree, resetting the carsize was dropped
accidentally. This fix fixes that revision by properly resetting how
many are in the car.

Noticed by: mav@

5 years agoAdd -l to camcontrol readcap.
imp [Tue, 12 Mar 2019 04:57:05 +0000 (04:57 +0000)]
Add -l to camcontrol readcap.

The -l flag sends only the READ CAPACITY (16) sevice action. Normally
we send the READ CAPACITY (10) command, and only send RC16 when the
capacity is larger than 2TB (since that's the max RC10 can
report). However, some badly programmed drives report different
numbers for RC10 and RC16. This can be hard to diagnose, but generally
there's a "Logical block address out of range" error when RC16 reports
a larger number than RC10 and the RC10 number is the correct one. By
comparing the output of readcap with and without the -l argmuent, one
can determine if there's a mismatch and if the DA_Q_NO_RC16 quirk is
needed.

Reviewed by: ken@
Differential Revision: https://reviews.freebsd.org/D19536

5 years agoRemove now useless -d and -t flags.
imp [Tue, 12 Mar 2019 04:49:59 +0000 (04:49 +0000)]
Remove now useless -d and -t flags.

These were used to set dst flag and minutes west of UTC
respectively. These are obsolete and have been removed form the
kernel. These existed primarily to faithfully emulate early
Unix ABIs that have been removed from FreeBSD.

Reviewed by: jbh@, brooks@
Differential Revision: https://reviews.freebsd.org/D19550

5 years agoKill tz_minuteswest and tz_dsttime.
imp [Tue, 12 Mar 2019 04:49:47 +0000 (04:49 +0000)]
Kill tz_minuteswest and tz_dsttime.

Research Unix, 7th Edition introduced TIMEZONE and DSTFLAG
compile-time constants in sys/param.h to communicate these values for
the machine. 4.2BSD moved from the compile-time to run-time and
introduced these variables and used for localtime() to return the
right offset from UTC (sometimes referred to as GMT, for this purpose
is the same). 4.4BSD migrated to using the tzdata code/database and
these variables were basically unused.

FreeBSD removed the real need for these with adjkerntz in
1995. However, some RTC clocks continued to use these variables,
though they were largely unused otherwise.  Later, phk centeralized
most of the uses in utc_offset, but left it using both tz_minuteswest
and adjkerntz.

POSIX (IEEE Std 1003.1-2017) states in the gettimeofday specification
"If tzp is not a null pointer, the behavior is unspecified" so there's
no standards reason to retain it anymore. In fact, gettimeofday has
been marked as obsolecent, meaning it could be removed from a future
release of the standard. It is the only interface defined in POSIX
that references these two values. All other references come from the
tzdata database via tzset().

These were used to more faithfully implement early unix ABIs which
have been removed from FreeBSD.  NetBSD has completely eliminated
these variables years ago. Linux has migrated to tzdata as well,
though these variables technically still exist for compatibility
with unspecified older programs.

So, there's no real reason to have them these days. They are a
historical vestige that's no longer used in any meaningful way.

Reviewed By: jhb@, brooks@
Differential Revision: https://reviews.freebsd.org/D19550

5 years agoAdd KASSERT to the softdep_disk_write_complete() function in the
mckusick [Tue, 12 Mar 2019 00:10:31 +0000 (00:10 +0000)]
Add KASSERT to the softdep_disk_write_complete() function in the
soft dependency code to ensure that it will be able to avoid a
dangling dependency.

Sponsored by: Netflix

5 years agoGive more complete information in INVARIANTS panic messages at end of
mckusick [Mon, 11 Mar 2019 23:53:56 +0000 (23:53 +0000)]
Give more complete information in INVARIANTS panic messages at end of
the ffs_truncate() function.

Sponsored by: Netflix

5 years agoUpdate ccr(4) to note recent support for SHA2-224 and plain SHA hashes.
jhb [Mon, 11 Mar 2019 23:18:09 +0000 (23:18 +0000)]
Update ccr(4) to note recent support for SHA2-224 and plain SHA hashes.

MFC after: 3 days
Sponsored by: Chelsio Communications

5 years agoUpdate the main loop in the flushbuflist() routine to properly select
mckusick [Mon, 11 Mar 2019 22:42:33 +0000 (22:42 +0000)]
Update the main loop in the flushbuflist() routine to properly select
buffers for flushing when requested to flush both normal and extended
attributes buffers.

Sponsored by: Netflix

5 years agoDrop "All rights reserved" from the files I own
asomers [Mon, 11 Mar 2019 22:23:56 +0000 (22:23 +0000)]
Drop "All rights reserved" from the files I own

Also, add SPDX tags where needed.

MFC after: 2 weeks

5 years agoAugment the UFS filesystem specific print function (called by the
mckusick [Mon, 11 Mar 2019 22:05:34 +0000 (22:05 +0000)]
Augment the UFS filesystem specific print function (called by the
kernel vn_printf() routine when printing out vnodes associated with
a UFS filesystem) to also include the inode's link count, effective
link count, generation number, owner, group, flags, size, and for
UFS2 filesystems, the extent size.

Sponsored by: Netflix

5 years agoAugment DDB "show buffer" command to print the buffer's referenced
mckusick [Mon, 11 Mar 2019 21:49:44 +0000 (21:49 +0000)]
Augment DDB "show buffer" command to print the buffer's referenced
vnode pointer (b_vp). The value of b_vp can be used by "show vnode"
to print the vnode and "show vnodebufs" to print all the clean and
dirty buffers associated with the vnode (which should include this
buffer).

Sponsored by: Netflix

5 years agoUpgrade Chipfancier SLC quirk to all versions
imp [Mon, 11 Mar 2019 20:57:54 +0000 (20:57 +0000)]
Upgrade Chipfancier SLC quirk to all versions

The 16GB, 32GB and 128GB versions of this product all have the same
problem. For some reason, the RC10 size is correct, while the RC16
size is larger (oddly by the capacity size / 1024 bytes). Using the
RC16 size results in illegal LBA range errors when geom tastes the
device. So, expand the quirk to cover all versions of this chip.

Ideally, we'd get both READ CAPACITY 10 and READ CAPACITY 16 sizes and
print a warnnig if they differ and use the smaller of the two numbers,
though that may be problematical as well. Furthermore, SBC-4
encourages users transition to RC16 only, which suggests that in the
future RC10 may disappear from some drives. It's unclear how to cope
with these drives generically.

PR: 234503
MFC After: 1 week

5 years agoAdd _PC_ACL_* to vop_stdpathconf
sjg [Mon, 11 Mar 2019 20:40:56 +0000 (20:40 +0000)]
Add _PC_ACL_* to vop_stdpathconf

This avoid EINVAL from tmpfs etc.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D19512

5 years agoFix amd64/i386 LINT build after r344982
wulf [Mon, 11 Mar 2019 19:46:15 +0000 (19:46 +0000)]
Fix amd64/i386 LINT build after r344982

Submitted by: jkim
Reported by: rpokala
MFC with: r344982

5 years agoPull in r355854 from upstream llvm trunk (by Jonas Paulsson):
dim [Mon, 11 Mar 2019 19:15:57 +0000 (19:15 +0000)]
Pull in r355854 from upstream llvm trunk (by Jonas Paulsson):

  [RegAlloc]  Avoid compile time regression with multiple copy hints.

  As a fix for https://bugs.llvm.org/show_bug.cgi?id=40986 ("excessive
  compile time building opencollada"), this patch makes sure that no
  phys reg is hinted more than once from getRegAllocationHints().

  This handles the case were many virtual registers are assigned to the
  same physreg. The previous compile time fix (r343686) in
  weightCalcHelper() only made sure that physical/virtual registers are
  passed no more than once to addRegAllocationHint().

  Review: Dimitry Andric, Quentin Colombet
  https://reviews.llvm.org/D59201

This should fix a hang when compiling certain generated .cpp files in
the graphics/opencollada port.

PR: 236313
MFC after: 1 month
X-MFC-With: r344779

5 years agoMerge LLVM libunwind release_80 branch r355677 (effectively, 8.0.0 rc4).
dim [Mon, 11 Mar 2019 18:56:04 +0000 (18:56 +0000)]
Merge LLVM libunwind release_80 branch r355677 (effectively, 8.0.0 rc4).

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoMerge LLVM libunwind trunk r351319, from just before upstream's
dim [Mon, 11 Mar 2019 18:45:36 +0000 (18:45 +0000)]
Merge LLVM libunwind trunk r351319, from just before upstream's
release_80 branch point.  Afterwards, we will merge the rest of the
changes in the actual release_80 branch.

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoRevert minor part of r344934.
mav [Mon, 11 Mar 2019 17:39:09 +0000 (17:39 +0000)]
Revert minor part of r344934.

I tried to save some CPU time on hopeless aggregation attempts, but it seems
the condition I added is overly strict, blocking also aggregation of optional
I/Os in cases which previously were possible.  Revert just to be safe.

MFC after: 1 month

5 years agoUpdate entries for accounts@, backups@, dnsadm@, mirror-admin@, and
gjb [Mon, 11 Mar 2019 15:47:26 +0000 (15:47 +0000)]
Update entries for accounts@, backups@, dnsadm@, mirror-admin@, and
remove refadm@.

Sponsored by: The FreeBSD Foundation

5 years agoUpdate the re@ member list.
gjb [Mon, 11 Mar 2019 15:36:24 +0000 (15:36 +0000)]
Update the re@ member list.

Sponsored by: The FreeBSD Foundation

5 years agoEliminate useless warning message when reading sysctl node in mlx4core.
hselasky [Mon, 11 Mar 2019 14:34:25 +0000 (14:34 +0000)]
Eliminate useless warning message when reading sysctl node in mlx4core.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoImprove support for switching to and from command polling mode in mlx4core.
hselasky [Mon, 11 Mar 2019 14:29:50 +0000 (14:29 +0000)]
Improve support for switching to and from command polling mode in mlx4core.

Make sure the enter and leave polling routines can be called multiple times
with same setting. Ignore setting polling or event mode twice. This fixes a
deadlock during shutdown if polling mode was already selected.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix a scribbler in the PMS driver.
dab [Mon, 11 Mar 2019 14:26:45 +0000 (14:26 +0000)]
Fix a scribbler in the PMS driver.

The ESGL bit was left uninitialized when executing the REPORT LUNS
ioctl. This could allow a zeroed data buffer to be treated as a
scatter/gather list. The firmware would eventually walk past the end
of the data buffer, potentially find what looked like a valid
address/length pair, and write the result to semi-random memory.

Obtained from: Dell EMC Isilon
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19398

5 years agoFix CRN resets in the isp(4) driver in certain situations.
ken [Mon, 11 Mar 2019 14:21:14 +0000 (14:21 +0000)]
Fix CRN resets in the isp(4) driver in certain situations.

The Command Reference Number (CRN) is part of the FC-Tape features
that we enable when talking to tape drives.  It starts at 1, and
goes to 255 and wraps around to 1.  There are a number of reset
type conditions that result in the CRN getting reset to 1.  These
are detailed in section 4.10 (table 8) of the FCP-4r02b specification.

One of the conditions is when a PRLI (Process Login) is sent by
the initiator, and the Establish Image Pair bit is set in Word 0
of the PRLI.

Previously, the isp(4) driver core sent a notification via
isp_async() that the target had changed or stayed in place, but
there was no indication of whether a PRLI was sent and whether the
Establish Image Pair bit was set.

The result of this was that in some situations, notably
switching back and forth between a direct connection and a switch
connection to a tape drive, the isp(4) driver would fail to reset
the CRN in situations that require it according to the spec.  When
the CRN isn't reset in a situation that requires it, the tape drive
then rejects every subsequent command that is sent to the drive.
It is assuming that the commands are being sent out of order.

So, modify the isp(4) driver to include Word 0 of the PRLI command
when it sends isp_async() notifications of target changes.  Look at
the Establish Image Pair bit, and reset the CRN if that bit is set.

With this change, I am able to switch a tape drive back and forth
between a direct connection and a switch connection, and the isp(4)
driver resets the CRN when it should.

sys/dev/isp_stds.h:
Add bit definitions for PRLI Word 0.

sys/dev/ispmbox.h:
Add PRLI Word 0 to the port database type, isp_pdb_t.

sys/dev/ispvar.h
Add PRLI Word 0 to fcportdb_t.

sys/dev/isp.c:
Populate the new prli_word0 parameter in the port database.

In isp_pdb_add_update(), add a check to see if the
Establish Image Pair bit is set in PRLI Word 0.  If it is,
then that is an additional reason to create a change
notification.

sys/dev/isp_freebsd.c:
In isp_async(), if the device changed or stayed, look at
PRLI Word 0 to see if the Establish Image Pair bit is set.
If it is, reset the CRN if we haven't already.

MFC after: 1 week
Sponsored by: Spectra Logic
Differential Revision: https://reviews.freebsd.org/D19472

5 years agoRemove an unneeded 'tail -n 1' from a pipeline
lidl [Mon, 11 Mar 2019 13:33:03 +0000 (13:33 +0000)]
Remove an unneeded 'tail -n 1' from a pipeline

When piping to awk, it's almost always an anti-pattern to use 'grep'
first.

When not in a pipeline, sometimes it is faster to use tail, as awk
must process all the lines in the input stream, and won't 'seek'.
In a pipeline, both grep and awk must process all lines, so we might
as well skip the extra process creation for tail and just use awk
for all the processing.

Reviewed by: jilles
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19441

5 years agoAdd IP_FW_NAT64 to codes that ipfw_chk() can return.
ae [Mon, 11 Mar 2019 10:42:09 +0000 (10:42 +0000)]
Add IP_FW_NAT64 to codes that ipfw_chk() can return.

It will be used by upcoming NAT64 changes. We use separate code
to avoid propogating EACCES error code to user level applications
when NAT64 consumes a packet.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

5 years agoAdd NULL pointer check to nat64_output().
ae [Mon, 11 Mar 2019 10:33:32 +0000 (10:33 +0000)]
Add NULL pointer check to nat64_output().

It is possible, that a processed packet was originated by local host,
in this case m->m_pkthdr.rcvif is NULL. Check and set it to V_loif to
avoid NULL pointer dereference in IP input code, since it is expected
that packet has valid receiving interface when netisr processes it.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

5 years agoiwm(4): use correct channel list source for Intel 3168
avos [Mon, 11 Mar 2019 08:30:29 +0000 (08:30 +0000)]
iwm(4): use correct channel list source for Intel 3168

Intel 3168 uses another EEPROM section to store channel flags;
port missing bits from iwlwifi to make it work.

PR: 230750, 236235
Tested by: Bert JW Regeer <xistence@0x58.com>
MFC after: 3 days

5 years agoMark the imx_spi device busy while transfers are in progress, so that the
ian [Mon, 11 Mar 2019 03:07:05 +0000 (03:07 +0000)]
Mark the imx_spi device busy while transfers are in progress, so that the
module can't be unloaded while interrupts are pending.

5 years agourtw(4): add promiscuous mode callback
avos [Mon, 11 Mar 2019 02:02:04 +0000 (02:02 +0000)]
urtw(4): add promiscuous mode callback

Also, pass control frames to the host while in MONITOR mode and / or
when promiscuous mode is enabled.

Tested with Netgear WG111 v3 (RTL8187B), STA / MONITOR modes.

MFC after: 2 weeks

5 years agoFix ieee80211_radiotap(9) usage in wireless drivers:
avos [Mon, 11 Mar 2019 01:27:01 +0000 (01:27 +0000)]
Fix ieee80211_radiotap(9) usage in wireless drivers:

- Alignment issues:
 * Add missing __packed attributes + padding across all drivers; in
most places there was an assumption that padding will be always
minimally suitable; in few places - e.g., in urtw(4) / rtwn(4) -
padding was just missing.
 * Add __aligned(8) attribute for all Rx radiotap headers since they can
contain 64-bit TSF timestamp; it cannot appear in Tx radiotap headers, so
just drop the attribute here. Refresh ieee80211_radiotap(9) man page
accordingly.

- Since net80211 automatically updates channel frequency / flags in
ieee80211_radiotap_chan_change() drop duplicate setup for these fields
in drivers.

Tested with Netgear WG111 v3 (urtw(4)), STA mode.

MFC after: 2 weeks

5 years agoFix crash in low memory conditions. Usual backtrace looked
trasz [Sun, 10 Mar 2019 23:05:38 +0000 (23:05 +0000)]
Fix crash in low memory conditions.  Usual backtrace looked
like this:

pqisrc_build_sgl() at pqisrc_build_sgl+0x8d/frame 0xfffffe009e8b7a00
pqisrc_build_raid_io() at pqisrc_build_raid_io+0x231/frame 0xfffffe009e8b7a40
pqisrc_build_send_io() at pqisrc_build_send_io+0x375/frame 0xfffffe009e8b7b00
pqi_request_map_helper() at pqi_request_map_helper+0x282/frame 0xfffffe009e8b7ba0
bus_dmamap_load_ccb() at bus_dmamap_load_ccb+0xd7/frame 0xfffffe009e8b7c00
pqi_map_request() at pqi_map_request+0x9b/frame 0xfffffe009e8b7c70
pqisrc_io_start() at pqisrc_io_start+0x55c/frame 0xfffffe009e8b7d50
smartpqi_cam_action() at smartpqi_cam_action+0xb8/frame 0xfffffe009e8b7de0
xpt_run_devq() at xpt_run_devq+0x30a/frame 0xfffffe009e8b7e40
xpt_action_default() at xpt_action_default+0x94b/frame 0xfffffe009e8b7e90
dastart() at dastart+0x33b/frame 0xfffffe009e8b7ee0
xpt_run_allocq() at xpt_run_allocq+0x1a2/frame 0xfffffe009e8b7f30
dastrategy() at dastrategy+0x71/frame 0xfffffe009e8b7f60
g_disk_start() at g_disk_start+0x351/frame 0xfffffe009e8b7fc0
g_io_request() at g_io_request+0x3cf/frame 0xfffffe009e8b8010
g_part_start() at g_part_start+0x120/frame 0xfffffe009e8b8090
g_io_request() at g_io_request+0x3cf/frame 0xfffffe009e8b80e0
zio_vdev_io_start() at zio_vdev_io_start+0x4b2/frame 0xfffffe009e8b8140
zio_execute() at zio_execute+0x17c/frame 0xfffffe009e8b8180
zio_nowait() at zio_nowait+0xc4/frame 0xfffffe009e8b81b0
vdev_queue_io_done() at vdev_queue_io_done+0x138/frame 0xfffffe009e8b81f0
zio_vdev_io_done() at zio_vdev_io_done+0x151/frame 0xfffffe009e8b8220
zio_execute() at zio_execute+0x17c/frame 0xfffffe009e8b8260
taskqueue_run_locked() at taskqueue_run_locked+0x10c/frame 0xfffffe009e8b82c0
taskqueue_thread_loop() at taskqueue_thread_loop+0x88/frame 0xfffffe009e8b82f0
fork_exit() at fork_exit+0x84/frame 0xfffffe009e8b8330
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe009e8b8330

Reviewed by: deepak.ukey_microsemi.com, sbruno
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19470

5 years agostyle.mdoc.5: Fix formatting issues
0mp [Sun, 10 Mar 2019 20:58:59 +0000 (20:58 +0000)]
style.mdoc.5: Fix formatting issues

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

5 years agoatrtc(4): install ACPI RTC/CMOS operation region handler
wulf [Sun, 10 Mar 2019 20:19:43 +0000 (20:19 +0000)]
atrtc(4): install ACPI RTC/CMOS operation region handler

FreeBSD base system does not provide an ACPI handler for the PC/AT RTC/CMOS
device with PnP ID PNP0B00; on some HP laptops, the absence of this handler
causes suspend/resume and poweroff(8) to hang or fail [1], [2]. On these
laptops EC _REG method queries the RTC date/time registers via ACPI
before suspending/powering off. The handler should be registered before
acpi_ec driver is loaded.

This change adds handler to access CMOS RTC operation region described in
section 9.15 of ACPI-6.2 specification [3]. It is installed only for ACPI
version of atrtc(4) so it should not affect old ACPI-less i386 systems.

It is possible to disable the handler with loader tunable:
debug.acpi.disabled=atrtc

Informational debugging printf can be enabled by setting hw.acpi.verbose=1
in loader.conf

[1] https://wiki.freebsd.org/Laptops/HP_Envy_6Z-1100
[2] https://wiki.freebsd.org/Laptops/HP_Notebook_15-af104ur
[3] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf

PR: 207419, 213039
Submitted by: Anthony Jenkins <Scoobi_doo@yahoo.com>
Reviewed by: ian
Discussed on: acpi@, 2013-2015, several threads
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19314

5 years agoGive the mx25l device sole ownership of the name /dev/flash/spi* instead of
ian [Sun, 10 Mar 2019 18:48:08 +0000 (18:48 +0000)]
Give the mx25l device sole ownership of the name /dev/flash/spi* instead of
trying to use disk_add_alias() to make spi* an alias for mx25l*.  It turns
out disk_add_alias() works for partitions, but not slices, and that's hard
to fix.

This change is, in effect, a partial revert of r344526.

The mips world relies on the existence of flashmap names formatted as
/dev/flash/spi0s.name, whereas pretty much nothing relies on at45d devices
using the /dev/spi* names (because until recently the at45d driver didn't
even work reliably). So this change makes mx25l devices the sole owner of
the /dev/flash/spi* namespace, which actually makes some sense because it is
a SpiFlash(tm) device, so flash/spi isn't a horrible name.

Reported by: Mori Hiroki <yamori813@yahoo.co.jp>

5 years agoMost Ethernet drivers that potentially can run a pfil(9) hook with
glebius [Sun, 10 Mar 2019 17:20:09 +0000 (17:20 +0000)]
Most Ethernet drivers that potentially can run a pfil(9) hook with
PFIL_MEMPTR flag are intentionally providing a memory address that
isn't aligned to pointer alignment. This is done to align an IPv4
or IPv6 header that is expected to follow Ethernet header.

When we return PFIL_REALLOCED we store a pointer to allocated mbuf
at this address. With this change the KPI changes to store the pointer
at aligned address, which usually yields in +2 bytes.

Provide two inlines:

pfil_packet_align() to get aligned pfil_packet_t for a misaligned one
pfil_mem2mbuf() to read out mbuf pointer from misaligned pfil_packet_t

Provide function pfil_realloc(), not used yet, that would convert a
memory pfil_packet_t to an mbuf one.

Reported by: hps
Reviewed by: hps, gallatin

5 years agoProperly handle a case when a first filter returns PFIL_REALLOCED, then
glebius [Sun, 10 Mar 2019 17:08:05 +0000 (17:08 +0000)]
Properly handle a case when a first filter returns PFIL_REALLOCED, then
second one returns PFIL_PASS.

5 years agoAugment ino64 entry
imp [Sat, 9 Mar 2019 17:17:59 +0000 (17:17 +0000)]
Augment ino64 entry

When updating across this change (the introduction of ino64), the
"fast and loose" practice of rebooting to multiuser and then doing an
installworld fails with missing symbols. Recommend strongly that users
do this in single user mode. The multiuser case only ever works by
accident because its requirements are stronger than is supported
accross this change. It usually works because critical symbols don't
change their version number in libc, which wasn't the case here.

5 years agoFix a number of entries (almost all mine) that were > 80 columns.
imp [Sat, 9 Mar 2019 17:17:55 +0000 (17:17 +0000)]
Fix a number of entries (almost all mine) that were > 80 columns.

When reading UPDATING from single user in vi, I noticed a few wrapped,
so fix them to not wrap.
expand -8 UPDATING | awk 'length > 80'
made this easy to find all the offenders.

5 years agoMisc fixes based on upgrading a laptop from 11.1R to -current
imp [Sat, 9 Mar 2019 17:17:44 +0000 (17:17 +0000)]
Misc fixes based on upgrading a laptop from 11.1R to -current

Add note about needing to start zfs because mount -a doesn't do that.
Add the word 'supported' before 'older branches' for older binaries.
Add note about options in custom config files as well.

5 years agopowerpc: Print trap frame address in ddb backtraces
jhibbits [Sat, 9 Mar 2019 03:24:39 +0000 (03:24 +0000)]
powerpc: Print trap frame address in ddb backtraces

Registers visible from 'show reg' don't always match the registers from the
offending trap frame.  Knowing the frame address lets one examine the
registers manually.

MFC after: 1 week

5 years agopowerpc: Print trap frame address for fatal traps
jhibbits [Sat, 9 Mar 2019 03:18:37 +0000 (03:18 +0000)]
powerpc: Print trap frame address for fatal traps

MFC after: 1 week

5 years agoAdd two more products found inside a T480 to usbdevs.
bz [Sat, 9 Mar 2019 03:15:09 +0000 (03:15 +0000)]
Add two more products found inside a T480 to usbdevs.

Add an Intel Bluetooth module.
Add Synaptics as a vendor with a fingerprint reader product.

MFC after: 2 weeks

5 years agopowerpc: Print data address register on alignment exceptions
jhibbits [Sat, 9 Mar 2019 03:10:56 +0000 (03:10 +0000)]
powerpc: Print data address register on alignment exceptions

MFC after: 1 week

5 years agoDon't compress and uuencode the "hexdump -C" output files. Just
marcel [Sat, 9 Mar 2019 02:03:07 +0000 (02:03 +0000)]
Don't compress and uuencode the "hexdump -C" output files.  Just
save them with the $FreeBSD$ tag prepended.  Changes to these
files are now a lot easier to comprehend, which makes diffs also
reviewable.

5 years agoTry to improve comment for socket state bits.
bz [Sat, 9 Mar 2019 01:37:00 +0000 (01:37 +0000)]
Try to improve comment for socket state bits.

In r324227 the comment moved into socketvar.h originally from
sockstate.h r180948.  Try to improve English and as a consequence rewrap
the comment.

No functional changes.

Reviewed by: jhb (a wording suggestion)
Differential Revision: https://reviews.freebsd.org/D13865

5 years agoDon't print all the I/O we abort on a reset, unless we're out of
imp [Sat, 9 Mar 2019 01:18:16 +0000 (01:18 +0000)]
Don't print all the I/O we abort on a reset, unless we're out of
retries.

When resetting the controller, we abort I/O. Prior to this fix, we
printed a ton of abort messages for I/O that we're going to
retry. This imparts no useful information. Stop printing them unless
our retry count is exhausted. Clarify code for when we don't retry,
and remove useless arg to a routine that's always called with it
as 'true'. All the other debug is still printed (including multiple
reset messages if we have multiple timeouts before the taskqueue
runs the actual reset) so that we know when we reset.

Reviewed by: jimharris@, chuck@
Differential Revision: https://reviews.freebsd.org/D19431

5 years agoImprove ARP logging.
bz [Sat, 9 Mar 2019 01:12:59 +0000 (01:12 +0000)]
Improve ARP logging.

r344504 added an extra ARP_LOG() call in case of an if_output() failure.
It turns out IPv4 can be noisy. In order to not spam the console by default:
(a) add a counter for these events so people can keep better track of how
    often it happens, and
(b) add a sysctl to select the default ARP_LOG log level and set it to
    INFO avoiding the one (the new) DEBUG level by default.

Claim a spare (1st one after 10 years since the stats were added) in order
to not break netstat from FreeBSD 12->13 updates in the future.

Reviewed by: karels
Differential Revision: https://reviews.freebsd.org/D19490

5 years agoCorrect wording around '-' masks.
gordon [Sat, 9 Mar 2019 00:30:13 +0000 (00:30 +0000)]
Correct wording around '-' masks.

PR: 236407
Reported by: Brian Saia
MFC after: 1 week

5 years agoMerge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
dim [Sat, 9 Mar 2019 00:27:50 +0000 (00:27 +0000)]
Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r355677 (effectively, 8.0.0 rc4), resolve conflicts, and bump version
numbers.

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoVendor import of LLVM libunwind trunk r351319 (just before the
dim [Fri, 8 Mar 2019 22:14:20 +0000 (22:14 +0000)]
Vendor import of LLVM libunwind trunk r351319 (just before the
release_80 branch point):
https://llvm.org/svn/llvm-project/libunwind/trunk@351319

5 years agoMFV/ZoL: Disable LBA weighting on files and SSDs
mav [Fri, 8 Mar 2019 21:13:45 +0000 (21:13 +0000)]
MFV/ZoL: Disable LBA weighting on files and SSDs

The LBA weighting makes sense on rotational media where the outer tracks
have twice the bandwidth of the inner tracks. However, it is detrimental
on nonrotational media such as solid state disks, where the only effect
is to ensure that metaslabs enter the best-fit allocation behavior
sooner, which is detrimental to performance. It also makes no sense on
files where the underlying filesystem can arrange things however it
wants.

Author: Richard Yao <ryao@gentoo.org>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3712
zfsonlinux/zfs@fb40095f5f0853946f8150481ca22602d1334dfe

To reduce code divergence this merge replaces equivalent but different
FreeBSD code detecting non-rotating medium vdevs.

MFC after: 1 month

5 years agoHave pthread_cond_destroy() return EBUSY if the condvar has waiters.
markj [Fri, 8 Mar 2019 21:07:08 +0000 (21:07 +0000)]
Have pthread_cond_destroy() return EBUSY if the condvar has waiters.

This is not required of a compliant implementation, but it's easy to
check for and helps improve compatibility with other common
implementations.  Moreover, it's consistent with our
pthread_mutex_destroy().

PR: 234805
Reviewed by: jhb, kib, ngie
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19496

5 years agoAdd separate aggregation limit for non-rotating media.
mav [Fri, 8 Mar 2019 19:38:52 +0000 (19:38 +0000)]
Add separate aggregation limit for non-rotating media.

Before sequential scrub patches ZFS never aggregated I/Os above 128KB.
Sequential scrub bumped that to 1MB, which motivation I understand for
spinning disks, since it should reduce number of head seeks.  But for
SSDs it makes much less sense to me, especially on FreeBSD, where due
to MAXPHYS limitation device will likely still see bunch of 128KB I/Os
instead of one large.  Having more strict aggregation limit allows to
avoid allocation of large memory buffer and memcpy to/from it, that is
a serious problem when bandwidth reaches few GB/s.

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

5 years agoUpdate members of doceng in the chart.
bcr [Fri, 8 Mar 2019 18:58:41 +0000 (18:58 +0000)]
Update members of doceng in the chart.

Update the members of the doceng team to include ryusuke@ and me.
Sort and reduce number of line breaks so that our bubble in the
chart is a bit more compact (similar to portmgr next to it).

Reminded by:    gjb

5 years agoMFV/ZoL: Fix zfs_vdev_aggregation_limit bounds checking
mav [Fri, 8 Mar 2019 18:49:27 +0000 (18:49 +0000)]
MFV/ZoL: Fix zfs_vdev_aggregation_limit bounds checking

Update the bounds checking for zfs_vdev_aggregation_limit so that
it has a floor of zero and a maximum value of the supported block
size for the pool.

Additionally add an early return when zfs_vdev_aggregation_limit
equals zero to disable aggregation.  For very fast solid state or
memory devices it may be more expensive to perform the aggregation
than to issue the IO immediately.

Author: Brian Behlendorf <behlendorf1@llnl.gov>
zfsonlinux/zfs@a58df6f53687ac6d1dee21f60de41b2552a43201

MFV/ZoL: Cap maximum aggregate IO size

Commit 8542ef8 allowed optional IOs to be aggregated beyond
the specified aggregation limit.  Since the aggregation limit
was also used to enforce the maximum block size, setting
`zfs_vdev_aggregation_limit=16777216` could result in an
attempt to allocate an ABD larger than 16M.

Author: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6259
Closes #6270
zfsonlinux/zfs@2d678f779aba26a93314c8ee1142c3985fa25cb6

5 years agoFix locking bug.
tuexen [Fri, 8 Mar 2019 18:17:57 +0000 (18:17 +0000)]
Fix locking bug.

MFC after: 3 days

5 years agoSome cleanup and consistency improvements.
tuexen [Fri, 8 Mar 2019 18:16:19 +0000 (18:16 +0000)]
Some cleanup and consistency improvements.

MFC after: 3 days

5 years agoexplain ``fsck -f'' more in detail
wosch [Fri, 8 Mar 2019 10:03:16 +0000 (10:03 +0000)]
explain ``fsck -f'' more in detail

PR: 223491
Approved by: mckusick, 0mp, imp
Differential Revision: https://reviews.freebsd.org/D19437

5 years agopf: Fix DIOCGETSRCNODES
kp [Fri, 8 Mar 2019 09:33:16 +0000 (09:33 +0000)]
pf: Fix DIOCGETSRCNODES

r343295 broke DIOCGETSRCNODES by failing to reset 'nr' after counting the
number of source tracking nodes.
This meant that we never copied the information to userspace, leading to '? ->
?' output from pfctl.

PR: 236368
MFC after: 1 week

5 years agoTeardown ifnet after stopping port in the mlx4en(4) driver.
hselasky [Fri, 8 Mar 2019 09:18:29 +0000 (09:18 +0000)]
Teardown ifnet after stopping port in the mlx4en(4) driver.

mlx4_en_stop_port() calls mlx4_en_put_qp() which can refer the link level
address of the network interface, which in turn will be freed by the
network interface detach function. Make sure the port is stopped
before detaching the network interface.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoDon't hold state lock while detaching network device instance in mlx4en(4).
hselasky [Fri, 8 Mar 2019 09:16:29 +0000 (09:16 +0000)]
Don't hold state lock while detaching network device instance in mlx4en(4).

It can happen during shutdown that the lock will recurse when the mlx4en(4)
instance is part of a lagg interface. Call ether_ifdetach() unlocked.

Backtrace:
panic(): _sx_xlock_hard: recursed on non-recursive sx &mdev->state_lock
_sx_xlock_hard()
_sx_xlock()
mlx4_en_ioctl()
if_setlladdr()
lagg_port_destroy()
lagg_port_ifdetach()
if_detach()
mlx4_en_destroy_netdev()
mlx4_en_remove()
mlx4_remove_device()
mlx4_unregister_device()
mlx4_unload_one()
mlx4_shutdown()
linux_pci_shutdown()
bus_generic_shutdown()

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agopowerpc64: Fix early exit with invalid kernel SLB entries
jhibbits [Fri, 8 Mar 2019 04:20:33 +0000 (04:20 +0000)]
powerpc64: Fix early exit with invalid kernel SLB entries

The check for early exit should be checking the SLB entry itself.  As
currently written it was checking the address of the SLB, which is always
non-zero, so would go through the kernel SR restore loop regardless.

Submitted by: mmacy
MFC after: 2 weeks

5 years agopowerpc: Fix cpufreq statement scoping
jhibbits [Fri, 8 Mar 2019 03:59:53 +0000 (03:59 +0000)]
powerpc: Fix cpufreq statement scoping

The second statements on the lines are not guarded by the `if' condition.
This triggers a warning with newer gcc.  It's relatively harmless given the
usage, but incorrect.  Instead, wrap the statements so they're properly
guarded.

Reported by: powerpc64-gcc xtoolchain
MFC after: 1 week

5 years agoFortuna: Add Chacha20 as an alternative stream cipher
cem [Fri, 8 Mar 2019 01:17:20 +0000 (01:17 +0000)]
Fortuna: Add Chacha20 as an alternative stream cipher

Chacha20 with a 256 bit key and 128 bit counter size is a good match for an
AES256-ICM replacement.

In userspace, Chacha20 is typically marginally slower than AES-ICM on
machines with AESNI intrinsics, but typically much faster than AES on
machines without special intrinsics.  ChaCha20 does well on typical modern
architectures with SIMD instructions, which includes most types of machines
FreeBSD runs on.

In the kernel, we can't (or don't) make use of AESNI intrinsics for
random(4) anyway.  So even on amd64, using Chacha provides a modest
performance improvement in random device throughput today.

This change makes the stream cipher used by random(4) configurable at boot
time with the 'kern.random.use_chacha20_cipher' tunable.

Very rough, non-scientific measurements at the /dev/random device, on a
GENERIC-NODEBUG amd64 VM with 'pv', show a factor of 2.2x higher throughput
for Chacha20 over the existing AES-ICM mode.

Reviewed by: delphij, markm
Approved by: secteam (delphij)
Differential Revision: https://reviews.freebsd.org/D19475

5 years agoUpdate for IETF draft-ietf-6man-ipv6only-flag.
bz [Thu, 7 Mar 2019 23:03:39 +0000 (23:03 +0000)]
Update for IETF draft-ietf-6man-ipv6only-flag.

When we roam between networks and our link-state goes down, automatically remove
the IPv6-Only flag from the interface.  Otherwise we might switch from an
IPv6-only to and IPv4-only network and the flag would stay and we would prevent
IPv4 from working.

While the actual function call to clear the flag is under EXPERIMENTAL,
the eventhandler is not as we might want to re-use it for other
functionality on link-down event (such was re-calculate default routers
for example if there is more than one).

Reviewed by: hrs
Differential Revision: https://reviews.freebsd.org/D19487

5 years agoImprove entropy for ZFS taskqueue selection.
mav [Thu, 7 Mar 2019 22:56:39 +0000 (22:56 +0000)]
Improve entropy for ZFS taskqueue selection.

I just found that at least on Skylake CPUs cpu_ticks() never returns odd
values, only even, and possibly has even bigger step (176/2?), that makes
its lower bits very bad entropy source, leaving half of taskqueues unused.
Switch to sbinuptime(), closer to upstreams, mitigates the problem by the
rate conversion working as kind of hash function.  In case that is somehow
not enough (timer rate is too low or too divisible) mix in curcpu.

MFC after: 1 week

5 years agosh/tests: Improve failure messages of expansion/arith15.0
jilles [Thu, 7 Mar 2019 22:51:58 +0000 (22:51 +0000)]
sh/tests: Improve failure messages of expansion/arith15.0

5 years agoCorrect my previous correction to the license. It now matches the text
brooks [Thu, 7 Mar 2019 22:34:45 +0000 (22:34 +0000)]
Correct my previous correction to the license.  It now matches the text
in https://spdx.org/licenses/GPL-2.0.html

5 years agoCorrect license boilerplate, to match the SPDX tag.
brooks [Thu, 7 Mar 2019 22:20:20 +0000 (22:20 +0000)]
Correct license boilerplate, to match the SPDX tag.

The GPL-2.0 tag is a deprecated tag which means that same thing as
GPL-2.0-only.

5 years agoPull in r354937 from upstream clang trunk (by Jörg Sonnenberger):
dim [Thu, 7 Mar 2019 19:33:39 +0000 (19:33 +0000)]
Pull in r354937 from upstream clang trunk (by Jörg Sonnenberger):

  Fix inline assembler constraint validation

  The current constraint logic is both too lax and too strict. It fails
  for input outside the [INT_MIN..INT_MAX] range, but it also
  implicitly accepts 0 as value when it should not. Adjust logic to
  handle both correctly.

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

Pull in r355491 from upstream clang trunk (by Hans Wennborg):

  Inline asm constraints: allow ICE-like pointers for the "n"
  constraint (PR40890)

  Apparently GCC allows this, and there's code relying on it (see bug).

  The idea is to allow expression that would have been allowed if they
  were cast to int. So I based the code on how such a cast would be
  done (the CK_PointerToIntegral case in
  IntExprEvaluator::VisitCastExpr()).

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

These should fix assertions and errors when using the inline assembly
"n" constraint in certain ways.

In case of devel/valgrind, a pointer was used as the input for the
constraint, which lead to "Assertion failed: (isInt() && "Invalid
accessor"), function getInt".

In case of math/secp256k1, a very large integer value was used as input
for the constraint, which lead to "error: value '4624529908474429119'
out of range for constraint 'n'".

PR:             236216, 236194
MFC after:      1 month
X-MFC-With:     r344779

5 years agoarm64: allwinner: a64: Add TCON clock
manu [Thu, 7 Mar 2019 19:32:01 +0000 (19:32 +0000)]
arm64: allwinner: a64: Add TCON clock

The tcon clock need a mux table for it's parent, for now just
list the parents twice.

5 years agoarm64: allwinner: Add CCU DE2
manu [Thu, 7 Mar 2019 19:30:37 +0000 (19:30 +0000)]
arm64: allwinner: Add CCU DE2

The Display Engine 2 have it's own Clock and Control Unit, add support
for it.

5 years agoarm: allwinner: Fix NM clock recalc
manu [Thu, 7 Mar 2019 19:28:47 +0000 (19:28 +0000)]
arm: allwinner: Fix NM clock recalc

If the NM clock is using a fractional divider the formula isn't the same.

5 years agostand/common/module: Apply style(9)
manu [Thu, 7 Mar 2019 18:57:43 +0000 (18:57 +0000)]
stand/common/module: Apply style(9)

5 years agoseq(1): Require user-provided format strings to contain a conversion
cem [Thu, 7 Mar 2019 18:24:16 +0000 (18:24 +0000)]
seq(1): Require user-provided format strings to contain a conversion

This matches GNU seq, for example.

For users that are looking for similar functionality, 'jot -b foo N' will
print 'foo' N times.  See jot(1).

PR: 236347
Reported by: <y AT maya.st>
Sponsored by: Dell EMC Isilon

5 years agoMFV r344878:
cy [Thu, 7 Mar 2019 13:36:00 +0000 (13:36 +0000)]
MFV r344878:

4.2.8p12 --> 4.2.8p13

MFC after: immediately
Security: CVE-2019-8936
VuXML: c2576e14-36e2-11e9-9eda-206a8a720317
Obtained from: nwtime.org