]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

5 years agomxge: Add SIOCGI2C support for devices with SFP/XFP cages
Andrew Gallatin [Wed, 4 Jul 2018 18:54:44 +0000 (18:54 +0000)]
mxge: Add SIOCGI2C support for devices with SFP/XFP cages

5 years agoWITHOUT_SERVICESDB:
Sean Bruno [Wed, 4 Jul 2018 17:18:35 +0000 (17:18 +0000)]
WITHOUT_SERVICESDB:

Add src.conf knob to disable the installation of /var/db/services.db

Default to leaving services.db in place, but allow the removal of the
file and its creation with a src.conf knob.

This file ends up being 2MB in size.  For small systems this is a waste
of space but its a tradeoff.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D9655

5 years agofix locking within tcp_ipsec_pcbctl() to match ipsec4_pcbctl(), ipsec4_pcbctl()
Sean Bruno [Wed, 4 Jul 2018 17:10:07 +0000 (17:10 +0000)]
fix locking within tcp_ipsec_pcbctl() to match ipsec4_pcbctl(), ipsec4_pcbctl()

IPSEC_PCBCTL() functions, which include tcp_ipsec_pcbctl(),
ipsec4_pcbctl(), and ipsec6_pcbctl(), should all have matching locking
semantics.

ipsec4_pcbctl() and ipsec6_pcbctl() expect the inp to be unlocked on
entry and exit and appear to be correctly implemented as such. But
tcp_ipsec_pcbctl() had other semantics. This patch fixes the semantics
for tcp_ipsec_pcbctl().

Submitted by: Jason Eggleston <jason@eggnet.com>
MFH: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14623

5 years agoAdd description to debug.ncores sysctl.
Mariusz Zaborski [Wed, 4 Jul 2018 17:06:51 +0000 (17:06 +0000)]
Add description to debug.ncores sysctl.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D16123

5 years agoepoch(9): Fix man page typo
Matt Macy [Wed, 4 Jul 2018 17:06:23 +0000 (17:06 +0000)]
epoch(9): Fix man page typo

Submitted by: se
Reported by: se

5 years agoComplete my vertex even though edges were in place.
Sean Chittenden [Wed, 4 Jul 2018 16:50:51 +0000 (16:50 +0000)]
Complete my vertex even though edges were in place.

Reported by: swills
Approved by: swills (mentor, implicit)

5 years agofix 335919 - check "last" not "inp" where appropriate
Matt Macy [Wed, 4 Jul 2018 16:34:07 +0000 (16:34 +0000)]
fix 335919 - check "last" not "inp" where appropriate

Submitted by: ae
Reported by: cy

5 years agomxge: fix panic at module unload
Andrew Gallatin [Wed, 4 Jul 2018 14:25:38 +0000 (14:25 +0000)]
mxge: fix panic at module unload

r333175 (multicast changes) exposed a bug where
mxge was not checking to see if the driver was being
unloaded while handing ioctls that touch hardware.
As a result, now that in6m_disconnect() is run from
an async gtaskq, it was busy-waiting in mxge_send_cmd()
while the mcast list was destroyed.

5 years agoAdd a semaphore ping benchmark.
Edward Tomasz Napierala [Wed, 4 Jul 2018 14:20:19 +0000 (14:20 +0000)]
Add a semaphore ping benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd a very simple memcpy benchmark.
Edward Tomasz Napierala [Wed, 4 Jul 2018 14:18:12 +0000 (14:18 +0000)]
Add a very simple memcpy benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoSort the benchmarks even more.
Edward Tomasz Napierala [Wed, 4 Jul 2018 14:15:48 +0000 (14:15 +0000)]
Sort the benchmarks even more.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRename "dup" and "fstat_shmfd" to "shmfd_dup" and "shmfd_fstat" for consistency.
Edward Tomasz Napierala [Wed, 4 Jul 2018 14:14:00 +0000 (14:14 +0000)]
Rename "dup" and "fstat_shmfd" to "shmfd_dup" and "shmfd_fstat" for consistency.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoSort the benchmarks; no functional changes intended.
Edward Tomasz Napierala [Wed, 4 Jul 2018 14:11:49 +0000 (14:11 +0000)]
Sort the benchmarks; no functional changes intended.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDisable pipepingtd benchmarks, to make it not depend on libthr.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:52:13 +0000 (13:52 +0000)]
Disable pipepingtd benchmarks, to make it not depend on libthr.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoMake the pipeping benchmarks work with larger buffer sizes.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:45:29 +0000 (13:45 +0000)]
Make the pipeping benchmarks work with larger buffer sizes.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd threaded pipe ping benchmark.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:39:48 +0000 (13:39 +0000)]
Add threaded pipe ping benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agomuge(4): remove DTB MAC addr from TODO list after r335925
Ed Maste [Wed, 4 Jul 2018 13:38:02 +0000 (13:38 +0000)]
muge(4): remove DTB MAC addr from TODO list after r335925

Also replace numbered list with - bulleted so the list entries do not
need to be renumbered as tasks are completed.

Sponsored by: The FreeBSD Foundation

5 years agoAdd a trivial "pipe ping" (two processes) benchmark.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:34:43 +0000 (13:34 +0000)]
Add a trivial "pipe ping" (two processes) benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoMake syscall_timing(1) build with WARNS=6.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:31:55 +0000 (13:31 +0000)]
Make syscall_timing(1) build with WARNS=6.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd setproctitle_fast(3) for frequent callers.
Konstantin Belousov [Wed, 4 Jul 2018 13:31:16 +0000 (13:31 +0000)]
Add setproctitle_fast(3) for frequent callers.

Some applications, notably PostgreSQL, want to call setproctitle()
very often.  It's slow.  Provide an alternative cheap way of updating
process titles without making any syscalls, instead requiring other
processes (top, ps etc) to do a bit more work to retrieve the data.
This uses a pre-existing code path inherited from ancient BSD, which
always did it that way.

Submitted by: Thomas Munro
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16111

5 years agoAdd getprogname(3) (ie null) benchmark.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:28:43 +0000 (13:28 +0000)]
Add getprogname(3) (ie null) benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agotop: do not fall to the thread name if kernel cache of the process
Konstantin Belousov [Wed, 4 Jul 2018 13:28:16 +0000 (13:28 +0000)]
top: do not fall to the thread name if kernel cache of the process
args is empty.

Instead, use kvm_getargv() unconditionally to obtain the process
arguments.  It means that one additional sysctl(2) is performed there.

Submitted by: Thomas Munro
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16111

5 years agoUse a macro for iteration.
Edward Tomasz Napierala [Wed, 4 Jul 2018 13:26:47 +0000 (13:26 +0000)]
Use a macro for iteration.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd a way for the process to request cleanup of the kernel cache of
Konstantin Belousov [Wed, 4 Jul 2018 13:22:48 +0000 (13:22 +0000)]
Add a way for the process to request cleanup of the kernel cache of
the process arguments.  New arguments length zero causes the drop of
the pargs instead of allocation of useless zero-length buffer.

Submitted by: Thomas Munro
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16111

5 years agoremove unneeded inclusion of sys/interrupt.h from several files
Andriy Gapon [Wed, 4 Jul 2018 09:07:18 +0000 (09:07 +0000)]
remove unneeded inclusion of sys/interrupt.h from several files

It's likely that the header was needed in the past for swi(9).
But now that code does not use swi(9) or any other interfaces defined
in sys/interrupt.h.

MFC after: 1 week

5 years agoloader: fdt: Try to load every possible DTB from u-boot
Emmanuel Vadot [Wed, 4 Jul 2018 07:37:45 +0000 (07:37 +0000)]
loader: fdt: Try to load every possible DTB from u-boot

U-Boot setup a few variables :

 - fdt_addr which is the board static dtb (most of the time loaded before
   u-boot or coming from some hardware like a ROM)
 - fdt_addr_r which is a location in RAM that holds the DTB loaded by
   u-boot or before u-boot

In the case of u-boot + rpi firmware the DTB is loaded in RAM but the location
still end up in the fdt_addr variable and the fdt_addr_r variable exist.

Change the behavior so we test that a DTB exists for every possible variable :

 - fdt_addr_r is checked first as if u-boot needed to modify it the
   correct DTB will live there.
 - fdt_addr is checked second as if we run on a hardware with DTB in ROM
   it means that we what/need to run that
 - fdtaddr looks like a FreeBSD-ism but since I'm not sure leave it.

Reviewed by: gonzo
Differential Revision: https://reviews.freebsd.org/D16101

5 years ago- Fix a double unlock in inp_block_unblock_source() and
Hiroki Sato [Wed, 4 Jul 2018 06:47:34 +0000 (06:47 +0000)]
- Fix a double unlock in inp_block_unblock_source() and
  lock leakage in inp_leave_group() which caused a panic.
- Make order of CTR1() and IN_MULTI_LIST_LOCK() consistent
  around inm_merge().

5 years agoepoch(9): update in_epoch() description as well
Matt Macy [Wed, 4 Jul 2018 03:54:39 +0000 (03:54 +0000)]
epoch(9): update in_epoch() description as well

5 years agoFreeBSD_version: update for epoch(9) r335924 KPI change
Matt Macy [Wed, 4 Jul 2018 03:46:23 +0000 (03:46 +0000)]
FreeBSD_version: update for epoch(9) r335924 KPI change

5 years agoepoch(9): update man page for r335924
Matt Macy [Wed, 4 Jul 2018 03:44:36 +0000 (03:44 +0000)]
epoch(9): update man page for r335924

5 years agoRevert r335833.
Will Andrews [Wed, 4 Jul 2018 03:36:46 +0000 (03:36 +0000)]
Revert r335833.

Several third-parties use at least some of these ioctls.  While it would be
better for regression testing if they were used in base (or at least in the
test suite), it's currently not worth the trouble to push through removal.

Submitted by: antoine, markj

5 years agomuge(4): add DTB blob as one more possible source of MAC address
Oleksandr Tymoshenko [Wed, 4 Jul 2018 03:02:53 +0000 (03:02 +0000)]
muge(4): add DTB blob as one more possible source of MAC address

On FDT-enabled platforms check if DTB blob has MAC address configured by
a boot loader. This information passed as a "local-mac-address" or
"mac-address" property of the device node. For USB NICs node
can be found by looking for compatibility string "usbVVV,PPP" where
VVV - vendor id (hex) and PPP - product id (hex)

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D16117

5 years agoepoch(9): allow preemptible epochs to compose
Matt Macy [Wed, 4 Jul 2018 02:47:16 +0000 (02:47 +0000)]
epoch(9): allow preemptible epochs to compose

- Add tracker argument to preemptible epochs
- Inline epoch read path in kernel and tied modules
- Change in_epoch to take an epoch as argument
- Simplify tfb_tcp_do_segment to not take a ti_locked argument,
  there's no longer any benefit to dropping the pcbinfo lock
  and trying to do so just adds an error prone branchfest to
  these functions
- Remove cases of same function recursion on the epoch as
  recursing is no longer free.
- Remove the the TAILQ_ENTRY and epoch_section from struct
  thread as the tracker field is now stack or heap allocated
  as appropriate.

Tested by: pho and Limelight Networks
Reviewed by: kbowling at llnw dot com
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16066

5 years agoMETA_MODE: Fix wanting a meta file in source tree.
Bryan Drewery [Wed, 4 Jul 2018 00:18:40 +0000 (00:18 +0000)]
META_MODE: Fix wanting a meta file in source tree.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agoUse OBJS_DEPEND_GUESS for forced opt_global.h dependency.
Bryan Drewery [Wed, 4 Jul 2018 00:18:36 +0000 (00:18 +0000)]
Use OBJS_DEPEND_GUESS for forced opt_global.h dependency.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agoAllow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
Jamie Gritton [Tue, 3 Jul 2018 23:47:20 +0000 (23:47 +0000)]
Allow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
 sockstat(1), ugidfw(8)
These are the last of the jail-aware userland utilities that didn't work
 with names.

PR: 229266
MFC after: 3 days
Differential Revision: D16047

5 years agoopensolaris compat: fix compile error
Matt Macy [Tue, 3 Jul 2018 23:45:02 +0000 (23:45 +0000)]
opensolaris compat: fix compile error

when opensolaris/sys/types.h is included before stddef.h ptrdiff_t
would be typedef'd twice

5 years agoudp6_input: validate inpcb before use
Matt Macy [Tue, 3 Jul 2018 23:30:53 +0000 (23:30 +0000)]
udp6_input: validate inpcb before use

When traversing pcbinfo lists (rather than calling lookup) we need to
explicitly validate an inpcb before use.

5 years agodocument MODULE_TIED behavior change
Matt Macy [Tue, 3 Jul 2018 23:09:09 +0000 (23:09 +0000)]
document MODULE_TIED behavior change

5 years agoEnable MODULE_TIED by default for modules compiled with the kernel
Matt Macy [Tue, 3 Jul 2018 23:05:42 +0000 (23:05 +0000)]
Enable MODULE_TIED by default for modules compiled with the kernel

Requested by: jhb

5 years agoUse 'e' instead of 'i' constraints with 64-bit atomic operations on amd64.
John Baldwin [Tue, 3 Jul 2018 22:03:28 +0000 (22:03 +0000)]
Use 'e' instead of 'i' constraints with 64-bit atomic operations on amd64.

The ADD, AND, OR, and SUB instructions take at most a 32-bit
sign-extended immediate operand.  64-bit constants that do not fit into
that constraint need to be loaded into a register.  The 'i' constraint
tells the compiler it can pass any integer constant to the assembler,
whereas the 'e' constrain only permits constants that fit into a 32-bit
sign-extended value.  This fixes using
atomic_add/clear/set/subtract_long/64 with constants that do not fit into
a 32-bit sign-extended immediate.

Reported by: several folks
Tested by: Pete Wright <pete@nomadlogic.org>
MFC after: 2 weeks

5 years agoFix .depend.foo.o tracking for sys/conf/files defined compilations.
Bryan Drewery [Tue, 3 Jul 2018 21:29:04 +0000 (21:29 +0000)]
Fix .depend.foo.o tracking for sys/conf/files defined compilations.

Some example files:
  ia32_genassym.o
  acpi_wakecode.o

The old mkdep method also lacked tracking these files.

Objects defined in sys/conf/files with no-obj and no-implicit-rule get their
own targets defined in the kernel Makefile but lack having their objects added
to DEPENDOBJS so never get a .depend file generated.  Normally if an object is
in OBJS it will get a .depend file.

Fix this by looking for .o files in CLEAN and ensuring they are part of
the -MD filtering and .depend loading.  This is a hack.  Other solutions
could exist involving sys/conf/files or config(8) to auto add these to
DEPENDFILES/DEPENDOBJS but this method seems reliable enough without being
intrusive or error-prone for new files.

Reported by: bde
MFC after: 3 weeks
Sponsored by: Dell EMC

5 years agoNeed offset.inc generated early if MODULE_TIED is defined.
Bryan Drewery [Tue, 3 Jul 2018 21:15:47 +0000 (21:15 +0000)]
Need offset.inc generated early if MODULE_TIED is defined.

5 years agoAll genassym.sh usage need offset.inc
Bryan Drewery [Tue, 3 Jul 2018 21:02:25 +0000 (21:02 +0000)]
All genassym.sh usage need offset.inc

5 years agogenoffset.c is not generated
Bryan Drewery [Tue, 3 Jul 2018 21:02:21 +0000 (21:02 +0000)]
genoffset.c is not generated

5 years agoFix r335906+r335907 to not pass multiple source files to genoffset_test.o target.
Bryan Drewery [Tue, 3 Jul 2018 20:03:19 +0000 (20:03 +0000)]
Fix r335906+r335907 to not pass multiple source files to genoffset_test.o target.

This is working around a bug with the FAST_DEPEND logic with custom targets
that use .ALLSRC.

Reported by: mmacy

5 years agoHandle .depend for genoffset_test.o
Bryan Drewery [Tue, 3 Jul 2018 19:24:52 +0000 (19:24 +0000)]
Handle .depend for genoffset_test.o