]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoPass on bhyve kernel module maintenance to
grehan [Sun, 10 Jun 2018 04:25:19 +0000 (04:25 +0000)]
Pass on bhyve kernel module maintenance to
tychon and jhb who've both had a long history
with the codebase.

Discussed with:  tychon, jhb

6 years agolualoader: Support variable substitution in env var settings
kevans [Sun, 10 Jun 2018 02:36:38 +0000 (02:36 +0000)]
lualoader: Support variable substitution in env var settings

We support both of the following cases of substitution:

bar="y"
foo="${bar}"
foo="$bar"

The latter substitution syntax is, of course, not recommended- all
punctuation must be considered potential variable names, and we do not go
through the effort of searching the different combinations of, for instance,
"$x.y.z" to determine if the variable is $x, $x.y, or $x.y.z.

This is not officially documented as supported, but it has worked in
forthloader for what is most likely a long time as `evaluate` is used to
process the right hand side of the assignment.

6 years agoUse __SCSSID() for SCCS IDs.
jhb [Sun, 10 Jun 2018 02:34:41 +0000 (02:34 +0000)]
Use __SCSSID() for SCCS IDs.

While here, fix $FreeBSD$ ID in ftime.c to use __FBSDID instead of a static
array.

6 years agoRemove old, dead compat code.
imp [Sun, 10 Jun 2018 02:30:09 +0000 (02:30 +0000)]
Remove old, dead compat code.

We no longer need to od these things conditionally, and the fallbacks
are to 4.2BSD era defaults, which nobody uses anymore. Vixie cron has
diverged from upstream anyway in our tree, and it's not clear there's
actually a viable upstream anymore. Plus, we don't follow the
vendor-supplied code pattern here.

I'm doing this to reduce false positives from grep.

6 years agoSet the $PATH in /etc/crontab like it is set by the cron(8)
imp [Sun, 10 Jun 2018 02:13:30 +0000 (02:13 +0000)]
Set the  $PATH in /etc/crontab like it is set by the cron(8)
daemon, for consistency.

Submitted by: Ben RUBSON
Pull Request: https://github.com/freebsd/freebsd/pull/155

6 years agolualoader: Process loader_conf_files properly
kevans [Sun, 10 Jun 2018 01:38:52 +0000 (01:38 +0000)]
lualoader: Process loader_conf_files properly

loader.conf(5) documents loader_conf_files to mean "additional configuration
files to be processed right after the present file." However, lualoader
ignored loader_conf_files after processing /boot/defaults/loader.conf.

Rewrite these bits to process loader_conf_files after each loaded file.

6 years agotop(1): permit sub-second delay times
eadler [Sun, 10 Jun 2018 00:02:56 +0000 (00:02 +0000)]
top(1): permit sub-second delay times

This removes the getuid check for delay==0. It didn't prevent users from
writing similar programs in the general case. In theory, if top(1) is
among one of the few restricted programs you're allowed to run, it may
have helped a little, but there are better ways of handling that case.

6 years agoDelete some macros that are unused.
rmacklem [Sat, 9 Jun 2018 23:38:22 +0000 (23:38 +0000)]
Delete some macros that are unused.

These macros were added because they were used by the pNFS server last
year. However, they are no longer used by the pNFS server code and
might as well be deleted.
This is a partial reversion of r326735.

6 years agotop(1): correctly reset per-cpu counters
eadler [Sat, 9 Jun 2018 23:24:08 +0000 (23:24 +0000)]
top(1): correctly reset per-cpu counters

I had changed this from a for loop to a memset during an earlier
cleanup. This change was incorrect so revert it.

While here, clean up

Reported by: flo

6 years agoDelete an unused macro and clean up a comment about it.
rmacklem [Sat, 9 Jun 2018 23:14:59 +0000 (23:14 +0000)]
Delete an unused macro and clean up a comment about it.

NFSDEV_MIRRORSTR was defined for the pNFS server, but has not been used,
so this patch deletes it. It also cleans up the comment and hopefully
makes it more readable.

6 years agotop(1): handle specific pids better
eadler [Sat, 9 Jun 2018 23:08:02 +0000 (23:08 +0000)]
top(1): handle specific pids better

When told to watch a specific pid, don't filter idle, system, or self
processes. The summary at the top will still flip correctly though.

6 years agotop(1): implement additional missing long options
eadler [Sat, 9 Jun 2018 22:30:10 +0000 (22:30 +0000)]
top(1): implement additional missing long options

6 years agotop(1): initial pass to freebsdize the man page
eadler [Sat, 9 Jun 2018 21:40:33 +0000 (21:40 +0000)]
top(1): initial pass to freebsdize the man page

The previous man page used many conventions not typical in FreeBSD.
Since we've forked top completely, convert the man page too.

6 years agotop(1): Implement long options
eadler [Sat, 9 Jun 2018 21:40:24 +0000 (21:40 +0000)]
top(1): Implement long options

This also documents some reserved or differing options from top's
original upstream.

6 years agodiff: Import fixes from OpenBSD
bapt [Sat, 9 Jun 2018 21:09:24 +0000 (21:09 +0000)]
diff: Import fixes from OpenBSD

original commit log by miller@OpenBSD  r1.46:
Fix exit value when diffing directories with missing files and the -N
or -P options are not used.  From Ibrahim Khalifa

6 years agoAdd myself to the calendar
ygy [Sat, 9 Jun 2018 21:05:25 +0000 (21:05 +0000)]
Add myself to the calendar

Requested by: mckusick
Reviewed by: emaste

6 years agoIsolate the pr(1) related code in its own source files
bapt [Sat, 9 Jun 2018 20:24:17 +0000 (20:24 +0000)]
Isolate the pr(1) related code in its own source files

This keeps diffreg.c closer to what it is supposed to do:
diffing regular files.

It also allows my code to get a proper license

6 years agotop(1): allow starting with -T flag
eadler [Sat, 9 Jun 2018 20:06:06 +0000 (20:06 +0000)]
top(1): allow starting with -T flag

6 years agoBump __FreeBSD_version after r334881 and force libdwarf to be rebuilt.
markj [Sat, 9 Jun 2018 20:01:03 +0000 (20:01 +0000)]
Bump __FreeBSD_version after r334881 and force libdwarf to be rebuilt.

Reported by: O. Hartmann <ohartmann@walstatt.org>
Reviewed by: bdrewery

6 years agolualoader: Add cli.lua(8) to the tree
kevans [Sat, 9 Jun 2018 19:51:09 +0000 (19:51 +0000)]
lualoader: Add cli.lua(8) to the tree

Reviewed by: rpokala
Differential Revision: https://reviews.freebsd.org/D14818

6 years agoTell the compiler that rdtscp clobbers %ecx.
markj [Sat, 9 Jun 2018 18:31:19 +0000 (18:31 +0000)]
Tell the compiler that rdtscp clobbers %ecx.

6 years agobsdgrep(1): Some more int -> bool conversions and name changes
kevans [Sat, 9 Jun 2018 18:11:46 +0000 (18:11 +0000)]
bsdgrep(1): Some more int -> bool conversions and name changes

Again motivated by upcoming work to rewrite a bunch of this- single-letter
variable names and slightly misleading variable names ("lastmatches" to
indicate that the last matched) are not helpful.

6 years agoAdd ZFS+GPT EFI and LEGACY+EFI to rootgen.sh and installboot.sh
allanjude [Sat, 9 Jun 2018 17:49:43 +0000 (17:49 +0000)]
Add ZFS+GPT EFI and LEGACY+EFI to rootgen.sh and installboot.sh

Reviewed by: imp (maintainer)
Sponsored by: Klara Systems
Differential Revision: https://reviews.freebsd.org/D15700

6 years agoChange rootgen.sh to use the default ZFS boot environment name
allanjude [Sat, 9 Jun 2018 17:47:56 +0000 (17:47 +0000)]
Change rootgen.sh to use the default ZFS boot environment name

Reviewed by: imp (maintainer)
Sponsored by: Klara Systems
Differential Revision: https://reviews.freebsd.org/D15699

6 years agoAdd missed libc++ entries to (Optional)ObsoleteFiles.inc
dim [Sat, 9 Jun 2018 17:40:31 +0000 (17:40 +0000)]
Add missed libc++ entries to (Optional)ObsoleteFiles.inc

Some of these were removed during the libc++ 5.0.0 import, others were
added in the libc++ 6.0.0 import.

MFC after: 3 days

6 years agostand: One more trivial consolidation (setting environment from howto)
kevans [Sat, 9 Jun 2018 15:52:29 +0000 (15:52 +0000)]
stand: One more trivial consolidation (setting environment from howto)

6 years agostand: Fix build after r334882
kevans [Sat, 9 Jun 2018 15:28:37 +0000 (15:28 +0000)]
stand: Fix build after r334882

Not sure how this was not caught in Universe.

6 years agoDon't process DWARF generated from non-C/C++ code.
markj [Sat, 9 Jun 2018 15:10:49 +0000 (15:10 +0000)]
Don't process DWARF generated from non-C/C++ code.

ctfconvert(1) is not designed to handle DWARF generated from such code,
and will generally fail in non-obvious ways.  Use an explicit check to
help catch such potential failures.

Reported by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 2 weeks

6 years agostand: Consolidate checking for boot flags driven by environment vars
kevans [Sat, 9 Jun 2018 15:10:39 +0000 (15:10 +0000)]
stand: Consolidate checking for boot flags driven by environment vars

e.g. boot_mute, boot_single, boot_verbose, and friends; we checked for these
in multiple places, consolidate into common/ and allow a setting of "NO" for
any of these to turn them off. This allows systems with multiple
loader.conf(5) or loader.conf(5) overlay systems to easily turn off
variables in later processed files by setting it to NO.

Reported by: Nick Wolff @ iXsystems
Reviewed by: imp

6 years agoAdd DW_LANG_* definitions from DWARF 4 and 5.
markj [Sat, 9 Jun 2018 14:50:38 +0000 (14:50 +0000)]
Add DW_LANG_* definitions from DWARF 4 and 5.

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15712

6 years agoIn the ThunderX BGX network driver we were skipping the NULL terminator
andrew [Sat, 9 Jun 2018 14:47:49 +0000 (14:47 +0000)]
In the ThunderX BGX network driver we were skipping the NULL terminator
when parsing the phy type, however this is included in the length returned
by OF_getprop. To fix this stop ignoring the terminator.

PR: 228828
Reported by: sbruno
Sponsored by: DARPA, AFRL

6 years agolualoader: Add hook.lua(8) to tree
kevans [Sat, 9 Jun 2018 14:26:30 +0000 (14:26 +0000)]
lualoader: Add hook.lua(8) to tree

Reviewed by: rpokala (w/ "All Rights Reserved" previously added)
Differential Revision: https://reviews.freebsd.org/D14815

6 years agolibsa(3): Correct statement about FS Write-support, name change
kevans [Sat, 9 Jun 2018 14:24:16 +0000 (14:24 +0000)]
libsa(3): Correct statement about FS Write-support, name change

- jhb implemented UFS write support a little over 16 years ago.
- Update the library name while we're here.

Reviewed by: jhb, rpokala
Differential Revision: https://reviews.freebsd.org/D14476

6 years agopf tests: Basic route-to tests
kp [Sat, 9 Jun 2018 14:21:07 +0000 (14:21 +0000)]
pf tests: Basic route-to tests

Very basic route-to tests. These tests attempt to provoke PR 228782 for IPv4
and IPv6. A test failure will panic the machine.

6 years agopf: Fix deadlock with route-to
kp [Sat, 9 Jun 2018 14:17:06 +0000 (14:17 +0000)]
pf: Fix deadlock with route-to

If a locally generated packet is routed (with route-to/reply-to/dup-to) out of
a different interface it's passed through the firewall again. This meant we
lost the inp pointer and if we required the pointer (e.g. for user ID matching)
we'd deadlock trying to acquire an inp lock we've already got.

Pass the inp pointer along with pf_route()/pf_route6().

PR: 228782
MFC after: 1 week

6 years agoExplicitly change the link state when we assingn an address.
ae [Sat, 9 Jun 2018 09:57:14 +0000 (09:57 +0000)]
Explicitly change the link state when we assingn an address.

Since we are setting IFF_UP flag on SIOCSIFADDR, it is possible, that
after this link state information still not initialized properly.
This leads to problems with routing, since now interface has
IFCAP_LINKSTATE capability and a route is considered as working only
when interface's link state is in LINK_STATE_UP (see RT_LINK_IS_UP()
macro).

Reported by: Marek Zarychta
MFC after: 3 days

6 years agopmc: mark some dead functions as such
eadler [Sat, 9 Jun 2018 04:54:36 +0000 (04:54 +0000)]
pmc: mark some dead functions as such

Also change a single instance of the comma operator to a semi-colon.

Reviewed by: mmacy

6 years agoncal: correct history section
eadler [Sat, 9 Jun 2018 04:40:17 +0000 (04:40 +0000)]
ncal: correct history section

originally reported Todd C. Miller[0]
Additional data see [1][2].

While here, pet igor.

Closes #152 (github pr)
Sbmitted by: Raf Czlonka

[0]
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/cal/cal.1?rev=1.28&content-type=text/x-cvsweb-markup
[1] https://www.bell-labs.com/usr/dmr/www/1stEdman.html
[2] https://www.bell-labs.com/usr/dmr/www/man61.pdf

6 years agoLOCKS: update current locks
eadler [Sat, 9 Jun 2018 03:08:04 +0000 (03:08 +0000)]
LOCKS: update current locks

- use a wild card for releng instead of listing them out. This ignores a
technicality that re@ owns the branches during release cycles, but this
has not been document in this file in a long time (if ever).

Approved by: core

6 years agotop(1): correct header, align it.
eadler [Sat, 9 Jun 2018 02:47:02 +0000 (02:47 +0000)]
top(1): correct header, align it.

THR is always 6 digits or longer. Now that the PID/THR change is
separated, use correct headers.

PR: 228823
Reported by: Trond.Endrestol@ximalas.info

6 years agoAdd st_mtime, st_ino and st_dev for ufs_stat
sjg [Sat, 9 Jun 2018 02:41:51 +0000 (02:41 +0000)]
Add st_mtime, st_ino and st_dev for ufs_stat

Differential Revision: D15064

6 years agopmc: fix logic in skipping riscv
mmacy [Sat, 9 Jun 2018 02:25:18 +0000 (02:25 +0000)]
pmc: fix logic in skipping riscv

6 years agotop(1): actually make change for tid vs pid
eadler [Sat, 9 Jun 2018 02:18:15 +0000 (02:18 +0000)]
top(1): actually make change for tid vs pid

6 years agopmc: don't build on riscv where there's no kmod support
mmacy [Sat, 9 Jun 2018 02:15:45 +0000 (02:15 +0000)]
pmc: don't build on riscv where there's no kmod support

6 years agotop(1): use a different command to toggle tid vs pid
eadler [Sat, 9 Jun 2018 02:14:33 +0000 (02:14 +0000)]
top(1): use a different command to toggle tid vs pid

- By popular demand, implement a different switch ("T") for toggling
between thread id and process id.
- Add an assert that the size of command chars is as expected.
- Also clean up some messiness I found when implementing this.
- Further document the new flag.

Requested by: flo, ronald-lists@klop.ws, bapt
PR: 139389 (for the record)
X-MFC-With: r334474

6 years agocounter: add a bit missed in r334858
mjg [Fri, 8 Jun 2018 22:06:32 +0000 (22:06 +0000)]
counter: add a bit missed in r334858

It happens to be a noop.

6 years agoRemove tx task spinning added in r333686
shurd [Fri, 8 Jun 2018 21:49:19 +0000 (21:49 +0000)]
Remove tx task spinning added in r333686

This caused issues with PASTE.  Just remove the reschedule since the DELAY()
should be enough for use cases such as pkt-gen which were failing before the
change.

Reported by: Michio Honda
Sponsored by: Limelight Networks

6 years agouma: implement provisional api for per-cpu zones
mjg [Fri, 8 Jun 2018 21:40:03 +0000 (21:40 +0000)]
uma: implement provisional api for per-cpu zones

Per-cpu zone allocations are very rarely done compared to regular zones.
The intent is to avoid pessimizing the latter case with per-cpu specific
code.

In particular contrary to the claim in r334824, M_ZERO is sometimes being
used for such zones. But the zeroing method is completely different and
braching on it in the fast path for regular zones is a waste of time.

6 years agohwpmc: remove dangling references to hwpmc_xscale
mmacy [Fri, 8 Jun 2018 20:39:49 +0000 (20:39 +0000)]
hwpmc: remove dangling references to hwpmc_xscale

Reported by: mjg

6 years agoDon't bother looking for non-executable pages when a process is
tychon [Fri, 8 Jun 2018 20:35:58 +0000 (20:35 +0000)]
Don't bother looking for non-executable pages when a process is
excluded from PTI.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D15708

6 years agoAF_UNIX: bring uipc_ready in compliance with new locking protocol
mmacy [Fri, 8 Jun 2018 20:31:59 +0000 (20:31 +0000)]
AF_UNIX: bring uipc_ready in compliance with new locking protocol

PR: 228742
Submitted by: markj
Reviewed by: markj

6 years agoCreate a symlink for sodtor_set(9) to the socket(9) man page.
jtl [Fri, 8 Jun 2018 19:47:04 +0000 (19:47 +0000)]
Create a symlink for sodtor_set(9) to the socket(9) man page.

6 years agoAdd a socket destructor callback. This allows kernel providers to set
jtl [Fri, 8 Jun 2018 19:35:24 +0000 (19:35 +0000)]
Add a socket destructor callback.  This allows kernel providers to set
callbacks to perform additional cleanup actions at the time a socket is
closed.

Michio Honda presented a use for this at BSDCan 2018.
(See https://www.bsdcan.org/2018/schedule/events/965.en.html .)

Submitted by: Michio Honda <micchie at sfc.wide.ad.jp> (previous version)
Reviewed by: lstewart (previous version)
Differential Revision: https://reviews.freebsd.org/D15706

6 years agohwpmc: yet another missed fixup
mmacy [Fri, 8 Jun 2018 18:54:47 +0000 (18:54 +0000)]
hwpmc: yet another missed fixup

6 years agoRestore release semantic for the old thread unlock on arm64.
kib [Fri, 8 Jun 2018 18:32:26 +0000 (18:32 +0000)]
Restore release semantic for the old thread unlock on arm64.

With the introduction of pmap_switch(), the DSB instruction on the
address map switch is not necessary executed, which is fixed by
changing the unlock store to release.  Also remove comment which
documented pre-pmap_switch() code.

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

6 years agohwpmc: remove hwpmc_xscale.c from corresponding arm build
mmacy [Fri, 8 Jun 2018 18:24:46 +0000 (18:24 +0000)]
hwpmc: remove hwpmc_xscale.c from corresponding arm build

6 years ago[ath_hal] Return failure if noise floor calibration fails.
adrian [Fri, 8 Jun 2018 18:21:57 +0000 (18:21 +0000)]
[ath_hal] Return failure if noise floor calibration fails.

If we fail noise floor calibration then we may end up with a deaf NIC
which we can't recover without a full chip reset.

Earlier chips seem to get less stuck in this condition versus AR9280/later
and AR9300/later, but whilst here just fix up the AR5212 era chips to also
return NF calibration failures.

This HAL routine would only return failure if the channel was not configured.

This is a no-op until the driver side code for doing resets and the HAL
code for being told about the reset type (and then handling it!) is
implemented.

Tested:

* AR9280, STA mode
* AR2425, STA mode
* AR9380, STA mode

6 years ago[ath_hal] Don't do ANI processing if we've reset.
adrian [Fri, 8 Jun 2018 18:15:23 +0000 (18:15 +0000)]
[ath_hal] Don't do ANI processing if we've reset.

If we've reset then we can't trust the current state of the ANI tracking,
so just wait until next time.

Tested:

* AR5424, STA mode (2GHz)

6 years agohwpmc: retire never completed xscale support
mmacy [Fri, 8 Jun 2018 18:09:19 +0000 (18:09 +0000)]
hwpmc: retire never completed xscale support

hwpmc xscale support is not actually functional and the
architecture is well past its shelf life.

6 years agoCorrect the list of supported drivers.
markj [Fri, 8 Jun 2018 17:55:06 +0000 (17:55 +0000)]
Correct the list of supported drivers.

- bnxt(4) is supported via iflib.
- mlx4en(4) support has not yet been committed.

6 years agohwpmc: update files missed by r334827
mmacy [Fri, 8 Jun 2018 17:41:49 +0000 (17:41 +0000)]
hwpmc: update files missed by r334827

6 years agoThis originated from ZFS On Linux, as
sef [Fri, 8 Jun 2018 17:38:28 +0000 (17:38 +0000)]
This originated from ZFS On Linux, as
https://github.com/zfsonlinux/zfs/commit/d4a72f23863382bdf6d0ae33196f5b5decbc48fd

During scans (scrubs or resilvers), it sorts the blocks in each transaction
group by block offset; the result can be a significant improvement. (On my
test system just now, which I put some effort to introduce fragmentation into
the pool since I set it up yesterday, a scrub went from 1h2m to 33.5m with the
changes.) I've seen similar rations on production systems.

Approved by: Alexander Motin
Obtained from: ZFS On Linux
Relnotes: Yes (improved scrub performance, with tunables)
Differential Revision: https://reviews.freebsd.org/D15562

6 years agoavoid 'tcp_outflags defined but not used'
mmacy [Fri, 8 Jun 2018 17:37:49 +0000 (17:37 +0000)]
avoid 'tcp_outflags defined but not used'

6 years agohpts: remove redundant decl breaking gcc build
mmacy [Fri, 8 Jun 2018 17:37:43 +0000 (17:37 +0000)]
hpts: remove redundant decl breaking gcc build

6 years agoSimplify this Makefile.
brd [Fri, 8 Jun 2018 15:05:26 +0000 (15:05 +0000)]
Simplify this Makefile.

Approved by: bapt (mentor)

6 years agobsdgrep(1): Evict character sequence that moved in
kevans [Fri, 8 Jun 2018 12:58:55 +0000 (12:58 +0000)]
bsdgrep(1): Evict character sequence that moved in

Reported by: trasz

6 years agounbreak LINT build after r334804
mmacy [Fri, 8 Jun 2018 05:48:36 +0000 (05:48 +0000)]
unbreak LINT build after r334804

6 years agohwpmc: fix arm64 INVARIANTS build
mmacy [Fri, 8 Jun 2018 05:48:28 +0000 (05:48 +0000)]
hwpmc: fix arm64 INVARIANTS build

6 years agouma: fix up r334824
mjg [Fri, 8 Jun 2018 05:40:36 +0000 (05:40 +0000)]
uma: fix up r334824

Turns out there is code which ends up passing M_ZERO to counters.
Since counters zero unconditionally on their own, just ignore drop the
flag in that place.

6 years agortentry_zinit: don't blindly pass through M_ZERO to counter alloc
mmacy [Fri, 8 Jun 2018 05:17:06 +0000 (05:17 +0000)]
rtentry_zinit: don't blindly pass through M_ZERO to counter alloc

6 years agohwpmc: avoid undefined variable on LINT
mmacy [Fri, 8 Jun 2018 05:01:09 +0000 (05:01 +0000)]
hwpmc: avoid undefined variable on LINT

6 years agohwpmc: simplify calling convention for hwpmc interrupt handling
mmacy [Fri, 8 Jun 2018 04:58:03 +0000 (04:58 +0000)]
hwpmc: simplify calling convention for hwpmc interrupt handling

pmc_process_interrupt takes 5 arguments when only 3 are needed.
cpu is always available in curcpu and inuserspace can always be
derived from the passed trapframe.

While facially a reasonable cleanup this change was motivated
by the need to workaround a compiler bug.

core2_intr(cpu, tf) ->
  pmc_process_interrupt(cpu, ring, pmc, tf, inuserspace) ->
    pmc_add_sample(cpu, ring, pm, tf, inuserspace)

In the process of optimizing the tail call the tf pointer was getting
clobbered:

(kgdb) up
    at /storage/mmacy/devel/freebsd/sys/dev/hwpmc/hwpmc_mod.c:4709
4709                                pmc_save_kernel_callchain(ps->ps_pc,
(kgdb) up
1205                    error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,

resulting in a crash in pmc_save_kernel_callchain.

6 years agoamd64: remove now unused bzero, bcmp and bcopy. move pagecopy higher up.
mjg [Fri, 8 Jun 2018 04:18:42 +0000 (04:18 +0000)]
amd64: remove now unused bzero, bcmp and bcopy. move pagecopy higher up.

6 years agouma: remove M_ZERO support for pcpu zones
mjg [Fri, 8 Jun 2018 03:16:16 +0000 (03:16 +0000)]
uma: remove M_ZERO support for pcpu zones

Nothing in the tree uses it and pcpu zones have a fundamentally different use
case than the regular zones - they are not supposed to be allocated and freed
all the time.

This reduces pollution in the allocation fast path.

6 years agotop(1): remove some unneeded indirection
eadler [Fri, 8 Jun 2018 02:03:51 +0000 (02:03 +0000)]
top(1): remove some unneeded indirection

6 years agotop(1): fix several style & const related issues
eadler [Fri, 8 Jun 2018 01:55:47 +0000 (01:55 +0000)]
top(1): fix several style & const related issues

- use parens for return
- put function names on newline
- sprinkle const where possible

6 years agobsdgrep(1): Slooowly peel away the chunky onion
kevans [Fri, 8 Jun 2018 01:25:07 +0000 (01:25 +0000)]
bsdgrep(1): Slooowly peel away the chunky onion

(or peel off the band-aid, whatever floats your boat)

This addresses two separate issues:

1.) Nothing within bsdgrep actually knew whether it cared about line numbers
  or not.

2.) The file layer knew nothing about the context in which it was being
  called.

#1 is only important when we're *not* processing line-by-line. #2 is
debatably a good idea; the parsing context is only handy because that's
where we store current offset information and, as of this commit, whether or
not it needs to be line-aware.

6 years agoamd64: fix a retarded bug in memset
mjg [Fri, 8 Jun 2018 00:47:24 +0000 (00:47 +0000)]
amd64: fix a retarded bug in memset

memset fills the target buffer from a byte-sized value passed in as the
second argument.

The fully-sized (8 bytes) register containing it is named %rsi. Lower 4 bytes
can be referred to as %esi and finally the lowest byte is %sil.

Vast majority of all the callers just zero the target buffer and set it up by
doing xor %esi,%esi which has a side-effect of zeroing the upper parts of
the register as well. Some others do a word-sized move to %esi which has the
same result.

However, there are callers which only fill %sil. This does *not* clear up
the rest of the register.

The value of %rsi is multiplied by $0x0101010101010101 to create a 8-byte sized
pattern for 8-byte stores.

Prior to the patch, the func just blindly took %rsi assuming the unwanted bytes
are zeroed out. Since this is not the case for the callers which only play with
%sil (the rest of the register can have absolutely anything), the resulting
pattern can be garbage.

This has potential for funny bugs. One side effect (which was not amusing)
after enabling it instead of bzero was that the kernel was hanging on boot
as a xen domU.

Reported by: Trond Endrestøl <Trond.Endrestol fagskolen.gjovik.no>
Pointy hat: me

6 years agoUMA memory debugging enabled with INVARIANTS consists of two things:
glebius [Fri, 8 Jun 2018 00:15:08 +0000 (00:15 +0000)]
UMA memory debugging enabled with INVARIANTS consists of two things:
trashing freed memory and checking that allocated memory is properly
trashed, and also of keeping a bitset of freed items. Trashing/checking
creates a lot of CPU cache poisoning, while keeping debugging bitsets
consistent creates a lot of contention on UMA zone lock(s). The performance
difference between INVARIANTS kernel and normal one is mostly attributed
to UMA debugging, rather than to all KASSERT checks in the kernel.

Add loader tunable vm.debug.divisor that allows either to turn off UMA
debugging completely, or turn it on only for a fraction of allocations,
while still running all KASSERTs in kernel. That allows to run INVARIANTS
kernels in production environments without reducing load by orders of
magnitude, but still doing useful extra checks.

Default value is 1, meaning debug every allocation. Value of 0 would
disable UMA debugging completely. Values above 1 enable debugging only
for every N-th item. It isn't possible to strictly follow the number,
but still amount of debugging is reduced roughly by (N-1)/N percent.

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

6 years agoAdd new functionality and syntax to cron(1) to allow to run jobs at a
glebius [Thu, 7 Jun 2018 22:38:40 +0000 (22:38 +0000)]
Add new functionality and syntax to cron(1) to allow to run jobs at a
given interval, which is counted in seconds since exit of the previous
invocation of the job. Example user crontab entry:

@25 sleep 10

The example will launch 'sleep 10' every 35 seconds. This is a rather
useless example above, but clearly explains the functionality.

The practical goal here is to avoid overlap of previous job invocation
to a new one, or to avoid too short interval(s) for jobs that last long
and doesn't have any point of immediate launch soon after previous run.

Another useful effect of interval jobs can be noticed when a cluster of
machines periodically communicates with a single node. Running the task
time based creates too much load on the node. Running interval based
spreads invocations across machines in cluster. Note that -j/-J won't
help in this case.

Sponsored by: Netflix

6 years agoFix excise_initrd_region() to support 32- and 64-bit initrd params.
leitao [Thu, 7 Jun 2018 21:24:21 +0000 (21:24 +0000)]
Fix excise_initrd_region() to support 32- and 64-bit initrd params.

Changed excise_initrd_region to support both 32- and 64-bit
values for linux,initrd-start and linux,initrd-end.

This fixes the boot problem on some machines after rS334485.

Submitted by: Luis Pires <lffpires@ruabrasil.org>
Reviewed by: jhibbits, leitao
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D15667

6 years agoTake out the stack alias inadvertantly added by my commit.
rrs [Thu, 7 Jun 2018 20:57:12 +0000 (20:57 +0000)]
Take out the stack alias inadvertantly added by my commit.

Reported by: Peter Lei

6 years agoEnsure proper initialization of superblock.
mckusick [Thu, 7 Jun 2018 20:49:01 +0000 (20:49 +0000)]
Ensure proper initialization of superblock.

Submitted by: Diane Bruce

6 years agoFix build issue with const and volatile and the
rrs [Thu, 7 Jun 2018 19:57:55 +0000 (19:57 +0000)]
Fix build issue with const and volatile and the
myriad ways that the various compliers treat this. The
only safe prefetch appears to be for AMD. The other
compilers either are not volatile or are not const :(

Reported by: Michael Tuexen

6 years agoUse simpler sed invocation.
bdrewery [Thu, 7 Jun 2018 19:39:11 +0000 (19:39 +0000)]
Use simpler sed invocation.

X-MFC-With: r334791
MFC after: 1 week
Submitted by: danfe

6 years agoBreak recursion involving getnewvnode and zfs_rmnode.
benno [Thu, 7 Jun 2018 18:59:32 +0000 (18:59 +0000)]
Break recursion involving getnewvnode and zfs_rmnode.

When we're at our vnode limit, getnewvnode will call into the vnode LRU
cache to free up vnodes. If the vnode we try to recycle is a ZFS vnode we
end up, eventually, in zfs_rmnode. If the ZFS vnode we're recycling
represents something with extended attributes, zfs_rmnode will call
zfs_zget which will attempt to allocate another vnode. If the next vnode we
try to recycle is also a ZFS vnode representing something with extended
attributes we can recurse further. This ends up being unbounded and can end
up overflowing the stack.

In order to avoid this, restructure zfs_rmnode to simply add the extended
attribute directory's object ID to the unlinked set, thus not requiring the
allocation of a vnode. We then schedule a task that calls zfs_unlinked_drain
which will do the work of properly marking the vnodes for unlinking.
zfs_unlinked_drain is also called on mount so these will be cleaned up
there.

Reviewed by: avg, mav
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D15342

6 years agonetbsd-tests: bsdgrep(1): Add a test for -m, too
kevans [Thu, 7 Jun 2018 18:53:39 +0000 (18:53 +0000)]
netbsd-tests: bsdgrep(1): Add a test for -m, too

6 years agobsdgrep(1): Don't initialize fts_flags twice
kevans [Thu, 7 Jun 2018 18:38:48 +0000 (18:38 +0000)]
bsdgrep(1): Don't initialize fts_flags twice

Admittedly, this is a clang-scan complaint... but it wasn't wrong. fts_flags
is initialized by all cases in the switch(), which should be fairly obvious.
Annotate this anyways.

6 years agobsdgrep(1): whoops, garbage collect the now write-only variable
kevans [Thu, 7 Jun 2018 18:36:12 +0000 (18:36 +0000)]
bsdgrep(1): whoops, garbage collect the now write-only variable

6 years agobsdgrep(1): Do some less dirty things with return types
kevans [Thu, 7 Jun 2018 18:27:58 +0000 (18:27 +0000)]
bsdgrep(1): Do some less dirty things with return types

Neither procfile nor grep_tree return anything meaningful to their callers.
None of the callers actually care about how many lines were matched in all
of the files they processed; it's all about "did anything match?"

This is generally just a light refactoring to remind me of what actually
matters as I'm rewriting these bits to care less about 'stuff'.

6 years ago- Once we have shifted arguments up to thrice, base-bits-dir is $1 rather
marius [Thu, 7 Jun 2018 18:24:25 +0000 (18:24 +0000)]
- Once we have shifted arguments up to thrice, base-bits-dir is $1 rather
  than $4. Introduce $BASEBITSDIR for clarity and to avoid repeating this
  mistake in the future. Fixing this ensures that we pick up newly built
  boot bits native to the target rather for/from the host.
- Apply some of the argument quoting fixes done in r287635 but missing in
  later revisions.

6 years agoThis commit brings in a new refactored TCP stack called Rack.
rrs [Thu, 7 Jun 2018 18:18:13 +0000 (18:18 +0000)]
This commit brings in a new refactored TCP stack called Rack.
Rack includes the following features:
 - A different SACK processing scheme (the old sack structures are not used).
 - RACK (Recent acknowledgment) where counting dup-acks is no longer done
        instead time is used to knwo when to retransmit. (see the I-D)
 - TLP (Tail Loss Probe) where we will probe for tail-losses to attempt
        to try not to take a retransmit time-out. (see the I-D)
 - Burst mitigation using TCPHTPS
 - PRR (partial rate reduction) see the RFC.

Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.

Note that any connection that does not support SACK will be kicked
back to the "default" base  FreeBSD stack (currently known as "default").

To build this into your kernel you will need to enable in your
kernel:
   makeoptions WITH_EXTRA_TCP_STACKS=1
   options TCPHPTS

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

6 years agonetbsd-tests: grep(1): Add test for -c flag
kevans [Thu, 7 Jun 2018 18:06:01 +0000 (18:06 +0000)]
netbsd-tests: grep(1): Add test for -c flag

Someone might be inclined to accidentally break this. someone might have
written said test because they broke it locally.

6 years agoAccount for dmap limit when selecting the pages for the bootstrap
kib [Thu, 7 Jun 2018 17:04:34 +0000 (17:04 +0000)]
Account for dmap limit when selecting the pages for the bootstrap
pagetables.

physmap[] can be inconsistent with the physical memory limit due to
buggy bios, or to the hw.physmem tunable. Since bootstrap pagetables
are initialized by accesses through the DMAP, we must ensure that DMAP
really cover the selected pages. This is only relevant when machine
has less than 4G RAM and buggy BIOS, which is the combination on Acer
Chromebook 720.

The call to mp_bootaddress() is moved later to have Maxmem initialized.

An alternative could be to always cover 4G for DMAP, but this change
seems to be simpler.

Reported and tested by: grembo
Reviewed by: royger
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15675

6 years agoStop using head(1) which is not available in installworld.
bdrewery [Thu, 7 Jun 2018 16:16:22 +0000 (16:16 +0000)]
Stop using head(1) which is not available in installworld.

installworld should not be executing this anyhow but there is some
obscure case doing it still.  The head(1) binary is not part of
ITOOLS and there's no need to add it.

MFC after: 1 week
Sponsored by: Dell EMC

6 years agodev/ofw: Fix ofw_fdt_getprop() return values to match documentation
leitao [Thu, 7 Jun 2018 15:59:08 +0000 (15:59 +0000)]
dev/ofw: Fix ofw_fdt_getprop() return values to match documentation

Fix the behavior of ofw_fdt_getprop() and ofw_fdt_getprop() functions to match
the documentation as the non-fdt code.

Submitted by: Luis Pires <lffpires@ruabrasil.org>
Reviewed by: manu, jhibbits
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D15680

6 years agoUnbreak dtrace runtime for udp after svn r334719 SO_REUSEPORT commit.
sbruno [Thu, 7 Jun 2018 15:27:07 +0000 (15:27 +0000)]
Unbreak dtrace runtime for udp after svn r334719 SO_REUSEPORT commit.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limeligght Networks

6 years agox86: reorganize code that deals with unexpected NMI-s
avg [Thu, 7 Jun 2018 14:46:52 +0000 (14:46 +0000)]
x86: reorganize code that deals with unexpected NMI-s

Expected NMI-s are those than are either generated by the software (such
as a CPU sending NMI to other CPU) or generated by the hardware after
the software configured it to do so (such as NMI-s on PMC events).

Some unexpected NMI-s can be caused by hardware failures and it is
possible to inquire the hardware about them (somewhat like MCA but much
more primitive) using an EISA mechanism.  In some cases the origin of
the NMI can remain truly unknown.

This commit should not change any functionality.  It just reorganizes
the code, so that it is easier to extend with new checks for the origin
of the NMI.  Also, it frees the code that has nothing to do with ISA
from DEV_ISA.

MFC after: 3 weeks

6 years agoexpand descriptions of x86 panic_on_nmi and kdb_on_nmi sysctls
avg [Thu, 7 Jun 2018 14:23:31 +0000 (14:23 +0000)]
expand descriptions of x86 panic_on_nmi and kdb_on_nmi sysctls

The descriptions were as terse as the variable names and they did not
explain additional conditions for knobs.

MFC after: 1 week

6 years agomd: use prestaged mfs_root
leitao [Thu, 7 Jun 2018 13:57:34 +0000 (13:57 +0000)]
md: use prestaged mfs_root

On PowerNV systems, the rootfs is passed through kexec, which loads the rootfs
into memory and set two fdt entries to describe where the file is located in
the memory;

I need to pass this memory region to the md device as a mfs_root, but, current
md driver does not support two things:

 * Just getting a pointer from an external (bootloader) memory. If I need to
workaround it, I would need to declare a static array and memcopy from this
external memory to this static variable.

 * The size of the image. The usage of mfs_root_end, which is not a pointer,
seems to be not possible for this prestaged scenario.

This patch simply adds a new way to load mfs_root from memory.

Differential Revision: https://reviews.freebsd.org/D15625
Approved by: kib, jhibbits (mentor)