Commit Graph

230221 Commits

Author SHA1 Message Date
Conrad Meyer
6771d4a815 interp_lua: Register io/loader with regular Lua module system
Reviewed by:	kevans
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D14421
2018-02-18 01:13:58 +00:00
Kyle Evans
faf2ee299c stand/lua: Remove some debugging bits that snuck in... gr... 2018-02-18 01:01:15 +00:00
Kyle Evans
15d8e03c32 stand/lua: Fix module_path handling with multiple kernels
Once we've successfully loaded a kernel, we add its directory to
module_path. If we switch kernels with the kernel selector, we again prepend
the kernel directory to the current module_path and end up with multiple
kernel paths, potentially with mismatched kernel/modules, added to
module_path.

Fix it by caching module_path at load() time and using the cached version
whenever we load a new kernel.
2018-02-18 00:56:12 +00:00
Kyle Evans
7fc96e380a stand/lua: Fix verbiage and some typos
"other_kernel" is decidedly not spelled "other_kern"
2018-02-18 00:44:09 +00:00
Ian Lepore
07fca7ace2 Fix fallout from the import of fresh dts source files from linux 4.15. It
appears that node names no longer include leading zeroes in the @address
qualifiers, so we have to search for the nodes involved in interrupt fixup
using both flavors of name to be compatible with old and new .dtb files.

(You know you're in a bad place when you're applying a workaround to code
that exists only as a workaround for another problem.)
2018-02-18 00:02:09 +00:00
Ian Lepore
02b84ad865 Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called.
Also, do callout_init() very early in attach, so that callout_drain()
can be called in detach without worrying about whether it ever got init'd.
2018-02-17 23:39:10 +00:00
Ian Lepore
47d67d2451 Do not try to deallocate memory that wasn't allocated (you'd think that
would be safe, but the function also tries to destroy mutexes that never
got created).

I guess this can only happen when imx_ehci_detach() is called on the
error-exit path from imx_ehci_attach(), and that path never got exercised
before today.
2018-02-17 23:23:27 +00:00
Hans Petter Selasky
9a323f25ab Implement spin_trylock_irq() function macro in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 22:45:15 +00:00
Hans Petter Selasky
1169b94c7b Stub more lockdep function macros in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 22:41:20 +00:00
Hans Petter Selasky
94b9710bc7 Implement get_task_pid() function macro in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 22:33:26 +00:00
Conrad Meyer
b216e997af liblua: Emulate DIR, opendir, fdopendir, closedir
In a similar fashion to FILE, provide thin shims for the standard directory
manipulation functions.

Reviewed by:	imp
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D14417
2018-02-17 22:18:39 +00:00
Conrad Meyer
f276951a4d liblua: Clean up io/loader C module registration
Utilize registration APIs Lua provides to make module definition a little
cleaner.

Discussed with:	imp
Sponsored by:	Dell EMC Isilon
2018-02-17 22:17:21 +00:00
Hans Petter Selasky
314d034088 Allow the put_user() function macro to put constant values by using the
existing __put_user() macro.

MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 21:47:15 +00:00
Hans Petter Selasky
2460cbb4a6 Implement BUILD_BUG_ON_INVALID() function macro in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 21:40:19 +00:00
Hans Petter Selasky
03f8ddedf0 Add support for printk_ratelimit() function macro and improve the existing
printk_ratelimited() function macro to return a boolean stating if there
was a printout, true, or not, false.

MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 21:25:19 +00:00
Justin Hibbits
bce6d88bc1 Merge AIM and Book-E PCPU fields
This is part of a long-term goal of merging Book-E and AIM into a single GENERIC
kernel.  As more work is done, the struct may be optimized further.

Reviewed by:	nwhitehorn
2018-02-17 20:59:12 +00:00
Hans Petter Selasky
e35dc5149d Add support for kref_read() function in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 20:56:35 +00:00
Hans Petter Selasky
13a27c3b43 Add support for mmgrab() function in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 20:52:54 +00:00
Hans Petter Selasky
2060ca654e Add support for __percpu and __weak macros in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 20:50:18 +00:00
Hans Petter Selasky
7353335d1c Move the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the
LinuxKPI to be compatible with Linux. No functional change.

MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 20:37:21 +00:00
Hans Petter Selasky
1249c589b6 Add checks for valid IRQ tag before setting up or tearing down an interrupt
handler in the LinuxKPI. This is needed when the interrupt handler is disabled
before freeing the interrupt.

MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
2018-02-17 20:09:43 +00:00
Emmanuel Vadot
0f7a6420fe aw_mmc: Only change the clock if it has really changed
This also seems to fix problem when booting Pine64 from the mmc.

Tested On:	Pine64
Tested On:	Pine64-LTS
2018-02-17 18:30:25 +00:00
Mateusz Guzik
8bf6ff2226 Revert r329448.
Turns out is is actually racy, reproducible with stress2/misc/truss.sh

Requested by:	kib
2018-02-17 17:23:43 +00:00
Hans Petter Selasky
426ded2c0b Remove unused bus_autoconf section from usb.ko.
Sponsored by:	Mellanox Technologies
2018-02-17 14:44:03 +00:00
Hans Petter Selasky
78b52692f2 Remove obsolete tool, bus_autoconf, which is replaced by devmatch(8). 2018-02-17 14:40:28 +00:00
Hans Petter Selasky
201c73815f 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
2018-02-17 14:34:47 +00:00
Kyle Evans
4afa0076c5 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
2018-02-17 14:30:39 +00:00
Hans Petter Selasky
974a95948a 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
2018-02-17 13:32:29 +00:00
Hans Petter Selasky
9a44db43ea 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
2018-02-17 13:13:55 +00:00
Hans Petter Selasky
171164e50d Revert redundant parts of r329440 after recent devmatch(8) changes.
Sponsored by:	Mellanox Technologies
2018-02-17 12:38:46 +00:00
Mariusz Zaborski
2ad275d20f Capsicumize uuidgen. 2018-02-17 12:32:53 +00:00
Mariusz Zaborski
4fc0a2791e 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)
2018-02-17 12:22:29 +00:00
Mateusz Guzik
e4ccf57fdc 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).
2018-02-17 12:07:09 +00:00
Mateusz Guzik
ad58e5e86c exit: stop doing PROC_SLOCK just to call proc_reap
It immediately does PROC_SUNLOCK anyway and the lock plays no role.
2018-02-17 09:03:11 +00:00
Mateusz Guzik
9c0e785c58 exit: get rid of PROC_SLOCK when checking a process to report
All accessed fields are protected with already held process lock.
2018-02-17 08:48:45 +00:00
Hans Petter Selasky
af4010be77 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
2018-02-17 08:12:35 +00:00
Warner Losh
3fa2c0489b 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
2018-02-17 06:57:43 +00:00
Warner Losh
247f52f185 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
2018-02-17 06:57:38 +00:00
Warner Losh
d38a8a7aa5 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
2018-02-17 06:57:34 +00:00
Warner Losh
5e0195c8f5 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
2018-02-17 06:57:30 +00:00
Warner Losh
b9c40202d8 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
2018-02-17 06:57:25 +00:00
Warner Losh
7e1637e491 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
2018-02-17 06:57:21 +00:00
Warner Losh
1e7e4fd25a 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@
2018-02-17 06:57:17 +00:00
Warner Losh
a164a319eb 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
2018-02-17 06:57:12 +00:00
Warner Losh
48c1581df5 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
2018-02-17 06:57:08 +00:00
Warner Losh
a35ddacab7 Fixup minor nits in the PNP_INFO protocol.
Sponsored by: Netflix
2018-02-17 06:57:03 +00:00
Kyle Evans
32a5a33ec5 stand/lua: Debugging string snuck in... 2018-02-17 05:53:41 +00:00
Kyle Evans
24a1bd54dc 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.
2018-02-17 05:52:25 +00:00
Kyle Evans
c959454232 stand/lua: Check for nil (GELI prompt) 2018-02-17 05:28:06 +00:00
Kyle Evans
11cac43197 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.
2018-02-17 05:26:28 +00:00