]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r350048:
Mark Johnston [Fri, 19 Jul 2019 16:21:19 +0000 (16:21 +0000)]
MFC r350048:
Chase r350037.

5 years agoMFC r349890:
Philip Paeps [Fri, 19 Jul 2019 15:37:29 +0000 (15:37 +0000)]
MFC r349890:
  telnet: fix a couple of snprintf() buffer overflows

  Obtained from:       Juniper Networks

MFC r349896:
  telnet: fix minor style violationo

  While here also fix a very unlikely NULL pointer dereference.

  Submitted by:        Shawn Webb <shawn.webb@hardenedbsd.org>

5 years agoMFC r349940:
Andrey V. Elsukov [Fri, 19 Jul 2019 15:17:54 +0000 (15:17 +0000)]
MFC r349940:
  Correctly truncate the rule in case when it has several action opcodes.

  It is possible, that opcode at the ACTION_PTR() location is not real
  action, but action modificator like "log", "tag" etc. In this case we
  need to check for each opcode in the loop to find O_EXTERNAL_ACTION.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

MFC r349941:
  Do not modify cmd pointer if it is already last opcode in the rule.

5 years agoMFC r350037:
Mark Johnston [Fri, 19 Jul 2019 15:11:14 +0000 (15:11 +0000)]
MFC r350037:
Fix the arm64 page table entry attribute mask.

5 years agoMFC r350054:
Mark Johnston [Fri, 19 Jul 2019 15:07:31 +0000 (15:07 +0000)]
MFC r350054:
Use a platform-independent constant for PKG_MAX_SIZE.

PR: 238511

5 years agoMFC r349237:
Alan Somers [Fri, 19 Jul 2019 14:27:18 +0000 (14:27 +0000)]
MFC r349237:

VOP_REVOKE(9): update locking requirements per r143495

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20524

5 years agoMFC r349230, r349234, r349477
Alan Somers [Fri, 19 Jul 2019 14:16:11 +0000 (14:16 +0000)]
MFC r349230, r349234, r349477

r349230:
Add a VOP_BMAP(9) man page

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20704

r349234:
VOP_BMAP(9): fix typo in the copyright header

Reported by: rgrimes
MFC-With: 349230
Sponsored by: The FreeBSD Foundation

r349477:
[skip ci] VOP_BMAP.9: fix diction in copyright header

MFC-With: r349230
Sponsored by: The FreeBSD Foundation

5 years agoMFC r349041:
Alan Somers [Fri, 19 Jul 2019 14:13:50 +0000 (14:13 +0000)]
MFC r349041:

open(2): fix the description of O_FSYNC

The man page claims that with O_FSYNC (aka O_SYNC) the kernel will not cache
written data. However, that's not true. Nor does POSIX require it.
Perhaps it was true when that section of the man page was written in r69336
(I haven't checked). But it's not true now.  Now the effect is simply that
writes are sent to disk immediately and synchronously, but they're still
cached.

See also: https://pubs.opengroup.org/onlinepubs/9699919799/
See also: ffs_write in sys/ufs/ffs/ffs_vnops.c

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20641

5 years agoMFC r349009:
Alan Somers [Fri, 19 Jul 2019 14:12:11 +0000 (14:12 +0000)]
MFC r349009:

Add test cases for epair

Implements the missing test cases for epair in a similar fashion to the
existing tests. Fixes shared abstractions to work with epair tests.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reviewed by: asomers
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D20498

5 years agoMFC r349917:
Cy Schubert [Thu, 18 Jul 2019 11:46:37 +0000 (11:46 +0000)]
MFC r349917:

Remove a tautological test for adding a rule in the block that
adds rules.

5 years agoMFC r349898, r349916:
Cy Schubert [Thu, 18 Jul 2019 11:43:09 +0000 (11:43 +0000)]
MFC r349898, r349916:

ipfilter commands, in this case ipf(8), passes its operations and rules
via an ioctl interface. Rules can be added or removed and stats and
counters can be zeroed out. As the ipfilter interprets these
instructions or operations they are stored in an integer called
addrem (add/remove). 0 is add, 1 is remove, and 2 is clear stats and
counters. Much of this is not documented. This commit documents these
operations by replacing simple integers with a self documenting
enum along with a few basic comments.

5 years agoMFC r349910:
Mark Johnston [Thu, 18 Jul 2019 01:33:00 +0000 (01:33 +0000)]
MFC r349910:
Fix some ISS bit definitions for data aborts.

5 years agoMFC r344629:
Mark Johnston [Wed, 17 Jul 2019 16:52:25 +0000 (16:52 +0000)]
MFC r344629:
rtsol: Use vwarnx(3) to log messages to standard error.

5 years agoMFC r349276:
Johannes Lundberg [Wed, 17 Jul 2019 16:38:40 +0000 (16:38 +0000)]
MFC r349276:
LinuxKPI: Add atomic_long_sub macro.

Reviewed by: imp (mentor), hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D20718

5 years agoMFC r349277:
Johannes Lundberg [Wed, 17 Jul 2019 16:34:32 +0000 (16:34 +0000)]
MFC r349277:
LinuxKPI: Additions to rcu list.

- Add rcu list functions.
- Make rcu hlist's foreach macro use rcu calls instead of the non-rcu macro.
- Bump FreeBSD version so we have a checkpoint for the vboxvideo drm driver.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D20719

5 years agoMFC r349978:
Cy Schubert [Wed, 17 Jul 2019 01:05:33 +0000 (01:05 +0000)]
MFC r349978:

style(9)

5 years agoMFC r349711:
Mark Johnston [Wed, 17 Jul 2019 00:27:11 +0000 (00:27 +0000)]
MFC r349711:
iwm: Drain callouts after stopping the device during detach.

5 years agoMFC r345632 by lwhsu: Fix `make` in sys/modules
Eugene Grosbein [Tue, 16 Jul 2019 18:39:59 +0000 (18:39 +0000)]
MFC r345632 by lwhsu: Fix `make` in sys/modules

PR:             239120

5 years agoMFC r349971:
Dimitry Andric [Tue, 16 Jul 2019 17:39:58 +0000 (17:39 +0000)]
MFC r349971:

Pull in r365760 from upstream lld trunk (by Fangrui Song):

  [ELF] Handle non-glob patterns before glob patterns in version
  scripts & fix a corner case of --dynamic-list

  This fixes PR38549, which is silently accepted by ld.bfd.
  This seems correct because it makes sense to let non-glob patterns
  take precedence over glob patterns.

  lld issues an error because
  `assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before
  `assignExactVersion(ver, v.id, v.name);`.

  Move all assignWildcardVersion() calls after assignExactVersion()
  calls to fix this.

  Also, move handleDynamicList() to the bottom. computeBinding() called
  by includeInDynsym() has this cryptic rule:

      if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible)
return STB_LOCAL;

  Before the change:

  * foo's version is set to VER_NDX_LOCAL due to `local: *`
  * handleDynamicList() is called
    - foo.computeBinding() is STB_LOCAL
    - foo.includeInDynsym() is false
    - foo.isPreemptible is not set (wrong)
  * foo's version is set to V1

  After the change:

  * foo's version is set to VER_NDX_LOCAL due to `local: *`
  * foo's version is set to V1
  * handleDynamicList() is called
    - foo.computeBinding() is STB_GLOBAL
    - foo.includeInDynsym() is true
    - foo.isPreemptible is set (correct)

  Reviewed By: ruiu

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

This makes it longer necessary to patch the version scripts for the
samba ports, to avoid "duplicate symbol 'pdb_search_init' in version
script" errors.

PR: 230602

5 years agoMFC r349869
Vincenzo Maffione [Tue, 16 Jul 2019 17:27:51 +0000 (17:27 +0000)]
MFC r349869

update calendar.freebsd

5 years agoMFC r349472:
Li-Wen Hsu [Tue, 16 Jul 2019 16:23:56 +0000 (16:23 +0000)]
MFC r349472:

Follow r349460 to complete removing "flags" in struct gpiobus_ivar

Sponsored by: The FreeBSD Foundation

5 years agoMFC r349834
Eric van Gyzen [Tue, 16 Jul 2019 16:05:42 +0000 (16:05 +0000)]
MFC r349834

Ignore kern.vt.splash_cpu without graphics

When the system has no graphical console, such as bhyve in common
configurations, ignore kern.vt.splash_cpu, instead of panicking
on INVARIANTS kernels.

Reviewed by: cem dumbbell
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20877

5 years agoMFC r349579: nctgpio: change default pin names to those used by the datasheet(s)
Andriy Gapon [Tue, 16 Jul 2019 16:01:51 +0000 (16:01 +0000)]
MFC r349579: nctgpio: change default pin names to those used by the datasheet(s)

That is, instead of the current GPIO00 - GPIO15 the names will be GPIO00
- GPIO07, GPIO10 - GPIO17.  The first digit is a GPIO "bank" / group
number and the second one is a pin number within the bank.  Alternative
view is that the pin names are changed from decimal numbering scheme to
octal one (as there are 8 pins per bank).

5 years agoMFC r349460: gpiobus: provide a new hint, pin_list
Andriy Gapon [Tue, 16 Jul 2019 15:52:47 +0000 (15:52 +0000)]
MFC r349460: gpiobus: provide a new hint, pin_list

"pin_list" allows to specify child pins as a list of pin numbers.
Existing hint "pins" serves the same purpose but with a 32-bit wide bit
mask.  One problem with that is that a controller can have more than 32
pins.  One example is amdgpio.  Also, a list of numbers is a little bit
more human friendly than a matching bit mask.  As a side note, it seems
that in FDT pins are typically specified by their numbers as well.

This commit also adds accessors for instance variables (IVARs) that
define the child pins.  My primary goal is to allow a child to be
configured programmatically rather than via hints (assuming that FDT is
not supported on a platform).  Also, while a child should not care about
specific pin numbers that are allocated to it, it could be interested in
how many were actually assigned to it.

While there, I removed "flags" instance variable.  It was unused.

5 years agoMFC r349428,r349433: owc_gpiobus: clean / fix up the driver module things
Andriy Gapon [Tue, 16 Jul 2019 15:48:02 +0000 (15:48 +0000)]
MFC r349428,r349433: owc_gpiobus: clean / fix up the driver module things

"fdt" is removed from the driver module name as the driver does not
require FDT and can work very well on hints based systems.

A module dependency is added for gpiobus.  Without that owc cannot
resolve symbols in gpiobus if both are loaded as kernel modules.

Finally, a driver module module version is added.

5 years agoMFC r349408: gpio.4: document device hints common to all devices on gpiobus
Andriy Gapon [Tue, 16 Jul 2019 15:44:07 +0000 (15:44 +0000)]
MFC r349408: gpio.4: document device hints common to all devices on gpiobus

5 years agoMFC r349406: owc.4: document how to set up the 1-wire bus on a device.hints system
Andriy Gapon [Tue, 16 Jul 2019 15:36:05 +0000 (15:36 +0000)]
MFC r349406: owc.4: document how to set up the 1-wire bus on a device.hints system

5 years agoMFC r348688: first step towards enforcing must-succeed semantics for bus accessors
Andriy Gapon [Tue, 16 Jul 2019 15:28:28 +0000 (15:28 +0000)]
MFC r348688: first step towards enforcing must-succeed semantics for bus accessors

5 years agoMFC r349645:
Hans Petter Selasky [Tue, 16 Jul 2019 15:07:33 +0000 (15:07 +0000)]
MFC r349645:
Remove dead code added after r348743 in the LinuxKPI. The
LINUXKPI_VERSION macro is not defined for any compiled LinuxKPI code
which basically means __GFP_NOTWIRED is never checked when allocating
pages. This should work fine with the existing external DRM code as
long as the page wiring and unwiring is balanced.

Sponsored by: Mellanox Technologies

5 years agoMFC r348355: revert r273728 and parts of r306589, iicbus no-stop by default feature
Andriy Gapon [Tue, 16 Jul 2019 14:59:39 +0000 (14:59 +0000)]
MFC r348355: revert r273728 and parts of r306589, iicbus no-stop by default feature

After r349224 the only consumer of that broken code is gone.

5 years agoMFC r349581
Vincenzo Maffione [Mon, 15 Jul 2019 20:25:49 +0000 (20:25 +0000)]
MFC r349581

netmap: fix two panics with emulated adapter

This patch fixes 2 panics. The first one is due to the current VNET not
being set in the emulated adapter transmission path. The second one
is caused by the M_PKTHDR flag not being set when preallocated mbufs
are recycled in the transmit path.

Submitted by:   aleksandr.fedorov@itglobal.com
Reviewed by:    vmaffione
Differential Revision:  https://reviews.freebsd.org/D20824

5 years agoMFC r349966
Vincenzo Maffione [Mon, 15 Jul 2019 20:12:54 +0000 (20:12 +0000)]
MFC r349966

netmap: fix bug introduced by r349752

r349752 introduced a NULL pointer reference bug
in the emulated netmap code.

Reported by:    lwhsu

5 years agoMFC r349950:
Konstantin Belousov [Mon, 15 Jul 2019 08:21:21 +0000 (08:21 +0000)]
MFC r349950:
Style: avoid long lines by using .Fo instead of .Fn.

5 years agoMFC r349913:
Konstantin Belousov [Sun, 14 Jul 2019 05:40:03 +0000 (05:40 +0000)]
MFC r349913:
Ensure that mds_handler always points to a valid method.

5 years agoMFC r349912:
Konstantin Belousov [Sun, 14 Jul 2019 05:39:02 +0000 (05:39 +0000)]
MFC r349912:
Restore ability to pass NULL name argument to pthread_set_name_np(3)
to clear the thread name.

PR: 239142

5 years agoMFC r349876:
Dimitry Andric [Sat, 13 Jul 2019 10:46:01 +0000 (10:46 +0000)]
MFC r349876:

Apply a workaround to be able to build clang 8.0.0 headers with clang
3.4.1, which is still in the stable/10 branch.

It looks like clang 3.4.1 implements static_asserts by instantiating a
temporary static object, and if those are in an anonymous union, it
results in "error: anonymous union can only contain non-static data
members".

To work around this implementation limitation, move the static_asserts
in question out of the anonymous unions.

This should make building the latest stable/11 from stable/10 possible
again.

Reported by: Mike Tancsa <mike@sentex.net>

5 years agoMFC 347238: vmm(4): Pass through RDSEED feature bit to guests
John Baldwin [Sat, 13 Jul 2019 00:51:11 +0000 (00:51 +0000)]
MFC 347238: vmm(4): Pass through RDSEED feature bit to guests

5 years agoMFC 343068:
John Baldwin [Sat, 13 Jul 2019 00:23:20 +0000 (00:23 +0000)]
MFC 343068:
Use capsicum_helpers(3) that allow us to simplify the code and its functions
will return success when the kernel is built without support of
the capability mode.

It is important to note, that I'm taking a more conservative approach
with these changes and it will be done in small steps.

5 years agoMFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes.
John Baldwin [Fri, 12 Jul 2019 22:31:12 +0000 (22:31 +0000)]
MFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes.

339911:
Emulate machine check related MSR_EXTFEATURES to allow guest OSes to
boot on AMD FX Series.

339936:
Merge cases with upper block.
This is a cosmetic change only to simplify code.

343075:
vmm(4): Take steps towards multicore bhyve AMD support

vmm's CPUID emulation presented Intel topology information to the guest, but
disabled AMD topology information and in some cases passed through garbage.
I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but
guest CPUs can migrate between host threads, so the information presented
was not consistent.  This could easily be observed with 'cpucontrol -i 0xfoo
/dev/cpuctl0'.

Slightly improve this situation by enabling the AMD topology feature flag
and presenting at least the CPUID fields used by FreeBSD itself to probe
topology on more modern AMD64 hardware (Family 15h+).  Older stuff is
probably less interesting.  I have not been able to empirically confirm it
is sufficient, but it should not regress anything either.

343166:
vmm(4): Mask Spectre feature bits on AMD hosts

For parity with Intel hosts, which already mask out the CPUID feature
bits that indicate the presence of the SPEC_CTRL MSR, do the same on
AMD.

Eventually we may want to have a better support story for guests, but
for now, limit the damage of incorrectly indicating an MSR we do not yet
support.

Eventually, we may want a generic CPUID override system for
administrators, or for minimum supported feature set in heterogenous
environments with failover.  That is a much larger scope effort than
this bug fix.

348592:
Emulate the AMD MSR_LS_CFG MSR used for various Ryzen errata.

Writes are ignored and reads always return zero.

PR: 224476, 235010

5 years agoMFC 348210: Add a constant for the LS config MSR on AMD CPUs.
John Baldwin [Fri, 12 Jul 2019 20:05:30 +0000 (20:05 +0000)]
MFC 348210: Add a constant for the LS config MSR on AMD CPUs.

5 years agoMFC r349583:
Dimitry Andric [Fri, 12 Jul 2019 19:43:59 +0000 (19:43 +0000)]
MFC r349583:

Pull in r360968 from upstream llvm trunk (by Philip Reames):

  Clarify comments on helpers used by LFTR [NFC]

  I'm slowly wrapping my head around this code, and am making comment
  improvements where I can.

Pull in r360972 from upstream llvm trunk (by Philip Reames):

  [LFTR] Factor out a helper function for readability purpose [NFC]

Pull in r360976 from upstream llvm trunk (by Philip Reames):

  [IndVars] Don't reimplement Loop::isLoopInvariant [NFC]

  Using dominance vs a set membership check is indistinguishable from a
  compile time perspective, and the two queries return equivelent
  results.  Simplify code by using the existing function.

Pull in r360978 from upstream llvm trunk (by Philip Reames):

  [LFTR] Strengthen assertions in genLoopLimit [NFCI]

Pull in r362292 from upstream llvm trunk (by Nikita Popov):

  [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181)

  Fix for https://bugs.llvm.org/show_bug.cgi?id=31181 and partial fix
  for LFTR poison handling issues in general.

  When LFTR moves a condition from pre-inc to post-inc, it may now
  depend on value that is poison due to nowrap flags. To avoid this, we
  clear any nowrap flag that SCEV cannot prove for the post-inc addrec.

  Additionally, LFTR may switch to a different IV that is dynamically
  dead and as such may be arbitrarily poison. This patch will correct
  nowrap flags in some but not all cases where this happens. This is
  related to the adoption of IR nowrap flags for the pre-inc addrec.
  (See some of the switch_to_different_iv tests, where flags are not
  dropped or insufficiently dropped.)

  Finally, there are likely similar issues with the handling of GEP
  inbounds, but we don't have a test case for this yet.

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

Pull in r362971 from upstream llvm trunk (by Philip Reames):

  Prepare for multi-exit LFTR [NFC]

  This change does the plumbing to wire an ExitingBB parameter through
  the LFTR implementation, and reorganizes the code to work in terms of
  a set of individual loop exits. Most of it is fairly obvious, but
  there's one key complexity which makes it worthy of consideration.
  The actual multi-exit LFTR patch is in D62625 for context.

  Specifically, it turns out the existing code uses the backedge taken
  count from before a IV is widened. Oddly, we can end up with a
  different (more expensive, but semantically equivelent) BE count for
  the loop when requerying after widening.  For the nestedIV example
  from elim-extend, we end up with the following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  This is the only test in tree which seems sensitive to this
  difference. The actual result of using the wider BETC on this example
  is that we actually produce slightly better code. :)

  In review, we decided to accept that test change.  This patch is
  structured to preserve the old behavior, but a separate change will
  immediate follow with the behavior change.  (I wanted it separate for
  problem attribution purposes.)

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

Pull in r362975 from upstream llvm trunk (by Philip Reames):

  [LFTR] Use recomputed BE count

  This was discussed as part of D62880.  The basic thought is that
  computing BE taken count after widening should produce (on average)
  an equally good backedge taken count as the one before widening.
  Since there's only one test in the suite which is impacted by this
  change, and it's essentially equivelent codegen, that seems to be a
  reasonable assertion.  This change was separated from r362971 so that
  if this turns out to be problematic, the triggering piece is obvious
  and easily revertable.

  For the nestedIV example from elim-extend.ll, we end up with the
  following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  Note that before is an i32 type, and the after is an i64.  Truncating
  the i64 produces the i32.

Pull in r362980 from upstream llvm trunk (by Philip Reames):

  Factor out a helper function for readability and reuse in a future
  patch [NFC]

Pull in r363613 from upstream llvm trunk (by Philip Reames):

  Fix a bug w/inbounds invalidation in LFTR (recommit)

  Recommit r363289 with a bug fix for crash identified in pr42279.
  Issue was that a loop exit test does not have to be an icmp, leading
  to a null dereference crash when new logic was exercised for that
  case.  Test case previously committed in r363601.

  Original commit comment follows:

  This contains fixes for two cases where we might invalidate inbounds
  and leave it stale in the IR (a miscompile). Case 1 is when switching
  to an IV with no dynamically live uses, and case 2 is when doing
  pre-to-post conversion on the same pointer type IV.

  The basic scheme used is to prove that using the given IV (pre or
  post increment forms) would have to already trigger UB on the path to
  the test we're modifying. As such, our potential UB triggering use
  does not change the semantics of the original program.

  As was pointed out in the review thread by Nikita, this is defending
  against a separate issue from the hasConcreteDef case. This is about
  poison, that's about undef. Unfortunately, the two are different, see
  Nikita's comment for a fuller explanation, he explains it well.

  (Note: I'm going to address Nikita's last style comment in a separate
  commit just to minimize chance of subtle bugs being introduced due to
  typos.)

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

Pull in r363875 from upstream llvm trunk (by Philip Reames):

  [LFTR] Rename variable to minimize confusion [NFC]

  (Recommit of r363293 which was reverted when a dependent patch was.)

  As pointed out by Nikita in D62625, BackedgeTakenCount is generally
  used to refer to the backedge taken count of the loop. A conditional
  backedge taken count - one which only applies if a particular exit is
  taken - is called a ExitCount in SCEV code, so be consistent here.

Pull in r363877 from upstream llvm trunk (by Philip Reames):

  [LFTR] Stylistic cleanup as suggested in last review comment of
  D62939 [NFC]

  (Resumbit of r363292 which was reverted along w/an earlier patch)

Pull in r364346 from upstream llvm trunk (by Philip Reames):

  [LFTR] Adjust debug output to include extensions (if any)

Pull in r364693 from upstream llvm trunk (by Philip Reames):

  [IndVars] Remove a bit of manual constant folding [NFC]

  SCEV is more than capable of folding (add x, trunc(0)) to x.

Pull in r364709 from upstream llvm trunk (by Nikita Popov):

  [LFTR] Fix post-inc pointer IV with truncated exit count (PR41998)

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we
  have a truncated exit count we'll truncate the IV when comparing
  against the limit, in which case exit count overflow in post-inc form
  doesn't matter. However, for pointer IVs we don't do that, so we have
  to be careful about incrementing the IV in the wide type.

  I'm fixing this by removing the IVCount variable (which was ExitCount
  or ExitCount+1) and replacing it with a UsePostInc flag, and then
  moving the actual limit adjustment to the individual cases (which
  are: pointer IV where we add to the wide type, integer IV where we
  add to the narrow type, and constant integer IV where we add to the
  wide type).

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

Together, these should fix a hang when building the textproc/htmldoc
port, due to an incorrect loop optimization.

PR: 237515

5 years agoMFC r349929:
Cy Schubert [Fri, 12 Jul 2019 02:15:06 +0000 (02:15 +0000)]
MFC r349929:

Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c.
The reason for this is that ipftest(8), which still works on FreeBSD-11,
fails to link to it, breaking stable/11 builds.

ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle.
glebius@ suggested we disable building it until I can get around to
fixing it. Hence this was not caught in -current.

The intention is to fix ipftest(8) as it is used by the netbsd-tests
(imported by ngie@ many moons ago) for regression testing.

5 years agoMFC r349286, r349293
Doug Moore [Fri, 12 Jul 2019 02:03:43 +0000 (02:03 +0000)]
MFC r349286, r349293

Modify swapon(8) to invoke BIO_DELETE to trim swap devices, either if
'-E' appears on the swapon command line, or if "trimonce" appears as
an fstab option.

Remove #include <sys/types.h> to fix a style(9) violation.

Assisted by: alc
Release notes: yes
Approved by: kib (mentor)

5 years agoMFC r348987, r348989:
Cy Schubert [Fri, 12 Jul 2019 00:50:33 +0000 (00:50 +0000)]
MFC r348987, r348989:

Resolve IPv6 checksum errors with stateful inspection. According to
PR/203585 this appears to have been broken by r235959, which predates
the ipfilter 5.1.2 import into FreeBSD.

The IPv6 checksum calculation is incorrect. To resolve this we call
in6_cksum() to do the the heavy lifting for us, through a new function
ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe
is added to aid with future debugging.

Plus whitespace adjustments (r348989).

PR: 203275, 203585
Differential Revision: https://reviews.freebsd.org/D20583

5 years agoMFC r348986:
Cy Schubert [Fri, 12 Jul 2019 00:35:43 +0000 (00:35 +0000)]
MFC r348986:

Register pfil hooks when VNET != vnet0. r302298, which virtualized ipf,
assumed the pfil hook registration performed in ipf_modload() would take
are of this. However ipf_modload() is only called when the ipl kld is
loaded or when ipfilter is first called when it is statically linked
into the kernel at build time.

Prior to this, even though r302298 has been in the tree for a while, it
has never been used. So, r302298 in reality begins now.

PR: 212000
Reported by: ahsanb@

5 years agoMFC r349753
Vincenzo Maffione [Thu, 11 Jul 2019 20:14:59 +0000 (20:14 +0000)]
MFC r349753

netmap: Remove pointer leakage in netmap_mem2.c

PR:             238641
Submitted by:   Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed by:    vmaffione

5 years agoMFC r349752
Vincenzo Maffione [Thu, 11 Jul 2019 20:13:51 +0000 (20:13 +0000)]
MFC r349752

netmap: fix kernel pointer printing in netmap_generic.c

Print the adapter name rather than the address of the adapter
to avoid kernel address leakage.

PR:             Bug 238642
Submitted by:   Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed by:    vmaffione

5 years agoMFC r349612:
Mark Johnston [Thu, 11 Jul 2019 15:38:40 +0000 (15:38 +0000)]
MFC r349612:
Mark pages allocated from the per-CPU cache.

5 years agoMFC 349843:
Cy Schubert [Thu, 11 Jul 2019 00:44:09 +0000 (00:44 +0000)]
MFC 349843:

Update frtuc struct comments. It not only defines TCP things we are
interested in but also UDP.

While at it document the source and destination port variables.

5 years agoMFC r349842:
Cy Schubert [Thu, 11 Jul 2019 00:38:10 +0000 (00:38 +0000)]
MFC r349842:

Correct the description for the low port in the port compare struct.

Adjust the high port description to match that of the low port
description.

5 years agoMFC r349527,349538:
Martin Matuska [Thu, 11 Jul 2019 00:21:15 +0000 (00:21 +0000)]
MFC r349527,349538:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary
            (OSS-Fuzz 15431)
  PR #1218: Fixes to sparse file handling

5 years agolibsecureboot: allow OpenPGP support to be dormant
Simon J. Gerraty [Wed, 10 Jul 2019 21:35:55 +0000 (21:35 +0000)]
libsecureboot: allow OpenPGP support to be dormant

Since we can now add OpenPGP trust anchors at runtime,
ensure the latent support is available.

Ensure we do not add duplicate keys to trust store.

Also allow reporting names of trust anchors added/revoked

We only do this for loader and only after initializing trust store.
Thus only changes to initial trust store will be logged.

MFC of r349446

Reviewed by:    stevek
Differential Revision:  https://reviews.freebsd.org/D20700

5 years agoMFC r340093 (by imp): Document disbale_phy in ahcich sysctls.
Alexander Motin [Wed, 10 Jul 2019 12:15:07 +0000 (12:15 +0000)]
MFC r340093 (by imp): Document disbale_phy in ahcich sysctls.

5 years agoMFC r349418: Fix qlxgbe(4) static build.
Alexander Motin [Wed, 10 Jul 2019 12:10:10 +0000 (12:10 +0000)]
MFC r349418: Fix qlxgbe(4) static build.

5 years agoMFC r349641:
Tijl Coosemans [Wed, 10 Jul 2019 08:07:33 +0000 (08:07 +0000)]
MFC r349641:

Also remove lib32 versions of libradius.

5 years agoMFC r349640, r349706:
Tijl Coosemans [Wed, 10 Jul 2019 08:05:13 +0000 (08:05 +0000)]
MFC r349640, r349706:

Also remove lib32 version of libcasper.so.0.

5 years agoMFC r349539
Li-Wen Hsu [Tue, 9 Jul 2019 09:09:51 +0000 (09:09 +0000)]
MFC r349539

Skip sys.netpfil.pf.names.names and sys.netpfil.pf.synproxy.synproxy
temporarily because kernel panics when flushing epair queue.

PR: 238870
Sponsored by: The FreeBSD Foundation

5 years agoMFC r349794:
Konstantin Belousov [Tue, 9 Jul 2019 07:19:36 +0000 (07:19 +0000)]
MFC r349794:
Document atomicity for read(2) and write(2).

5 years agoRestore binary compatibility for epoch(9) API.
Hans Petter Selasky [Mon, 8 Jul 2019 21:33:14 +0000 (21:33 +0000)]
Restore binary compatibility for epoch(9) API.
This is a direct commit.

Discussed with: jhb@
Sponsored by: Mellanox Technologies

5 years agoMFC r349321: Improve AHCI Enclosure Management and SES interoperation.
Alexander Motin [Mon, 8 Jul 2019 10:21:38 +0000 (10:21 +0000)]
MFC r349321: Improve AHCI Enclosure Management and SES interoperation.

Since SES specs do not define mechanism to map enclosure slots to SATA
disks, AHCI EM code I written many years ago appeared quite useless,
that always bugged me.  I was thinking whether it was a good idea, but
if LSI HBAs do that, why I shouldn't?

This change introduces simple non-standard mechanism for the mapping
into both AHCI EM and SES code, that makes AHCI EM on capable controllers
(most of Intel's) a first-class SES citizen, allowing it to report disk
physical path to GEOM, show devices inserted into each enclosure slot in
`sesutil map` and `getencstat`, control locate and fault LEDs for specific
devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc.

I've successfully tested this on Supermicro X10DRH-i motherboard connected
with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane.
It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for
each disk identical to real SES of Supermicro SAS2 backplanes.

Relnotes: yes

5 years agoMFC r341811 (by delphij):
Alexander Motin [Mon, 8 Jul 2019 10:19:49 +0000 (10:19 +0000)]
MFC r341811 (by delphij):
Remove questionable initialization for ICH8M, rely on BIOS to properly
initialize the controller.

According to the datasheet, the old code checks if port 2 (P2E, 0x4) was
the only enabled port (except port 0, which was ignored by mask 0xfe),
and issue a write to the PCS register to disable all but port 0, right
before ahci_ctlr_reset.

Some other operating systems would issue a port enable to all ports, but
since the current code only does the special initialization for ICH8M,
it entirely and rely on BIOS to do the right thing (the alternative
would be https://reviews.freebsd.org/D18300?id=50922 , should we see
reports that we really need to do it).

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

5 years agoMFC r340092 (by imp): Implement ability to turn on/off PHYs for AHCI devices.
Alexander Motin [Mon, 8 Jul 2019 10:18:11 +0000 (10:18 +0000)]
MFC r340092 (by imp): Implement ability to turn on/off PHYs for AHCI devices.

As part of Chuck's work on fixing kernel crashes caused by disk I/O
errors, it is useful to be able to trigger various kinds of
errors. This patch allows causing an AHCI-attached disk to disappear,
by having the driver keep the PHY disabled when the driver would
otherwise enable the PHY. It also allows making the disk reappear by
having the driver go back to setting the PHY enable/disable state as
it normal would and simulating the hardware event that causes a bus
rescan.

Submitted by: Chuck Silvers
Differential Revision: https://reviews.freebsd.org/D16043

5 years agoMFC r340041 (by miwi): - Add quirk for Samsung on Mac Mini 7,1
Alexander Motin [Mon, 8 Jul 2019 10:17:00 +0000 (10:17 +0000)]
MFC r340041 (by miwi): - Add quirk for Samsung on Mac Mini 7,1

PR: 201676
Submitted by: Ruben Kerkhof

5 years agoMFC r349246: SPC-3 and up require some UAs to be returned as fixed.
Alexander Motin [Sun, 7 Jul 2019 18:51:01 +0000 (18:51 +0000)]
MFC r349246: SPC-3 and up require some UAs to be returned as fixed.

5 years agoMFC r349243: Optimize xpt_getattr().
Alexander Motin [Sun, 7 Jul 2019 18:50:23 +0000 (18:50 +0000)]
MFC r349243: Optimize xpt_getattr().

Do not allocate temporary buffer for attributes we are going to return
as-is, just make sure to NUL-terminate them.  Do not zero temporary 64KB
buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled
and there are also length fields inside the returned data also.

5 years agoMFC r349220: Add wakeup_any(), cheaper wakeup_one() for taskqueue(9).
Alexander Motin [Sun, 7 Jul 2019 18:49:39 +0000 (18:49 +0000)]
MFC r349220: Add wakeup_any(), cheaper wakeup_one() for taskqueue(9).

wakeup_one() and underlying sleepq_signal() spend additional time trying
to be fair, waking thread with highest priority, sleeping longest time.
But in case of taskqueue there are many absolutely identical threads, and
any fairness between them is quite pointless.  It makes even worse, since
round-robin wakeups not only make previous CPU affinity in scheduler quite
useless, but also hide from user chance to see CPU bottlenecks, when
sequential workload with one request at a time looks evenly distributed
between multiple threads.

This change adds new SLEEPQ_UNFAIR flag to sleepq_signal(), making it wakeup
thread that went to sleep last, but no longer in context switch (to avoid
immediate spinning on the thread lock).  On top of that new wakeup_any()
function is added, equivalent to wakeup_one(), but setting the flag.
On top of that taskqueue(9) is switchied to wakeup_any() to wakeup its
threads.

As result, on 72-core Xeon v4 machine sequential ZFS write to 12 ZVOLs
with 16KB block size spend 34% less time in wakeup_any() and descendants
then it was spending in wakeup_one(), and total write throughput increased
by ~10% with the same as before CPU usage.

5 years agoMFC r349195: Use sbuf_cat() in GEOM confxml generation.
Alexander Motin [Sun, 7 Jul 2019 18:47:01 +0000 (18:47 +0000)]
MFC r349195: Use sbuf_cat() in GEOM confxml generation.

When it comes to megabytes of text, difference between sbuf_printf() and
sbuf_cat() becomes substantial.

5 years agoMFC r349190: Fix typo in r349178.
Alexander Motin [Sun, 7 Jul 2019 18:45:57 +0000 (18:45 +0000)]
MFC r349190: Fix typo in r349178.

5 years agoMFC r349178: Optimize kern.geom.conf* sysctls.
Alexander Motin [Sun, 7 Jul 2019 18:44:51 +0000 (18:44 +0000)]
MFC r349178: Optimize kern.geom.conf* sysctls.

On large systems those sysctls may generate megabytes of output.  Before
this change sbuf(9) code was resizing buffer by 4KB each time many times,
generating tons of TLB shootdowns.  Unfortunately in this case existing
sbuf_new_for_sysctl() mechanism, supposed to help with this issue, is not
applicable, since all the sbuf writes are done in different kernel thread.

This change improves situation in two ways:
 - on first sysctl call, not providing any output buffer, it sets special
sbuf drain function, just counting the data and so not needing big buffer;
 - on second sysctl call it uses as initial buffer size value saved on
previous call, so that in most cases there will be no reallocation, unless
GEOM topology changed significantly.

5 years agoMFC r349040: Minimize aggsum_compare(&arc_size, arc_c) calls.
Alexander Motin [Sun, 7 Jul 2019 18:42:25 +0000 (18:42 +0000)]
MFC r349040: Minimize aggsum_compare(&arc_size, arc_c) calls.

For busy ARC situation when arc_size close to arc_c is desired.  But
then it is quite likely that aggsum_compare(&arc_size, arc_c) will need
to flush per-CPU buckets to find exact comparison result.  Doing that
often in a hot path penalizes whole idea of aggsum usage there, since it
replaces few simple atomic additions with dozens of lock acquisitions.

Replacing aggsum_compare() with aggsum_upper_bound() in code increasing
arc_p when ARC is growing (arc_size < arc_c) according to PMC profiles
allows to save ~5% of CPU time in aggsum code during sequential write
to 12 ZVOLs with 16KB block size on large dual-socket system.

I suppose there some minor arc_p behavior change due to lower precision
of the new code, but I don't think it is a big deal, since it should
affect only very small window in time (aggsum buckets are flushed every
second) and in ARC size (buckets are limited to 10 average ARC blocks
per CPU).

5 years agoMFC r349039: Alike to ZoL disable metaslab allocation tracing code.
Alexander Motin [Sun, 7 Jul 2019 18:40:35 +0000 (18:40 +0000)]
MFC r349039: Alike to ZoL disable metaslab allocation tracing code.

It is too generous to collect in production debug traces that can only
be read with kernel debugger.  Illumos includes special code in their
mdb debugger to read it, we don't.

5 years agoMFC r349035: Properly align struct multilist_sublist to cache line.
Alexander Motin [Sun, 7 Jul 2019 18:39:32 +0000 (18:39 +0000)]
MFC r349035: Properly align struct multilist_sublist to cache line.

Manual Illumos alignment does not fit us due to different kmutex_t size.

5 years agoMFC r349029: Update td_runtime of running thread on each statclock().
Alexander Motin [Sun, 7 Jul 2019 18:38:40 +0000 (18:38 +0000)]
MFC r349029: Update td_runtime of running thread on each statclock().

Normally td_runtime is updated on context switch, but there are some kernel
threads that due to high absolute priority may run for many seconds without
context switches (yes, that is bad, but that is true), which means their
td_runtime was not updated all that time, that made them invisible for top
other then as some general CPU usage.

5 years agoMFC r349006: Move write aggregation memory copy out of vq_lock.
Alexander Motin [Sun, 7 Jul 2019 18:37:46 +0000 (18:37 +0000)]
MFC r349006: Move write aggregation memory copy out of vq_lock.

Memory copy is too heavy operation to do under the congested lock.
Moving it out reduces congestion by many times to almost invisible.
Since the original zio removed from the queue, and the child zio is
not executed yet, I don't see why would the copy need protection.
My guess it just remained like this from the time when lock was not
dropped here, which was added later to fix lock ordering issue.

Multi-threaded sequential write tests with both HDD and SSD pools
with ZVOL block sizes of 4KB, 16KB, 64KB and 128KB all show major
reduction of lock congestion, saving from 15% to 35% of CPU time
and increasing throughput from 10% to 40%.

5 years agoMFC r349292: Decouple enc/ses verbosity from bootverbose.
Alexander Motin [Sun, 7 Jul 2019 18:33:21 +0000 (18:33 +0000)]
MFC r349292: Decouple enc/ses verbosity from bootverbose.

I don't want to be regularly notified that my enclosure violates standards
until there is some real problem I want to debug.

5 years agoMFC r349287: Remove ancient SCSI-2/3 mentioning.
Alexander Motin [Sun, 7 Jul 2019 18:32:34 +0000 (18:32 +0000)]
MFC r349287: Remove ancient SCSI-2/3 mentioning.

5 years agoMFC r349284: Make ELEMENT INDEX validation more strict.
Alexander Motin [Sun, 7 Jul 2019 18:31:53 +0000 (18:31 +0000)]
MFC r349284: Make ELEMENT INDEX validation more strict.

SES specifications tell: "The Additional Element Status descriptors shall
be in the same order as the status elements in the Enclosure Status
diagnostic page".  It allows us to question ELEMENT INDEX that is lower
then values we already processed.  There are many SAS2 enclosures with
this kind of problem.

While there, add more specific error messages for cases when ELEMENT INDEX
is obviously wrong.  Also skip elements with INVALID bit set.

5 years agoMFC r349281: Fix individual_element_index when some type has 0 elements.
Alexander Motin [Sun, 7 Jul 2019 18:29:10 +0000 (18:29 +0000)]
MFC r349281: Fix individual_element_index when some type has 0 elements.

When some type has 0 elements, saved_individual_element_index was set
to -1 on second type bump, since individual_element_index was not
restored after the first.  To me it looks easier just to increment
saved_individual_element_index separately than think when to save it.

5 years agoMFC r349671:
Mark Johnston [Sun, 7 Jul 2019 17:45:17 +0000 (17:45 +0000)]
MFC r349671:
Cache the next queue element when traversing a page queue.

5 years agoMFC r349599:
Mark Johnston [Sun, 7 Jul 2019 17:43:15 +0000 (17:43 +0000)]
MFC r349599:
Fix handling of errors from sblock() in soreceive_stream().

PR: 238789

5 years agoMFC r349441 (by rgrimes):
Mark Johnston [Sun, 7 Jul 2019 17:30:23 +0000 (17:30 +0000)]
MFC r349441 (by rgrimes):
Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H).

PR: 238794

5 years agoMFC r349733:
Mark Johnston [Sun, 7 Jul 2019 14:19:46 +0000 (14:19 +0000)]
MFC r349733:
Defer funsetown() calls for a TTY to tty_rel_free().

5 years agoMFC r349730:
Mark Johnston [Sun, 7 Jul 2019 14:19:19 +0000 (14:19 +0000)]
MFC r349730:
elfcopy: Clear errors after fetching the shstrtab index.

5 years agoMFC r349500:
Navdeep Parhar [Sun, 7 Jul 2019 05:30:07 +0000 (05:30 +0000)]
MFC r349500:

cxgbe/t4_tom: Fix regression in t_maxseg usage within t4_tom.

t_maxseg was changed in r293284 to not have any adjustment for TCP
timestamps.  t4_tom inadvertently went back to pre-r293284 semantics
in r332506.

Sponsored by: Chelsio Communications

5 years agoMFC r349499:
Navdeep Parhar [Sun, 7 Jul 2019 00:43:38 +0000 (00:43 +0000)]
MFC r349499:

cxgbe/iw_cxgbe: Remove unused field from the endpoint structure.

5 years agoMFC r349242, r349501, r349514, and r349517.
Navdeep Parhar [Sun, 7 Jul 2019 00:30:20 +0000 (00:30 +0000)]
MFC r349242, r349501, r349514, and r349517.

r349242:
cxgbe/t4_tom: DDP_DEAD is a ddp flag and not a toepcb flag.

The driver was in effect setting TPF_ABORT_SHUTDOWN on the toepcb
instead of what was intended.

Sponsored by: Chelsio Communications

r349501:
cxgbe/t4_tom: Mark the socket's receive as done before calling
handle_ddp_close.

This eliminates a bad race where an aio_ddp_requeue that happened to run
after handle_ddp_close could bump up the active count.

Discussed with: jhb@
Sponsored by: Chelsio Communications

r349514:
cxgbe/t4_tom: the AIO tx job queue must be empty by the time the driver
releases the offload resources associated with the tid.

Reviewed by: jhb@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D20798

r349517:
cxgbe/t4_tom: Tweaks to some of the AIO related CTRs.

Reviewed by: jhb@
Sponsored by: Chelsio Communications

5 years agoMFC r349608:
Konstantin Belousov [Sat, 6 Jul 2019 16:19:04 +0000 (16:19 +0000)]
MFC r349608:
Use traditional 'p' local to designate td->td_proc in kern_mmap.

5 years agoMFC r349547:
Mark Johnston [Sat, 6 Jul 2019 01:00:11 +0000 (01:00 +0000)]
MFC r349547:
Use a consistent snapshot of the fd's rights in fget_mmap().

5 years agoMFC r349546:
Mark Johnston [Sat, 6 Jul 2019 00:59:11 +0000 (00:59 +0000)]
MFC r349546:
Fix mutual exclusion in pipe_direct_write().

5 years agoMFC: r348590, r348591
Rick Macklem [Fri, 5 Jul 2019 22:36:31 +0000 (22:36 +0000)]
MFC: r348590, r348591
Modify mountd so that it incrementally updates the kernel exports upon a reload.

Without this patch, mountd would delete/load all exports from the exports
file(s) when it receives a SIGHUP. This works fine for small exports file(s),
but can take several seconds to do when there are large numbers (10000+) of
exported file systems. Most of this time is spent doing the system calls
that delete/export each of these file systems. When the "-S" option
has been specified (the default these days), the nfsd threads are suspended
for several seconds while the reload is done.

This patch changes mountd so that it only does system calls for file systems
where the exports have been changed/added/deleted as compared to the exports
done for the previous load/reload of the exports file(s).
Basically, when SIGHUP is posted to mountd, it saves the exportlist structures
from the previous load and creates a new set of structures from the current
exports file(s). Then it compares the current with the previous and only does
system calls for cases that have been changed/added/deleted.
The nfsd threads do not need to be suspended until the comparison step is
being done. This results in a suspension period of milliseconds for a server
with 10000+ exported file systems.

There is some code using a LOGDEBUG() macro that allow runtime debugging
output via syslog(LOG_DEBUG,...) that can be enabled by creating a file
called /var/log/mountd.debug. This code is expected to be replaced with
code that uses dtrace by cy@ in the near future, once issues w.r.t. dtrace
in stable/12 have been resolved.

The patch should not change the usage of the exports file(s), but improves
the performance of reloading large exports file(s) where there are only a
small number of changes done to the file(s).

PR: 237860

5 years agoMFC r349607: pci(4): Use plural registers
Niclas Zeising [Fri, 5 Jul 2019 22:21:02 +0000 (22:21 +0000)]
MFC r349607: pci(4): Use plural registers

Original commit message:

pci(4): Use plural configuration registers

Change to use registers instead of register, as it is customary to use
plural when talking about PCI registers.

This was missed in r349150.

5 years agoMFC r349098:
Philip Paeps [Fri, 5 Jul 2019 16:43:41 +0000 (16:43 +0000)]
MFC r349098:
  Add macOS-like three finger drag trackpad gesture to psm(4)

5 years agoMFC r349507:
Hans Petter Selasky [Fri, 5 Jul 2019 12:35:49 +0000 (12:35 +0000)]
MFC r349507:
Need to wait for epoch callbacks to complete before detaching a
network interface.

This particularly manifests itself when an INP has multicast options
attached during a network interface detach. Then the IPv4 and IPv6
leave group call which results from freeing the multicast address, may
access a freed ifnet structure. These are the steps to reproduce:

service mdnsd onestart # installed from ports

ifconfig epair create
ifconfig epair0a 0/24 up
ifconfig epair0a destroy

Tested by: pho @
Sponsored by: Mellanox Technologies

5 years agoMFC r349506:
Hans Petter Selasky [Fri, 5 Jul 2019 12:33:31 +0000 (12:33 +0000)]
MFC r349506:
Implement API for draining EPOCH(9) callbacks.

The epoch_drain_callbacks() function is used to drain all pending
callbacks which have been invoked by prior epoch_call() function calls
on the same epoch. This function is useful when there are shared
memory structure(s) referred to by the epoch callback(s) which are not
refcounted and are rarely freed. The typical place for calling this
function is right before freeing or invalidating the shared
resource(s) used by the epoch callback(s). This function can sleep and
is not optimized for performance.

Differential Revision: https://reviews.freebsd.org/D20109
Sponsored by: Mellanox Technologies

5 years agoMFC r340404, r340415, r340417, r340419 and r340420:
Hans Petter Selasky [Fri, 5 Jul 2019 12:26:30 +0000 (12:26 +0000)]
MFC r340404, r340415, r340417, r340419 and r340420:
Synchronize epoch(9) code with -head to make merging new patches
and features easier.
The FreeBSD version has been bumped to force recompilation of
external kernel modules.

Sponsored by: Mellanox Technologies

MFC r340404:
Uninline epoch(9) entrance and exit. There is no proof that modern
processors would benefit from avoiding a function call, but bloating
code. In fact, clang created an uninlined real function for many
object files in the network stack.

- Move epoch_private.h into subr_epoch.c. Code copied exactly, avoiding
  any changes, including style(9).
- Remove private copies of critical_enter/exit.

Reviewed by: kib, jtl
Differential Revision: https://reviews.freebsd.org/D17879

MFC r340415:
The dualism between epoch_tracker and epoch_thread is fragile and
unnecessary. So, expose CK types to kernel and use a single normal
structure for epoch_tracker.

Reviewed by: jtl, gallatin

MFC r340417:
With epoch not inlined, there is no point in using _lite KPI. While here,
remove some unnecessary casts.

MFC r340419:
style(9), mostly adjusting overly long lines.

MFC r340420:
epoch(9) revert r340097 - no longer a need for multiple sections per cpu

I spoke with Samy Bahra and recent changes to CK to make ck_epoch_call and
ck_epoch_poll not modify the record have eliminated the need for this.

5 years agoMFC r349369:
Hans Petter Selasky [Fri, 5 Jul 2019 10:31:37 +0000 (10:31 +0000)]
MFC r349369:
Convert all IPv4 and IPv6 multicast memberships into using a STAILQ
instead of a linear array.

The multicast memberships for the inpcb structure are protected by a
non-sleepable lock, INP_WLOCK(), which needs to be dropped when
calling the underlying possibly sleeping if_ioctl() method. When using
a linear array to keep track of multicast memberships, the computed
memory location of the multicast filter may suddenly change, due to
concurrent insertion or removal of elements in the linear array. This
in turn leads to various invalid memory access issues and kernel
panics.

To avoid this problem, put all multicast memberships on a STAILQ based
list. Then the memory location of the IPv4 and IPv6 multicast filters
become fixed during their lifetime and use after free and memory leak
issues are easier to track, for example by: vmstat -m | grep multi

All list manipulation has been factored into inline functions
including some macros, to easily allow for a future hash-list
implementation, if needed.

This patch has been tested by pho@ .

Differential Revision: https://reviews.freebsd.org/D20080
Reviewed by: markj @
Sponsored by: Mellanox Technologies

5 years agoMFC r349503-349504:
Cy Schubert [Fri, 5 Jul 2019 04:24:09 +0000 (04:24 +0000)]
MFC r349503-349504:

Document the -B, binary logfile, and the -C config file options.
Reference the ipmon.5 man page and ipmon.conf.

PR: 238816

5 years agoMFC r349611, r349614:
Konstantin Belousov [Fri, 5 Jul 2019 01:19:28 +0000 (01:19 +0000)]
MFC r349611, r349614:
Style.

5 years agoMFC: r348452
Rick Macklem [Fri, 5 Jul 2019 00:55:46 +0000 (00:55 +0000)]
MFC: r348452
Replace a single linked list with a hash table of lists.

mountd.c uses a single linked list of "struct exportlist" structures,
where there is one of these for each exported file system on the NFS server.
This list gets long if there are a large number of file systems exported and
the list must be searched for each line in the exports file(s) when
SIGHUP causes the exports file(s) to be reloaded.
A simple benchmark that traverses SLIST() elements and compares two 32bit
fields in the structure for equal (which is what the search is)
appears to take a couple of nsec. So, for a server with 72000 exported file
systems, this can take about 5sec during reload of the exports file(s).
By replacing the single linked list with a hash table with a target of
10 elements per list, the time should be reduced to less than 1msec.
Peter Errikson (who has a server with 72000+ exported file systems) ran
a test program using 5 hashes to see how they worked.
fnv_32_buf(fsid,..., 0)
fnv_32_buf(fsid,..., FNV1_32_INIT)
hash32_buf(fsid,..., 0)
hash32_buf(fsid,..., HASHINIT)
- plus simply using the low order bits of fsid.val[0].
The first three behaved about equally well, with the first one being
slightly better than the others.
It has an average variation of about 4.5% about the target list length
and that is what this patch uses.
Peter Errikson also tested this hash table version and found that the
performance wasn't measurably improved by a larger hash table, so a
load factor of 10 appears adequate.

PR: 237860

5 years agoMFC r349239, r349241: update vm_map_protect.9
Ed Maste [Thu, 4 Jul 2019 19:52:50 +0000 (19:52 +0000)]
MFC r349239, r349241: update vm_map_protect.9

Clarify that vm_map_protect cannot upgrade max_protection

It's implied by the man page's RETURN VALUES section, but be explicit in
the description that vm_map_protect can not set new protection bits that
are already in each entry's max_protection.

Clarify vm_map_protect max_protection downgrade

As reported in review D20709 by brooks calling vm_map_protect to set a
new max_protection value downgrades existing mappings if necessary (as
opposed to returning an error).

Sponsored by: The FreeBSD Foundation