]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoFix bug introduced by r351184.
Michal Meloun [Sun, 18 Aug 2019 15:37:19 +0000 (15:37 +0000)]
Fix bug introduced by r351184.
We should check the returned handle, not the pointer to it.

Noticed by: ian
X-MFC with: r351184
MFC after: 1 week

4 years agoAdd a blocking wait bit to refcount. This allows refs to be used as a simple
Jeff Roberson [Sun, 18 Aug 2019 11:43:58 +0000 (11:43 +0000)]
Add a blocking wait bit to refcount.  This allows refs to be used as a simple
barrier.

Reviewed by: markj, kib
Discussed with: jhb
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21254

4 years agoImprove rk_pinctrl driver:
Michal Meloun [Sun, 18 Aug 2019 09:19:33 +0000 (09:19 +0000)]
Improve rk_pinctrl driver:
- add support for 'output-low', 'output-high', 'output-low' and
  'output-enable' properties. These are use in RK3288 DT files
- add support for RK3288
- to reduce overall file size, use local macros for initialization
  of pinctrl description structures.

MFC after: 2 weeks

4 years agoImprove rk_i2c driver:
Michal Meloun [Sun, 18 Aug 2019 09:11:43 +0000 (09:11 +0000)]
Improve rk_i2c driver:
- Properly handle IIC_M_NOSTOP and IIC_M_NOSTART flags.
- add polling mode, so driver can be used even if interrupts are not
  enabled (this is necessary for proper support of PMICs).
- add support for RK3288

MFC after: 2 weeks

4 years agoEnhance support of extres in dwmmc driver.
Michal Meloun [Sun, 18 Aug 2019 08:54:10 +0000 (08:54 +0000)]
Enhance support of extres in dwmmc driver.
Handle all clocks, regulators and resets defined by dwmmc bindings.

MFC after: 2 weeks

4 years agoAdd method for getting of syscon handle from parent device.
Michal Meloun [Sun, 18 Aug 2019 08:08:56 +0000 (08:08 +0000)]
Add method for getting of syscon handle from parent device.

If simple multifuction device also provides syscon interface, its
childern should be able to consume it. Due to this:
- declare coresponding method in syscon interface
- implement it in simple multifunction device driver

MFC after: 1 week

4 years agoRemove unnecessary debugging from r351181 that caused powerpc build to fail.
Jeff Roberson [Sun, 18 Aug 2019 08:07:31 +0000 (08:07 +0000)]
Remove unnecessary debugging from r351181 that caused powerpc build to fail.

Tested by: make universe TARGETS=powerpc

4 years agovm_phys_avail_find is only used on NUMA kernels. Fix a build error.
Jeff Roberson [Sun, 18 Aug 2019 07:43:15 +0000 (07:43 +0000)]
vm_phys_avail_find is only used on NUMA kernels.  Fix a build error.

4 years agoEncapsulate phys_avail manipulation in a set of simple routines. Add a
Jeff Roberson [Sun, 18 Aug 2019 07:06:31 +0000 (07:06 +0000)]
Encapsulate phys_avail manipulation in a set of simple routines.  Add a
NUMA aware boot time memory allocator that will be used to allocate early
domain correct structures.  Code partially submitted by gallatin.

Reviewed by: gallatin, kib
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21251

4 years agoOFED: Fix accidental double-copy of rdma_sdp.h in r351176
Conrad Meyer [Sun, 18 Aug 2019 04:19:41 +0000 (04:19 +0000)]
OFED: Fix accidental double-copy of rdma_sdp.h in r351176

The mistake came about like this: the first attempt to commit was blocked by
a pre-commit hook due to missing SVN tags.  svn revert doesn't delete new
files, I guess.  While reapplying the fixed diff, the non-empty target file
was just concatenated with the new contents?  Ugh. :-(

4 years agosimple_httpd was not buildable for some time due to multiple missing
Eugene Grosbein [Sun, 18 Aug 2019 01:00:21 +0000 (01:00 +0000)]
simple_httpd was not buildable for some time due to multiple missing
"static" keywords and -Werror,-Wmissing-variable-declarations

This change adds needed "static" so it builds again with WARNS?=6
No functional changes.

MFC after: 1 week

4 years agoRevert r351130
Emmanuel Vadot [Sat, 17 Aug 2019 19:06:05 +0000 (19:06 +0000)]
Revert r351130

This driver should use the syscon handle exposed by the parent simple-mfd one.

4 years agoRevert r351129
Emmanuel Vadot [Sat, 17 Aug 2019 19:05:11 +0000 (19:05 +0000)]
Revert r351129

the point of syscon node is to avoid multiple device driver reading/writing
to the same area.

Reported by: ian

4 years agoOFED: Unbreak SDP support in ibcore
Conrad Meyer [Sat, 17 Aug 2019 18:54:07 +0000 (18:54 +0000)]
OFED: Unbreak SDP support in ibcore

This regression was introduced in the r326169 Linux v4.9 Infiniband upgrade.
Restore the functionality.

Reviewed by: hselasky
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21298

4 years agofork: rework locking around do_fork
Mateusz Guzik [Sat, 17 Aug 2019 18:19:49 +0000 (18:19 +0000)]
fork: rework locking around do_fork

- move allproc lock into the func, it is of no use prior to it
- the code would lock p1 and p2 while holding allproc to partially
construct it after it gets added to the list. instead we can do the
work prior to adding anything.
- protect lastpid with procid_lock

As a side effect we do less work with allproc held.

Sponsored by: The FreeBSD Foundation

4 years agofork: bump process count before checking for permission to cross the limit
Mateusz Guzik [Sat, 17 Aug 2019 17:56:43 +0000 (17:56 +0000)]
fork: bump process count before checking for permission to cross the limit

The limit is almost never reached. Do the check only on failure to see if
we can override it.

No change in user-visible behavior.

Sponsored by: The FreeBSD Foundation

4 years agofork: stop skipping < 100 ids on wrap around
Mateusz Guzik [Sat, 17 Aug 2019 17:42:01 +0000 (17:42 +0000)]
fork: stop skipping < 100 ids on wrap around

Code doing this is commented with a claim that these IDs are occupied by
daemons, but that's demonstrably false. To an extent the range is used by init
and kernel processes (and on sufficiently big machines it indeed is fully
populated).

On a sample box 40-way box the highest id in the range is 63. On a different one
it is 23. Just use the range.

Sponsored by: The FreeBSD Foundation

4 years agoping6: Raise WARNS level to 6
Alan Somers [Sat, 17 Aug 2019 17:22:08 +0000 (17:22 +0000)]
ping6: Raise WARNS level to 6

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21260

4 years agoping: Move in_cksum() to a separate source file
Alan Somers [Sat, 17 Aug 2019 15:25:01 +0000 (15:25 +0000)]
ping: Move in_cksum() to a separate source file

This is a preparation step for adding ATF tests of in_cksum(), which has been
modified to operate on unaligned data. ping.o cannot be linked to the test
executable because both of them contain 'main' symbol.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21288

4 years agoping6: Fix dnsdecode() bug introduced by r350859
Alan Somers [Sat, 17 Aug 2019 14:28:32 +0000 (14:28 +0000)]
ping6: Fix dnsdecode() bug introduced by r350859

Revision 350859 removed level of indirection that was needed for setting the
caller's `cp' pointer. dnsdecode() uses return value to indicate error or
success. It returns pointer to a buffer holding a decompressed DNS name or
NULL. The caller uses that value only to find out the result, not for accessing
the buffer.

We use the return value to propagate the new value of `cp' pointer to
the caller instead of using an output argument.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
MFC-With: 350859
Sponsored by: Google, Inc (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21266

4 years agoSDP: Fix brain-o from r351162
Conrad Meyer [Sat, 17 Aug 2019 10:11:34 +0000 (10:11 +0000)]
SDP: Fix brain-o from r351162

Lost in translation between different SDP stacks.

Reported by: hselasky

4 years agozfs_vget: fix vnode reference count leak in error path
Andriy Gapon [Sat, 17 Aug 2019 09:23:03 +0000 (09:23 +0000)]
zfs_vget: fix vnode reference count leak in error path

If vn_lock() failed, then the function returned the error but the vnode
obtained via zfs_zget() was never released.

MFC after: 10 days
Sponsored by: Panzura

4 years agoInclude item position in report descriptor dump in usbhidctl(1).
Hans Petter Selasky [Sat, 17 Aug 2019 08:29:22 +0000 (08:29 +0000)]
Include item position in report descriptor dump in usbhidctl(1).

Submitted by: Kevin Zheng <kevinz5000@gmail.com>
PR: 239918
MFC after: 1 week

4 years agoReduce size of EFI_STAGING_SIZE to 32 on arm
Tom Jones [Sat, 17 Aug 2019 06:47:43 +0000 (06:47 +0000)]
Reduce size of EFI_STAGING_SIZE to 32 on arm

Reduce the size of the EFI_STAGING area we allocate on arm to 32. On arm SBC
such as the NanoPi-NEOLTS the staging area allocation will fail on the 256MB
model with a staging size of 64.

Reviewed by:    bcran, manu
Approved by:    bz (mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D21016

4 years agoAdd basic NAT test for pf, ipf and ipfw
Tom Jones [Sat, 17 Aug 2019 06:44:11 +0000 (06:44 +0000)]
Add basic NAT test for pf, ipf and ipfw

Add common firewall NAT tests for pf, ipf and ipfw (using both in-kernel and
userspace NAT).

Submitted by:   Ahsan Barkati
Sponsored by:   Google, Inc. (GSoC 2019)
Reviewed by:    kp
Approved by:    bz (mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D21199

4 years agoOFED: Fix ib_mad.h ib_user_mad.h include to match new uapi path
Conrad Meyer [Sat, 17 Aug 2019 03:09:03 +0000 (03:09 +0000)]
OFED: Fix ib_mad.h ib_user_mad.h include to match new uapi path

Sponsored by: Dell EMC Isilon

4 years agoSDP: Add a dbg() on QP events
Conrad Meyer [Sat, 17 Aug 2019 03:07:41 +0000 (03:07 +0000)]
SDP: Add a dbg() on QP events

Sponsored by: Dell EMC Isilon

4 years agoSDP: Also log a nice status string in RX WC error dbg()
Conrad Meyer [Sat, 17 Aug 2019 03:06:46 +0000 (03:06 +0000)]
SDP: Also log a nice status string in RX WC error dbg()

Sponsored by: Dell EMC Isilon

4 years agoSDP: Include nice string names for raw event numbers in a dbg()
Conrad Meyer [Sat, 17 Aug 2019 03:05:09 +0000 (03:05 +0000)]
SDP: Include nice string names for raw event numbers in a dbg()

Sponsored by: Dell EMC Isilon

4 years agoSDP: SYSCTL_DECL SDP-wide sysctl node in header
Conrad Meyer [Sat, 17 Aug 2019 03:03:26 +0000 (03:03 +0000)]
SDP: SYSCTL_DECL SDP-wide sysctl node in header

This allows use of the shared _net_inet_sdp in more than one compilation
unit.  (Nothing in-tree uses this today, but some of Isilon's out-of-tree
SDP enhancements add sysctls below the node.)

Sponsored by: Dell EMC Isilon

4 years agoLinuxkpi: Prevent easy generated ctor name conflicts with prefix
Conrad Meyer [Sat, 17 Aug 2019 03:00:58 +0000 (03:00 +0000)]
Linuxkpi: Prevent easy generated ctor name conflicts with prefix

Sponsored by: Dell EMC Isilon

4 years agoFix small bug in wrapping introduced in r325955.
Warner Losh [Sat, 17 Aug 2019 02:36:42 +0000 (02:36 +0000)]
Fix small bug in wrapping introduced in r325955.

When local support was fixed, it introduced a minor bug in formatting. We don't
increment the lpos by enouogh, so lines are a little too long. Adjust to be
correct now with variable length srcprefix.

4 years agoAdd nowerror and local to the list of tokens.
Warner Losh [Sat, 17 Aug 2019 02:36:37 +0000 (02:36 +0000)]
Add nowerror and local to the list of tokens.

4 years agoMove initializations of config earlier.
Warner Losh [Sat, 17 Aug 2019 02:35:53 +0000 (02:35 +0000)]
Move initializations of config earlier.

Inizialize global variables earlier in the process. It doesn't matter today, but
may in the future if we want to access these lists earlier in config's run.

4 years agonet: Update SFF-8024 definitions and strings with values from rev 4.6
Eric Joyner [Sat, 17 Aug 2019 00:10:56 +0000 (00:10 +0000)]
net: Update SFF-8024 definitions and strings with values from rev 4.6

This will let ifconfig -v's SFF eeprom read functionality recognize more
module types.

Signed-off-by: Eric Joyner <erj@freebsd.org>
Reviewed by: gallatin@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21041

4 years agoiflib: add iflib_deregister to help cleanup on exit
Eric Joyner [Fri, 16 Aug 2019 23:33:44 +0000 (23:33 +0000)]
iflib: add iflib_deregister to help cleanup on exit

Commit message by Jake:
The iflib_register function exists to allocate and setup some common
structures used by both iflib_device_register and iflib_pseudo_register.

There is no associated cleanup function used to undo the steps taken in
this function.

Both iflib_device_deregister and iflib_pseudo_deregister have some of
the necessary steps scattered in their flow. However, most of the
necessary cleanup is not done during the error path of
iflib_device_register and iflib_pseudo_register.

Some examples of missed cleanup include:

the ifp pointer is not free'd during error cleanup
the STATE and CTX locks are not destroyed during error cleanup
the vlan event handlers are not removed during error cleanup
media added to the ifmedia structure is not removed
the kobject reference is never deleted
Additionally, when initializing the kobject class reference counter is
increased even though kobj_init already increases it. This results in
the class never being free'd again because the reference count would
never hit zero even after all driver instances are unloaded.

To aid in proper cleanup, implement an iflib_deregister function that
goes through the reverse steps taken by iflib_register.

Call this function during the error cleanup for iflib_device_register
and iflib_pseudo_register. Additionally call the function in the
iflib_device_deregister and iflib_pseudo_deregister functions near the
end of their flow. This helps reduce code duplication and ensures that
proper steps are taken to cleanup allocations and references in both the
regular and error cleanup flows.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@, erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21005

4 years agoRework r339635 to fix .depend.tables.h handling.
Bryan Drewery [Fri, 16 Aug 2019 22:34:10 +0000 (22:34 +0000)]
Rework r339635 to fix .depend.tables.h handling.

Avoid touching the tables.h file unless it has changed to avoid unneeded
rebuilds.

Also revert r350301's explicit dependencies.

Reviewed by: emaste
MFC after: 2 weeks
X-MFC-With: r339635 (kevans request)
PR: 238828
Sponsored by: DellEMC
Differential Revision: https://reviews.freebsd.org/D21295

4 years agoImplement detach_kernel_driver command in usbconfig(8).
Hans Petter Selasky [Fri, 16 Aug 2019 21:17:56 +0000 (21:17 +0000)]
Implement detach_kernel_driver command in usbconfig(8).

Submitted by: Kevin Zheng <kevinz5000@gmail.com>
PR: 239916
MFC after: 1 week

4 years agoarm64: Add EspressoBin DTB to the build
Emmanuel Vadot [Fri, 16 Aug 2019 21:11:43 +0000 (21:11 +0000)]
arm64: Add EspressoBin DTB to the build

This will compile the espressobin dts to a dtb file and this will be
install in /boot/dtb/marvell/ during installkernel.

MFC after: 1 week

4 years agoDelete sys/dir.h which was deprecated since 1997.
Xin LI [Fri, 16 Aug 2019 20:53:36 +0000 (20:53 +0000)]
Delete sys/dir.h which was deprecated since 1997.

PR: 21519
Submitted by: Yoshihiro Ota <ota j email ne jp>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D20479

4 years agoForgotten part of r351137.
Alexander Motin [Fri, 16 Aug 2019 20:30:31 +0000 (20:30 +0000)]
Forgotten part of r351137.

MFC after: 2 weeks

4 years agoNTB Tool: Test driver for NTB hardware drivers.
Alexander Motin [Fri, 16 Aug 2019 20:14:37 +0000 (20:14 +0000)]
NTB Tool: Test driver for NTB hardware drivers.

NTB Tool driver is meant for testing NTB hardware driver functionalities,
such as doorbell interrupts, link events, scratchpad registers and memory
windows.  This is a port of ntb_tool driver from Linux.  It has been
verified on top of AMD and PLX NTB HW drivers.

Submitted by: Arpan Palit <arpan.palit@amd.com>
Cleaned up by: mav
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D18819

4 years agostand: gptboot: fix build with xtoolchain-llvm90
Kyle Evans [Fri, 16 Aug 2019 20:09:20 +0000 (20:09 +0000)]
stand: gptboot: fix build with xtoolchain-llvm90

ufsread.c grows a dependency on __ashldi3 with llvm90. For gptboot, just
start pulling in ashldi3.c ashrdi3.c lshrdi3.c into libsa for all archs as
the number of archs requiring one or more of them keeps growing. qdivrem.c
and quad.h can be trivially kicked out of libsa if we start pulling these
from compiler-rt as qdivrem was only used to implement umoddi3, divdi3,
moddi3 (also in qdivrem.c).

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21291

4 years agostand: boot2: fix build with xtoolchain-llvm90
Kyle Evans [Fri, 16 Aug 2019 20:07:43 +0000 (20:07 +0000)]
stand: boot2: fix build with xtoolchain-llvm90

ufsread.c grows a dependency on __ashldi3 with llvm90. Grab ashldi3.c out of
compiler-rt rather than trying to link against libsa (for now).
-Wno-missing-prototypes is necessary to compile ashldi3.c standalone.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21291

4 years agoAdd support for 'j', 't' and 'z' flags to kernel sscanf().
Alexander Motin [Fri, 16 Aug 2019 19:46:22 +0000 (19:46 +0000)]
Add support for 'j', 't' and 'z' flags to kernel sscanf().

MFC after: 2 weeks

4 years agoCheck paddr for overflow.
Aleksandr Rybalko [Fri, 16 Aug 2019 19:27:05 +0000 (19:27 +0000)]
Check paddr for overflow.
Fix panic on initialize of "vm reserv" per-superpage lock in case when RAM ends at upper boundary of address space.
Observed on ARM32 board BPI-R2 (2GB RAM 0x80000000-0xffffffff).

PR: 235362
Reviewed by: kib, markj, alc
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21272

4 years agomd(4): remove the unused and unusable MDIOCLIST ioctl.
Brooks Davis [Fri, 16 Aug 2019 18:57:32 +0000 (18:57 +0000)]
md(4): remove the unused and unusable MDIOCLIST ioctl.

It is unused, the ABI was broken in r322969, and it is broken by design
(more than MDNPAD md devices can exist and there is no way to retreive
them with this interface).

mdconfig(8) was converted to use libgeom to obtain this information
in r157160 and any other consumers of MDIOCLIST should likewise be
converted.

Reviewed by: emaste
Relnotes: yes
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18936

4 years agoaarch64: make pmap_change_attr public like on other platforms
Ed Maste [Fri, 16 Aug 2019 18:21:31 +0000 (18:21 +0000)]
aarch64: make pmap_change_attr public like on other platforms

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D20787

4 years agoarm64: mv: a37x0_gpio: Set the memory to SHAREABLE
Emmanuel Vadot [Fri, 16 Aug 2019 17:10:38 +0000 (17:10 +0000)]
arm64: mv: a37x0_gpio: Set the memory to SHAREABLE

Since r349596 the syscon driver will map the memory. Since the gpio/pinctrl
controller wants it too set it to SHAREABLE.
This fix the gpio controller for attaching and so consumer can use it.
Now the sdhci_xenon driver can detect presence of an sdcard and attach
the mmc driver.

MFC after: 1 week

4 years agofdt: simple-mfd: Set the syscon memory to SHAREABLE
Emmanuel Vadot [Fri, 16 Aug 2019 17:08:06 +0000 (17:08 +0000)]
fdt: simple-mfd: Set the syscon memory to SHAREABLE

Since syscon is usually used with another compatible string (and so
another driver), this driver might want to map the memory too.

MFC after: 1 week

4 years agoAdd @generated tag to libc syscall asm wrappers
Ed Maste [Fri, 16 Aug 2019 14:14:57 +0000 (14:14 +0000)]
Add @generated tag to libc syscall asm wrappers

Although libc syscall wrappers do not get checked in this can aid in
finding the source of generated files when spelunking in the objdir.

Multiple tools use @generated to identify generated files (for example,
in a review Phabricator will by default hide diffs in generated files).
For consistency use the @generated tag in makesyscalls.sh as we've done
for other generated files, even though these wrappers aren't checked in
to the tree.

4 years agoarch.7: indicate expectation that arm (i.e., v5) will be removed before 13.0
Ed Maste [Fri, 16 Aug 2019 14:06:04 +0000 (14:06 +0000)]
arch.7: indicate expectation that arm (i.e., v5) will be removed before 13.0

MFC after: 1 week

4 years agoRegen src.conf.5 after r351027 (enable BSD_CRTBEGIN on powerpc)
Ed Maste [Fri, 16 Aug 2019 13:50:44 +0000 (13:50 +0000)]
Regen src.conf.5 after r351027 (enable BSD_CRTBEGIN on powerpc)

4 years agostand: push LIBC_SRC up into defs.mk
Kyle Evans [Fri, 16 Aug 2019 13:22:57 +0000 (13:22 +0000)]
stand: push LIBC_SRC up into defs.mk

Other parts of stand/ that don't use libsa will need to grab bits from libc
shortly. Push LIBC_SRC up to defs.mk in advance of this so that they can use
it, and rename it to LIBCSRC to match the convention of the rest of the *SRC
variables in this file.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21282

4 years agoUpdate pthread_cond_timedwait() test to current NetBSD
Eric van Gyzen [Fri, 16 Aug 2019 13:10:08 +0000 (13:10 +0000)]
Update pthread_cond_timedwait() test to current NetBSD

NetBSD adapted and committed our r350620.  Update to their version 1.8.

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

4 years agozpool-features.7: Fix a typo
Mateusz Piotrowski [Fri, 16 Aug 2019 10:43:23 +0000 (10:43 +0000)]
zpool-features.7: Fix a typo

Reported by: pstef
Reviewed by: pstef
Approved by: src (pstef)
Differential Revision: https://reviews.freebsd.org/D21290

4 years agoFix OOM handling of some corner cases.
Konstantin Belousov [Fri, 16 Aug 2019 09:43:49 +0000 (09:43 +0000)]
Fix OOM handling of some corner cases.

In addition to pagedaemon initiating OOM, also do it from the
vm_fault() internals.  Namely, if the thread waits for a free page to
satisfy page fault some preconfigured amount of time, trigger OOM.
These triggers are rate-limited, due to a usual case of several
threads of the same multi-threaded process to enter fault handler
simultaneously.  The faults from pagedaemon threads participate in the
calculation of OOM rate, but are not under the limit.

Reviewed by: markj (previous version)
Tested by: pho
Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D13671

4 years agofusefs: don't send the namespace during listextattr
Alan Somers [Fri, 16 Aug 2019 05:06:54 +0000 (05:06 +0000)]
fusefs: don't send the namespace during listextattr

The FUSE_LISTXATTR operation always returns the full list of a file's
extended attributes, in all namespaces. There's no way to filter the list
server-side. However, currently FreeBSD's fusefs driver sends a namespace
string with the FUSE_LISTXATTR request. That behavior was probably copied
from fuse_vnop_getextattr, which has an attribute name argument. It's
been there ever since extended attribute support was added in r324620. This
commit removes it.

Reviewed by: cem
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21280

4 years agoMove phys_avail definition into MI code. It is consumed in the MI layer and
Jeff Roberson [Fri, 16 Aug 2019 00:45:14 +0000 (00:45 +0000)]
Move phys_avail definition into MI code.  It is consumed in the MI layer and
doing so adds more flexibility with less redundant code.

Reviewed by: jhb, markj, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21250

4 years agoFix i386 build.
Alexander Motin [Thu, 15 Aug 2019 23:56:19 +0000 (23:56 +0000)]
Fix i386 build.

MFC after: 2 weeks

4 years agoFix copy_file_range(2) so that unneeded blocks are not allocated to the output file.
Rick Macklem [Thu, 15 Aug 2019 23:21:41 +0000 (23:21 +0000)]
Fix copy_file_range(2) so that unneeded blocks are not allocated to the output file.

When the byte range for copy_file_range(2) doesn't go to EOF on the
output file and there is a hole in the input file, a hole must be
"punched" in the output file. This is done by writing a block of bytes
all set to 0.
Without this patch, the write is done unconditionally which means that,
if the output file already has a hole in that byte range, a unneeded data block
of all 0 bytes would be allocated.
This patch adds code to check for a hole in the output file, so that it can
skip doing the write if there is already a hole in that byte range of
the output file. This avoids unnecessary allocation of blocks to the
output file.

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

4 years agoLimit memory window usage in ntb_transport to 256MB.
Alexander Motin [Thu, 15 Aug 2019 22:55:59 +0000 (22:55 +0000)]
Limit memory window usage in ntb_transport to 256MB.

This adds safety net for the case of misconfigured NTB with too big
memory window, for which we may be unable to allocate a memory buffer,
which does not make much sense for the network interface.  While there,
fix the code to really work with asymmetric window sizes setup.

This makes driver just print warning message on boot instead of hanging
if too large memory window is configured.

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

4 years agopmc: restore "unhalted-cycles" alias
Matt Macy [Thu, 15 Aug 2019 21:51:11 +0000 (21:51 +0000)]
pmc: restore "unhalted-cycles" alias

Reported by: mav@

4 years agoping6: Fix alignment errors
Alan Somers [Thu, 15 Aug 2019 19:52:32 +0000 (19:52 +0000)]
ping6: Fix alignment errors

This fixes -Wcast-align errors when compiled with WARNS=6.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21217

4 years agoping6: fix uninitialized variable warnings when MK_CASPER=no
Alan Somers [Thu, 15 Aug 2019 19:27:36 +0000 (19:27 +0000)]
ping6: fix uninitialized variable warnings when MK_CASPER=no

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21273

4 years agotwsi: Fix build when DEBUG is used on 32bits arch.
Emmanuel Vadot [Thu, 15 Aug 2019 18:59:52 +0000 (18:59 +0000)]
twsi: Fix build when DEBUG is used on 32bits arch.

MFC after: 3 days

4 years agoarm: allwinner: Set aw_ccu to BUS_PASS_BUS
Emmanuel Vadot [Thu, 15 Aug 2019 18:57:48 +0000 (18:57 +0000)]
arm: allwinner: Set aw_ccu to BUS_PASS_BUS

In r350842 I've switched the bus pass to resource so it matches the other
clock drivers but this cannot work as this drivers is meant to match
the dts node '/clocks' and if we don't do it at this pass simplebus is
catching this node and we cannot attach.
This solve booting on Allwinner boards that are still using /clocks (A20 SoC)

MFC after: 3 days

4 years agoAdd missing comma in calendar.freebsd
Kirk McKusick [Thu, 15 Aug 2019 18:46:27 +0000 (18:46 +0000)]
Add missing comma in calendar.freebsd

4 years agogptzfsboot: remove CLANG_NO_IAS
Ed Maste [Thu, 15 Aug 2019 18:43:01 +0000 (18:43 +0000)]
gptzfsboot: remove CLANG_NO_IAS

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler did not handle .codeNN directives.  Clang gained
support quite some time ago, so we can build stand/ with IAS.

In some cases there were small differences in generated object output.
In the case of gptzfsboot however using GNU as or Clang IAS to assemble
gptldr.S resulted in identical final gptzfsboot binary output.

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

4 years agostand: remove CLANG_NO_IAS from pxeldr
Ed Maste [Thu, 15 Aug 2019 17:59:22 +0000 (17:59 +0000)]
stand: remove CLANG_NO_IAS from pxeldr

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.  In most cases IAS- and GNU as-assembled boot components were
identical, and CLANG_NO_IAS was already removed from other components.

Clang IAS produces different output for some components, including
pxeldr, so CLANG_NO_IAS was not previously removed for those.

In the case of pxeldr the difference is that IAS adds a size override
prefix (67h) to three instructions to specify a 32-bit address, even
though the two high bytes are zero and the address fits in 16 bits.
this wastes three bytes per instruction and causes some additional nop
npadding to be required elsewhere in the object, but pxeboot is not
size-constrained so it doesn't matter.

Sponsored by: The FreeBSD Foundation

4 years agoMFV: r351091
Jung-uk Kim [Thu, 15 Aug 2019 17:43:36 +0000 (17:43 +0000)]
MFV: r351091

Fix the reported boot failures and revert r350510.

Note this commit is effectively merging ACPICA 20190703 again and applying
an upstream patch.

https://github.com/acpica/acpica/commit/73f6372

Tested by: scottl

4 years agortld-elf: fix build with xtoolchain-llvm90
Kyle Evans [Thu, 15 Aug 2019 17:35:24 +0000 (17:35 +0000)]
rtld-elf: fix build with xtoolchain-llvm90

strstr ends up using bcmp when compiled with llvm90; pull it in from libc
as well.

MFC after: 3 days

4 years agostand: remove CLANG_NO_IAS from cdboot
Ed Maste [Thu, 15 Aug 2019 17:32:39 +0000 (17:32 +0000)]
stand: remove CLANG_NO_IAS from cdboot

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.  In most cases IAS- and GNU as-assembled boot components were
identical, and CLANG_NO_IAS was already removed from other components.

Clang IAS produces different output for some components, including
cdboot, so CLANG_NO_IAS was not previously removed for those.

In the case of cdboot the difference is that IAS adds a size override
prefix (67h) to many instructions to specify a 32-bit address, even
though the two high bytes are zero.  This wastes three bytes per
instance, but as cdboot is not size-constrained it doesn't matter.
Padding is also different in one case; Clang used two one-byte nops
while GNU as used a single two-byte xchg %eax, %eax.  In any case, there
is no functional change.

Sponsored by:   The FreeBSD Foundation

4 years agoExit interpreter before initializing objects.
Jung-uk Kim [Thu, 15 Aug 2019 17:31:11 +0000 (17:31 +0000)]
Exit interpreter before initializing objects.

https://github.com/acpica/acpica/commit/73f6372

4 years agoping6: Fix data type of the buffer for ancillary data of a received message
Alan Somers [Thu, 15 Aug 2019 17:24:10 +0000 (17:24 +0000)]
ping6: Fix data type of the buffer for ancillary data of a received message

The old code worked, but wasted some stack space.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21275

4 years agoCatch mkheaders.c up to the removal of counted device support in 2005.
Warner Losh [Thu, 15 Aug 2019 17:21:38 +0000 (17:21 +0000)]
Catch mkheaders.c up to the removal of counted device support in 2005.

mkheaders.c hasn't made headers in ~15 years. Belatedly update the comments to
reflect that all it does these days is warn about 'device foo' lines in the
config where we don't know what a 'foo' is.

Remove extra includes too. These also haven't been needed for 15 years and
weren't removed at the time the comment wasn't updated...

4 years agoRevert r351078, r351085: stand/quad.h eviction
Kyle Evans [Thu, 15 Aug 2019 17:15:32 +0000 (17:15 +0000)]
Revert r351078, r351085: stand/quad.h eviction

It did not go well; further examination is required...

4 years agoSort getopt(3) options and case statements per style(9)
Warner Losh [Thu, 15 Aug 2019 17:06:53 +0000 (17:06 +0000)]
Sort getopt(3) options and case statements per style(9)

Alphebetize the options and cases without regard for case.

4 years agofinish the pcp feature, but documenting it in the man page...
John-Mark Gurney [Thu, 15 Aug 2019 16:58:00 +0000 (16:58 +0000)]
finish the pcp feature, but documenting it in the man page...

4 years agolibc quad.h: one last _STANDALONE correction
Kyle Evans [Thu, 15 Aug 2019 16:28:05 +0000 (16:28 +0000)]
libc quad.h: one last _STANDALONE correction

4 years agoAdd NTB modules to i386 build.
Alexander Motin [Thu, 15 Aug 2019 16:27:04 +0000 (16:27 +0000)]
Add NTB modules to i386 build.

There is no reason why NTB should not be usable on i386 if memory windows
are small enough.

4 years agoFix i386 LINT build after r351056.
Alexander Motin [Thu, 15 Aug 2019 16:22:15 +0000 (16:22 +0000)]
Fix i386 LINT build after r351056.

MFC after: 13 days

4 years agoping6: fix uninitialized variable warning for intvl
Alan Somers [Thu, 15 Aug 2019 16:09:27 +0000 (16:09 +0000)]
ping6: fix uninitialized variable warning for intvl

GCC isn't smart enough to realize that this variable was always initialized.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21271

4 years agoEnable ACPICA mutex debugging in INVARIANTS case.
Jung-uk Kim [Thu, 15 Aug 2019 16:04:22 +0000 (16:04 +0000)]
Enable ACPICA mutex debugging in INVARIANTS case.

This lets us detect lock order reversal in ACPICA code to avoid deadlock.

4 years agoping6: quiet an undefined variable warning
Alan Somers [Thu, 15 Aug 2019 15:55:01 +0000 (15:55 +0000)]
ping6: quiet an undefined variable warning

GCC 4.2 isn't smart enough to know that this variable is already defined by
the time it's used.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21269

4 years agoping6: quiet warning about unused copyright variable
Alan Somers [Thu, 15 Aug 2019 15:49:01 +0000 (15:49 +0000)]
ping6: quiet warning about unused copyright variable

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21270

4 years agostand: kick out quad.h
Kyle Evans [Thu, 15 Aug 2019 15:47:48 +0000 (15:47 +0000)]
stand: kick out quad.h

Use quad.h from libc instead for the time being. This reduces the number of
nearly-identical-quad.h we have in tree to two with only minor changes.

Prototypes for some *sh*di3 have been added to match the copy in libkern.
The differences between the two are likely few enough that they can perhaps
be merged with little additional effort to bring us down to 1.

MFC after: 3 days

4 years agoRevert r351076 and r351074 because of atomic_swap_64 on 32-bit platforms
Andriy Gapon [Thu, 15 Aug 2019 15:27:58 +0000 (15:27 +0000)]
Revert r351076 and r351074 because of atomic_swap_64 on 32-bit platforms

Trying to sort it out.

4 years agoMFV r351075: 10406 large_dnode changes broke zfs recv of legacy stream
Andriy Gapon [Thu, 15 Aug 2019 15:11:20 +0000 (15:11 +0000)]
MFV r351075: 10406 large_dnode changes broke zfs recv of legacy stream

illumos/illumos-gate@811964cd9f1fbae0fc3b93d116269e9b1fca090a
https://github.com/illumos/illumos-gate/commit/811964cd9f1fbae0fc3b93d116269e9b1fca090a

https://www.illumos.org/issues/10406
  The large dnode changes from 8423 caused problems in zfs recv for a legacy
  stream. This manifests when attempting to mount the received stream, but the
  problem is in the receive code. We missed the following commit from ZoL which
  fixes this.
  commit da2feb42fb5c7a8c1e1cc67f7a880da9d8e97bc2
  Author: Tom Caputi <tcaputi@datto.com>
  Date: Thu Jun 28 17:55:11 2018 -0400
  Fix 'zfs recv' of non large_dnode send streams
  Currently, there is a bug where older send streams without the
      DMU_BACKUP_FEATURE_LARGE_DNODE flag are not handled correctly.
      The code in receive_object() fails to handle cases where
      drro->drr_dn_slots is set to 0, which is always the case when the
      sending code does not support this feature flag. This patch fixes
      the issue by ensuring that that a value of 0 is treated as
      DNODE_MIN_SLOTS.

Author: Tom Caputi <tcaputi@datto.com>

MFC after: 3 weeks
X-MFC after: r351074

4 years ago10406 large_dnode changes broke zfs recv of legacy stream
Andriy Gapon [Thu, 15 Aug 2019 15:07:17 +0000 (15:07 +0000)]
10406 large_dnode changes broke zfs recv of legacy stream

illumos/illumos-gate@811964cd9f1fbae0fc3b93d116269e9b1fca090a
https://github.com/illumos/illumos-gate/commit/811964cd9f1fbae0fc3b93d116269e9b1fca090a

https://www.illumos.org/issues/10406
  The large dnode changes from 8423 caused problems in zfs recv for a legacy
  stream. This manifests when attempting to mount the received stream, but the
  problem is in the receive code. We missed the following commit from ZoL which
  fixes this.
  commit da2feb42fb5c7a8c1e1cc67f7a880da9d8e97bc2
  Author: Tom Caputi <tcaputi@datto.com>
  Date: Thu Jun 28 17:55:11 2018 -0400
  Fix 'zfs recv' of non large_dnode send streams
  Currently, there is a bug where older send streams without the
      DMU_BACKUP_FEATURE_LARGE_DNODE flag are not handled correctly.
      The code in receive_object() fails to handle cases where
      drro->drr_dn_slots is set to 0, which is always the case when the
      sending code does not support this feature flag. This patch fixes
      the issue by ensuring that that a value of 0 is treated as
      DNODE_MIN_SLOTS.

Author: Tom Caputi <tcaputi@datto.com>

4 years agoMFV r350898: 8423 8199 7432 Implement large_dnode pool feature
Andriy Gapon [Thu, 15 Aug 2019 14:57:27 +0000 (14:57 +0000)]
MFV r350898: 8423 8199 7432 Implement large_dnode pool feature

8423 8199 7432 Implement large_dnode pool feature

8423 Implement large_dnode pool feature
8199 multi-threaded dmu_object_alloc()
7432 Large dnode pool feature

llumos/illumos-gate@54811da5ac6b517992fdc173df5d605e4e61fdc0
https://github.com/illumos/illumos-gate/commit/54811da5ac6b517992fdc173df5d605e4e61fdc0
https://www.illumos.org/issues/8423
https://www.illumos.org/issues/8199
https://www.illumos.org/issues/7432

  ZoL issues:
  Improved dnode allocation #6564
  Clean up large dnode code #6262
  Fix dnode_hold() freeing dnode behavior #8172
  Fix dnode allocation race #6414, #6439
  Partial: Raw sends must be able to decrease nlevels #6821, #6864
  Remove unnecessary txg syncs from receive_object() Closes #7197

This updates FreeBSD large_dnode code (that was imported from ZoL) to a version
that was committed to illumos.  It has some cleanups, improvements and fixes
comparing to what we have in FreeBSD now.  I think that the most significant
update is 8199 multi-threaded dmu_object_alloc().

Obtained from: illumos
MFC after: 3 weeks

4 years agostand: remove CLANG_NO_IAS from boot2
Ed Maste [Thu, 15 Aug 2019 14:54:18 +0000 (14:54 +0000)]
stand: remove CLANG_NO_IAS from boot2

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.  In most cases IAS- and GNU as-assembled boot components were
identical, and CLANG_NO_IAS was already removed from other components.

Clang IAS produces different output for some components, including
boot2, so CLANG_NO_IAS was not previously removed for those.

In the case of boot2 the difference is that IAS produces a larger
encoding for one instruction (the testb at the beginning of read).

GNU as produces:

    2e    f6 06 b0 08       80

while IAS includes an address size override prefix (67) and produces:

    2e 67 f6 05 b3 08 00 00 80

This results in three fewer NOPs elsewhere in boot2 but no functional
change, so switch to IAS for boot2.

(We can separately pursue improved 16-bit IAS support with the LLVM
developers.)

Sponsored by: The FreeBSD Foundation

4 years agoImplement new methods for Intel and PLX NTB.
Alexander Motin [Thu, 15 Aug 2019 14:11:11 +0000 (14:11 +0000)]
Implement new methods for Intel and PLX NTB.

This restores parity with AMD NTB driver.  Though without any drivers
supporting more then one peer and respective KPI modification to pass
peer index to most of the calls this addition is pretty useless now.

MFC after: 2 weeks

4 years agoFix rule truncation on external action module unloading.
Andrey V. Elsukov [Thu, 15 Aug 2019 13:44:33 +0000 (13:44 +0000)]
Fix rule truncation on external action module unloading.

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

4 years agotelnet: remove 3rd clause from Berkeley copyrights
Ed Maste [Thu, 15 Aug 2019 13:27:57 +0000 (13:27 +0000)]
telnet: remove 3rd clause from Berkeley copyrights

Per the July 22, 1999 letter (in /COPYRIGHT) from
William Hoskins
Director, Office of Technology Licensing
University of California, Berkeley

MFC after: 1 week

4 years agodo not enable userland retpoline if not supported by compiler/linker
Ed Maste [Thu, 15 Aug 2019 12:48:17 +0000 (12:48 +0000)]
do not enable userland retpoline if not supported by compiler/linker

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21101

4 years agopf tests: Fix accidental duplication of content
Mateusz Piotrowski [Thu, 15 Aug 2019 12:00:59 +0000 (12:00 +0000)]
pf tests: Fix accidental duplication of content

Some files got their contented duplicated in r345409. Some mistakes where
fixed in r345430. The only file that was left with a duplicated content was
CVE-2019-5598.py.

Reviewed by: kp
Approved by: src (kp)
Differential Revision: https://reviews.freebsd.org/D21267

4 years agoRevert prior change till installworld sorted
Simon J. Gerraty [Thu, 15 Aug 2019 06:00:55 +0000 (06:00 +0000)]
Revert prior change till installworld sorted

4 years agofusefs: fix conditional from r351061
Alan Somers [Thu, 15 Aug 2019 04:47:42 +0000 (04:47 +0000)]
fusefs: fix conditional from r351061

The entirety of r351061 was a copy/paste error.  I'm sorry I've been
comitting so hastily.

Reported by: rpokala
Reviewed by: rpokala
MFC after: 2 weeks
MFC-With: 351061
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21265

4 years agopowerpc/pmap: Enable UMA_MD_SMALL_ALLOC for 64-bit booke
Justin Hibbits [Thu, 15 Aug 2019 03:42:15 +0000 (03:42 +0000)]
powerpc/pmap: Enable UMA_MD_SMALL_ALLOC for 64-bit booke

The only thing blocking UMA_MD_SMALL_ALLOC from working on 64-bit booke
powerpc was a missing check in pmap_kextract().  Adding DMAP handling into
pmap_kextract(), we can now use UMA_MD_SMALL_ALLOC.  This should improve
performance and stability a bit, since DMAP is always mapped in TLB1, so
this relieves pressure on TLB0.

MFC after: 3 weeks