]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agodwatch(1): Guard against error when given -t "*..."
dteske [Sun, 27 May 2018 22:27:47 +0000 (22:27 +0000)]
dwatch(1): Guard against error when given -t "*..."

dwatch allows you to customnize the predicate (condition) for when
information is displayed. The DTrace syntax for this is:

probe[, ...] /predicate/ { [actions] }

But if predicate is something like "*args[1]!=NULL" to test that
the first pointer in an array is non-NULL, the syntax produced is:

probe[, ...] /*arg1!=NULL/ { [actions] }

The issue being that "/*" is the beginning of a comment and thus
the following error is emitted:

dtrace: failed to compile script /dev/stdin:
line 535: /* encountered inside a comment

This patch adds whitespace around the argument given to -t,
producing:

probe[, ...] / *arg1!=NULL / { [actions] }

Sponsored by: Smule, Inc.

6 years agoMatch style of the other prototypes, and don't name the argument.
jhibbits [Sun, 27 May 2018 20:36:43 +0000 (20:36 +0000)]
Match style of the other prototypes, and don't name the argument.

6 years agoStop idle threads on power9 in the idle task until an interrupt.
jhibbits [Sun, 27 May 2018 20:24:24 +0000 (20:24 +0000)]
Stop idle threads on power9 in the idle task until an interrupt.

This reduces the CPU cycle wastage on power9, which is SMT4.  Any idle
thread that's spinning is simply starving working threads on the same core
of valuable resources.

This can be reduced further by taking more advantage of the PSSCR supported
states, as well as permitting state loss, as is currently done for power8.
The currently implemented stop state is the lowest latency, which may still
consume resources.

6 years agoRemove "All rights reserved" from dtrace_sctp(4) comments
dteske [Sun, 27 May 2018 19:27:34 +0000 (19:27 +0000)]
Remove "All rights reserved" from dtrace_sctp(4) comments

Copied from dtrace_tcp(4)

Reviewed by: rgrimes
Sponsored by: Smule, Inc.

6 years agoAdd manual page for the sctp DTrace provider.
dteske [Sun, 27 May 2018 18:43:14 +0000 (18:43 +0000)]
Add manual page for the sctp DTrace provider.

Sponsored by: Smule, Inc.

6 years agopmcstat: suppress uninitialized warning of event
mmacy [Sun, 27 May 2018 17:49:27 +0000 (17:49 +0000)]
pmcstat: suppress uninitialized warning of event

6 years agoMake the cfumass rc script support USB template 10.
trasz [Sun, 27 May 2018 10:48:21 +0000 (10:48 +0000)]
Make the cfumass rc script support USB template 10.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoin_pcbladdr: remove debug code that snuck in with ifa epoch conversion r334118
mmacy [Sun, 27 May 2018 06:47:09 +0000 (06:47 +0000)]
in_pcbladdr: remove debug code that snuck in with ifa epoch conversion r334118

6 years agoFix the sleep event for layout recall.
rmacklem [Sat, 26 May 2018 23:02:15 +0000 (23:02 +0000)]
Fix the sleep event for layout recall.

The sleep for I/O completion during an NFSv4.1 pNFS layout recall used
the wrong event value and could result in the "[nfscl]" thread hung
for the mount.
This patch fixes the event to be the correct.
This bug will only affect NFSv4.1 pnfs mounts and only when the server
does a layout recall callback, so it won't affect many. Without the patch,
a mount without the "pnfs" option will avoid the problem.
Found during testing of the pNFS server.

MFC after: 1 week

6 years agosrc.conf: use more natural language for @generated
eadler [Sat, 26 May 2018 21:14:49 +0000 (21:14 +0000)]
src.conf: use more natural language for @generated

Requested by: emaste

6 years agopmu-events: re-delete after re-addition by revert
mmacy [Sat, 26 May 2018 19:38:31 +0000 (19:38 +0000)]
pmu-events: re-delete after re-addition by revert

6 years agopmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
mmacy [Sat, 26 May 2018 19:29:19 +0000 (19:29 +0000)]
pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
vendor provided pmu-events tables and sundry cleanups.

The vendor pmu-events tables provide counter descriptions, default
sample rates, event, umask, and flag values for all the counter
configuration permutations. Using this gives us:

- much simpler kernel code for the MD component
- helpful long and short event descriptions
- simpler user code
- sample rates that won't overload the system

Update man page with newer sample types and remove unused sample type.

6 years agoRevert r334242 "pmc(3)/hwpmc(4): update supported Intel processors to rely fully...
mmacy [Sat, 26 May 2018 19:26:19 +0000 (19:26 +0000)]
Revert r334242 "pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the"
because of squash commit messages

6 years agopmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
mmacy [Sat, 26 May 2018 18:12:50 +0000 (18:12 +0000)]
pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
vendor provided pmu-events tables and sundry cleanups.

The vendor pmu-events tables provide counter descriptions, default
sample rates, event, umask, and flag values for all the counter
configuration permutations. Using this gives us:

- much simpler kernel code for the MD component
- helpful long and short event descriptions
- simpler user code
- sample rates that won't overload the system

Update man page with newer sample types and remove unused sample type.

Squashed commit of the following:

commit 4459d43eff815bec08ccc5533dbe5de846f03128
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Sat May 26 00:06:31 2018 -0700

    libpmc: fix pmu function signatures for non amd64

commit a2cb8bbc586c65d41f9b291430a2261ec67b59fe
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:38:11 2018 -0700

    pmcstat: fix indentation of usage

commit f686954b15ff56a833ac80404898977cb80a265b
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:19:49 2018 -0700

    pmclog(3): add callchain and pmcallocatedyn, remove pcsample

commit 73e13a0d2e9498c81c150d14d022050cee7511bb
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:19:00 2018 -0700

    pmclog.h: GC pcsample field

commit 3e93ffd65da641fa657539dad3c48e281f8b5798
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:05:57 2018 -0700

    hwpmc: make Intel core CPUs use external event tables

commit 634f5fae1e1644ac324003136c66cd9c619d1c93
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:00:06 2018 -0700

    pmclog: update log record types, bump PMC_MAJOR
    - explicitly make log record types a multiple of 8 bytes
    - hook in pmu event types for pmc_allocate records
    - remove references to no longer PCSAMPLE record

commit 83d84fcd2d65bdf6ddcb2e155a22f0cfa2a9c225
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 21:52:10 2018 -0700

    libpmc: add support for having vendor table driven pmc_allocate

commit 9e6ad63c40c2fce8404847ace5078ca6cb33a736
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 19:11:33 2018 -0700

    hwpmc_core: add accessors for EVSEL & UMASK, make IAP_UMASK useful to user

commit 859dceb93daa6419a48c794db99b6758e5b041c9
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 19:09:45 2018 -0700

    pmcstat: update usage and man page as well as make -L consistent with pmccontrol

commit 79c7d8597e28c2eb13f5f9113e65ec2792ca57b1
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 18:07:03 2018 -0700

    pmu_util: add support for all current intel event keywords

commit d8089c7f6a6c8527f38324252b1ffb47004694c6
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 17:45:00 2018 -0700

    add description for new arguments

commit 058336740bab53c62ec88a3a026ea848cf3878c6
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 17:38:15 2018 -0700

    libpmc: move pmu_events table and pmu_utils out of libpmcstat so that they can be used by pmc_allocate

commit 049b66b382e2f833c3f47bc8df9e750cb265709f
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 16:12:41 2018 -0700

    pmcstat: hook pmu_events counter description utility routines in

commit f5e01e7b37a691dc045e1aa16b3ebdd162515de8
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 16:11:59 2018 -0700

    pmu_events: add utility routines for listing counters and their descriptions

commit cba4d4f8907f772279f86f18f915e0d74d33ac56
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 16:09:50 2018 -0700

    pmu-events: expand out skylake regex to simplify string matches

6 years agokern_cpuset: fix small leak on error path
vangyzen [Sat, 26 May 2018 14:23:11 +0000 (14:23 +0000)]
kern_cpuset: fix small leak on error path

The "mask" was leaked on some error paths.

Reported by: Coverity
CID: 1384683
Sponsored by: Dell EMC

6 years agoif_hn: fix use of uninitialized variable
vangyzen [Sat, 26 May 2018 14:14:56 +0000 (14:14 +0000)]
if_hn: fix use of uninitialized variable

omcast was used without being initialized in the non-multicast case.
The only effect was that the interface's multicast output counter could be
incorrect.

Reported by: Coverity
CID: 1379662
MFC after: 3 days
Sponsored by: Dell EMC

6 years agokdb_trap: Fix use of uninitialized data
vangyzen [Sat, 26 May 2018 14:01:44 +0000 (14:01 +0000)]
kdb_trap: Fix use of uninitialized data

In some cases, other_cpus was used without being initialized.
Thankfully, it was harmless.

Reported by: Coverity
CID: 1385265
Sponsored by: Dell EMC

6 years agoRevert r333493, which was a temporary fix for 11.2-RELEASE, and instead
trasz [Sat, 26 May 2018 11:13:17 +0000 (11:13 +0000)]
Revert r333493, which was a temporary fix for 11.2-RELEASE, and instead
switch the default kldxref_enable to YES.

The reason is that it's required for every image that's being cross-built,
as kldxref(8) cannot handle files for non-native architectures.  For the
one that is not - amd64 - having it on by default doesn't change anything;
the script is noop if the linker.hints already exists.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agokldstat: align "Size" to the right
eadler [Sat, 26 May 2018 05:15:07 +0000 (05:15 +0000)]
kldstat: align "Size" to the right

This change also makes alignment and spacing an explicit number rather
than a bunch of spaces.

Reviewed by: mmacy
Requested by: Yuri Pankov <yuripv@yuripv.net>

6 years agoOn POWER9 clear the HID0_RADIX before enabling the page tables
jhibbits [Sat, 26 May 2018 04:33:19 +0000 (04:33 +0000)]
On POWER9 clear the HID0_RADIX before enabling the page tables

POWER9 supports Radix page tables in addition to Hashed page tables.  When
Radix page tables are in use, the TLB is cut in half, so that half of the
TLB is used for the page walk cache.  This is the default behavior, however
FreeBSD currently does not support Radix tables.  Clear this bit so that we
can use the full TLB.  Do this in the MMU logic so that configuration can be
localized to the specific translation format.  Once we do support Radix
tables, the setup for that will be localized to the Radix MMU kobj.

6 years agoFix a typo missed in r334232
jhibbits [Sat, 26 May 2018 04:24:25 +0000 (04:24 +0000)]
Fix a typo missed in r334232

6 years agoUse pmap_enter(..., psind=1) in vm_fault_populate() on amd64. While
alc [Sat, 26 May 2018 02:59:34 +0000 (02:59 +0000)]
Use pmap_enter(..., psind=1) in vm_fault_populate() on amd64.  While
superpage mappings were already being created by automatic promotion in
vm_fault_populate(), this change reduces the cost of creating those
mappings.  Essentially, one pmap_enter(..., psind=1) call takes the place
of 512 pmap_enter(..., psind=0) calls, and that one pmap_enter(...,
psind=1) call eliminates the allocation of a page table page.

Reviewed by: kib
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D15572

6 years agoCorrect a typo for opal temperature sensor type constant
jhibbits [Sat, 26 May 2018 02:45:41 +0000 (02:45 +0000)]
Correct a typo for opal temperature sensor type constant

6 years agoiflib: Add new shared flag: IFLIB_ADMIN_ALWAYS_RUN
erj [Sat, 26 May 2018 00:46:08 +0000 (00:46 +0000)]
iflib: Add new shared flag: IFLIB_ADMIN_ALWAYS_RUN

ixl(4)'s nvmupdate utility expects the nvmupdate process to run
while the interface is down; these nvm update commands use the
admin queue, so the admin queue needs to be able to generate
interrupts and be processed while the interface is down.

So add a flag that ixl(4) sets that lets the entire admin task
run even when the interface is marked down/IFF_DRV_RUNNING isn't set.

With this change, nvmupdate should function like it did pre-iflib.

Reviewed by: gallatin@, sbruno@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D15575

6 years agoOnly crop the VPN on POWER4 and derivatives for TLBIE operations
jhibbits [Sat, 26 May 2018 00:41:50 +0000 (00:41 +0000)]
Only crop the VPN on POWER4 and derivatives for TLBIE operations

Summary:
PowerISA 2.03 and later require bits 14:65 in the RB register argument,
which is the full value of the vpn argument post-shift.  Only POWER4, POWER4+,
and PPC970* need the upper 16 bits cropped.

With this change FreeBSD can boot to multi-user on POWER9.

Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D15581

6 years agoMETA_MODE: Fix trying to rebuild jevents due to missing .meta file.
bdrewery [Fri, 25 May 2018 21:46:53 +0000 (21:46 +0000)]
META_MODE: Fix trying to rebuild jevents due to missing .meta file.

The tool is built separately in buildworld in a subdirectory rather than
how other build-tools are done.  Subdirectory builds in lib/libpmcstat
remain broken since the tool cannot be auto-built from here.

6 years agoUse proper BTOOLSPATH for build-tools path.
bdrewery [Fri, 25 May 2018 21:46:49 +0000 (21:46 +0000)]
Use proper BTOOLSPATH for build-tools path.

6 years agoCleanup style
bdrewery [Fri, 25 May 2018 21:46:07 +0000 (21:46 +0000)]
Cleanup style

6 years agoSupport -DNO_CLEAN builds across r334223+r334224.
brooks [Fri, 25 May 2018 20:42:28 +0000 (20:42 +0000)]
Support -DNO_CLEAN builds across r334223+r334224.

6 years agoRegen after r334223: make vadvise compat freebsd11.
brooks [Fri, 25 May 2018 20:41:26 +0000 (20:41 +0000)]
Regen after r334223: make vadvise compat freebsd11.

6 years agoMake vadvise compat freebsd11.
brooks [Fri, 25 May 2018 20:40:23 +0000 (20:40 +0000)]
Make vadvise compat freebsd11.

The vadvise syscall (aka ovadvise) is undocumented and has always been
implmented as returning EINVAL.  Put the syscall under COMPAT11 and
provide a userspace implementation.

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

6 years agortrequest1_fib: we need to always bump the ifaddr refcount when we take a reference...
mmacy [Fri, 25 May 2018 19:48:26 +0000 (19:48 +0000)]
rtrequest1_fib: we need to always bump the ifaddr refcount when we take a reference from
an rtentry. r334118 introduced a case when this was not done.

While we're here make the intent more obvious by moving the refcount
bump down to when we know we'll actually need it.

Reported by: markj

6 years agorc.subr: Support loading environmental variables from a file
feld [Fri, 25 May 2018 19:36:26 +0000 (19:36 +0000)]
rc.subr: Support loading environmental variables from a file

The current support for setting environment via foo_env="" in rc.conf is
not scalable and does not handle envs with spaces in the value. It seems
a common pattern for some newer software is to skip configuration files
altogether and rely on the env. This is well supported in systemd unit
files and may be the inspiration for this trend.

MFH: 1 week
Differential Revision: https://reviews.freebsd.org/D14453

6 years agoWe don't need check if str is NULL as free(3) will handle NULL
araujo [Fri, 25 May 2018 19:12:30 +0000 (19:12 +0000)]
We don't need check if str is NULL as free(3) will handle NULL
argument.

Reported by: kib@

6 years agoFix building GENERIC-MMCCAM on arm64
kibab [Fri, 25 May 2018 19:00:28 +0000 (19:00 +0000)]
Fix building GENERIC-MMCCAM on arm64

Since GENERIC includes quite a few drivers now, all MMC drivers should have
appropriate MMCCAM-related ifdefs and include opt_mmccam.h so that
those ifdefs are actually processed correctly.

Reviewed by: manu
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15569

6 years agocxgbe(4): Suppress a warning about code that is used only with options
np [Fri, 25 May 2018 18:57:41 +0000 (18:57 +0000)]
cxgbe(4): Suppress a warning about code that is used only with options
RATELIMIT.

Reported by: mmacy@

6 years agoAfter a long discussion about assert(3), we gonna use a HardenedBSD
araujo [Fri, 25 May 2018 18:54:40 +0000 (18:54 +0000)]
After a long discussion about assert(3), we gonna use a HardenedBSD
approach to chek strdup(3) memory allocation.

Submitted by: Shaw Webb <shawn.webb@hardenedbsd.org>
Reported by: brooks
Obtained from: HardenedBSD

6 years agopmcstat(8)
sbruno [Fri, 25 May 2018 18:11:13 +0000 (18:11 +0000)]
pmcstat(8)
- Document per thread filtering.

Submitted by: kbowling
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15549

6 years agoif_muge: Use lock assertion instead of broken locking in lan78xx_chip_init
emaste [Fri, 25 May 2018 17:31:43 +0000 (17:31 +0000)]
if_muge: Use lock assertion instead of broken locking in lan78xx_chip_init

Previously lan78xx_chip_init locked the driver's mutex if not already
locked, but unlocked it only in the case of error.  This provided a
fairly clear indication that the function is already called with the
lock held, so just replace it with a lock assertion.

Sponsored by: The FreeBSD Foundation

6 years agoif_muge: connect module to the build
emaste [Fri, 25 May 2018 17:29:29 +0000 (17:29 +0000)]
if_muge: connect module to the build

Supported Microchip devices:
- LAN7515 USB 2 hub and gigabit Ethernet controller w/ PHY
- LAN7800 USB 3.0 gigabit Ethernet controller w/ PHY

The LAN7515 is the Ethernet controller on the Raspberry Pi 3 B+.

This driver has some TODO items outstanding, but basic functionality
works.

Sponsored by: The FreeBSD Foundation

6 years agoOptimize i386 pmap_extract_and_hold().
kib [Fri, 25 May 2018 16:29:22 +0000 (16:29 +0000)]
Optimize i386 pmap_extract_and_hold().

In particular, stop using pmap_pte() to read non-promoted pte while
walking the page table.  pmap_pte() needs to shoot down the kernel
mapping globally which causes IPI broadcast.  Since
pmap_extract_and_hold() is used for slow copyin(9), it is very
significant hit for the 4/4 kernels.

Instead, create single purpose per-processor page frame and use it to
locally map page table page inside the critical section, to avoid
reuse of the frame by other thread if context switched.

Measurement demostrated very significant improvements in any load that
utilizes copyin/copyout.

Found and benchmarked by: bde
Sponsored by: The FreeBSD Foundation

6 years agoCleanup. Remove unused instruction and label.
kib [Fri, 25 May 2018 16:24:20 +0000 (16:24 +0000)]
Cleanup.  Remove unused instruction and label.

Tested by: bde
Sponsored by: The FreeBSD Foundation

6 years agoExtend show proc with reaper, sigparent, and vmspace information
bz [Fri, 25 May 2018 13:59:48 +0000 (13:59 +0000)]
Extend show proc with reaper, sigparent, and vmspace information
I have regularly needed the last couple of months.

Sponsored by: iXsystems, Inc.

6 years agorctl: correct use of "vmem" instead of "vmemoryuse"
eadler [Fri, 25 May 2018 13:40:07 +0000 (13:40 +0000)]
rctl: correct use of "vmem" instead of "vmemoryuse"

Submitted by: Jamie Landeg-Jones <jamie@catflap.org>
PR: 228482
MFC after: 1 month

6 years agoAdd time2posix and posix2time to time.h
eadler [Fri, 25 May 2018 13:40:05 +0000 (13:40 +0000)]
Add time2posix and posix2time to time.h

These are documented in `time2posix.3` but the symbols are not actually
visible. Since these are not POSIX hide them behind _BSD_VISIBLE.

Reviewed by: wollman
Differential Revision: https://reviews.freebsd.org/D15530

6 years agoAdd myself (arrowd) to share/misc/committers-ports.dot
arrowd [Fri, 25 May 2018 11:49:21 +0000 (11:49 +0000)]
Add myself (arrowd) to share/misc/committers-ports.dot

Approved by: tcberner (mentor)

6 years agoxen: remove dead code from gnttab.h
royger [Fri, 25 May 2018 08:44:00 +0000 (08:44 +0000)]
xen: remove dead code from gnttab.h

This code was left over when it was imported from Linux. The original
committer thought that those functions would be implemented, so the
prototypes where left in place. Delete them at once.

Submitted by: pratyush
Reviewed by: royger
Differential Review: https://reviews.freebsd.org/D15553

6 years agore-synchronize TSC-s on SMP systems after resume, if necessary
avg [Fri, 25 May 2018 07:33:20 +0000 (07:33 +0000)]
re-synchronize TSC-s on SMP systems after resume, if necessary

The TSC-s are checked and synchronized only if they were good
originally.  That is, invariant, synchronized, etc.

This is necessary on an AMD-based system where after a wakeup from STR I
see that BSP clock differs from AP clocks by a count that roughly
corresponds to one second.  The APs are in sync with each other.  Not
sure if this is a hardware quirk or a firmware bug.

This is what I see after a resume with this change:
    SMP: passed TSC synchronization test after adjustment
    acpi_timer0: restoring timecounter, ACPI-fast -> TSC-low

Reviewed by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D15551

6 years agofix zfs_getpages crash when called from sendfile, followup to r329363
avg [Fri, 25 May 2018 07:29:52 +0000 (07:29 +0000)]
fix zfs_getpages crash when called from sendfile, followup to r329363

It turns out that sendfile_swapin() has an optimization where it may
insert pointers to bogus_page into the page array that it passes to
VOP_GETPAGES.  That happens to work with buffer cache, because it
extensively uses bogus_page internally, so it has the necessary checks.
However, ZFS did not expect bogus_page as VOP_GETPAGES(9) does not
document such a (ab)use of bogus_page.

So, this commit adds checks and handling of bogus_page.

I expect that use of bogus_page with VOP_GETPAGES will get documented
sooner rather than later.

Reported by: Andrew Reilly <areilly@bigpond.net.au>, delphij
Tested by: Andrew Reilly <areilly@bigpond.net.au>
Requested by: many
MFC after: 1 week

6 years agoRefactor NVMe CAM integration.
mav [Fri, 25 May 2018 03:34:33 +0000 (03:34 +0000)]
Refactor NVMe CAM integration.

 - Remove layering violation, when NVMe SIM code accessed CAM internal
device structures to set pointers on controller and namespace data.
Instead make NVMe XPT probe fetch the data directly from hardware.
 - Cleanup NVMe SIM code, fixing support for multiple namespaces per
controller (reporting them as LUNs) and adding controller detach support
and run-time namespace change notifications.
 - Add initial support for namespace change async events.  So far only
in CAM mode, but it allows run-time namespace arrival and departure.
 - Add missing nvme_notify_fail_consumers() call on controller detach.
Together with previous changes this allows NVMe device detach/unplug.

Non-CAM mode still requires a lot of love to stay on par, but at least
CAM mode code should not stay in the way so much, becoming much more
self-sufficient.

Reviewed by: imp
MFC after: 1 month
Sponsored by: iXsystems, Inc.

6 years agoFix a memory leak on topology_parse().
araujo [Fri, 25 May 2018 02:07:05 +0000 (02:07 +0000)]
Fix a memory leak on topology_parse().

strdup(3) allocates memory for a copy of the string, does the copy and
returns a pointer to it. If there is no sufficient memory NULL is returned
and the global errno is set to ENOMEM.
We do a sanity check to see if it was possible to allocate enough memory.

Also as we allocate memory, we need to free this memory used. Or it will
going out of scope leaks the storage it points to.

Reviewed by: rgrimes
MFC after: 3 weeks.
X-MFC: r332298
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D15550

6 years agoRemove extra space before parenthesis in src.conf(5)
bcran [Fri, 25 May 2018 01:38:59 +0000 (01:38 +0000)]
Remove extra space before parenthesis in src.conf(5)

Reviewed by: eadler
Differential Revision: https://reviews.freebsd.org/D15528

6 years ago[ath_hal] migrate the shared HAL_RESET_* pieces out into ath_hal.
adrian [Fri, 25 May 2018 01:27:39 +0000 (01:27 +0000)]
[ath_hal] migrate the shared HAL_RESET_* pieces out into ath_hal.

I'm in the process of reworking how the reset path works with an eye
to better recovery when the chips hang and/or go RF/PHY deaf.
This is the first step in a lot of unification and API changes.

6 years agoMALTA64EL: disable modules until objcopy is fixed
mmacy [Thu, 24 May 2018 23:58:57 +0000 (23:58 +0000)]
MALTA64EL: disable modules until objcopy is fixed

6 years agonetipsec/!VIMAGE: don't declare/define spdcache_destroy on non-VIMAGE builds
mmacy [Thu, 24 May 2018 23:47:27 +0000 (23:47 +0000)]
netipsec/!VIMAGE: don't declare/define spdcache_destroy on non-VIMAGE builds
this breaks MIPS compiles in universe

6 years agoCK: update consumers to use CK macros across the board
mmacy [Thu, 24 May 2018 23:21:23 +0000 (23:21 +0000)]
CK: update consumers to use CK macros across the board

r334189 changed the fields to have names distinct from those in queue.h
in order to expose the oversights as compile time errors

6 years agoProtect bzero call against macro expansion
imp [Thu, 24 May 2018 23:20:10 +0000 (23:20 +0000)]
Protect bzero call against macro expansion

Shortly, we'll be moving to defining bzero and memset in terms of
__builting_memset. To do that, we can't have macro calls to bzero in
the fallback impelmentation of memset. Normal calls to bzero are fine.
All 4 architectures that use this have their own copies of bzero, so
there's no mutual recursion issue between memset and bcopy.

6 years agoFix exit code for mismatches after r333013.
bdrewery [Thu, 24 May 2018 22:15:47 +0000 (22:15 +0000)]
Fix exit code for mismatches after r333013.

The -c flag still does the wrong thing versus the older version due to
lack of pipefail support.

Reported by: antoine

6 years agoImport CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.
cognet [Thu, 24 May 2018 21:38:18 +0000 (21:38 +0000)]
Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.
This brings us the renaming of fields in ck_queue, so that our own
LIST/SLIST/TAILQ/etc won't accidentally work with them.

6 years agolibpmcstat: Don't build pmu tables on !amd64 until the corresponding
mmacy [Thu, 24 May 2018 21:22:03 +0000 (21:22 +0000)]
libpmcstat: Don't build pmu tables on !amd64 until the corresponding
util routines have been written and tested. Currently building them
breaks the build on power64

Reported by: emaste

6 years agoAF_UNIX: It is possible for UNIX datagram sockets to be connected
mmacy [Thu, 24 May 2018 21:13:46 +0000 (21:13 +0000)]
AF_UNIX: It is possible for UNIX datagram sockets to be connected
to themselves. The updated code assumed that that could not happen
and would try to lock the unp mutex twice.

There may be a lingering issue here but this fixes it for the
reporter.

PR: 228458
Reported by: marieheleneka at gmail.com

6 years agoThis is no unreferenced, so retire it.
imp [Thu, 24 May 2018 21:11:38 +0000 (21:11 +0000)]
This is no unreferenced, so retire it.

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

6 years agoMake memmove and bcopy share code
imp [Thu, 24 May 2018 21:11:33 +0000 (21:11 +0000)]
Make memmove and bcopy share code

Make memmove the primary interface, but have bcopy be an alternative
entry point that jumps into memmove. This will slightly pessimize
bcopy calls, but those are about to get much rarer. Return dst always,
but it will be ignored by bcopy callers. We can remove just the alt
entry point if we ever remove bcopy entirely.

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

6 years agoDefine memmove and make bcopy alt entry point
imp [Thu, 24 May 2018 21:11:28 +0000 (21:11 +0000)]
Define memmove and make bcopy alt entry point

Make a memmove entry point just before bcopy and have it swap its args
before continuing into the body of bcopy. Adjust the returns to return
dst (original %o0 swapped to %o1) from both entry points. bcopy users
will ignore them. Since these are in the branch delay slot, it should
take no additional time. I use %o6 for this rather than just move %o1
back to %o2 at the end since my sparc64 assembler knowledge is weak.
Also eliminate wrapper call from memmove to bcopy.

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

6 years agoMake memmove an alias for memcpy
imp [Thu, 24 May 2018 21:11:24 +0000 (21:11 +0000)]
Make memmove an alias for memcpy

memcpy was an alias for bcopy with arg swap. This code handles
overlapping copies, so making memmove an alias is safe. We can
eliminate the call from libkern's memmove to this bcopy as a result.

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

6 years agoEliminate an unused parameter from vm_fault_populate().
alc [Thu, 24 May 2018 20:43:41 +0000 (20:43 +0000)]
Eliminate an unused parameter from vm_fault_populate().

Reviewed by: kib
MFC after: 10 days

6 years agoUpdate r334154 with review feedback from D15490.
markj [Thu, 24 May 2018 20:26:37 +0000 (20:26 +0000)]
Update r334154 with review feedback from D15490.

An old revision was committed by accident.

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

6 years agorescue: Restore 'make depend' call to fix WITH_META_MODE after r334008.
bdrewery [Thu, 24 May 2018 18:49:19 +0000 (18:49 +0000)]
rescue: Restore 'make depend' call to fix WITH_META_MODE after r334008.

The rescue/crunchgen build avoids linking binaries for the objects it is
building by doing 'make foo.o bar.o' rather than 'make all'.  This breaks the
implicit 'beforebuild: depend' dependency which ensured that all source files
were generated and up-to-date before building the object files.  This
manifested as a WITH_META_MODE build problem for bin/sh in the rescue build
with syntax.{c,h} not properly being regenerated or recognized as changed in
the dependency graph.

Sponsored by: Dell EMC
MFC after: 1 week
Reported by: many

6 years agoIndicate the brk/sbrk are deprecated and not portable.
brooks [Thu, 24 May 2018 18:32:54 +0000 (18:32 +0000)]
Indicate the brk/sbrk are deprecated and not portable.

More firmly suggest mmap(2) instead.

Include the history of arm64 and riscv shipping without brk/sbrk.

Mention that sbrk(0) produces unreliable results.

Reviewed by: emaste, Marcin Cieślak
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15535

6 years agoAF_UNIX: evidently Samba likes to connect a unix socket to itself, fix locking
mmacy [Thu, 24 May 2018 18:22:13 +0000 (18:22 +0000)]
AF_UNIX: evidently Samba likes to connect a unix socket to itself, fix locking

6 years agoAF_UNIX in connectat unp and unp2 can be the same
mmacy [Thu, 24 May 2018 18:22:05 +0000 (18:22 +0000)]
AF_UNIX in connectat unp and unp2 can be the same

6 years agoClarify that USB bus power consumption is measured in mA at 5V.
trasz [Thu, 24 May 2018 18:02:02 +0000 (18:02 +0000)]
Clarify that USB bus power consumption is measured in mA at 5V.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoif_delgroups: add missed unlock introduced by r334118
mmacy [Thu, 24 May 2018 17:54:08 +0000 (17:54 +0000)]
if_delgroups: add missed unlock introduced by r334118

6 years agoUPDATING: remove EOL whitespace in 20180523 entry
emaste [Thu, 24 May 2018 17:08:55 +0000 (17:08 +0000)]
UPDATING: remove EOL whitespace in 20180523 entry

6 years agoYank crufty INTR_FILTER option
cem [Thu, 24 May 2018 17:06:00 +0000 (17:06 +0000)]
Yank crufty INTR_FILTER option

It was introduced to the tree in r169320 and r169321 in May 2007.

It never got much use and never became a kernel default.  The code
duplicates the default path quite a bit, with slight modifications.  Just
yank out the cruft.  Whatever goals were being aimed for can probably be met
within the existing framework, without a flag day option.

Mostly mechanical change: 'unifdef -m -UINTR_FILTER'.

Reviewed by: mmacy
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D15546

6 years agoexect() was removed in 2018, not 2017.
brooks [Thu, 24 May 2018 17:05:41 +0000 (17:05 +0000)]
exect() was removed in 2018, not 2017.

6 years agoDon't implement break(2) at all on aarch64 and riscv.
brooks [Thu, 24 May 2018 17:04:27 +0000 (17:04 +0000)]
Don't implement break(2) at all on aarch64 and riscv.

This should have been done when they were removed from libc, but was
overlooked in the runup to 11.0.  No users should exist.

Approved by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15539

6 years agoif_muge: Add LAN78xx family USB ids but attach only to LAN7800
emaste [Thu, 24 May 2018 16:34:06 +0000 (16:34 +0000)]
if_muge: Add LAN78xx family USB ids but attach only to LAN7800

This driver was developed for the LAN7800 and the register-compatible
LAN7515 and has only been tested on those devices.  Adding support for
other members of the family should be straightforward, once we have
devices to test.

With this change the driver will probe but fail to attach due to the
Chip ID check, but will leave a hint leading to the driver that needs
work.

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

6 years agoWe can't release the refcount outside of the periph lock.
imp [Thu, 24 May 2018 16:31:18 +0000 (16:31 +0000)]
We can't release the refcount outside of the periph lock.

We're dropping the periph lock then dropping the refcount. However,
that violates the locking protocol and is racy. This seems to be
the cause of weird occasional panics with a bogus assert.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15517

6 years agoAvoid two suword() calls per auxarg entry.
brooks [Thu, 24 May 2018 16:25:18 +0000 (16:25 +0000)]
Avoid two suword() calls per auxarg entry.

Instead, construct an auxargs array and copy it out all at once.

Use an array of Elf_Auxinfo rather than pairs of Elf_Addr * to represent
the array. This is the correct type where pairs of words just happend
to work. To reduce the size of the diff, AUXARGS_ENTRY is altered to act
on this array rather than introducing a new macro.

Return errors on copyout() and suword() failures and handle them in the
caller.

Incidentally fixes AT_RANDOM and AT_EXECFN in 32-bit linux on amd64
which incorrectly used AUXARG_ENTRY instead of AUXARGS_ENTRY_32
(now removed due to the use of proper types).

Reviewed by: kib
Comments from: emaste, jhb
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15485

6 years agoRemove physmap from the arm64 machdep.h. This was missed in r334162.
andrew [Thu, 24 May 2018 16:07:47 +0000 (16:07 +0000)]
Remove physmap from the arm64 machdep.h. This was missed in r334162.

6 years agoAdd Peraso Technologies, Inc. to the list.
bz [Thu, 24 May 2018 15:47:15 +0000 (15:47 +0000)]
Add Peraso Technologies, Inc. to the list.

Sponsored by: Turing Robotic Industries

6 years agoAllow us to read the physmap data into our own array and use this to build
andrew [Thu, 24 May 2018 15:32:49 +0000 (15:32 +0000)]
Allow us to read the physmap data into our own array and use this to build
the DMAP region on arm64.

We already have the needed information to build these tables, we just need
to extract it. This significantly simplifies the code.

Obtained from: ABT Systems Ltd
Sponsored by: Turing Robotic Industries

6 years agoTry to be consistent and spell "vnet" lower case like all the
bz [Thu, 24 May 2018 15:31:05 +0000 (15:31 +0000)]
Try to be consistent and spell "vnet" lower case like all the
other options (and as we do on command line).

Sponsored by: iXsystems, Inc.

6 years agoImprove the KASSERT to also have the prison pointer.
bz [Thu, 24 May 2018 15:28:21 +0000 (15:28 +0000)]
Improve the KASSERT to also have the prison pointer.
Helpful when debugging from ddb.

Sponsored by: iXsystems, Inc.

6 years agoAF_UNIX: assert that we're not acquiring the same lock
mmacy [Thu, 24 May 2018 15:28:16 +0000 (15:28 +0000)]
AF_UNIX: assert that we're not acquiring the same lock

6 years agoAdd function to wait for USB ethernet attach to complete.
hselasky [Thu, 24 May 2018 15:24:42 +0000 (15:24 +0000)]
Add function to wait for USB ethernet attach to complete.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoPrint the physmem tables under a verbose boot.
andrew [Thu, 24 May 2018 15:07:53 +0000 (15:07 +0000)]
Print the physmem tables under a verbose boot.

Obtained from: ABT Systems Ltd
Sponsored by: Turing Robotic Industries

6 years agoremove All Rights Reserved from new libpmcstat file
mmacy [Thu, 24 May 2018 15:04:44 +0000 (15:04 +0000)]
remove All Rights Reserved from new libpmcstat file

6 years agoExclude memory from the /reserved-memory mappings with the no-map property
andrew [Thu, 24 May 2018 14:55:50 +0000 (14:55 +0000)]
Exclude memory from the /reserved-memory mappings with the no-map property
set. This memory must not be mapped by the operating system other than
under control of the device driver.

Obtained from: ABT Systems Ltd
Sponsored by: Turing Robotic Industries

6 years agoSplit the active and inactive queue scans into separate subroutines.
markj [Thu, 24 May 2018 14:16:22 +0000 (14:16 +0000)]
Split the active and inactive queue scans into separate subroutines.

The scans are largely independent, so this helps make the code
marginally neater, and makes it easier to incorporate feedback from the
active queue scan into the page daemon control loop.

Improve some comments while here.  No functional change intended.

Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D15490

6 years agoRestore arm, riscv, sparc64, and mips to UNIVERSE after r334128
emaste [Thu, 24 May 2018 14:01:22 +0000 (14:01 +0000)]
Restore arm, riscv, sparc64, and mips to UNIVERSE after r334128

6 years agocxgbe(4): Report IFCAP_TXRTLMT to kernels built with RATELIMIT if the
np [Thu, 24 May 2018 10:55:26 +0000 (10:55 +0000)]
cxgbe(4): Report IFCAP_TXRTLMT to kernels built with RATELIMIT if the
firmware has provisioned resources for this feature.

Sponsored by: Chelsio Communications

6 years agoxen/pvh: allocate dbg_stack
royger [Thu, 24 May 2018 10:22:57 +0000 (10:22 +0000)]
xen/pvh: allocate dbg_stack

Or else init_secondary will hit a page fault (or write garbage
somewhere).

Sponsored by: Citrix Systems R&D

6 years agoxen/evtchn: fix LOR in evtchn device
royger [Thu, 24 May 2018 10:20:42 +0000 (10:20 +0000)]
xen/evtchn: fix LOR in evtchn device

Remove the device from the list before unbinding it. Doing it in this
order allows calling xen_intr_unbind without holding the bind_mutex
lock.

Sponsored by: Citrix Systems R&D

6 years agoxen-blkback: don't unbind the interrupt while holding the lock
royger [Thu, 24 May 2018 10:19:54 +0000 (10:19 +0000)]
xen-blkback: don't unbind the interrupt while holding the lock

There's no need to perform the interrupt unbind while holding the
blkback lock, and doing so leads to the following LOR:

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffff8000802fe90 xbbd1 (xbbd1) @ /usr/src/sys/dev/xen/blkback/blkback.c:3423
 2nd 0xffffffff81fdf890 intrsrc (intrsrc) @ /usr/src/sys/x86/x86/intr_machdep.c:224
stack backtrace:
#0 0xffffffff80bdd993 at witness_debugger+0x73
#1 0xffffffff80bdd814 at witness_checkorder+0xe34
#2 0xffffffff80b7d798 at _sx_xlock+0x68
#3 0xffffffff811b3913 at intr_remove_handler+0x43
#4 0xffffffff811c63ef at xen_intr_unbind+0x10f
#5 0xffffffff80a12ecf at xbb_disconnect+0x2f
#6 0xffffffff80a12e54 at xbb_shutdown+0x1e4
#7 0xffffffff80a10be4 at xbb_frontend_changed+0x54
#8 0xffffffff80ed66a4 at xenbusb_back_otherend_changed+0x14
#9 0xffffffff80a2a382 at xenwatch_thread+0x182
#10 0xffffffff80b34164 at fork_exit+0x84
#11 0xffffffff8101ec9e at fork_trampoline+0xe

Reported by:    Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D

6 years agodev/xenstore: prevent transaction hijacking
royger [Thu, 24 May 2018 10:18:31 +0000 (10:18 +0000)]
dev/xenstore: prevent transaction hijacking

The user-space xenstore device is currently lacking a check to make
sure that the caller is only using transaction ids currently assigned
to it. This allows users of the xenstore device to hijack transactions
not started by them, although the scope is limited to transactions
started by the same domain.

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D

6 years agocxgbe(4): Data path for rate-limited tx.
np [Thu, 24 May 2018 10:18:14 +0000 (10:18 +0000)]
cxgbe(4): Data path for rate-limited tx.

This is hardware support for the SO_MAX_PACING_RATE sockopt (see
setsockopt(2)), which is available in kernels built with "options
RATELIMIT".

Relnotes: Yes
Sponsored by: Chelsio Communications

6 years agodev/xenstore: add support for watches
royger [Thu, 24 May 2018 10:17:49 +0000 (10:17 +0000)]
dev/xenstore: add support for watches

Allow user-space applications to register watches using the xenstore
device.  This is needed in order to run toolstack operations on
domains different than the one where xenstore is running (in which
case the device is not used, since the connection to xenstore is done
using a plain socket).

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D

6 years agoxenstore: don't wait with the PCATCH flag
royger [Thu, 24 May 2018 10:17:03 +0000 (10:17 +0000)]
xenstore: don't wait with the PCATCH flag

Due to the current synchronous xenstore implementation in FreeBSD, we
cannot return from xs_read_reply without reading a reply, or else the
ring gets out of sync and the next request will read the previous
reply and crash due to the type mismatch. A proper solution involves
making use of the req_id field in the message and allowing multiple
in-flight messages at the same time on the ring.

Remove the PCATCH flag so that signals don't interrupt the wait.

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D