]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoRemove redundant check and wrong fix: fat.c checks already take care
Xin LI [Mon, 19 Aug 2019 04:28:12 +0000 (04:28 +0000)]
Remove redundant check and wrong fix: fat.c checks already take care
about cluster chains.

Obtained from: OpenBSD
MFC after: 2 weeks

4 years agoperiodic: replace "tty" with "test -t 0"
Alan Somers [Mon, 19 Aug 2019 01:14:11 +0000 (01:14 +0000)]
periodic: replace "tty" with "test -t 0"

Apparently using tty for this purpose has been deprecated since 4.4 Lite.

Reviewed by: cy
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D21318

4 years agoAdd an entry to RELNOTES for r351201.
Rick Macklem [Mon, 19 Aug 2019 00:46:31 +0000 (00:46 +0000)]
Add an entry to RELNOTES for r351201.

4 years agoAdd a vop_stdioctl() that performs a trivial FIOSEEKDATA/FIOSEEKHOLE.
Rick Macklem [Mon, 19 Aug 2019 00:29:05 +0000 (00:29 +0000)]
Add a vop_stdioctl() that performs a trivial FIOSEEKDATA/FIOSEEKHOLE.

Without this patch, when an application performed lseek(SEEK_DATA/SEEK_HOLE)
on a file in a file system that does not have its own VOP_IOCTL(), the
lseek(2) fails with errno ENOTTY. This didn't seem appropriate, since
ENOTTY is not listed as an error return by either the lseek(2) man page
nor the POSIX draft for lseek(2).
A discussion on freebsd-current@ seemed to indicate that implementing
a trivial algorithm that returns the offset argument for FIOSEEKDATA and
returns the file's size for FIOSEEKHOLE was the preferred fix.
http://docs.FreeBSD.org/cgi/mid.cgi?CAOtMX2iiQdv1+15e1N_r7V6aCx_VqAJCTP1AW+qs3Yg7sPg9wA
The Linux kernel appears to implement this trivial algorithm as well.

This patch adds a vop_stdioctl() that implements this trivial algorithm.
It returns errors consistent with vn_bmap_seekhole() and, as such, will
still return ENOTTY for non-regular files.

I have proposed a separate patch that maps errors not described by the
lseek(2) man page nor POSIX draft to EINVAL. This patch is under separate
review.

Reviewed by: kib
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D21299

4 years agoAllocate all per-cpu datastructures in domain correct memory.
Jeff Roberson [Sun, 18 Aug 2019 23:44:23 +0000 (23:44 +0000)]
Allocate all per-cpu datastructures in domain correct memory.

Reviewed by: kib, gallatin (some objections)
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21242

4 years agoiwmbtfw(8): Fix compilation on platforms using gcc.
Vladimir Kondratyev [Sun, 18 Aug 2019 23:10:07 +0000 (23:10 +0000)]
iwmbtfw(8): Fix compilation on platforms using gcc.

X-MFC with: r351197

4 years agoAllocate amd64's page array using pages and page directory pages from the
Jeff Roberson [Sun, 18 Aug 2019 23:07:56 +0000 (23:07 +0000)]
Allocate amd64's page array using pages and page directory pages from the
NUMA domain that the pages describe.  Patch original from gallatin.

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

4 years agoiwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices
Vladimir Kondratyev [Sun, 18 Aug 2019 22:20:28 +0000 (22:20 +0000)]
iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices

Currently supported models are: 8260, 8265, 9560, 9260 and 22161.
Firmware files can be installed with comms/iwmbt-firmware port.

PR: 237083
Reviewed by: hps, emax
X-MFC with: r351196
Differential Revision: https://reviews.freebsd.org/D21071

4 years agong_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode.
Vladimir Kondratyev [Sun, 18 Aug 2019 22:11:42 +0000 (22:11 +0000)]
ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode.

Add helper function for synchronous execution of HCI commands at probe
stage and use this function to check firmware state of Intel Wireless
8260/8265 bluetooth devices found in many post 2016 year laptops.

Attempt to initialize FreeBSD bluetooth stack while such a device is in
bootloader mode locks the adapter hardly so it requires power on/off
cycle to restore.

This change blocks ng_ubt attachment unless operational firmware is
loaded thus preventing the lock up.

PR: 237083
Reviewed by: hps, emax
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21071

4 years agoFix an issue with executing tmpfs binary.
Konstantin Belousov [Sun, 18 Aug 2019 20:36:11 +0000 (20:36 +0000)]
Fix an issue with executing tmpfs binary.

Suppose that a binary was executed from tmpfs mount, and the text
vnode was reclaimed while the binary was still running.  It is
possible during even the normal operations since tmpfs vnode'
vm_object has swap type, and no references on the vnode is held.  Also
assume that the text vnode was revived for some reason.  Then, on the
process exit or exec, unmapping of the text mapping tries to remove
the text reference from the vnode, but since it went from
recycle/instantiation cycle, there is no reference kept, and assertion
in VOP_UNSET_TEXT_CHECKED() triggers.

Fix this by keeping a use reference on the tmpfs vnode for each exec
reference.  This prevents the vnode reclamation while executable map
entry is active.

Do it by adding per-mount flag MNTK_TEXT_REFS that directs
vop_stdset_text() to add use ref on first vnode text use, and
per-vnode VI_TEXT_REF flag, to record the need on unref in
vop_stdunset_text() on last vnode text use going away.  Set
MNTK_TEXT_REFS for tmpfs mounts.

Reported by: bdrewery
Tested by: sbruno, pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoChange locking requirements for VOP_UNSET_TEXT().
Konstantin Belousov [Sun, 18 Aug 2019 20:24:52 +0000 (20:24 +0000)]
Change locking requirements for VOP_UNSET_TEXT().

Require the vnode to be locked for the VOP_UNSET_TEXT() call.  This
will be used by the following bug fix for a tmpfs issue.

Tested by: sbruno, pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agovfs: stop always overwriting ->mnt_stat in VFS_STATFS
Mateusz Guzik [Sun, 18 Aug 2019 18:40:12 +0000 (18:40 +0000)]
vfs: stop always overwriting ->mnt_stat in VFS_STATFS

The struct is already populated on each mount (and remount). Fields are either
constant or not used by filesystem in the first place.

Some infrequently used functions use it to avoid having to allocate a new buffer
and are left alone.

The current code results in an avoidable copying single-threaded and significant
cache line bouncing multithreaded

While here deduplicate initial filling of the struct.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21317

4 years agoperiodic: fix anticongestion for scripts run after security
Alan Somers [Sun, 18 Aug 2019 17:12:06 +0000 (17:12 +0000)]
periodic: fix anticongestion for scripts run after security

Revision 316342, which introduced the anticongestion feature, failed to
consider that the periodic scripts are executed by a recursive invocation of
periodic.  The recursive invocation wrongly cleaned up a temporary file that
should've been cleaned up only by the original invocation.  The result is
that if the first script that requests an anticongestion sleep runs after
the security scripts, the sleep won't happen.

Fix this bug by delaying cleanup until the end of the original invocation.

PR: 236564
Submitted by: Yasuhiro KIMURA <yasu@utahime.org>
Reviewed by: imp
MFC after: 1 month

4 years agorandom(4): Reorder configuration of random source modules
Conrad Meyer [Sun, 18 Aug 2019 16:04:01 +0000 (16:04 +0000)]
random(4): Reorder configuration of random source modules

Move fast entropy source registration to the earlier
SI_SUB_RANDOM:SI_ORDER_FOURTH and move random_harvestq_prime after that.
Relocate the registration routines out of the much later randomdev module
and into random_harvestq.

This is necessary for the fast random sources to actually register before we
perform random_harvestq_prime() early in the kernel boot.

No functional change.

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

4 years agoi386: Implement atomic_load_64(9) and atomic_store_64(9).
Konstantin Belousov [Sun, 18 Aug 2019 15:58:44 +0000 (15:58 +0000)]
i386: Implement atomic_load_64(9) and atomic_store_64(9).

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

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