]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoStop using ../zfs/libzfs.h but instead use libzfs.h.
Warner Losh [Sun, 8 Jul 2018 07:42:58 +0000 (07:42 +0000)]
Stop using ../zfs/libzfs.h but instead use libzfs.h.

While ../zfs/libzfs.h mostly works, there are a few situations where
it does not. Eliminate the problem by using plain libzfs.h, like we do
for ufs support. This fixes the weird cases, and is easier to
understand. It also follows the general style convetion of avoiding
../ in #includes.

5 years agoMove ZFS files into libsa
Warner Losh [Sun, 8 Jul 2018 07:42:49 +0000 (07:42 +0000)]
Move ZFS files into libsa

Move the libzfs stuff into libsa. There's no need for it to be a
separate library. The separate library adds to the issues of build
ordering that we see from time to time. Move the filesystem support
into libsa, like all the other filesystem support rather than making
zfs the odd-duck out.

Discussed with: allanjude@

5 years agoCreate an aarch64 subdir under man4, now that we have aarch64 manpages.
Ian Lepore [Sun, 8 Jul 2018 01:29:48 +0000 (01:29 +0000)]
Create an aarch64 subdir under man4, now that we have aarch64 manpages.

Reported by: Mark Millard

5 years agoAdd pnp info to imx6_ahci, and add a module makefile, and a manpage for it.
Ian Lepore [Sun, 8 Jul 2018 00:27:28 +0000 (00:27 +0000)]
Add pnp info to imx6_ahci, and add a module makefile, and a manpage for it.

5 years agoMove armv8crypto.4 into the aarch64 dir; should have been part of r336077.
Ian Lepore [Sun, 8 Jul 2018 00:02:14 +0000 (00:02 +0000)]
Move armv8crypto.4 into the aarch64 dir; should have been part of r336077.

Pointy hat: ian@
Reported by: rpokola@

5 years agoMove arm- and aarch64-specific manpages into arch-specific directories.
Ian Lepore [Sat, 7 Jul 2018 21:49:30 +0000 (21:49 +0000)]
Move arm- and aarch64-specific manpages into arch-specific directories.

This removes a bit of the .if/.endif clutter from man4/Makefile by using
the existing machinery that supports per-arch manpages.

5 years agoAdd a manpage for the imx5/6 watchdog driver.
Ian Lepore [Sat, 7 Jul 2018 20:43:01 +0000 (20:43 +0000)]
Add a manpage for the imx5/6 watchdog driver.

5 years agoFix handling of the hybrid DS case for a pNFS server.
Rick Macklem [Sat, 7 Jul 2018 19:27:49 +0000 (19:27 +0000)]
Fix handling of the hybrid DS case for a pNFS server.

After the addition of the "#mds_path" suffix for a DS specification on the
"-p" nfsd option, it is possible to have a mix of DSs assigned to an MDS
file system and DSs that store files for all DSs. This is what I referred
to as "hybrid" above.
At first, I didn't think this hybrid case would be useful, but I now believe
that some system administrators may fine it useful.
This patch modifies the file storage assignment algorithm so that it
makes the "#mds_path" DSs take priority and the all file systems DSs
are now only used for MDS file systems with no "#mds_path" DS servers.
This only affects the pNFS server for this "hybrid" case.

5 years agoImport commit from NetBSD with checkin message:
Kirk McKusick [Sat, 7 Jul 2018 19:11:43 +0000 (19:11 +0000)]
Import commit from NetBSD with checkin message:

    Avoid Undefined Behavior in ffs_clusteracct()

    Change the type of 'bit' variable from int to unsigned int and use unsigned
    values consistently.

    sys/ufs/ffs/ffs_subr.c:336:10, shift exponent -1 is negative

    Detected with Kernel Undefined Behavior Sanitizer.

    Reported by <Harry Pantazis>

Submitted by: Pedro Giffuni

5 years agoAdd support to the imx watchdog for the FDT "timeout-sec" property, by
Ian Lepore [Sat, 7 Jul 2018 19:10:00 +0000 (19:10 +0000)]
Add support to the imx watchdog for the FDT "timeout-sec" property, by
automatically initializing the watchdog using the given value.  Also,
attach at BUS_PASS_TIMER to extend watchdog protection to more of the
kernel init process.

5 years agoCorrectly calculate the value to put in the imx wdog countdown register.
Ian Lepore [Sat, 7 Jul 2018 19:03:38 +0000 (19:03 +0000)]
Correctly calculate the value to put in the imx wdog countdown register.

The correct value is seconds*2-1.  The code was using just seconds*2, which
led to being off by a half-second -- usually not a big deal, except when the
value was the max (128) it overflowed so zero would get written to the
countdown register, which equates to a timeout of a half second.

5 years agoAdd pnp info and a module makefile for the imx_wdog watchdog driver.
Ian Lepore [Sat, 7 Jul 2018 17:25:09 +0000 (17:25 +0000)]
Add pnp info and a module makefile for the imx_wdog watchdog driver.

5 years agoFix PCI_SUBDEV call
Warner Losh [Sat, 7 Jul 2018 15:55:58 +0000 (15:55 +0000)]
Fix PCI_SUBDEV call

5 years agoUpdate AMDSMB to use PCI_MATCH
Warner Losh [Sat, 7 Jul 2018 15:55:52 +0000 (15:55 +0000)]
Update AMDSMB to use PCI_MATCH

Differential Review: https://reviews.freebsd.org/D16172

5 years agoSwitch to using new PCI_MATCH stuff.
Warner Losh [Sat, 7 Jul 2018 15:25:16 +0000 (15:25 +0000)]
Switch to using new PCI_MATCH stuff.

5 years agoCreate PCI_MATCH and pci_match_device
Warner Losh [Sat, 7 Jul 2018 15:25:11 +0000 (15:25 +0000)]
Create PCI_MATCH and pci_match_device

Create a covenience function to match PCI device IDs. It's about 15
years overdue.

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

5 years agoMention the need to update devmatch.conf
Warner Losh [Sat, 7 Jul 2018 15:25:06 +0000 (15:25 +0000)]
Mention the need to update devmatch.conf

5 years agoWrap the declaration and assignment of "stripe" with #ifdef NUMA declarations
Sean Bruno [Sat, 7 Jul 2018 13:37:44 +0000 (13:37 +0000)]
Wrap the declaration and assignment of "stripe" with #ifdef NUMA declarations
as not all targets are NUMA aware.

Found with gcc.

Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16113

5 years agostruct ifmediareq *ifmrp is only used in the COMPAT_FREEBSD32 parts of
Sean Bruno [Sat, 7 Jul 2018 13:35:06 +0000 (13:35 +0000)]
struct ifmediareq *ifmrp is only used in the COMPAT_FREEBSD32 parts of
ifioctl().  Move it inside the proper #ifdef.  This was throwing a valid
"Assigned but unused" warning with gcc.

Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16063

5 years agoAllow alternate TCP stack to populate the TCP FO client cookie
Michael Tuexen [Sat, 7 Jul 2018 12:28:16 +0000 (12:28 +0000)]
Allow alternate TCP stack to populate the TCP FO client cookie
cache.

Without this patch, TCP FO could be used when using alternate
TCP stack, but only existing entires in the TCP client cookie
cache could be used. This cache was not populated by connections
using alternate TCP stacks.

Sponsored by: Netflix, Inc.

5 years agoAllow the use of slashes in process names of RFC 3164 formatted messages.
Ed Schouten [Sat, 7 Jul 2018 11:53:39 +0000 (11:53 +0000)]
Allow the use of slashes in process names of RFC 3164 formatted messages.

Tools such as Postfix use slashes in process names for hierarchy
(postfix/qmgr). By allowing these slashes, syslogd is able to extract
the process name and process ID nicely, so that they can be stored in
RFC 5424 message fields.

MFC after: 1 week

5 years agoWhen initializing the TCP FO client cookie cache, take into account
Michael Tuexen [Sat, 7 Jul 2018 11:18:26 +0000 (11:18 +0000)]
When initializing the TCP FO client cookie cache, take into account
whether the TCP FO support is enabled or not for the client side.

The code in tcp_fastopen_init() implicitly assumed that the sysctl
variable V_tcp_fastopen_client_enable was initialized to 0. This
was initially true, but was changed in r335610, which unmasked this
bug.

Thanks to Pieter de Goeje for reporting the issue on freebsd-net@

5 years agoLet ofw_iicbus work its magic on OPAL i2c buses.
Justin Hibbits [Sat, 7 Jul 2018 01:58:40 +0000 (01:58 +0000)]
Let ofw_iicbus work its magic on OPAL i2c buses.

ofw_iicbus already has attachments on iichb.  Rather than adding an explicit
attachment onto opal_i2c, simply change the exposed name of the OPAL i2c bus
to 'iichb'.

5 years agoUse the ticks since the last update to reduce hysteresis in the partpopq and
Jeff Roberson [Sat, 7 Jul 2018 01:54:45 +0000 (01:54 +0000)]
Use the ticks since the last update to reduce hysteresis in the partpopq and
contention on the vm_reserv_domain lock.

This gives a roughly 8x speedup on will-it-scale fault1 on a 16 core machine.

Reviewed by: alc, kib, markj

5 years agohyperv: Fix boot-up after malloc() returns memory of NX by default now
Dexuan Cui [Sat, 7 Jul 2018 00:41:04 +0000 (00:41 +0000)]
hyperv: Fix boot-up after malloc() returns memory of NX by default now

FreeBSD VM can't boot up on Hyper-V after the recent malloc change in
r335068: Make UMA and malloc(9) return non-executable memory in most cases.

The hypercall page here must be executable.
Fix the boot-up issue by adding M_EXEC.

PR: 229167
Sponsored by: Microsoft

5 years agoExport a breakpoint() function to userland for arm and arm64.
John Baldwin [Fri, 6 Jul 2018 23:49:17 +0000 (23:49 +0000)]
Export a breakpoint() function to userland for arm and arm64.

Enable ptrace() tests using breakpoint() on these architectures.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D15191

5 years agoSet .PATH to dev/usb/serial so that these modules compile again.
Ian Lepore [Fri, 6 Jul 2018 22:07:26 +0000 (22:07 +0000)]
Set .PATH to dev/usb/serial so that these modules compile again.

5 years agoig4(4): Fix Apollo lake entries platform identifier
Oleksandr Tymoshenko [Fri, 6 Jul 2018 22:01:00 +0000 (22:01 +0000)]
ig4(4): Fix Apollo lake entries platform identifier

Identify Apollo Lake controllers as IG4_APL and not as a IG4_SKYLAKE

Reported by: rpokala@

5 years agoig4(4): add support for Apollo Lake I2C controllers
Oleksandr Tymoshenko [Fri, 6 Jul 2018 21:22:50 +0000 (21:22 +0000)]
ig4(4): add support for Apollo Lake I2C controllers

Add PCI ids for I2C controllers on Apollo Lake platform. Also convert
switch/case probe logic into a table.

Reviewed by: avg
Differential Revision: https://reviews.freebsd.org/D16120

5 years agoExpand x86 struct pcpus to UMA_PCPU_ALLOC_SIZE AKA PAGE_SIZE.
Konstantin Belousov [Fri, 6 Jul 2018 19:50:44 +0000 (19:50 +0000)]
Expand x86 struct pcpus to UMA_PCPU_ALLOC_SIZE AKA PAGE_SIZE.

This restores counters(9) operation.
Revert r336024. Improve assert of pcpu size on x86.

Reviewed by: mmacy
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D16163

5 years agoRevert to recommit with the proper message.
Konstantin Belousov [Fri, 6 Jul 2018 19:50:25 +0000 (19:50 +0000)]
Revert to recommit with the proper message.

5 years agoSave a call to pmap_remove() if entry cannot have any pages mapped.
Konstantin Belousov [Fri, 6 Jul 2018 19:48:47 +0000 (19:48 +0000)]
Save a call to pmap_remove() if entry cannot have any pages mapped.

Due to the way rtld creates mappings for the shared objects, each dso
causes unmap of at least three guard map entries.  For instance, in
the buildworld load, this change reduces the amount of pmap_remove()
calls by 1/5.

Profiled by: alc
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16148

5 years agoRegen arm64 linux sysent after r336043
Ed Maste [Fri, 6 Jul 2018 19:47:09 +0000 (19:47 +0000)]
Regen arm64 linux sysent after r336043

5 years agoFix arm64 linuxulator clone() argument order
Ed Maste [Fri, 6 Jul 2018 19:44:49 +0000 (19:44 +0000)]
Fix arm64 linuxulator clone() argument order

Linux/arm64 is CLONE_BACKWARDS - i.e., "Architecture has tls passed as
the 4th argument of clone(2), not the 5th one."

The linux clone() syscall has four different permutations of argument
order, depending on architecture - see the #ifdef CONFIG_CLONE_BACKWARDS
maze in Linux's kernel/fork.c.

Sponsored by: Turing Robotic Industries

5 years agocxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB
Navdeep Parhar [Fri, 6 Jul 2018 19:33:58 +0000 (19:33 +0000)]
cxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB
sectors, instead of refusing to attach to the card.

Submitted by: Casey Leedom @ Chelsio
MFC after: 3 days
Sponsored by: Chelsio Communications

5 years agoChange the pNFS server so that it does not disable a mirrored DS for
Rick Macklem [Fri, 6 Jul 2018 19:18:45 +0000 (19:18 +0000)]
Change the pNFS server so that it does not disable a mirrored DS for
an NFSERR_STALE error reported via a LayoutReturn.

The current FreeBSD client can generate these errors for an operational
DS while doing a recovery of a mirror after a mirrored DS has been repaired.
I am not sure why these errors occur, but my best current guess is a race
between the Layout Recall issued by the kernel code run from pnfsdscopymr(8)
and a Read operation on the DS for the file bing copied.
The errors are not fatal, since the client falls back on doing I/O through
the MDS, which can do the I/O successfully as a proxy. (The fact that the
MDS can do this indicates that the file does still exist on the functioning
DS.)
This change only affects the pNFS server and only when a client does a
LayoutReturn with the NFSERR_STALE error report.

5 years agoChange prison_add_vfs() to the more generic prison_add_allow(), which
Jamie Gritton [Fri, 6 Jul 2018 18:50:22 +0000 (18:50 +0000)]
Change prison_add_vfs() to the more generic prison_add_allow(), which
can add any dynamic allow.* or allow.*.* parameter.  Also keep
prison_add_vfs() as a wrapper.

Differential Revision: D16146

5 years agopsci: Add \n at the end of printf
Emmanuel Vadot [Fri, 6 Jul 2018 17:39:48 +0000 (17:39 +0000)]
psci: Add \n at the end of printf

Add a \n at the end of the printf if no PSCI function was found otherwise
it mess up the console log.

5 years agokern_environment: Fix SYSINIT ordering
Kyle Evans [Fri, 6 Jul 2018 16:51:35 +0000 (16:51 +0000)]
kern_environment: Fix SYSINIT ordering

The dynamic environment was being initialized at SI_SUB_KMEM, SI_ORDER_ANY.
I added the hint-merging at SI_SUB_KMEM, SI_ORDER_ANY as well in r335998 -
this can only work by coincidence.

Re-do both to operate at SI_SUB_KMEM + 1, SI_ORDER_FIRST and SI_ORDER_SECOND
respectively to be safe. It's sufficiently obfuscated away as to when in
SU_SUB_KMEM malloc will be available, and the dynamic environment cannot be
relied upon there anyways since it's initialized at SI_ORDER_ANY.

Reported by: bde
Discussed with: bde
X-MFC-With: r335998

5 years agoMissed a bit of doc change from r335921.
Jamie Gritton [Fri, 6 Jul 2018 16:23:30 +0000 (16:23 +0000)]
Missed a bit of doc change from r335921.

PR: 229266

5 years agoAdding myself to committers-src.dot and calendar.freebsd
Ben Widawsky [Fri, 6 Jul 2018 16:22:26 +0000 (16:22 +0000)]
Adding myself to committers-src.dot and calendar.freebsd

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D16154

5 years agoOne more 32-bit fix for r335979.
Brooks Davis [Fri, 6 Jul 2018 13:34:45 +0000 (13:34 +0000)]
One more 32-bit fix for r335979.

Reported by: tuexen

5 years agoRemove duplicate configuration values as they are already defined in
Sean Bruno [Fri, 6 Jul 2018 13:31:06 +0000 (13:31 +0000)]
Remove duplicate configuration values as they are already defined in
std.AR_MIPS_BASE

5 years agor336028 changed next_msg to a char * from char [] of fixed size. Change
Sean Bruno [Fri, 6 Jul 2018 13:22:44 +0000 (13:22 +0000)]
r336028 changed next_msg to a char * from char [] of fixed size.  Change
2nd argument of vsnprintf() to get the strlen of next_msg so that the
appropriate size is used.

Found with gcc.

/usr.bin/top/display.c: In function 'new_message':
/usr.bin/top/display.c:963:31: error:
argument to 'sizeof' in 'vsnprintf' call is the same expression as the
destination; did you mean to provide an explicit length?
[-Werror=sizeof-pointer-memaccess]
     vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);

Reviewed by: daichi

5 years agoSave a call to pmap_remove() if entry cannot have any pages mapped.
Konstantin Belousov [Fri, 6 Jul 2018 12:44:48 +0000 (12:44 +0000)]
Save a call to pmap_remove() if entry cannot have any pages mapped.

Due to the way rtld creates mappings for the shared objects, each dso
causes unmap of at least three guard map entries.  For instance, in
the buildworld load, this change reduces the amount of pmap_remove()
calls by 1/5.

Profiled by: alc
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16148

5 years agoStyle: no need for braces around single-line then clause.
Konstantin Belousov [Fri, 6 Jul 2018 12:37:46 +0000 (12:37 +0000)]
Style: no need for braces around single-line then clause.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D16148

5 years agoChanged to eliminate the upper limit of command length displayed
Daichi GOTO [Fri, 6 Jul 2018 12:07:06 +0000 (12:07 +0000)]
Changed to eliminate the upper limit of command length displayed
by "-a" and expand to match terminal width

Reviewed by: eadler
Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D16083

5 years agoTeach binutils that arm64 is a 64bit architecture. This is needed to cross
Andrew Turner [Fri, 6 Jul 2018 11:50:59 +0000 (11:50 +0000)]
Teach binutils that arm64 is a 64bit architecture. This is needed to cross
build from arm64 to other architectures that use binutils.

Sponsored by: ABT Systems Ltd

5 years agoconfig(8): Fix broken ABI
Kyle Evans [Fri, 6 Jul 2018 11:23:14 +0000 (11:23 +0000)]
config(8): Fix broken ABI

r336019 introduced ${SRCTOP}/sys to the include paths in order to pull in a
new sys/{c,}nv.h. This is wrong, because the build tree's ABI isn't
guaranteed to match what's running on the host system.

Fix instead by removing -I${SRCTOP}/sys and installing the libnv headers
with `make -C lib/libnv includes`... this may or may not get re-worked in
the future so that a userland lib isn't installing includes from sys/.

Reported by: bdrewery

5 years agoMake sure kernel modules built by default are portable between UP and
Hans Petter Selasky [Fri, 6 Jul 2018 10:13:42 +0000 (10:13 +0000)]
Make sure kernel modules built by default are portable between UP and
SMP systems by extending defined(SMP) to include defined(KLD_MODULE).

This is a regression issue after r335873 .

Discussed with: mmacy@
Sponsored by: Mellanox Technologies

5 years agocounter(9): unbreak amd64 following r336020
Matt Macy [Fri, 6 Jul 2018 10:10:00 +0000 (10:10 +0000)]
counter(9): unbreak amd64 following r336020

Apply temporary fix to counter until daylight hours.
The fact that the assembly for counter_u64_add relied on the sizeof(struct pcpu) was
the basis for the otherwise arbitrary offset never came up in D15933.
critical_{enter,exit} is now inline so the only real added overhead is the
added (mostly false) conditional branch in exit.

5 years agoCorrect breakage on 32-bit platforms from r335979.
Brooks Davis [Fri, 6 Jul 2018 10:03:33 +0000 (10:03 +0000)]
Correct breakage on 32-bit platforms from r335979.

5 years agohwpmc: remove hacks to work around incorrect pc_domain
Matt Macy [Fri, 6 Jul 2018 06:21:24 +0000 (06:21 +0000)]
hwpmc: remove hacks to work around incorrect pc_domain

5 years agoepoch(9): simplify initialization
Matt Macy [Fri, 6 Jul 2018 06:20:03 +0000 (06:20 +0000)]
epoch(9): simplify initialization

replace manual NUMA aware allocation with a pcpu zone

5 years agoBack pcpu zone with domain correct pages
Matt Macy [Fri, 6 Jul 2018 02:06:03 +0000 (02:06 +0000)]
Back pcpu zone with domain correct pages

- Change pcpu zone consumers to use a stride size of PAGE_SIZE.
  (defined as UMA_PCPU_ALLOC_SIZE to make future identification easier)

- Allocate page from the correct domain for a given cpu.

- Don't initialize pc_domain to non-zero value if NUMA is not defined
  There are some misconceptions surrounding this field. It is the
  _VM_ NUMA domain and should only ever correspond to valid domain
  values as understood by the VM.

The former slab size of sizeof(struct pcpu) was somewhat arbitrary.
The new value is PAGE_SIZE because that's the smallest granularity
which the VM can allocate a slab for a given domain. If you have
fewer than PAGE_SIZE/8 counters on your system there will be some
memory wasted, but this is obviously something where you want the
cache line to be coming from the correct domain.

Reviewed by: jeff
Sponsored by: Limelight Networks
Differential Revision:  https://reviews.freebsd.org/D15933

5 years agoconfig(8): De-dupe hint/env vars within a single file
Kyle Evans [Fri, 6 Jul 2018 01:11:06 +0000 (01:11 +0000)]
config(8): De-dupe hint/env vars within a single file

r335653 flipped the order in which hints/env files are concatenated to match
the order in which vars are processed by the kernel. This is the other
hammer to drop.

Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
latest value specified for a key. This leaves some duplicates if a variable
is specified in multiple hint/env files or via `envvar` in a kernel config,
but the reversed order of concatenation (from r335653) makes this a
non-issue as the latest-specified version will be seen first.

This change also silently rewrote hint bits to use the same sanitization
process that ian@ wrote for r335642. To the kernel, hints and env vars are
basically the same thing through early boot, then get merged into the
dynamic environment once kmem becomes available and the dynamic environment
is created. They should be subjected to the same restrictions.

libnv has been added to -legacy for the time being to support the build of
config(8) with the new cnvlist API.

Tested with: universe (11 host & 12 host)
MFC after: 1 month

5 years agoThis exposes ZFS user and group quotas via the normal
Sean Eric Fagan [Thu, 5 Jul 2018 22:56:13 +0000 (22:56 +0000)]
This exposes ZFS user and group quotas via the normal
quatactl(2) mechanism.  (Read-only at this point, however.)
In particular, this is to allow rpc.rquotad query quotas
for NFS mounts, allowing users to see their quotas on the
hosts using the datasets.

The changes specifically:

* Add new RPC entry points for querying quotas.
* Changes the library routines to allow non-UFS quotas.
* Changes rquotad to check for quotas on mounted filesystems,
rather than being limited to entries in /etc/fstab
* Lastly, adds a VFS entry-point for ZFS to query quotas.

Note that this makes one unavoidable behavioural change: if quotas
are enabled, then they can be queried, as opposed to the current
method of checking for quotas being specified in fstab.  (With
ZFS, if there are user or group quotas, they're used, always.)

Reviewed by: delphij, mav
Approved by: mav
Sponsored by: iXsystems Inc
Differential Revision: https://reviews.freebsd.org/D15886

5 years agoath(4): Fix typo in debugging code
Conrad Meyer [Thu, 5 Jul 2018 21:38:54 +0000 (21:38 +0000)]
ath(4): Fix typo in debugging code

PR: 229548
Submitted by: David Binderman <dcb314 AT hotmail.com>

5 years agoRevert r336011,r336012 until I can competently test
Kyle Evans [Thu, 5 Jul 2018 18:55:42 +0000 (18:55 +0000)]
Revert r336011,r336012 until I can competently test

5 years agoFix build after r336011
Kyle Evans [Thu, 5 Jul 2018 18:39:02 +0000 (18:39 +0000)]
Fix build after r336011

Add libnv to bootstrap-tools, use ${SRCTOP}/sys headers.

5 years agoconfig(8): De-dupe hint/env vars within a single file
Kyle Evans [Thu, 5 Jul 2018 17:53:51 +0000 (17:53 +0000)]
config(8): De-dupe hint/env vars within a single file

r335653 flipped the order in which hints/env files are concatenated to match
the order in which vars are processed by the kernel. This is the other
hammer to drop.

Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
latest value specified for a key. This leaves some duplicates if a variable
is specified in multiple hint/env files or via `envvar` in a kernel config,
but the reversed order of concatenation (from r335653) makes this a
non-issue as the latest-specified version will be seen first.

This change also silently rewrote hint bits to use the same sanitization
process that ian@ wrote for r335642. To the kernel, hints and env vars are
basically the same thing through early boot, then get merged into the
dynamic environment once kmem becomes available and the dynamic environment
is created. They should be subjected to the same restrictions.

MFC after: 1 month

5 years agoExtend r335969 to superpages.
Konstantin Belousov [Thu, 5 Jul 2018 17:28:06 +0000 (17:28 +0000)]
Extend r335969 to superpages.

It is possible that a fictitious unmanaged userspace mapping of
superpage is created on x86, e.g. by pmap_object_init_pt(), with the
physical address outside the vm_page_array[] coverage.

Noted and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16085

5 years agoriscv: Remove unused variable "code"
Sean Bruno [Thu, 5 Jul 2018 17:26:44 +0000 (17:26 +0000)]
riscv:  Remove unused variable "code"

gcc found that the variabl "code", while being assigned a value, isn't
be used for anything.

Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D16114

5 years agoRevert r335999 to re-commit with the correct error message.
Konstantin Belousov [Thu, 5 Jul 2018 17:26:13 +0000 (17:26 +0000)]
Revert r335999 to re-commit with the correct error message.

5 years agoCreate a new macro for static DPCPU data.
Andrew Turner [Thu, 5 Jul 2018 17:13:37 +0000 (17:13 +0000)]
Create a new macro for static DPCPU data.

On arm64 (and possible other architectures) we are unable to use static
DPCPU data in kernel modules. This is because the compiler will generate
PC-relative accesses, however the runtime-linker expects to be able to
relocate these.

In preparation to fix this create two macros depending on if the data is
global or static.

Reviewed by: bz, emaste, markj
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D16140

5 years agoRemove redundant device ar71xx_wdog which is now included from
Sean Bruno [Thu, 5 Jul 2018 17:11:55 +0000 (17:11 +0000)]
Remove redundant device ar71xx_wdog which is now included from
std.AR_MIPS_BASE

5 years agoRemove redundant AH_DEBUG_ALQ.
Sean Bruno [Thu, 5 Jul 2018 17:09:46 +0000 (17:09 +0000)]
Remove redundant AH_DEBUG_ALQ.

5 years agoMake ZSTD a real option via ZSTDIO.
Sean Bruno [Thu, 5 Jul 2018 17:07:23 +0000 (17:07 +0000)]
Make ZSTD a real option via ZSTDIO.

It looks like the intent was to allow ZSTD support to be
compiled into the kernel with options ZSTDIO. But it doesn't look
like that was ever implemented or I'm missing how to do it.

I did a cursory audit of kernel config files and made a decision to
enable ZSTDIO in riscv GENERIC and mips MALTA configurations.  All other
kernel configurations already had this option in their kernel configs
but they didn't do anything useful as the feature was declared as
"standard" prior to this.

Reviewed by: cem allanjude
Differential Revision: https://reviews.freebsd.org/D16007

5 years agoSplit up deadlkres() to make it more readable in anticipation of
Bjoern A. Zeeb [Thu, 5 Jul 2018 17:06:54 +0000 (17:06 +0000)]
Split up deadlkres() to make it more readable in anticipation of
further changes adding another level of indentation.

Some of the logic got simplified with the break out functions.
There should be no functional changes.

Reviewed by: kib
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D15914

5 years agoWork around lame warnings in ancient gcc on 32-bit platforms.
Brooks Davis [Thu, 5 Jul 2018 17:02:10 +0000 (17:02 +0000)]
Work around lame warnings in ancient gcc on 32-bit platforms.

Fixes r335979.

5 years agoCopyout(9) on 4/4 i386 needs correct vm_page_array[].
Konstantin Belousov [Thu, 5 Jul 2018 16:43:15 +0000 (16:43 +0000)]
Copyout(9) on 4/4 i386 needs correct vm_page_array[].

On the 4/4 i386, copyout(9) may need to call pmap_extract_and_hold()
on arbitrary userspace mapping.  If the mapping is backed by the
non-managed cdev pager or by the sg pager, on dense configs we might
access arbitrary element of vm_page_array[], in particular, not
corresponding to a page from the memory segment.  Initialize such pages
as fictitious with the corresponding physical address.

Reported by: bde
Reviewed by: alc, markj (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D16085

5 years agoUse vm_page_unhold_pages() instead of manually rolling unoptimized
Konstantin Belousov [Thu, 5 Jul 2018 16:40:20 +0000 (16:40 +0000)]
Use vm_page_unhold_pages() instead of manually rolling unoptimized
version of it.

Noted by: alc
Sponsored by: The FreeBSD Foundation

5 years agoIn x86 pmap_extract_and_hold(), there is no need to recalculate the
Konstantin Belousov [Thu, 5 Jul 2018 16:38:54 +0000 (16:38 +0000)]
In x86 pmap_extract_and_hold(), there is no need to recalculate the
physical address, which is readily available after sucessfull
vm_page_pa_tryrelock().

Noted and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16085

5 years agokern_environment: use any provided environments, evict hintmode/envmode
Kyle Evans [Thu, 5 Jul 2018 16:30:32 +0000 (16:30 +0000)]
kern_environment: use any provided environments, evict hintmode/envmode

At the moment, hintmode and envmode are used to indicate whether static
hints or static env have been provided in the kernel config(5) and the
static versions are mutually exclusive with loader(8)-provided environment.
hintmode *can* be reconfigured later to pull from the dynamic environment,
thus taking advantage of the loader(8) or post-kmem environment setting.

This changeset fixes both problems at once to move us from a semi-confusing
state to a consistent state: if an environment file, hints file, or
loader(8) environment are provided, we use them in a well-known order of
precedence:

- loader(8) environment
- static environment
- static hints file

Once the dynamic environment is setup this becomes a moot point. The
loader(8) and static environments are merged (respecting the above order of
precedence), and the static hints are merged in on an as-needed basis after
the dynamic environment has been setup.

Hints lookup are changed to respect all of the above. Before the dynamic
environment is setup, lookups use the above-mentioned order and fallback to
the next environment if a matching hint is not found. Once the dynamic
environment is setup, that is used on its own since it captures all of the
above information plus any dynamic kenv settings that came up later in boot.

The following tangentially related changes were made to res_find:

- A hintp cookie is now passed in so that related searches continue using
  the chain of environments (or dynamic environment) without relying on
  global state
- All three environments will be searched if they actually have valid hints
  to use, rather than just choosing the first environment that actually had
  a hint and rolling with that only

The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
still honored and will disable their respective environments from being used
for hint lookups and from being merged into the dynamic environment, as
expected.

MFC after: 1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D15953

5 years agoRevert r335995 due to accidental changes snuck in
Kyle Evans [Thu, 5 Jul 2018 16:28:43 +0000 (16:28 +0000)]
Revert r335995 due to accidental changes snuck in

5 years agoIn x86 pmap_extract_and_hold(), there is no need to recalculate the
Konstantin Belousov [Thu, 5 Jul 2018 16:27:34 +0000 (16:27 +0000)]
In x86 pmap_extract_and_hold(), there is no need to recalculate the
physical address, which is readily available after sucessfull
vm_page_pa_tryrelock().

Noted and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16085

5 years agokern_environment: use any provided environments, evict hintmode/envmode
Kyle Evans [Thu, 5 Jul 2018 16:25:48 +0000 (16:25 +0000)]
kern_environment: use any provided environments, evict hintmode/envmode

At the moment, hintmode and envmode are used to indicate whether static
hints or static env have been provided in the kernel config(5) and the
static versions are mutually exclusive with loader(8)-provided environment.
hintmode *can* be reconfigured later to pull from the dynamic environment,
thus taking advantage of the loader(8) or post-kmem environment setting.

This changeset fixes both problems at once to move us from a semi-confusing
state to a consistent state: if an environment file, hints file, or
loader(8) environment are provided, we use them in a well-known order of
precedence:

- loader(8) environment
- static environment
- static hints file

Once the dynamic environment is setup this becomes a moot point. The
loader(8) and static environments are merged (respecting the above order of
precedence), and the static hints are merged in on an as-needed basis after
the dynamic environment has been setup.

Hints lookup are changed to respect all of the above. Before the dynamic
environment is setup, lookups use the above-mentioned order and fallback to
the next environment if a matching hint is not found. Once the dynamic
environment is setup, that is used on its own since it captures all of the
above information plus any dynamic kenv settings that came up later in boot.

The following tangentially related changes were made to res_find:

- A hintp cookie is now passed in so that related searches continue using
  the chain of environments (or dynamic environment) without relying on
  global state
- All three environments will be searched if they actually have valid hints
  to use, rather than just choosing the first environment that actually had
  a hint and rolling with that only

The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
still honored and will disable their respective environments from being used
for hint lookups and from being merged into the dynamic environment, as
expected.

MFC after: 1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D15953

5 years agoAdd jsm in committers-ports.dot with mentor/mentee
Jesper Schmitz Mouridsen [Thu, 5 Jul 2018 16:18:05 +0000 (16:18 +0000)]
Add jsm in committers-ports.dot with mentor/mentee

Approved by: miwi (mentor)
Differential Revision:https://reviews.freebsd.org/D16143

5 years agoWith the introduction of reapers and reaplists in r275800,
Bjoern A. Zeeb [Thu, 5 Jul 2018 16:16:28 +0000 (16:16 +0000)]
With the introduction of reapers and reaplists in r275800,
proc0 and init are setup as a circular dependency.

create_init() calls fork1() which calls do_fork(). There the
newproc (initproc) is setup with a reaper of proc0 who's reaper
points to itself. The newproc (initproc) is then put on its
reaper's (proc0) p_reaplist (initproc is a descendants of proc0
for proc0 to reap). Upon return to create_init(), proc0 is
added to initproc's p_reaplist (which would mean proc0 is a
descendant of init, for init to reap). This creates a
circular dependency which eventually leads to LIST corruptions
when trying to kill init and a proc0.

For the base system we never really hit this case during reboot.
The problem only became visible after adding more virtual process
spaces which could go away cleanly (work existing in an experimental
branch).

Reviewed by: kib
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D15924

5 years agoRevert r335983.
Brooks Davis [Thu, 5 Jul 2018 16:03:03 +0000 (16:03 +0000)]
Revert r335983.

The bfd linker in tree doesn't support multiple names for the same
symbol (at least with current flags).

5 years agoDetach all children before beginning to tear down the hardware, instead of
Ian Lepore [Thu, 5 Jul 2018 16:00:58 +0000 (16:00 +0000)]
Detach all children before beginning to tear down the hardware, instead of
doing it last.  Also, remove the local tracking of whether usb's busdma
memory allocation got done, because it's safe to call the free_all
function even if it wasn't.

5 years agoAdd a missing call to usb_bus_mem_free_all() when detaching.
Ian Lepore [Thu, 5 Jul 2018 15:52:26 +0000 (15:52 +0000)]
Add a missing call to usb_bus_mem_free_all() when detaching.

5 years agoUpdate with the members of the 10th core team, core.x.
Sean Chittenden [Thu, 5 Jul 2018 15:40:14 +0000 (15:40 +0000)]
Update with the members of the 10th core team, core.x.

5 years agoRemove a test and early-out which just can't possibly be right. It causes
Ian Lepore [Thu, 5 Jul 2018 15:34:16 +0000 (15:34 +0000)]
Remove a test and early-out which just can't possibly be right.  It causes
detach() to do nothing if attach() succeeded, which is the opposite of
what's needed.  Also, move device_delete_children() from the end to the
beginning of detach(), so that children won't be trying to make use of the
hardware we're in the process of shutting down.

PR: 229510

5 years agoGet rid of netbsd_lchown and netbsd_msync syscall entries.
Brooks Davis [Thu, 5 Jul 2018 14:12:56 +0000 (14:12 +0000)]
Get rid of netbsd_lchown and netbsd_msync syscall entries.

No valid FreeBSD binary ever called them (they would call lchown and
msync directly) and we haven't supported NetBSD binaries in ages.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15814

5 years agoFix an out-of-bounds array access... the irq data for teardown is in two
Ian Lepore [Thu, 5 Jul 2018 14:09:48 +0000 (14:09 +0000)]
Fix an out-of-bounds array access... the irq data for teardown is in two
arrays, as elements 0 and 1 of one array and elements 1 and 2 of the other.
Run the loop 0..1 instead of 1..2 and use named constants to offset into
one of the arrays.

PR: 229508

5 years agoSilence warnings about unused variables when RACCT is defined but RCTL
Konstantin Belousov [Thu, 5 Jul 2018 13:37:31 +0000 (13:37 +0000)]
Silence warnings about unused variables when RACCT is defined but RCTL
is not.

Reported by: Dries Michiels <driesm.michiels@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoMake struct xinpcb and friends word-size independent.
Brooks Davis [Thu, 5 Jul 2018 13:13:48 +0000 (13:13 +0000)]
Make struct xinpcb and friends word-size independent.

Replace size_t members with ksize_t (uint64_t) and pointer members
(never used as pointers in userspace, but instead as unique
idenitifiers) with kvaddr_t (uint64_t). This makes the structs
identical between 32-bit and 64-bit ABIs.

On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
this is an ABI breaking change. The ABI of most of these structs
was previously broken in r315662.  This also imposes a small API
change on userspace consumers who must handle kernel pointers
becoming virtual addresses.

PR: 228301 (exp-run by antoine)
Reviewed by: jtl, kib, rwatson (various versions)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15386

5 years agoFix mandoc -Tlint warning introduced in r335977.
Edward Tomasz Napierala [Thu, 5 Jul 2018 11:50:59 +0000 (11:50 +0000)]
Fix mandoc -Tlint warning introduced in r335977.

Reported by: 0mp@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd trivial usage example to ports(7).
Edward Tomasz Napierala [Thu, 5 Jul 2018 11:03:11 +0000 (11:03 +0000)]
Add trivial usage example to ports(7).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd a name for the MSR controlling standard extended features report on AMD.
Konstantin Belousov [Thu, 5 Jul 2018 10:44:18 +0000 (10:44 +0000)]
Add a name for the MSR controlling standard extended features report on AMD.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoOrder the portion of the AMD-specific MSRs names definitions numerically.
Konstantin Belousov [Thu, 5 Jul 2018 10:34:01 +0000 (10:34 +0000)]
Order the portion of the AMD-specific MSRs names definitions numerically.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years ago- Add bhyve NVMe device emulation.
Marcelo Araujo [Thu, 5 Jul 2018 03:33:58 +0000 (03:33 +0000)]
- Add bhyve NVMe device emulation.

The initial work on bhyve NVMe device emulation was done by the GSoC student
Shunsuke Mie and was heavily modified in performan, functionality and
guest support by Leon Dang.

bhyve:
-s <n>,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z

accepted devpath:
/dev/blockdev
/path/to/image
ram=size_in_MiB

Tested with guest OS: FreeBSD Head, Linux Fedora fc27, Ubuntu 18.04,
                      OpenSuse 15.0, Windows Server 2016 Datacenter.
Tested with all accepted device paths: Real nvme, zdev and also with ram.
Tested on: AMD Ryzen Threadripper 1950X 16-Core Processor and
           Intel(R) Xeon(R) CPU E5-2609 v2 @ 2.50GHz.

Tests at: https://people.freebsd.org/~araujo/bhyve_nvme/nvme.txt

Submitted by: Shunsuke Mie <sux2mfgj_gmail.com>,
Leon Dang <leon_digitalmsx.com>
Reviewed by: chuck (early version), grehan
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D14022

5 years agomxge: replace 65536 with IP_MAXPACKET in tso settings.
Andrew Gallatin [Thu, 5 Jul 2018 02:43:10 +0000 (02:43 +0000)]
mxge: replace 65536 with IP_MAXPACKET in tso settings.

5 years agoAllow callers to vm_phys_split_pages() to specify whether insertion should
Alan Cox [Thu, 5 Jul 2018 02:08:57 +0000 (02:08 +0000)]
Allow callers to vm_phys_split_pages() to specify whether insertion should
occur at the head or the tail of the page queues.

5 years agoAs of r335784, if pmap_enter() replaces a managed mapping by an unmanaged
Alan Cox [Thu, 5 Jul 2018 02:04:18 +0000 (02:04 +0000)]
As of r335784, if pmap_enter() replaces a managed mapping by an unmanaged
mapping, then it leaks the unlinked PV entry.  This change eliminates that
leak, freeing the PV entry.

Reviewed by: kib, markj
X-MFC with: r335784
Differential Revision: https://reviews.freebsd.org/D16130

5 years agoepoch(9): make nesting assert in epoch_wait_preempt more specific
Matt Macy [Wed, 4 Jul 2018 21:34:08 +0000 (21:34 +0000)]
epoch(9): make nesting assert in epoch_wait_preempt more specific

Reported by: markj

5 years agoIn x86 pmap_extract_and_hold()s, handle the case of PHYS_TO_VM_PAGE()
Konstantin Belousov [Wed, 4 Jul 2018 21:21:59 +0000 (21:21 +0000)]
In x86 pmap_extract_and_hold()s, handle the case of PHYS_TO_VM_PAGE()
returning NULL.

vm_fault_quick_hold_pages() can be legitimately called on userspace
mappings backed by fictitious pages created by unmanaged device and sg
pagers.

Note that other architectures pmap_extract_and_hold() might need
similar fix, but I postponed the examination.

Reported by: bde
Discussed with: alc
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16085

5 years agoFix the pNFS server so that it handles the "#mds_path" check for mirrors.
Rick Macklem [Wed, 4 Jul 2018 19:46:26 +0000 (19:46 +0000)]
Fix the pNFS server so that it handles the "#mds_path" check for mirrors.

The recently added feature of the pNFS server will set an fsid for the
MDS file system to define the file system a DS should store files for.
For a case where a DS handling all file systems has failed, it was possible
for the code to check for a mirror with a specified fs, even though
nfsdev_mdsisset was 0, possibly causing a false successful check for a mirror.
This patch adds a check for nfsdev_mdsisset != 0 to avoid this.
It only affects the pNFS server for a rare case. Found via code inspection.

5 years agomxge: choose appropriate values for hw tso
Andrew Gallatin [Wed, 4 Jul 2018 19:29:06 +0000 (19:29 +0000)]
mxge: choose appropriate values for hw tso