]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoFix USB driver matching in devmatch(8).
hselasky [Sat, 17 Feb 2018 14:34:47 +0000 (14:34 +0000)]
Fix USB driver matching in devmatch(8).

Multiple drivers can match on the same USB device and the order of loading
decides which driver gets the device. Use the supplied mask value as an
indication of priority, so that vendor specific device drivers are loaded
before more generic ones.

Sponsored by: Mellanox Technologies

6 years agostand/lua: dumpModules => lsModules
kevans [Sat, 17 Feb 2018 14:30:39 +0000 (14:30 +0000)]
stand/lua: dumpModules => lsModules

rgrimes@ notes that this behavior is more befitting of the latter name than
the former, and I'm inclined to agree.

Reported by: rgrimes

6 years agoFix handling of "one_nomatch" shell variable to preserve its contents
hselasky [Sat, 17 Feb 2018 13:32:29 +0000 (13:32 +0000)]
Fix handling of "one_nomatch" shell variable to preserve its contents
appearing as a single argument passed to devmatch(8).

Don't depend on "sort" utility from usr/bin which might not be
available when devd is started.

Sponsored by: Mellanox Technologies

6 years agoInvoke devmatch rc.d script directly instead of depending on "service"
hselasky [Sat, 17 Feb 2018 13:13:55 +0000 (13:13 +0000)]
Invoke devmatch rc.d script directly instead of depending on "service"
which is installed in usr/sbin and might not be available at the time
devd is started.

Sponsored by: Mellanox Technologies

6 years agoRevert redundant parts of r329440 after recent devmatch(8) changes.
hselasky [Sat, 17 Feb 2018 12:38:46 +0000 (12:38 +0000)]
Revert redundant parts of r329440 after recent devmatch(8) changes.

Sponsored by: Mellanox Technologies

6 years agoCapsicumize uuidgen.
oshogbo [Sat, 17 Feb 2018 12:32:53 +0000 (12:32 +0000)]
Capsicumize uuidgen.

6 years agoIntroduce channel flags in libcasper.
oshogbo [Sat, 17 Feb 2018 12:22:29 +0000 (12:22 +0000)]
Introduce channel flags in libcasper.

Instead of passing flags (which describe a type of nvlist)
every send/recv we remember them in channel.
It's enough for use to extract them only during unwrap.
This simplify use of Casper.

Reviewed by: bruffer@, bcr@ (both man page)
Differential Revision: https://reviews.freebsd.org/D14196 (man page)

6 years agoUndo LOCK_PROFILING pessimisation after r313454 and r313455
mjg [Sat, 17 Feb 2018 12:07:09 +0000 (12:07 +0000)]
Undo LOCK_PROFILING pessimisation after r313454 and r313455

With the option used to compile the kernel both sx and rw shared ops would
always go to the slow path which added avoidable overhead even when the
facility is disabled.

Furthermore the increased time spent doing uncontested shared lock acquire
would be bogusly added to total wait time, somewhat skewing the results.

Restore old behaviour of going there only when profiling is enabled.

This change is a no-op for kernels without LOCK_PROFILING (which is the
default).

6 years agoexit: stop doing PROC_SLOCK just to call proc_reap
mjg [Sat, 17 Feb 2018 09:03:11 +0000 (09:03 +0000)]
exit: stop doing PROC_SLOCK just to call proc_reap

It immediately does PROC_SUNLOCK anyway and the lock plays no role.

6 years agoexit: get rid of PROC_SLOCK when checking a process to report
mjg [Sat, 17 Feb 2018 08:48:45 +0000 (08:48 +0000)]
exit: get rid of PROC_SLOCK when checking a process to report

All accessed fields are protected with already held process lock.

6 years agoCompile fix for GCC in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 08:12:35 +0000 (08:12 +0000)]
Compile fix for GCC in the LinuxKPI.

Older versions of GCC don't allow flexible array members in a union.
Use a zero length array instead.

MFC after: 1 week
Reported by: jbeich@
Sponsored by: Mellanox Technologies

6 years agoImplement --hints to read hints file directly
imp [Sat, 17 Feb 2018 06:57:43 +0000 (06:57 +0000)]
Implement --hints to read hints file directly

In testing, it's often useful to copy a few files into a directory and
kldxref them to ensure that particular cases are handled correctly.
Add --hints (-h) to facilitate this testing and enable future
automated testing.

Sponsored by: Netflix

6 years agoPass in the NOMATCH event to devmatch
imp [Sat, 17 Feb 2018 06:57:38 +0000 (06:57 +0000)]
Pass in the NOMATCH event to devmatch

In devd/devmatch.conf, we need to pass the event to the devmatch
serivce. It gets passed to devmatch -p for matching. We always pass
this, unlike hps' original patch, so we kill two birds with one stone
and only match modules to the event passed in.

Submitted by: hps@
Sponsored by: Netflix

6 years agoAdd option to parse NOMATCH event and suggest modules to load
imp [Sat, 17 Feb 2018 06:57:34 +0000 (06:57 +0000)]
Add option to parse NOMATCH event and suggest modules to load

Add --nomatch/-p to search for individual drivers based on a NOMATCH
event from devd.

Submitted by: hps (earlier version)
Sponsored by: Netflix

6 years agoTweak the 'I' flagged value
imp [Sat, 17 Feb 2018 06:57:30 +0000 (06:57 +0000)]
Tweak the 'I' flagged value

'I' was omitting 'zero' values. This is not quite correct, and was put
in as a hack but not documented. Remove it. If we find what the hack
was really needed for, we'll either fix the need for it, or invent a
new flagged value type.

Submitted by: hps@
Sponsored by: Netflix

6 years agoImplement 'T' field matching.
imp [Sat, 17 Feb 2018 06:57:25 +0000 (06:57 +0000)]
Implement 'T' field matching.

Implement 'T' field matching. This is needed to prevent false
positives. However, it's not general enough. It only handles one field
and there's a ton of edge cases even with that it likely wouldn't
handle. To do it more generally and also eliminate a lot of the
hackiness that's in this program now, we'd need to creating
directories for lookups ala awk, pearl, python, etc. It appears to be
sufficient, though, to get my keyboard loaded on boot.

Sponsored by: Netflix

6 years agoIf we're passed an argument, then treat it as a single NOMATCH event
imp [Sat, 17 Feb 2018 06:57:21 +0000 (06:57 +0000)]
If we're passed an argument, then treat it as a single NOMATCH event
to parse rather than searching for all events. Pass with new -p arg to
devmatch. devmatch will use that one event rather than walking the
entire tree.

kldload will stop at the first failure. So we need to loop.  Also,
symbolic links may confused kldload into trying (and failing) to load
multiple modules at once, so guard against that.

Noticed by: hps (with similar patch)
Sponsored by: Netflix

6 years agoCorrect the PNP information generated by the usb driver to match the
imp [Sat, 17 Feb 2018 06:57:17 +0000 (06:57 +0000)]
Correct the PNP information generated by the usb driver to match the
artificial NOMATCH usb does in lieu of creating a device_t for devices
with no drivers. Also, correct bus to be 'uhub' since where USB
devices attach, even though 'usb' is more logical, we need the
physical bus here.

Submitted by: hps@

6 years agoWarn when we encounter unknown PNP field specifiers.
imp [Sat, 17 Feb 2018 06:57:12 +0000 (06:57 +0000)]
Warn when we encounter unknown PNP field specifiers.

The 'T' field went unimplemented for months due to a lack of warning.
Add a warnings to detect mistakes sooner.

Sponsored by: Netflix

6 years agoAdd description for T specifier. It's for PNP keys that are checked
imp [Sat, 17 Feb 2018 06:57:08 +0000 (06:57 +0000)]
Add description for T specifier. It's for PNP keys that are checked
programatically that must be true for a device to match, but aren't in
the table as discrete fields.

Sponsored by: Netflix

6 years agoFixup minor nits in the PNP_INFO protocol.
imp [Sat, 17 Feb 2018 06:57:03 +0000 (06:57 +0000)]
Fixup minor nits in the PNP_INFO protocol.

Sponsored by: Netflix

6 years agostand/lua: Debugging string snuck in...
kevans [Sat, 17 Feb 2018 05:53:41 +0000 (05:53 +0000)]
stand/lua: Debugging string snuck in...

6 years agostand/lua: Style pass
kevans [Sat, 17 Feb 2018 05:52:25 +0000 (05:52 +0000)]
stand/lua: Style pass

These are the style points that I'd like to try and maintain in our lua
scripts:
- Parentheses around conditionals
- Trailing semicolons, except on block terminators
- s:method(...) instead of string.method(s, ...) where applicable

There's likely more, but that'll get hammered out as we continue.

6 years agostand/lua: Check for nil (GELI prompt)
kevans [Sat, 17 Feb 2018 05:28:06 +0000 (05:28 +0000)]
stand/lua: Check for nil (GELI prompt)

6 years agostand/lua: Add optional GELI passphrase prompt
kevans [Sat, 17 Feb 2018 05:26:28 +0000 (05:26 +0000)]
stand/lua: Add optional GELI passphrase prompt

Prompt for GELI passphrase when geom_eli_passphrase_prompt has been set to
"YES" in loader.conf(5).

This entailed breaking out the password prompt into its own function that
can be reused between the password compare bits and this prompt that simply
takes the entered password and passes it along in the environment as
kern.geom.eli.passphrase.

I've also added a TODO to re-evaluate later if we want the "password
masking" -- it is currently not functional, so one still can't observe the
length of the password typed at the prompt.

6 years agostand/lua: Try to load alternate kernels as directories first
kevans [Sat, 17 Feb 2018 05:02:38 +0000 (05:02 +0000)]
stand/lua: Try to load alternate kernels as directories first

This is the procedure that config.loadkernel tries to go through, but
reloading kernel config didn't use this function. Amend config.loadkernel to
take an optional other_kernel.

While here, be a little more verbose ("Trying to load kernel") so that it's
easy to follow where we've gone wrong.

6 years agostand/lua: Correct test sense, this should have been 'not nil'
kevans [Sat, 17 Feb 2018 04:46:06 +0000 (04:46 +0000)]
stand/lua: Correct test sense, this should have been 'not nil'

6 years agostand/lua: Address some nits
kevans [Sat, 17 Feb 2018 04:43:41 +0000 (04:43 +0000)]
stand/lua: Address some nits

1.) Instead of string.function(s, ...), use s:function(...)
2.) Don't try to concatenate `res`, it was just tested to be nil
3.) Note that "Loading configuration" is configured modules, and be a little
more precise in mentioning what failed ("loading of one or more modules")

6 years agostand/lua: Add debug method to dump modules
kevans [Sat, 17 Feb 2018 04:33:37 +0000 (04:33 +0000)]
stand/lua: Add debug method to dump modules

6 years agostand/lua: Correct some trivial errors in config
kevans [Sat, 17 Feb 2018 04:22:36 +0000 (04:22 +0000)]
stand/lua: Correct some trivial errors in config

An empty module_path to start with isn't ideal, but if all modules are
contained within a kernel directory (which is what we just tested) then it
isn't strictly an error. Don't assume that module_path has a value already.

When we fail to load the kernel, printing the result (which is guaranteed to
be nil) is not intended; print the name of the kernel.

6 years agostand/lua: Color non-default kernels blue
kevans [Sat, 17 Feb 2018 04:07:16 +0000 (04:07 +0000)]
stand/lua: Color non-default kernels blue

6 years agostand/lua: Correct interpretation of autoboot_delay
kevans [Sat, 17 Feb 2018 03:39:55 +0000 (03:39 +0000)]
stand/lua: Correct interpretation of autoboot_delay

autoboot_delay=NO is documented to wait for input and *not* autoboot, which
is the exact opposite of the current behavior.

Additionally, autoboot_delay=-1 is documented to disallow the user from
interrupting the boot (i.e. autoboot immediately), which was not previously
honored.

This also fixes the case insensitive comparison to be truly case
insensitive. This is kind of nit-picky, but the previous version would only
accept "no" and "NO".

6 years agostand/lua: Enable menu autoboot; it seems to work
kevans [Sat, 17 Feb 2018 03:13:05 +0000 (03:13 +0000)]
stand/lua: Enable menu autoboot; it seems to work

6 years agostand/lua: Don't set autoboot_delay=NO in menu autoboot sequence
kevans [Sat, 17 Feb 2018 03:12:35 +0000 (03:12 +0000)]
stand/lua: Don't set autoboot_delay=NO in menu autoboot sequence

We'll set it later if "Escape to loader prompt" is actually chosen, there's
no need to be setting it here.

6 years agoOn process exit signal the parent after dropping the proctree lock.
mjg [Sat, 17 Feb 2018 00:24:50 +0000 (00:24 +0000)]
On process exit signal the parent after dropping the proctree lock.

6 years agoUnref the prison after proctree is dropped.
mjg [Sat, 17 Feb 2018 00:23:56 +0000 (00:23 +0000)]
Unref the prison after proctree is dropped.

6 years agoPostpone sx_sunlock(&proctree_lock) on fork until after allproc is dropped.
mjg [Sat, 17 Feb 2018 00:23:28 +0000 (00:23 +0000)]
Postpone sx_sunlock(&proctree_lock) on fork until after allproc is dropped.

There is a significant contention on the lock during -j 128 package build.
This change drops total wait time on this lock by 60%.

6 years agoTidy up kern_wait6
mjg [Sat, 17 Feb 2018 00:21:50 +0000 (00:21 +0000)]
Tidy up kern_wait6

- don't relock curproc in msleep
- don't relock proctree if P_STATCHILD is spotted
- reformat the proc_to_reap call in the main loop

6 years agoRevert r329269.
benno [Sat, 17 Feb 2018 00:12:30 +0000 (00:12 +0000)]
Revert r329269.

I tried to rework a section to fit inside 80 columns but the change ended
up being functional. Back this out so I can readdress.

6 years agostand/lua: Make CAROUSEL_ENTRY func parameters consistent with name
kevans [Fri, 16 Feb 2018 23:59:50 +0000 (23:59 +0000)]
stand/lua: Make CAROUSEL_ENTRY func parameters consistent with name

We have no need for the index yet, but add it anyways to keep signatures
consistent.

6 years agoRemove unused symbols.
kib [Fri, 16 Feb 2018 23:18:42 +0000 (23:18 +0000)]
Remove unused symbols.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agostand/lua: Don't reload kernel config if we only have one kernel
kevans [Fri, 16 Feb 2018 22:57:52 +0000 (22:57 +0000)]
stand/lua: Don't reload kernel config if we only have one kernel

Don't move this into config.reload because we may want to force reloads if
/boot changes out from under us later.

As a caution: changing kernels in lualoader at the moment might not be
loading all of your modules (in my testing, at least) from loader.conf(5).
This is a known problem.

6 years agostand/lua: Don't try to divide by 0; do nothing
kevans [Fri, 16 Feb 2018 22:51:08 +0000 (22:51 +0000)]
stand/lua: Don't try to divide by 0; do nothing

6 years agostand/lua: Allow MENU_RETURN items to have a func, fix escape to prompt
kevans [Fri, 16 Feb 2018 22:17:30 +0000 (22:17 +0000)]
stand/lua: Allow MENU_RETURN items to have a func, fix escape to prompt

6 years agozfs: fix formatting in a log statement
asomers [Fri, 16 Feb 2018 21:59:08 +0000 (21:59 +0000)]
zfs: fix formatting in a log statement

Submitted by: Dave Baukus <daveb@spectralogic.com>
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agotrpt(8): Clean up build hack to detect ancient compiler
cem [Fri, 16 Feb 2018 20:46:44 +0000 (20:46 +0000)]
trpt(8): Clean up build hack to detect ancient compiler

Detect ancient GCC specifically, rather than using target architecture as a
crude heuristic.

Side note: compilers should really ignore -Wno- and -Wno-error= flags they
don't recognize.  Seems like modern compilers produce warnings instead of
errors.  Though, with -Werror they turn into errors.  Clang's error can be
disabled with -Wno-error=unknown-warning-option, but GCC doesn't seem to
have a named method to disable the specific warning.

Submitted by: rpokala@ (earlier version)
Suggested by: rpokala@
Reviewed by: tinderbox
Sponsored by: Dell EMC Isilon

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Fri, 16 Feb 2018 20:45:32 +0000 (20:45 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r325330).

MFC after: 3 months
X-MFC-With: r327952
PR: 224669

6 years agolua-test: Image the loader test directory if it doesn't exist yet
kevans [Fri, 16 Feb 2018 20:26:18 +0000 (20:26 +0000)]
lua-test: Image the loader test directory if it doesn't exist yet

6 years agoDefault to /tmp/loadertest for lua test scripts
kevans [Fri, 16 Feb 2018 20:23:48 +0000 (20:23 +0000)]
Default to /tmp/loadertest for lua test scripts

6 years agoVendor import of llvm release_60 branch r325330:
dim [Fri, 16 Feb 2018 19:10:15 +0000 (19:10 +0000)]
Vendor import of llvm release_60 branch r325330:
https://llvm.org/svn/llvm-project/llvm/branches/release_60@325330

6 years agostand/lua: Use escaped dot instead of single character class
kevans [Fri, 16 Feb 2018 18:50:06 +0000 (18:50 +0000)]
stand/lua: Use escaped dot instead of single character class

6 years agoFollow r329348 in ipcs for getting rid of the requirement to include SysV IPC
lwhsu [Fri, 16 Feb 2018 18:07:04 +0000 (18:07 +0000)]
Follow r329348 in ipcs for getting rid of the requirement to include SysV IPC
headers with _KERNEL

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D14398

6 years agoxen/pv: remove the attach of the ISA bus from the Xen PV bus
royger [Fri, 16 Feb 2018 18:04:27 +0000 (18:04 +0000)]
xen/pv: remove the attach of the ISA bus from the Xen PV bus

There's no need to attach the ISA bus from the Xen PV one.

Sponsored by:           Citrix Systems R&D

6 years agoDefine CK_MD_TSO for the relevant arches (i386, amd64 and sparc64).
cognet [Fri, 16 Feb 2018 17:50:06 +0000 (17:50 +0000)]
Define CK_MD_TSO for the relevant arches (i386, amd64 and sparc64).
Defaulting to CK_MD_RMO has the unfortunate side effect of generating
memory barriers that are useless on those arches, and the even more
unfortunate side effect of generating lfence/sfence/mfence on i386, even
if older CPUs don't support it.
This should fix the panic reported when using IPFW on a Pentium 3.
Note that mfence and sfence might still be used in a few case, but that
shouldn't happen in FreeBSD right now, and should be fixed upstream first.

MFC after: 1 week

6 years agostand/lua: Chop off the decimal for numbers passed to setcursor
kevans [Fri, 16 Feb 2018 17:46:07 +0000 (17:46 +0000)]
stand/lua: Chop off the decimal for numbers passed to setcursor

Decimals screw up the escape sequence and the cursor will not get set. Right
now this only affects setting the cursor for drawing "Welcome to FreeBSD" --
the resulting number after our (x+(w/2)-9) calculation gets output as
"14.0."

This should be fixed at the interpreter level, rather than here, but this is
not a widespread problem at the moment so we'll fix it up in further work.

Reported by: David Wolfskill <david@catwhisker.org>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D14375

6 years agostand/lua: Correct usage and acceptance of BACKSPACE/DELETE keys
kevans [Fri, 16 Feb 2018 17:42:38 +0000 (17:42 +0000)]
stand/lua: Correct usage and acceptance of BACKSPACE/DELETE keys

6 years agoHandle generic pathconf attributes in the .zfs ctldir
asomers [Fri, 16 Feb 2018 16:56:09 +0000 (16:56 +0000)]
Handle generic pathconf attributes in the .zfs ctldir

MFC instructions: change the value of _PC_LINK_MAX to INT_MAX

Reported by: jhb
MFC after: 19 days
X-MFC-With: 329265
Sponsored by: Spectra Logic Corp

6 years agoPut the pine64 root filesystem on teh correct partition.
andrew [Fri, 16 Feb 2018 16:22:54 +0000 (16:22 +0000)]
Put the pine64 root filesystem on teh correct partition.

The Pine64 root filesystem was incorrectly created directly on the MBR
partition. This can cause the loader to get confused when loading the
kernel from this filesystem.

The loader will see this as a small partition meaning later checks to
ensure it doesn't read past the end of the disk incorrectly report a
failure. This seems to work mostly by accident with the released images as
they are smaller than the reported size, however after growfs has run the
image may no longer boot.

Reviewed by: gjb, emaste, imp
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14343

6 years agoImplement mutex_trylock_recursive() in the LinuxKPI.
hselasky [Fri, 16 Feb 2018 16:01:39 +0000 (16:01 +0000)]
Implement mutex_trylock_recursive() in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoImplement memdup_user_nul() in the LinuxKPI.
hselasky [Fri, 16 Feb 2018 15:52:28 +0000 (15:52 +0000)]
Implement memdup_user_nul() in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoImplement tasklet_enable() and tasklet_disable() in the LinuxKPI.
hselasky [Fri, 16 Feb 2018 15:41:16 +0000 (15:41 +0000)]
Implement tasklet_enable() and tasklet_disable() in the LinuxKPI.

MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoFix a memory leak introduced in r328426.
markj [Fri, 16 Feb 2018 15:41:03 +0000 (15:41 +0000)]
Fix a memory leak introduced in r328426.

ffs_sbget() may return a superblock buffer even if it fails, so the
caller must be prepared to free it in this case. Moreover, when tasting
alternate superblock locations in a loop, ffs_sbget()'s readfunc
callback must free the previously allocated buffer.

Reported and tested by: pho
Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D14390

6 years agoUse the conventional name for an array of pages.
markj [Fri, 16 Feb 2018 15:38:22 +0000 (15:38 +0000)]
Use the conventional name for an array of pages.

No functional change intended.

Discussed with: kib
MFC after: 3 days

6 years agoCorrect module symbol export handling
emaste [Fri, 16 Feb 2018 15:38:02 +0000 (15:38 +0000)]
Correct module symbol export handling

EXPORT_SYMS can be set to YES, NO, a list of symbols to export from a
module, or to a filename containing such a list.  For the case that it
is set to a symbol list, replace spaces in the list with newlines, so
the created file is in the format expected by kmod_syms.awk.

Reviewed by: imp, jhb
MFC after: 1 month
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D14284

6 years agoImplement enable_irq() and disable_irq() in the LinuxKPI.
hselasky [Fri, 16 Feb 2018 15:37:33 +0000 (15:37 +0000)]
Implement enable_irq() and disable_irq() in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoAllow the cmpxchg() macro in the LinuxKPI to work on pointers without
hselasky [Fri, 16 Feb 2018 15:20:21 +0000 (15:20 +0000)]
Allow the cmpxchg() macro in the LinuxKPI to work on pointers without
generating compiler warnings, -Wint-conversion .

Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoRationalize license text on Linuxolator files
emaste [Fri, 16 Feb 2018 15:00:14 +0000 (15:00 +0000)]
Rationalize license text on Linuxolator files

Many licenses on Linuxolator files contained small variations from the
standard FreeBSD license text.  To avoid license proliferation switch to
the standard 2-clause FreeBSD license for those files where I have
permission from each of the listed copyright holders.  Additional files
waiting on permission from others are listed in review D14210.

Approved by: kan, marcel, sos, rdivacky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agostand/lua: Remove sneaky kernel assignment
kevans [Fri, 16 Feb 2018 14:59:11 +0000 (14:59 +0000)]
stand/lua: Remove sneaky kernel assignment

6 years agostand/lua: Create/use some MENU_ constants where applicable
kevans [Fri, 16 Feb 2018 14:57:42 +0000 (14:57 +0000)]
stand/lua: Create/use some MENU_ constants where applicable

6 years agostand/lua: Create a "carousel" menu entry type
kevans [Fri, 16 Feb 2018 14:39:41 +0000 (14:39 +0000)]
stand/lua: Create a "carousel" menu entry type

This is a pre-cursor to boot environment support in lualoader. Create a new
menu item type, "carousel_entry", that generally provides a callback to get
the list of items, a carousel_id for storing the current value, and the
standard name/func functions that an entry has.

The difference between this and a normal menu item, functionally, is that
selecting a carousel item will automatically rotate through available items
and wrap back at the beginning when the list is exhausted.

The 'name' function takes the choice index, current choice, and the list of
choices as parameters so that the menu item can decorate the name freely as
desired.

The 'func' function takes the current choice as a parameter, so it can act
accordingly.

The kernel menu item has been rewritten to use the carousel_entry type as
both an example and initial test of its functionality before it is used for
boot environment options.

6 years agostand/lua: Set ACPI's default the proper way (setACPI)
kevans [Fri, 16 Feb 2018 13:57:43 +0000 (13:57 +0000)]
stand/lua: Set ACPI's default the proper way (setACPI)

6 years agoUse local symbol for offset.
kib [Fri, 16 Feb 2018 13:32:46 +0000 (13:32 +0000)]
Use local symbol for offset.

Small global symbols confuse ddb which matches them against small
unrelated displacements and makes the disassembly ugly.

Reported by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agomove vintr_intercept_enabled under INVARIANTS
avg [Fri, 16 Feb 2018 07:02:14 +0000 (07:02 +0000)]
move vintr_intercept_enabled under INVARIANTS

The function is not used outside of INVARIANTS since r328622.

MFC after: 1 week

6 years agoread-behind / read-ahead support for zfs_getpages()
avg [Fri, 16 Feb 2018 06:59:35 +0000 (06:59 +0000)]
read-behind / read-ahead support for zfs_getpages()

ZFS caches blocks it reads in its ARC, so in general the optional
pages are not as useful as with filesystems that read the data
directly into the target pages.  But still the optional pages
are useful to reduce the number of page faults and associated
VM / VFS / ZFS calls.
Another case that gets optimized (as a side effect) is paging in
from a hole.  ZFS DMU does not currently provide a convenient
API to check for a hole.  Instead it creates a temporary zero-filled
block and allows accessing it as if it were a normal data block.
Getting multiple pages one by one from a hole results in repeated
creation and destruction of the temporary block (and an associated
ARC header).

Tested with fsx using various supported blocks sizes from 512 bytes
to 128 KB and additionally 1 MB.

Please note that in illumos and ZoL they do not do the range-locking in
the page-in path. This is because ZFS has a double-caching problem
between ARC and page cache and that requires zfs_read() and zfs_write()
to consult pages in the page cache. So, in those functions they first
lock a range and then lock pages corresponding to the range. While in
the page-in (and maybe page-out) path they first lock the pages and then
would lock the range. So, they would have a deadlock.

I believe that FreeBSD does not have that problem, because the page-in
deals only with invalid pages while zfs_read() and zfs_write() need to
access only valid pages. They do not wait on a busy page unless it's
already valid.

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

6 years agoPrevent savecore from reading bounds from the current directory.
silby [Fri, 16 Feb 2018 06:51:39 +0000 (06:51 +0000)]
Prevent savecore from reading bounds from the current directory.

Rev 244218 removed the requirement that you provide a dump
directory when checking if there is a coredump ready to be written.
That had the side-effect of causing the bounds file to be read
from the current working directory instead of the dump directory.
As the bounds file is irrelevant when just checking, the simplest
fix is to not read the bounds file when checking.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14383

6 years agoDocument memset_s(3). memset_s(3) is defined in
cy [Fri, 16 Feb 2018 05:48:45 +0000 (05:48 +0000)]
Document memset_s(3). memset_s(3) is defined in
C11 standard (ISO/IEC 9899:2011) K.3.7.4.1 The memset_s function
(p: 621-622)

Fix memset(3) portion of the man page by replacing the first argument
(destination) "b" with "dest", which is more descriptive than "b".
This also makes it consistent with the term used in the memset_s()
portion of the man page.

See also http://en.cppreference.com/w/c/string/byte/memset.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13682

6 years agoThis change fixes duplicate detection of same IOMMU/AMD-Vi device for Ryzen with...
anish [Fri, 16 Feb 2018 05:17:00 +0000 (05:17 +0000)]
This change fixes duplicate detection of same IOMMU/AMD-Vi device for Ryzen with EFR support.

IVRS can have entry of type legacy and non-legacy present at same time for same AMD-Vi device. ivhd driver will ignore legacy if new IVHD type is present as specified in AMD-Vi specification. Earlier both of IVHD entries used and two ivhd devices were created.
Add support for new IVHD type 0x11 and 0x40 in ACPI. Create new struct of type acpi_ivrs_hardware_new for these new type of IVHDs. Legacy type 0x10 will continue to use acpi_ivrs_hardware.

Reviewed by: avg
Approved by: grehan
Differential Revision:https://reviews.freebsd.org/D13160

6 years agostand/lua: Remove a magic number/string (not a trivial literal)
kevans [Fri, 16 Feb 2018 04:59:21 +0000 (04:59 +0000)]
stand/lua: Remove a magic number/string (not a trivial literal)

We'll arbitrarily use KEYSTR_ for string representations of non-trivial
characters.

6 years agostand/lua: Say "loader prompt" instead of "lua interpreter"
kevans [Fri, 16 Feb 2018 04:50:14 +0000 (04:50 +0000)]
stand/lua: Say "loader prompt" instead of "lua interpreter"

Noting that we're in lualoader is nice, but it's not a difference we raelly
need to expose to Fred. Re-word it to match the 4th wording and reduce
differences.

6 years agostand/lua: Remove explicit alias from "Back to main menu"
kevans [Fri, 16 Feb 2018 04:45:53 +0000 (04:45 +0000)]
stand/lua: Remove explicit alias from "Back to main menu"

This removes a redundant alias that has since been converted into a global
alias. It was converted to a global alias before to ensure that we always
have a way to go up one level in the menu.

6 years agostand/lua: Allow menu items to not have explicit aliases
kevans [Fri, 16 Feb 2018 04:44:47 +0000 (04:44 +0000)]
stand/lua: Allow menu items to not have explicit aliases

This will generally be used for cases like "Back to main menu" that already
have global aliases installed.

6 years agostand/lua: Move kernel selection into main menu
kevans [Fri, 16 Feb 2018 04:31:09 +0000 (04:31 +0000)]
stand/lua: Move kernel selection into main menu

This matches the corresponding 4th behavior.

6 years agotrpt(8): Work around GCC4 shenanigans
cem [Fri, 16 Feb 2018 04:30:57 +0000 (04:30 +0000)]
trpt(8): Work around GCC4 shenanigans

Reduce warns to known good value and do not add -Wno- flag the ancient GCC4
does not understand.

Reported by: jhibbits
Sponsored by: Dell EMC Isilon

6 years agoAdd inline to errno.d for translating int to string
dteske [Fri, 16 Feb 2018 04:22:29 +0000 (04:22 +0000)]
Add inline to errno.d for translating int to string

Gives DTrace scripts strerror(3) functionality.

Reviewed by: markj
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D14386

6 years agostand/lua: Consistently use semicolons for line endings
kevans [Fri, 16 Feb 2018 04:10:10 +0000 (04:10 +0000)]
stand/lua: Consistently use semicolons for line endings

6 years agostand/lua: Set reasonable ACPI default based on presence
kevans [Fri, 16 Feb 2018 04:03:15 +0000 (04:03 +0000)]
stand/lua: Set reasonable ACPI default based on presence

Set it based on hint.acpi.0.rsdp. Initially, hint.acpi.0.disabled will be
respected. "Using System Defaults" will override whether it's explicitly
disabled by hint and re-load it based on whether it's present on the system.

Unlike the 4th version, this is not restricted to x86. I have no strong
reasoning for this, so this is definitely open to change.

6 years agostand/lua: Don't descend into an empty kernels submenu
kevans [Fri, 16 Feb 2018 03:14:23 +0000 (03:14 +0000)]
stand/lua: Don't descend into an empty kernels submenu

This submenu is likely going to go away in favor of kernel selection as it
is done in forth at the moment, but for the time being don't descend into it
if we have no kernels available for listing.

6 years agostand/lua: Reduce magic numbers
kevans [Fri, 16 Feb 2018 03:12:24 +0000 (03:12 +0000)]
stand/lua: Reduce magic numbers

Enter/backspace values are hardcoded in both the menu and password scripts.
Separate these out to core for reuse between the two.

6 years agoGet rid of the requirement to include SysV IPC headers with _KERNEL
brooks [Fri, 16 Feb 2018 01:33:01 +0000 (01:33 +0000)]
Get rid of the requirement to include SysV IPC headers with _KERNEL
defined in ipcrm by introducing _WANT_SYSVxxx_INTERNALS defines.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14271

6 years agoNote that on amd64 pmap_enter(psind = 1) works (since r321378).
kib [Fri, 16 Feb 2018 01:08:32 +0000 (01:08 +0000)]
Note that on amd64 pmap_enter(psind = 1) works (since r321378).

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agorc.conf.5: Flip default background_fsck language to match defaults
cem [Fri, 16 Feb 2018 01:03:08 +0000 (01:03 +0000)]
rc.conf.5: Flip default background_fsck language to match defaults

Reviewed by: Daniel O'Connor <darius AT dons.net.au>
Sponsored by: Dell EMC Isilon

6 years agoEliminate bsd.stand.mk and -fPIC 32-bit intel builds
imp [Fri, 16 Feb 2018 00:17:32 +0000 (00:17 +0000)]
Eliminate bsd.stand.mk and -fPIC 32-bit intel builds

OK. We don't really need a bsd.stand.mk, and it was causing a -fPIC
for the toolchain to be added (bogusly) when building on amd64. Pull
all relevant defs back into defs.mk and delete bsd.stand.mk.

This saves about 15-20k on i386 loader and zfsloader which when
combined with Lua give us a lot more stack space in those constrained
environments.

6 years agoOptimize zfsd for the happy case
asomers [Thu, 15 Feb 2018 21:30:30 +0000 (21:30 +0000)]
Optimize zfsd for the happy case

If there are no damaged pools, then ignore all GEOM events.  We only use
them to fix damaged pools.  However, still pay attention to ZFS events.

MFC after: 20 days
X-MFC-With: 329284
Sponsored by: Spectra Logic Corp

6 years agoReduce duplication in __acl_*_(file|link).
brooks [Thu, 15 Feb 2018 21:24:43 +0000 (21:24 +0000)]
Reduce duplication in __acl_*_(file|link).

Add const to new kern_ functions and push down as required.

Reviewed by: rwatson
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14174

6 years agotrpt(8): Sprinkle style(9) and adddress warnings
cem [Thu, 15 Feb 2018 21:06:56 +0000 (21:06 +0000)]
trpt(8): Sprinkle style(9) and adddress warnings

Update function definitions to post-ISO style; remove deprecated "register"
keyword.  Correct indentation.  Sprinkle 'static' on file-local variables.

Appease warnings at WARNS=6, for both Clang and GCC.

Sponsored by: Dell EMC Isilon

6 years agoChange size of padding to reflect reality. No functional change.
jkim [Thu, 15 Feb 2018 20:42:38 +0000 (20:42 +0000)]
Change size of padding to reflect reality.  No functional change.

Discussed with: kib

6 years agolibsa: Consolidate tftp sendrecv into net.c sendrecv
kevans [Thu, 15 Feb 2018 19:49:15 +0000 (19:49 +0000)]
libsa: Consolidate tftp sendrecv into net.c sendrecv

bootp/arp/rarp/rpc all use the sendrecv implementation in net.c. tftp has
its own implementation because it passes an extra parameter into the recv
callback for the received payload type to be held.

These sendrecv implementations are otherwise equivalent, so consolidate
them. The other users of sendrecv won't be using the extra argument to recv,
but this gives us only one place to worry about respecting timeouts and one
consistent timeout behavior.

Tested by: sbruno
Reviewed by: sbruno, tsoome
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14373

6 years agoSimplify building before installing.
imp [Thu, 15 Feb 2018 18:58:03 +0000 (18:58 +0000)]
Simplify building before installing.

6 years agoReport the number of remaining retries when we have an error that
imp [Thu, 15 Feb 2018 18:57:54 +0000 (18:57 +0000)]
Report the number of remaining retries when we have an error that
we're retrying.

6 years agoReduce duplication in __mac_*_(file|link)(2) implementation.
brooks [Thu, 15 Feb 2018 18:57:22 +0000 (18:57 +0000)]
Reduce duplication in __mac_*_(file|link)(2) implementation.

Reviewed by: rwatson
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14175