]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoloader: use teken teminal emulator for x86 and uefi
Toomas Soome [Thu, 5 Sep 2019 22:15:50 +0000 (22:15 +0000)]
loader: use teken teminal emulator for x86 and uefi

Replace mini cons25 emulator with teken, this does enable us proper console
terminal for loader and will make it possible to implement different
back end callbacks to draw to screen.

At this time we still only "draw" in text mode.

4 years agoRemove long-dead BUF_ASSERT_{,UN}HELD assertions
Conrad Meyer [Thu, 5 Sep 2019 21:43:33 +0000 (21:43 +0000)]
Remove long-dead BUF_ASSERT_{,UN}HELD assertions

These were fully neutered in r177676 (2008), but not removed at the time for
unclear reasons.  They're totally dead code, so go ahead and yank them now.

No functional change.

4 years agomsdosfs: Drop an unneeded brelse in bread error condition
Conrad Meyer [Thu, 5 Sep 2019 21:30:52 +0000 (21:30 +0000)]
msdosfs: Drop an unneeded brelse in bread error condition

After r294954, it is an invariant that bread returns non-NULL bp if and only
if the routine succeeded.  On error, it handles any buffer cleanup
internally.  So the brelse(NULL) here was just redundant.

No functional change.

Discussed with: kib (extracted from a larger differential)

4 years agonvdimm(4): Add description of NVDIMM Namespace support
D Scott Phillips [Thu, 5 Sep 2019 20:51:41 +0000 (20:51 +0000)]
nvdimm(4): Add description of NVDIMM Namespace support

Reviewed by: kib, bcr
Approved by: emaste (mentor)
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21536

4 years agoBounds check again after advancing cp, otherwise we have a possible
Cy Schubert [Thu, 5 Sep 2019 19:35:30 +0000 (19:35 +0000)]
Bounds check again after advancing cp, otherwise we have a possible
heap buffer overflow. This was discovered by a Google fuzzer test.
This can lead to remote denial of service. User interaction and
execution privileges are not a prerequisite for exploitation.

Reported by: enh at Google, to FreeBSD by maya@NetBSD.org
Obtained from: enh at Google
See also: NetBSD ns_name.c r1.12
Reviewed by: delphij, ume
MFC after: 3 days
https://android-review.googlesource.com/c/platform/bionic/+/1093130
Differential Revision: https://reviews.freebsd.org/D21523

4 years agoUse a single write of 3 bytes instead of iicdev_writeto() in ads111x.
Ian Lepore [Thu, 5 Sep 2019 19:17:53 +0000 (19:17 +0000)]
Use a single write of 3 bytes instead of iicdev_writeto() in ads111x.

The iicdev_writeto() function basically does scatter-gather IO by filling
in a pair of iic_msg structs to write the register address then the data
from different locations but with a single bus START/xfer/STOP sequence.
It turns out several low-level i2c controller drivers do not honor the
IIC_NOSTART flag, so the second piece of the write gets a new START on
the bus, and that confuses the ads111x chips which expect a continuous
write of 3 bytes to set a register.

A proper fix for this is to track down all the misbehaving controllers
drivers and fix them.  For now this change makes this driver work again.

4 years agopkgbase: Add the pkg trusted keys to the FreeBSD-utilities package
Emmanuel Vadot [Thu, 5 Sep 2019 19:17:17 +0000 (19:17 +0000)]
pkgbase: Add the pkg trusted keys to the FreeBSD-utilities package

4 years agoEnsure a measurement is complete before reading the result in ads111x.
Ian Lepore [Thu, 5 Sep 2019 19:07:48 +0000 (19:07 +0000)]
Ensure a measurement is complete before reading the result in ads111x.
Also, disable the comparator by default; it's not used for anything.

The previous logic would start a measurement, and then pause_sbt() for the
averaging time currently configured in the chip.  After waiting that long,
the code would blindly read the measurement register and return its value.
The problem is that the chip's idea of averaging time is based on its
internal free-running 1MHz oscillator, which may be running at a wildly
different rate than the kernel clock.  If the chip's internal timer was
running slower than the kernel clock, we'd end up grabbing a stale result
from an old measurement.

The driver now still uses pause_sbt() to yield the cpu while waiting for
the measurement to complete, but after sleeping it checks the chip's status
register to ensure the measurement engine is idle.  If it's not, the driver
uses a retry loop to wait a bit (5% of the original wait time) then check
again for completion.

4 years agoSet required program for all acl tests
Kristof Provost [Thu, 5 Sep 2019 18:54:46 +0000 (18:54 +0000)]
Set required program for all acl tests

r339782 re-enabled acl test 00 and 02, which were disabled in r336617
due to PR 229930.
When the tests were disabled the code to set their required programs was
disabled as well, but this was not reinstated when r339782 re-enabled
them.
Do so now.

Sponsored by: Axiado

4 years agovfs: temporarily revert r351825
Mateusz Guzik [Thu, 5 Sep 2019 18:19:51 +0000 (18:19 +0000)]
vfs: temporarily revert r351825

There are 2 problems:
- it introduces a funny bug where it can end up trylocking the same vnode [1]
- it exposes a pre-existing softdep deadlock [2]

Both are easier to run into that the bug which got fixed, so revert until
a complete solution is worked out.

Reported by: cy [1], pho [2]
Sponsored by: The FreeBSD Foundation

4 years agoAdjust teken to allow build as part of loader
Toomas Soome [Thu, 5 Sep 2019 18:07:40 +0000 (18:07 +0000)]
Adjust teken to allow build as part of loader

Building for loader needs specific headers.

4 years agoAdd dwgpio to NOTES so it gets built in LINT kernels.
Ruslan Bukin [Thu, 5 Sep 2019 17:54:57 +0000 (17:54 +0000)]
Add dwgpio to NOTES so it gets built in LINT kernels.

Sponsored by: DARPA, AFRL

4 years agoBump up the low range of cpuset numbers to account for the kernel cpuset.
Stephen J. Kiernan [Thu, 5 Sep 2019 17:48:39 +0000 (17:48 +0000)]
Bump up the low range of cpuset numbers to account for the kernel cpuset.

Reviewed by: jeff
Obtained from: Juniper Networks, Inc.

4 years ago[lib80211] add initial VHT (11ac) channel ranges for FCC.
Adrian Chadd [Thu, 5 Sep 2019 15:55:24 +0000 (15:55 +0000)]
[lib80211] add initial VHT (11ac) channel ranges for FCC.

This is a simple set of VHT channels and flags for the FCC (US) regulatory
domain.  This needs to be researched and done for the rest of the
regulatory domains, but this should at least unblock some more ath10k
testing.

4 years agopcie: return an error if a matching resource is not found
Ed Maste [Thu, 5 Sep 2019 15:45:21 +0000 (15:45 +0000)]
pcie: return an error if a matching resource is not found

Submitted by: markj
Reviewed by: manu
Event: vBSDCon FreeBSD hackathon
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20884

4 years agopatch(1): fix the file removal test, strengthen it a bit
Kyle Evans [Thu, 5 Sep 2019 15:35:57 +0000 (15:35 +0000)]
patch(1): fix the file removal test, strengthen it a bit

To remain compatible with GNU patch, we should ensure that once we're
removing empty files after a reversed /dev/null patch we don't remove files
that have been modified. GNU patch leaves these intact and just reverses the
hunk that created the file, effectively implying --remove-empty-files for
reversed /dev/null patches.

4 years agoficl: add xemit word
Toomas Soome [Thu, 5 Sep 2019 15:06:30 +0000 (15:06 +0000)]
ficl: add xemit word

While emit will output one byte on screen, the xemit will output xchar.

See: http://forth-standard.org/standard/xchar/XEMIT

4 years agorc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)
Mateusz Piotrowski [Thu, 5 Sep 2019 14:52:22 +0000 (14:52 +0000)]
rc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)

A user may set ${name}_env variable in rc.conf(5) in order to set additional
environment variables for a service command.  Unfortunately, at the moment
this variable is only honored when the command is specified via the command
variable. Those additional environment variables coming from ${name}_env
are never set if the service is started via the ${rc_arg}_cmd variable (for
example start_cmd).

PR: 239692
Reviewed by: bcr, jilles
Approved by: src (jilles)
Differential Revision: https://reviews.freebsd.org/D21228

4 years agopkgbase: pfctl: tests: Put tests files in the FreeBSD-tests package
Emmanuel Vadot [Thu, 5 Sep 2019 14:19:06 +0000 (14:19 +0000)]
pkgbase: pfctl: tests: Put tests files in the FreeBSD-tests package

Reviewed by: kp, gjb
Differential Revision: https://reviews.freebsd.org/D21521

4 years agopkgbase: Handle FILES when no FILESGROUP isn't used
Emmanuel Vadot [Thu, 5 Sep 2019 14:18:13 +0000 (14:18 +0000)]
pkgbase: Handle FILES when no FILESGROUP isn't used

bsd.files.mk only add the TAG when groups are used, fix this.

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D21520

4 years agopkgbase: Add tag for LIBSYMLINK case
Emmanuel Vadot [Thu, 5 Sep 2019 14:17:28 +0000 (14:17 +0000)]
pkgbase: Add tag for LIBSYMLINK case

Otherwised the files aren't packaged.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21508

4 years agopkgbase: Add tags for includes in bsd.incs.mk
Emmanuel Vadot [Thu, 5 Sep 2019 14:16:39 +0000 (14:16 +0000)]
pkgbase: Add tags for includes in bsd.incs.mk

Otherwise the files aren't packaged.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21507

4 years agopkgbase: Create a FreeBSD-utilities package and make it the default one
Emmanuel Vadot [Thu, 5 Sep 2019 14:15:47 +0000 (14:15 +0000)]
pkgbase: Create a FreeBSD-utilities package and make it the default one

The default package use to be FreeBSD-runtime but it should only contain
binaries and libs enough to boot to single user and repair the system, it
is also very handy to have a package that can be tranform to a small mfsroot.
So create a new package named FreeBSD-utilities and make it the default one.
Also move a few binaries and lib into this package when it make sense.
Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21506

4 years agopkgbase: Add TAG for evdev and veriexec headers
Emmanuel Vadot [Thu, 5 Sep 2019 14:14:47 +0000 (14:14 +0000)]
pkgbase: Add TAG for evdev and veriexec headers

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D21505

4 years agopkgbase: Put the sys/common test into the tests package
Emmanuel Vadot [Thu, 5 Sep 2019 14:14:07 +0000 (14:14 +0000)]
pkgbase: Put the sys/common test into the tests package

Every other test is there so do the same for those.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21504

4 years agopkgbase: Put a lot of binaries and lib in FreeBSD-runtime
Emmanuel Vadot [Thu, 5 Sep 2019 14:13:08 +0000 (14:13 +0000)]
pkgbase: Put a lot of binaries and lib in FreeBSD-runtime

All of them are needed to be able to boot to single user and be able
to repair a existing FreeBSD installation so put them directly into
FreeBSD-runtime.

Reviewed by:    bapt, gjb
Differential Revision:  https://reviews.freebsd.org/D21503

4 years agopkgbase: Put libbluetooth in the bluetooth package
Emmanuel Vadot [Thu, 5 Sep 2019 14:11:16 +0000 (14:11 +0000)]
pkgbase: Put libbluetooth in the bluetooth package

It make sense to have everything bluetooth related in the same package.
Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21502

4 years agopkgbase: Move libcap_ to FreeBSD-runtime
Emmanuel Vadot [Thu, 5 Sep 2019 14:10:26 +0000 (14:10 +0000)]
pkgbase: Move libcap_ to FreeBSD-runtime

A lot of binaries present in FreeBSD-runtime depend on it so move
the libs there.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21501

4 years agopkgbase: Tag passwd related file to be in FreeBSD-runtime package.
Emmanuel Vadot [Thu, 5 Sep 2019 14:09:33 +0000 (14:09 +0000)]
pkgbase: Tag passwd related file to be in FreeBSD-runtime package.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21500

4 years agopkgbase: Move rc scripts and related files to their own packages
Emmanuel Vadot [Thu, 5 Sep 2019 14:08:45 +0000 (14:08 +0000)]
pkgbase: Move rc scripts and related files to their own packages

It doesn't need to be in runtime and might help people who want to
experiment with other rc system or don't use one (like in small
embedded mfsroot).

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21499

4 years agopkgbase: Force zfs(8) and zpool(8) to be in the runtime package
Emmanuel Vadot [Thu, 5 Sep 2019 14:07:49 +0000 (14:07 +0000)]
pkgbase: Force zfs(8) and zpool(8) to be in the runtime package

Those commands are needed to repair a FreeBSD installation so add them
to the runtime package

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21498

4 years agopkgbase: lib80211 is needed by ifconfig(8) so put it in FreeBSD-runtime
Emmanuel Vadot [Thu, 5 Sep 2019 14:06:48 +0000 (14:06 +0000)]
pkgbase: lib80211 is needed by ifconfig(8) so put it in FreeBSD-runtime

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21497

4 years agopkgbase: Move the bootloader related files to a new FreeBSD-bootloader package
Emmanuel Vadot [Thu, 5 Sep 2019 14:06:01 +0000 (14:06 +0000)]
pkgbase: Move the bootloader related files to a new FreeBSD-bootloader package

Bootloader file isn't needed for jails so don't include it in FreeBSD-runtime.

Reviewed by: bapt, delphij, gjb
Differential Revision: https://reviews.freebsd.org/D21496

4 years agoDecrease the default audio playback latency to a maximum of 21.3ms.
Hans Petter Selasky [Thu, 5 Sep 2019 10:49:12 +0000 (10:49 +0000)]
Decrease the default audio playback latency to a maximum of 21.3ms.
This significantly improves the audio playback response time.

Discussed with: mav@
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoficl: add uIsGreater word
Toomas Soome [Thu, 5 Sep 2019 09:04:48 +0000 (09:04 +0000)]
ficl: add uIsGreater word

For some reason we have u< but not u>, fix it.

4 years agopatch(1): add some basic tests
Kyle Evans [Thu, 5 Sep 2019 03:16:14 +0000 (03:16 +0000)]
patch(1): add some basic tests

Summary:
- basic: test application of patches created by diff -u at the
  beginning/middle/end of file, which have differing amounts of context
  before and after chunks being added
- limited_ctx: stems from PR 74127 in which a rogue line was getting added
  when the patch should have been rejected. Similar behavior was
  reproducible with larger contexts near the beginning/end of a file. See
  r326084 for details
- file_creation: patch sourced from /dev/null should create the file
- file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents
  when re-applied (personal vendetta, WIP, see comment)
- file_removal: this follows from nodupe; the reverse of a patch sourced
  from /dev/null is most naturally deleting the file, as is expected based
  on GNU patch behavior (WIP)

4 years agosys/mount.h: Comment on distinction between vfs_{c,}mount
Conrad Meyer [Thu, 5 Sep 2019 00:56:37 +0000 (00:56 +0000)]
sys/mount.h: Comment on distinction between vfs_{c,}mount

Hope to save someone else a little future effort in ugly duplicated code.

No functional change.

4 years agoDelete the unused "nd" argument for nfsrv_checkdsattr().
Rick Macklem [Wed, 4 Sep 2019 22:37:28 +0000 (22:37 +0000)]
Delete the unused "nd" argument for nfsrv_checkdsattr().

The "nd" argument for nfsrv_checkdsattr() is no longer used by the function.
This patch deletes it. This allows subsequent patches to delete the "nd"
argument from nfsrv_proxyds(), since it's only use of "nd" was to pass it
to nfsrv_checkdsattr(). The same will then be true for nfsvno_getattr(),
which passes "nd" to nfsrv_proxyds().
Getting rid of the "nd" argument from nfsvno_getattr() avoids confusion
over why it might need "nd".

This patch is trivial and does not have any semantic effect.
Found by inspection while working on the NFSv4.2 server.

4 years agoThe efifat files are no longer used: remove the code to build them
Rebecca Cran [Wed, 4 Sep 2019 20:55:48 +0000 (20:55 +0000)]
The efifat files are no longer used: remove the code to build them

Reviewed by: imp, tsoome, emaste
Differential Revision: https://reviews.freebsd.org/D20562

4 years agomadvise(MADV_FREE): Quick fix to time rewind.
Konstantin Belousov [Wed, 4 Sep 2019 20:28:16 +0000 (20:28 +0000)]
madvise(MADV_FREE): Quick fix to time rewind.

Don't free pages in a shadowing object.  While this degrades MADV_FREE
to a no-op (and we could, instead, choose to fall back to
MADV_DONTNEED, at the cost of changing pmap_madvise), this is
presently considered a temporary fix. We may prefer to risk a little
fragmentation of the map by creating a zero/OBJT_DEFAULT entry over
top of the existing object and, simultaneously, revert to the existing
marking any pages in the former shadowing object in the advised region
as reclaimable.  At least one consumer of MADV_FREE (snmalloc) may use
mmap() to construct zeroed pages "eventually" here anyway, so the
fragmentation may be coming anyway.

Submitted by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
PR: 240061
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21517

4 years agoSupport doorbell strides != 0.
Warner Losh [Wed, 4 Sep 2019 20:08:36 +0000 (20:08 +0000)]
Support doorbell strides != 0.

The NVMe standard (1.4) states

>>> 8.6 Doorbell Stride for Software Emulation
>>> The doorbell stride,...is useful in software emulation of an NVM
>>> Express controller. ...  For hardware implementations of the NVM
>>> Express interface, the expected doorbell stride value is 0h.

However, hardware in the wild exists with a doorbell stride of 1
(meaning 8 byte separation). This change supports that hardware, as
well as software emulators as envisioned in Section 8.6. Since this is
the fast path, care has been taken to make this computation
efficient. The bit of math to compute an offset for each is replaced
by a memory load from cache of a pre-computed value.

MFC After: 3 days
Reviewed by: scottl@
Differential Revision: https://reviews.freebsd.org/D21514

4 years agovfs: fully hold vnodes in vnlru_free_locked
Mateusz Guzik [Wed, 4 Sep 2019 19:23:18 +0000 (19:23 +0000)]
vfs: fully hold vnodes in vnlru_free_locked

Currently the code only bumps holdcnt and clears the VI_FREE flag, not
performing actual vhold. Since the vnode is still visible elsewhere, a
potential new user can find it and incorrectly assume it is properly held.

Use vholdl instead to correctly hold the vnode. Another place recycling
(vlrureclaim) does this already.

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

4 years agoReport the Host Buffer Memory minimum and preferred sizes.
Warner Losh [Wed, 4 Sep 2019 19:19:23 +0000 (19:19 +0000)]
Report the Host Buffer Memory minimum and preferred sizes.

The Host Buffer feature (NVMe 1.4 section 89) allows for the NVMe card
request the host provide it buffer for lookaside tables and maybe
other things. Report the card's minimum and preferred sizes with
nvmecontrol/camcontrol identify.

4 years agoPROGS: Build common sources before recursed PROGS_TARGETS as well when building.
Bryan Drewery [Wed, 4 Sep 2019 18:32:11 +0000 (18:32 +0000)]
PROGS: Build common sources before recursed PROGS_TARGETS as well when building.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoFix /proc/mounts for autofs(5) mounts.
Edward Tomasz Napierala [Wed, 4 Sep 2019 18:00:54 +0000 (18:00 +0000)]
Fix /proc/mounts for autofs(5) mounts.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoImprove debugging output.
Edward Tomasz Napierala [Wed, 4 Sep 2019 18:00:03 +0000 (18:00 +0000)]
Improve debugging output.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years ago- correct HISTORY section
Jason Helfman [Wed, 4 Sep 2019 17:52:30 +0000 (17:52 +0000)]
- correct HISTORY section
- while here clarify wording

PR: 240260 (based on)
Submitted by: gbergling@gmail.com
MFC after: after 1 week

4 years agoprocstat/tests: Fix flakiness by waiting for program to start
Jilles Tjoelker [Wed, 4 Sep 2019 16:25:41 +0000 (16:25 +0000)]
procstat/tests: Fix flakiness by waiting for program to start

Some of the procstat tests start a program "while1" and examine the process
using procstat, but did not wait properly for it to start (kill -0 will
succeed immediately after the child process has been created).

Instead, have "while1" write something when it starts, and use a fifo to
wait for that.

PR: 233587, 233588
Reviewed by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21519

4 years agoInclude dwgpio to the build.
Ruslan Bukin [Wed, 4 Sep 2019 15:55:44 +0000 (15:55 +0000)]
Include dwgpio to the build.

Sponsored by: DARPA, AFRL

4 years agoo Add support for multi-port instances of Synopsys DesignWare APB GPIO
Ruslan Bukin [Wed, 4 Sep 2019 15:37:24 +0000 (15:37 +0000)]
o Add support for multi-port instances of Synopsys DesignWare APB GPIO
  Controller.
o Rename the driver to dwgpio.

Sponsored by: DARPA, AFRL

4 years agoBack out r351799
Kyle Evans [Wed, 4 Sep 2019 14:32:04 +0000 (14:32 +0000)]
Back out r351799

empty does not appear to work like I thought it did and it actively breaks
real LOCAL_MODULES usage, of which I have none at the moment...

4 years agopseudofs: make readdir work without a pid again
Kyle Evans [Wed, 4 Sep 2019 14:20:39 +0000 (14:20 +0000)]
pseudofs: make readdir work without a pid again

Specifically, the following was broken:

$ mount -t procfs procfs /proc
$ ls -l /proc

r351741 reworked readdir slightly to avoid pfs_node/pidhash LOR, but
inadvertently regressed pid == NO_PID; new pfs_lookup_proc() fails for the
obvious reasons, and later pfs_visible_proc doesn't capture the
pid == NO_PID -> return 1 aspect of pfs_visible. We can infact skip this
whole block if we're operating on a directory w/ NO_PID, as it's always
visible.

Reported by: trasz
Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D21518

4 years agobectl(8): implement sorting for 'bectl list' output
Kyle Evans [Wed, 4 Sep 2019 13:59:06 +0000 (13:59 +0000)]
bectl(8): implement sorting for 'bectl list' output

Allow 'bectl list' to sort output by a given property name. The property
name is passed in using a command-line flag, '-c' for ascending order and
'-C' for descending order. The properties allowed to sort by are:

- name (the default output, even if '-c' or '-C' are not used)
- creation
- origin
- used
- usedds
- usedsnap
- usedrefreserv

The default output for 'bectl list' is now ascending alphabetical order of
BE name.

To sort by creation time from earliest to latest, the command would be
'bectl list -c creation'

Submitted by: Rob Fairbanks <rob.fx907 gmail com>
Reviewed by: ler
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20818

4 years agompsutil slot set status
Andriy Gapon [Wed, 4 Sep 2019 13:47:38 +0000 (13:47 +0000)]
mpsutil slot set status

This code has been written as a proof of concept, but I think that it
can be useful in general.  It allows to set the status of an enclosure
slot.  Practically, this means controlling whatever slot status LEDs the
enclosure provides.  At present, the new command does not have sanity
checks or any conveniences.  That means that it is possible to issue the
command for an invalid slot and an enclosure.  But the worst I have seen
happening is either the command failing or simply being ignored.  Also,
at the moment, the status has to be specified as a numeric bit mask.
The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
slot is by the enclosure handle and the slot number.  Both are readily
available from mpsutil show commands.

So, future enhancements could include alternative ways to address a slot
(e.g., by a disk handle or a disk device name) and human friendly names
for slot statuses.

The new command is useful alternative to 'sas2ircu locate' command.
First, sas2ircu is a proprietary blob.  Second, it supports setting only
locate / identify status bit.

Tested on HP H220 running LSI IT firmware 20.x.

Reviewed by: bapt
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D20535

4 years agoAdjust history, info source from v1's manuals
Sevan Janiyan [Wed, 4 Sep 2019 13:44:46 +0000 (13:44 +0000)]
Adjust history, info source from v1's manuals
https://www.bell-labs.com/usr/dmr/www/1stEdman.html

MFC after: 5 days

4 years agoshutdown_halt: make sure that watchdog timer is stopped
Andriy Gapon [Wed, 4 Sep 2019 13:26:59 +0000 (13:26 +0000)]
shutdown_halt: make sure that watchdog timer is stopped

The point of halt is to keep the machine in limbo.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21222

4 years agoZFS: Always refuse receving non-resume stream when resume state exists
Andriy Gapon [Wed, 4 Sep 2019 07:33:22 +0000 (07:33 +0000)]
ZFS: Always refuse receving non-resume stream when resume state exists

This fixes a hole in the situation where the resume state is left from
receiving a new dataset and, so, the state is set on the dataset itself
(as opposed to %recv child).

Additionally, distinguish incremental and resume streams in error
messages.

This was also committed to ZoL:
zfsonlinux/zfs@ebeb6f23bf7e8fe6732a05267ed1cab4c38d3b23

MFC after: 2 weeks
Sponsored by: CyberSecure

4 years agoCorrect overflow logic in fullpath().
Xin LI [Wed, 4 Sep 2019 04:44:03 +0000 (04:44 +0000)]
Correct overflow logic in fullpath().

Obtained from: OpenBSD
MFC after: 3 days

4 years agoFix the SACK block generation in the base TCP stack by bringing it in
Michael Tuexen [Wed, 4 Sep 2019 04:38:31 +0000 (04:38 +0000)]
Fix the SACK block generation in the base TCP stack by bringing it in
sync with the RACK stack.

Reviewed by: rrs@
MFC after: 5 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21513

4 years agoFix some nits in pmap_page_array_startup().
Mark Johnston [Tue, 3 Sep 2019 22:26:01 +0000 (22:26 +0000)]
Fix some nits in pmap_page_array_startup().

- Use ptoa() instead of the archaic ctob().
- Use pagezero() to zero a PDP page.
- Remove PA_MIN_ADDRESS, orphaned by r351742.
- Remove unneeded parens and an unnecessary control flow statement.

Reported by: alc
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21495

4 years agoLOCAL_MODULES: Allow LOCAL_MODULES="" in src.conf to work
Kyle Evans [Tue, 3 Sep 2019 22:01:12 +0000 (22:01 +0000)]
LOCAL_MODULES: Allow LOCAL_MODULES="" in src.conf to work

Currently LOCAL_MODULES= works, but LOCAL_MODULES="" causes build errors as
.for still has the empty string to loop over. An .if empty prior to the loop
was considered, but LOCAL_MODULES has empty quotes at that point and thus,
isn't empty. A better solution likely exists, but this floats us by for
now...

4 years agoAllow more nesting of GEOM partitioning schemes
Kyle Evans [Tue, 3 Sep 2019 20:57:20 +0000 (20:57 +0000)]
Allow more nesting of GEOM partitioning schemes

GEOM is supposed to be topology-agnostic, but the GPT and BSD partition code
has arbitrary restrictions on nesting that are annoying in cases such as
running VMs on raw partitions (since the VM's partitioning scheme is not
visible to the host).

This patch adds sysctls to disable the restrictions except in the case of
BSD label (and similar) partitions with offset 0 (where we need to avoid
recursively recognizing the label).

Submitted by: Andrew Gierth
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21350

4 years agoposixshm: start counting writeable mappings
Kyle Evans [Tue, 3 Sep 2019 20:33:38 +0000 (20:33 +0000)]
posixshm: start counting writeable mappings

r351650 switched posixshm to using OBJT_SWAP for shm_object

r351795 added support to the swap_pager for tracking writeable mappings

Take advantage of this and start tracking writeable mappings; fd sealing
will use this to reject a seal on writing with EBUSY if any such mapping
exist.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D21456

4 years agovm pager: writemapping accounting for OBJT_SWAP
Kyle Evans [Tue, 3 Sep 2019 20:31:48 +0000 (20:31 +0000)]
vm pager: writemapping accounting for OBJT_SWAP

Currently writemapping accounting is only done for vnode_pager which does
some accounting on the underlying vnode.

Extend this to allow accounting to be possible for any of the pager types.
New pageops are added to update/release writecount that need to be
implemented for any pager wishing to do said accounting, and we implement
these methods now for both vnode_pager (unchanged) and swap_pager.

The primary motivation for this is to allow other systems with OBJT_SWAP
objects to check if their objects have any write mappings and reject
operations with EBUSY if so. posixshm will be the first to do so in order to
reject adding write seals to the shmfd if any writable mappings exist.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D21456

4 years agoUnbreak Linux binaries linked against new glibc, such as the ones
Edward Tomasz Napierala [Tue, 3 Sep 2019 19:48:23 +0000 (19:48 +0000)]
Unbreak Linux binaries linked against new glibc, such as the ones
from recent Ubuntu versions.  Without it they segfault on startup.

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

4 years agoFix two TCP RACK issues:
Michael Tuexen [Tue, 3 Sep 2019 19:48:02 +0000 (19:48 +0000)]
Fix two TCP RACK issues:
* Convert the TCP delayed ACK timer from ms to ticks as required.
  This fixes the timer on platforms with hz != 1000.
* Don't delay acknowledgements which report duplicate data using
  DSACKs.

Reviewed by: rrs@
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21512

4 years ago- Retire pc-sysinstall(8)
Kris Moore [Tue, 3 Sep 2019 19:42:04 +0000 (19:42 +0000)]
- Retire pc-sysinstall(8)

https://reviews.freebsd.org/D21094

Submitted by: kmoore@FreeBSD.org
Approved by: imp@FreeBSD.org

4 years agoAdd stackgap control mode to proccontrol(1).
Konstantin Belousov [Tue, 3 Sep 2019 18:58:48 +0000 (18:58 +0000)]
Add stackgap control mode to proccontrol(1).

PR: 239894
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21352

4 years agoAdd procctl(PROC_STACKGAP_CTL)
Konstantin Belousov [Tue, 3 Sep 2019 18:56:25 +0000 (18:56 +0000)]
Add procctl(PROC_STACKGAP_CTL)

It allows a process to request that stack gap was not applied to its
stacks, retroactively.  Also it is possible to control the gaps in the
process after exec.

PR: 239894
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21352

4 years agoUse makefs -t msdos in make_esp_file
Matt Macy [Tue, 3 Sep 2019 18:37:55 +0000 (18:37 +0000)]
Use makefs -t msdos in make_esp_file

With this last piece in place, make -C /usr/src/release release.iso is
finally able to run in a jail. This was not possible before because
msdosfs cannot be mounted inside a jail.

Submitted by: ryan@ixsystems.com
Reviewed by: emaste@, imp@, gjb@
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D21385

4 years agoAdd conv=fsync flag to dd
Matt Macy [Tue, 3 Sep 2019 18:35:55 +0000 (18:35 +0000)]
Add conv=fsync flag to dd

The fsync flag performs an fsync(2) on the output file before closing it.
This will be useful for the ZFS test suite.

Submitted by: ryan@ixsystems.com
Reviewed by: jilles@, imp@
MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agobsdgrep(1): add some basic tests for some GNU Extension support
Kyle Evans [Tue, 3 Sep 2019 18:32:29 +0000 (18:32 +0000)]
bsdgrep(1): add some basic tests for some GNU Extension support

These will be expanded later as I come up with good test cases; for now,
these seem to be enough to trigger bugs in base gnugrep and expose missing
features in bsdgrep.

4 years agoMake linprocfs(4) report Tgid, Linux ltrace(1) needs it.
Edward Tomasz Napierala [Tue, 3 Sep 2019 16:33:02 +0000 (16:33 +0000)]
Make linprocfs(4) report Tgid, Linux ltrace(1) needs it.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agovfs: implement usecount implying holdcnt
Mateusz Guzik [Tue, 3 Sep 2019 15:42:11 +0000 (15:42 +0000)]
vfs: implement usecount implying holdcnt

vnodes have 2 reference counts - holdcnt to keep the vnode itself from getting
freed and usecount to denote it is actively used.

Previously all operations bumping usecount would also bump holdcnt, which is
not necessary. We can detect if usecount is already > 1 (in which case holdcnt
is also > 1) and utilize it to avoid bumping holdcnt on our own. This saves
on atomic ops.

Reviewed by: kib
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21471

4 years agoImplement nvme suspend / resume for pci attachment
Warner Losh [Tue, 3 Sep 2019 15:26:11 +0000 (15:26 +0000)]
Implement nvme suspend / resume for pci attachment

When we suspend, we need to properly shutdown the NVME controller. The
controller may go into D3 state (or may have the power removed), and
to properly flush the metadata to non-volatile RAM, we must complete a
normal shutdown. This consists of deleting the I/O queues and setting
the shutodown bit. We have to do some extra stuff to make sure we
reset the software state of the queues as well.

On resume, we have to reset the card twice, for reasons described in
the attach funcion. Once we've done that, we can restart the card. If
any of this fails, we'll fail the NVMe card, just like we do when a
reset fails.

Set is_resetting for the duration of the suspend / resume. This keeps
the reset taskqueue from running a concurrent reset, and also is
needed to prevent any hw completions from queueing more I/O to the
card. Pass resetting flag to nvme_ctrlr_start. It doesn't need to get
that from the global state of the ctrlr. Wait for any pending reset to
finish. All queued I/O will get sent to the hardware as part of
nvme_ctrlr_start(), though the upper layers shouldn't send any
down. Disabling the qpairs is the other failsafe to ensure all I/O is
queued.

Rename nvme_ctrlr_destory_qpairs to nvme_ctrlr_delete_qpairs to avoid
confusion with all the other destroy functions.  It just removes the
queues in hardware, while the other _destroy_ functions tear down
driver data structures.

Split parts of the hardware reset function up so that I can
do part of the reset in suspsend. Split out the software disabling
of the qpairs into nvme_ctrlr_disable_qpairs.

Finally, fix a couple of spelling errors in comments related to
this.

Relnotes: Yes
MFC After: 1 week
Reviewed by: scottl@ (prior version)
Differential Revision: https://reviews.freebsd.org/D21493

4 years agoRevert a portion of r351628 that I did not mean to commit.
Mark Johnston [Tue, 3 Sep 2019 14:39:36 +0000 (14:39 +0000)]
Revert a portion of r351628 that I did not mean to commit.

Reported by: mjg
MFC with: r351628

4 years agoAdd preliminary support for atomic updates of per-page queue state.
Mark Johnston [Tue, 3 Sep 2019 14:29:58 +0000 (14:29 +0000)]
Add preliminary support for atomic updates of per-page queue state.

Queue operations on a page use the page lock when updating the page to
reflect the desired queue state, and the page queue lock when physically
enqueuing or dequeuing a page.  Multiple pages share a given page lock,
but queue state is per-page; this false sharing results in heavy lock
contention.

Take a small step towards the use of atomic_cmpset to synchronize
updates to per-page queue state by introducing vm_page_pqstate_cmpset()
and using it in the page daemon.  In the longer term the plan is to stop
using the page lock to protect page identity and rely only on the object
and page busy locks.  However, since the page daemon avoids acquiring
the object lock except when necessary, some synchronization with a
concurrent free of the page is required.  vm_page_pqstate_cmpset() can
be used to ensure that queue state updates are successful only if the
page is not scheduled for a dequeue, which is sufficient for the page
daemon.

Add vm_page_swapqueue(), which moves a page from one queue to another
using vm_page_pqstate_cmpset().  Use it in the active queue scan, which
does not use the object lock.  Modify vm_page_dequeue_deferred() to
use vm_page_pqstate_cmpset() as well.

Reviewed by: kib
Discussed with: jeff
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21257

4 years agoMap the vm_page array into KVA on amd64.
Mark Johnston [Tue, 3 Sep 2019 13:18:51 +0000 (13:18 +0000)]
Map the vm_page array into KVA on amd64.

r351198 allows the kernel to use domain-local memory to back the vm_page
array (up to 2MB boundaries) and reserves a separate PML4 entry for that
purpose.  One consequence of that change is that the vm_page array is no
longer present in minidumps, which only adds pages mapped above
VM_MIN_KERNEL_ADDRESS.

To avoid the friction caused by having kernel data structures mapped
below VM_MIN_KERNEL_ADDRESS, map the vm_page array starting at
VM_MIN_KERNEL_ADDRESS instead of using a dedicated PML4 entry.

Reviewed by: kib
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21491

4 years agopseudofs: fix a LOR pfs_node vs pidhash (sleepable after non-sleepable)
Mateusz Guzik [Tue, 3 Sep 2019 12:54:51 +0000 (12:54 +0000)]
pseudofs: fix a LOR pfs_node vs pidhash (sleepable after non-sleepable)

Sponsored by: The FreeBSD Foundation

4 years agosuperio: fix the copyright block and update the year
Andriy Gapon [Tue, 3 Sep 2019 12:40:58 +0000 (12:40 +0000)]
superio: fix the copyright block and update the year

MFC after: 2 weeks

4 years agoTemporarily skip sys.sys.qmath_test.qdivq_s64q in CI because it is unstable
Li-Wen Hsu [Tue, 3 Sep 2019 10:49:13 +0000 (10:49 +0000)]
Temporarily skip sys.sys.qmath_test.qdivq_s64q in CI because it is unstable

PR: 240219
Discussed with: trasz
Sponsored by: The FreeBSD Foundation

4 years agoAdd sysctlbyname system call
Mateusz Guzik [Tue, 3 Sep 2019 04:16:30 +0000 (04:16 +0000)]
Add sysctlbyname system call

Previously userspace would issue one syscall to resolve the sysctl and then
another one to actually use it. Do it all in one trip.

Fallback is provided in case newer libc happens to be running on an older
kernel.

Submitted by: Pawel Biernacki
Reported by: kib, brooks
Differential Revision: https://reviews.freebsd.org/D17282

4 years agoAdd a sysctl to dump kernel mappings and their properties on amd64.
Mark Johnston [Mon, 2 Sep 2019 21:57:57 +0000 (21:57 +0000)]
Add a sysctl to dump kernel mappings and their properties on amd64.

The sysctl is called vm.pmap.kernel_maps.  It dumps address ranges
and their corresponding protection and mapping mode, as well as
counts of 2MB and 1GB pages in the range.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21380

4 years agoReplace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.
Mark Johnston [Mon, 2 Sep 2019 21:54:08 +0000 (21:54 +0000)]
Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.

No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoThis patch improves the DSACK handling to conform with RFC 2883.
Michael Tuexen [Mon, 2 Sep 2019 19:04:02 +0000 (19:04 +0000)]
This patch improves the DSACK handling to conform with RFC 2883.
The lowest SACK block is used when multiple Blocks would be elegible as
DSACK blocks ACK blocks get reordered - while maintaining the ordering of
SACK blocks not relevant in the DSACK context is maintained.

Reviewed by: rrs@, tuexen@
Obtained from: Richard Scheffenegger
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21038

4 years agoFix the name of the devicetree bindings document file cited in the manpage.
Ian Lepore [Mon, 2 Sep 2019 18:32:08 +0000 (18:32 +0000)]
Fix the name of the devicetree bindings document file cited in the manpage.

Reported by: thj@

4 years agoBump Linux version to 3.2.0. Without it, binaries linked against
Edward Tomasz Napierala [Mon, 2 Sep 2019 18:10:35 +0000 (18:10 +0000)]
Bump Linux version to 3.2.0.  Without it, binaries linked against
glibc 2.24 and up (eg Ubuntu 19.04) fail with "FATAL: kernel too old".

This alone is not enough to make newer binaries actually work;
fix/hack/workaround is pending review at https://reviews.freebsd.org/D20687.

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

4 years agoIn nvme_completion_poll, add a sanity check to make sure that we complete the
Warner Losh [Mon, 2 Sep 2019 17:11:32 +0000 (17:11 +0000)]
In nvme_completion_poll, add a sanity check to make sure that we complete the
polling within a second. Panic if we don't. All the commands that use this
interface should typically complete within a few tens to hundreds of
microseconds. Panic rather than return ETIMEDOUT because if the command somehow
does later complete, it will randomly corrupt memory. Also, it helps to get a
traceback from where the unexpected failure happens, rather than an infinite
loop.

4 years agoIn all the places that we use the polled for completion interface, except crash
Warner Losh [Mon, 2 Sep 2019 17:11:27 +0000 (17:11 +0000)]
In all the places that we use the polled for completion interface, except crash
dump support code, move the while loop into an inline function. These aren't
done in the fast path, so if the compiler choses to not inline, any performance
hit is tiny.

4 years agoAdd a brief comment explaining why we can return ETIMEDOUT from the call to the
Warner Losh [Mon, 2 Sep 2019 17:10:46 +0000 (17:10 +0000)]
Add a brief comment explaining why we can return ETIMEDOUT from the call to the
polled interface. Normally this would have the potential to corrupt stack memory
because the completion routines would run after we return. In this case,
however, we're doing a dump so it's safe for reasons explained in the comment.

4 years agoRelax compat.linux.osrelease checks. This way one can do eg
Edward Tomasz Napierala [Mon, 2 Sep 2019 16:57:42 +0000 (16:57 +0000)]
Relax compat.linux.osrelease checks.  This way one can do eg
'compat.linux.osrelease=3.10.0-957.12.1.el7.x86_64', which
corresponds to CentOS 7.

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

4 years agovfs: restore mp null check in vop_stdgetwritemount
Mateusz Guzik [Mon, 2 Sep 2019 15:24:25 +0000 (15:24 +0000)]
vfs: restore mp null check in vop_stdgetwritemount

The initially read mount point can already be NULL.

Reported by: markj
Fixes: r351656 ("vfs: stop refing freed mount points in vop_stdgetwritemount")
Sponsored by: The FreeBSD Foundation

4 years agoLinuxKPI: Add sysfs create/remove functions that handles multiple files in one call.
Johannes Lundberg [Mon, 2 Sep 2019 14:51:59 +0000 (14:51 +0000)]
LinuxKPI: Add sysfs create/remove functions that handles multiple files in one call.

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

4 years agolibc: Use musl's optimized memchr
Ed Maste [Mon, 2 Sep 2019 13:56:44 +0000 (13:56 +0000)]
libc: Use musl's optimized memchr

Parentheses added to HASZERO macro to avoid a GCC warning.

Reviewed by: kib, mjg
Obtained from: musl (snapshot at commit 4d0a82170a)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17631

4 years agolibutil: remove SIGSYS handling from setusercontext
Mateusz Guzik [Mon, 2 Sep 2019 13:55:31 +0000 (13:55 +0000)]
libutil: remove SIGSYS handling from setusercontext

It was a workaround for cases where the kernel lacks setloginclass(2),
added in the 9.x era.

Submitted by: Pawel Biernacki

4 years agoBelatedly bump __FreeBSD_version for r351659, gets(3) removal
Ed Maste [Mon, 2 Sep 2019 12:48:18 +0000 (12:48 +0000)]
Belatedly bump __FreeBSD_version for r351659, gets(3) removal

Reported by: linimon

4 years agoproc: clear pid bitmap entry after dropping proctree lock
Mateusz Guzik [Mon, 2 Sep 2019 12:46:43 +0000 (12:46 +0000)]
proc: clear pid bitmap entry after dropping proctree lock

There is no correctness change here, but the procid lock is contended in
the fork path and taking it while holding proctree avoidably extends its
hold time.

Note that there are other ids which can end up getting cleared with the
lock.

Sponsored by: The FreeBSD Foundation

4 years agoloader.efi: use and prefer coninex interface
Toomas Soome [Mon, 2 Sep 2019 11:04:17 +0000 (11:04 +0000)]
loader.efi: use and prefer coninex interface

Add support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

4 years agoloader.efi: some systems do not translate scan code 0x8 to backspace
Toomas Soome [Mon, 2 Sep 2019 10:45:10 +0000 (10:45 +0000)]
loader.efi: some systems do not translate scan code 0x8 to backspace

Add scancode translation for backspace.

4 years agoUse DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI.
Hans Petter Selasky [Mon, 2 Sep 2019 08:34:45 +0000 (08:34 +0000)]
Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI.
This fixes system hangs on reading device registers on aarch64.

Tested with: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu
Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D20789
MFC after: 1 week
Sponsored by: Mellanox Technologies