Commit Graph

230214 Commits

Author SHA1 Message Date
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
Kyle Evans
18c286a0ac 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.
2018-02-17 05:02:38 +00:00
Kyle Evans
4d290ffb2d stand/lua: Correct test sense, this should have been 'not nil' 2018-02-17 04:46:06 +00:00
Kyle Evans
7104917375 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")
2018-02-17 04:43:41 +00:00
Kyle Evans
41e77b5399 stand/lua: Add debug method to dump modules 2018-02-17 04:33:37 +00:00
Kyle Evans
c990f0a990 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.
2018-02-17 04:22:36 +00:00
Kyle Evans
bcf48a159e stand/lua: Color non-default kernels blue 2018-02-17 04:07:16 +00:00
Kyle Evans
702b460d41 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".
2018-02-17 03:39:55 +00:00