]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoBuild ofw_iicbus as a module if OPT_FDT is defined.
ian [Mon, 19 Feb 2018 00:47:03 +0000 (00:47 +0000)]
Build ofw_iicbus as a module if OPT_FDT is defined.

6 years agomtx: add mtx_spin_wait_unlocked
mjg [Mon, 19 Feb 2018 00:38:14 +0000 (00:38 +0000)]
mtx: add mtx_spin_wait_unlocked

The primitive can be used to wait for the lock to be released. Intended
usage is for locks in structures which are about to be freed.

The benefit is the avoided interrupt enable/disable trip + atomic op to
grab the lock and shorter wait if the lock is held (since there is no
worry someone will contend on the lock, re-reads can be more aggressive).

Briefly discussed with:  kib

6 years agoProvide public declarations for ofw_spibus_driver and ofw_spibus_devclass
ian [Sun, 18 Feb 2018 23:35:23 +0000 (23:35 +0000)]
Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass
so other drivers can refer to them in DRIVER_MODULE() decls.

6 years agoPrint more info for -v runs and temp hack for usb vs uhub
imp [Sun, 18 Feb 2018 23:16:16 +0000 (23:16 +0000)]
Print more info for -v runs and temp hack for usb vs uhub

Despite best efforts to regularize, there's a few tables in the system
that still report they are for bus usb when they are really for bus
uhub (where usb devices attach). Add a temporary workaround for this
until these places have been eliminated (likely my fault).

Second, when running verbose, describe what we're doing when
searching. This output can be quite long, but says exactly what's
going on (this output is to stdout, so it's useless for scripting).

6 years agoProvide a public function to acquire a gpio pin by giving the property name
ian [Sun, 18 Feb 2018 23:08:43 +0000 (23:08 +0000)]
Provide a public function to acquire a gpio pin by giving the property name
and index.  A private function to do exactly that already existed, so this
renames gpio_pin_get_by_ofw_impl() to gpio_pin_get_by_ofw_propidx() and
provides a declaration for it in a public header.

Previously there were functions to get a pin by property name (assuming
there would only be one pin defined for the name), or by index (asuming
the property has the standard name "gpios").  It turns out there are
devicetree bindings that describe properties with names other than "gpios"
which can describe multiple pins.  Hence the need to retrieve the Nth item
from a named property.

6 years agoAdd the MODULE_DEPEND()s needed so that the kernel linker can resolve all
ian [Sun, 18 Feb 2018 23:01:33 +0000 (23:01 +0000)]
Add the MODULE_DEPEND()s needed so that the kernel linker can resolve all
the symbols at load time when iicbus is not compiled into the kernel.

6 years agoAdd iic_recover_bus.c, now part of iicbus. This should have been added
ian [Sun, 18 Feb 2018 22:57:04 +0000 (22:57 +0000)]
Add iic_recover_bus.c, now part of iicbus.  This should have been added
as part of r320463.

6 years agoArrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain.
ian [Sun, 18 Feb 2018 22:54:19 +0000 (22:54 +0000)]
Arrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain.
Whitespace only, no functional changes.

6 years agoexit: get rid of PROC_SLOCK when checking a process to report, take #2
mjg [Sun, 18 Feb 2018 21:07:15 +0000 (21:07 +0000)]
exit: get rid of PROC_SLOCK when checking a process to report, take #2

The suspension counter needs synchronisation through slock, but we don't
need it to check if inspecting the counter is necessary to begin with.
In the common case it is not, thus avoid the lock if possible.

Reviewed by: kib
Tested by: pho

6 years agoGive the imx_i2c driver its own name, set up its relationship to ofw_iicbus.
ian [Sun, 18 Feb 2018 20:08:35 +0000 (20:08 +0000)]
Give the imx_i2c driver its own name, set up its relationship to ofw_iicbus.
Previously it called itself 'iichb' to link up with the EARLY_DRIVER_MODULE
declaration in ofw_iicbus.c.

6 years agoFix broken assertion in r329520.
oshogbo [Sun, 18 Feb 2018 20:04:39 +0000 (20:04 +0000)]
Fix broken assertion in r329520.

Reported by: pho@ lwhsu@

6 years agoAllow i2c hardware drivers to declare their own relationships to ofw_iicbus
ian [Sun, 18 Feb 2018 19:33:28 +0000 (19:33 +0000)]
Allow i2c hardware drivers to declare their own relationships to ofw_iicbus
rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in
the ofw_iicbus source.  This means hw drivers will no longer be required to
use one of a few predefined driver names.  They will also now be able to
decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE
and to set which pass to attach on for early modules.

Mainly, this adds extern declarations for the driver and devclass variables.
It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant
with the way we use ofw_ prefixes on this stuff.

6 years agoCorrect/improve the descriptions if kern.ipc.(shmsegs,sema,msqids).
brooks [Sun, 18 Feb 2018 19:19:36 +0000 (19:19 +0000)]
Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids).

The description of kern.ipc.shmsegs was wrong since 2005.  I updated the
others (which were more correct) to match.

PR: 225933
Reviewed by: cem
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14391

6 years agoOptimise xchg() to use atomic_swap_32() and atomic_swap_64().
hselasky [Sun, 18 Feb 2018 18:46:56 +0000 (18:46 +0000)]
Optimise xchg() to use atomic_swap_32() and atomic_swap_64().

Suggested by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix implementation of xchg() function macro in the LinuxKPI.
hselasky [Sun, 18 Feb 2018 17:37:23 +0000 (17:37 +0000)]
Fix implementation of xchg() function macro in the LinuxKPI.
The exchange operation must be atomic.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoImprove command lifecycle debugging and detection of problems.
scottl [Sun, 18 Feb 2018 16:41:34 +0000 (16:41 +0000)]
Improve command lifecycle debugging and detection of problems.

Sponsored by: Netflix

6 years agoDon't include DMAR map entry zone items in kernel dumps.
markj [Sun, 18 Feb 2018 16:03:50 +0000 (16:03 +0000)]
Don't include DMAR map entry zone items in kernel dumps.

Such items may be allocated in the I/O path used by the dumper,
potentially causing the dump to fail. Since there is some precedent
in the DMAR driver for avoiding this problem using _NODUMP, apply
this workaround to the zone as well.

Reported and tested by: mmacy
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14422

6 years agoUse the fdeget_locked function instead of the fget_locked in the
oshogbo [Sun, 18 Feb 2018 15:27:24 +0000 (15:27 +0000)]
Use the fdeget_locked function instead of the fget_locked in the
sys_capability.

Reviewed by: pjd@ (earlier version)
Discussed with: mjg@

6 years agoImplement support for radix_tree_for_each_slot() and radix_tree_exception()
hselasky [Sun, 18 Feb 2018 12:54:21 +0000 (12:54 +0000)]
Implement support for radix_tree_for_each_slot() and radix_tree_exception()
in the LinuxKPI and use unsigned long type for the radix tree index.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoefi: Do not pad the efi devpath structure
manu [Sun, 18 Feb 2018 11:17:39 +0000 (11:17 +0000)]
efi: Do not pad the efi devpath structure

This solve problem when booting with efi on armv7
Reviewed by: imp, tsoome
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14415

6 years agoImplement the KMEM_CACHE() function macro in the LinuxKPI.
hselasky [Sun, 18 Feb 2018 09:52:30 +0000 (09:52 +0000)]
Implement the KMEM_CACHE() function macro in the LinuxKPI.

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

6 years agoMake the vm_fault structure in the LinuxKPI compatible with
hselasky [Sun, 18 Feb 2018 09:31:01 +0000 (09:31 +0000)]
Make the vm_fault structure in the LinuxKPI compatible with
newer versions of the Linux kernel. No functional change.

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

6 years agoImplement the rcu_dereference_raw() function macro.
hselasky [Sun, 18 Feb 2018 09:10:14 +0000 (09:10 +0000)]
Implement the rcu_dereference_raw() function macro.
Make sure all RCU dereferencing use the READ_ONCE() function macro.

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

6 years agoImplement __GFP_BITS_SHIFT and __GFP_BITS_MASK macros in the LinuxKPI.
hselasky [Sun, 18 Feb 2018 08:58:20 +0000 (08:58 +0000)]
Implement __GFP_BITS_SHIFT and __GFP_BITS_MASK macros in the LinuxKPI.
Add compile time asserts to catch conflicts with native defines.

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

6 years agoImplement __list_del_entry() helper functions in the LinuxKPI.
hselasky [Sun, 18 Feb 2018 08:47:15 +0000 (08:47 +0000)]
Implement __list_del_entry() helper functions in the LinuxKPI.

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

6 years agoImplement file_inode() and call_mmap() helper functions in the LinuxKPI.
hselasky [Sun, 18 Feb 2018 08:40:07 +0000 (08:40 +0000)]
Implement file_inode() and call_mmap() helper functions in the LinuxKPI.

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

6 years agoRefactor dentry structure into its own header file in the LinuxKPI similary
hselasky [Sun, 18 Feb 2018 08:29:25 +0000 (08:29 +0000)]
Refactor dentry structure into its own header file in the LinuxKPI similary
to Linux. No functional change. Implement d_inode() helper function.

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

6 years agoUpdate the ktime type in the LinuxKPI to be a signed 64-bit integer similarly
hselasky [Sun, 18 Feb 2018 08:05:40 +0000 (08:05 +0000)]
Update the ktime type in the LinuxKPI to be a signed 64-bit integer similarly
to Linux, to avoid compilation issues. Implement ktime_get_real_seconds().

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

6 years agoMFV r324198: 8081 Compiler warnings in zdb
mav [Sun, 18 Feb 2018 04:00:29 +0000 (04:00 +0000)]
MFV r324198: 8081 Compiler warnings in zdb

illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c
https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c

https://www.illumos.org/issues/8081
  zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD,
  which uses -WError, the only way to build it is to disable all compiler
  warnings. This makes it much harder to detect newly introduced bugs. We should
  cleanup all the warnings.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Alan Somers <asomers@gmail.com>

6 years agoBuild modules specific to imx5/imx6 only when building those kernels.
ian [Sun, 18 Feb 2018 02:48:54 +0000 (02:48 +0000)]
Build modules specific to imx5/imx6 only when building those kernels.

This adds sys/modules/imx with a SUBDIR makefile to make the whole
collection of modules that are specific to these SoCs.  Initially, that
"whole collection" consists of the if_ffec and imx_i2c drivers.

The if_ffec driver is referenced in its existing home in ../ffec rather
than moving it into the imx directory, because it's used by powerpc too,
but it is no longer built for all armv6/7 systems.

The imx_i2c driver is newly added as a module.

6 years agoAdd a detach method so that this can be a kldunload-friendly module.
ian [Sun, 18 Feb 2018 02:01:41 +0000 (02:01 +0000)]
Add a detach method so that this can be a kldunload-friendly module.

6 years agoMFV r323911:
mav [Sun, 18 Feb 2018 01:42:17 +0000 (01:42 +0000)]
MFV r323911:
8502 illumos#7955 broke delegated datasets when libshare is not present

illumos/illumos-gate@1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da
https://github.com/illumos/illumos-gate/commit/1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da

https://www.illumos.org/issues/8502
  The code in lib/libzfs/common/libzfs_mount.c already basically handles
  the case when libshare is not installed. We just need to not fail in
  zfs_init_libshare_impl.  I tested this in lx and things work as
  expected. I also tested there trying to set sharenfs and sharesmb on
  the delegated dataset. Neither is allowed from within a zone.  The
  spew of msgs from a native zone is not ZFS specific. I see the same
  spew simply running the share command.

Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Jerry Jelinek <jerry.jelinek@joyent.com>

6 years agostand/lua: More style nits, config.lua
kevans [Sun, 18 Feb 2018 01:35:46 +0000 (01:35 +0000)]
stand/lua: More style nits, config.lua

Some other points I think we need to be consistent on:
- Spacing around string concatenation (always)
- Test against 'nil' explicitly rather than relying on 'not' for things that
  reasonably won't be returning a boolean. e.g. loader.getenv

Eventually this will all get formalized somewhere.

6 years agoliblua: Fix missing '}' in lutil.c after r329499
kevans [Sun, 18 Feb 2018 01:31:18 +0000 (01:31 +0000)]
liblua: Fix missing '}' in lutil.c after r329499

6 years agolua loader: Auto detect eligible list of kernels to boot
cem [Sun, 18 Feb 2018 01:16:37 +0000 (01:16 +0000)]
lua loader: Auto detect eligible list of kernels to boot

Reviewed by: imp, kevans
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14419

6 years agoLua loader: Add barebones "lfs" module
cem [Sun, 18 Feb 2018 01:15:25 +0000 (01:15 +0000)]
Lua loader: Add barebones "lfs" module

Add a Lua FileSystem module, an emulation of a subset of the permissively
licensed (MIT) Lua library of the same name[0], to our loader's Lua
environment.

[0]: https://github.com/keplerproject/luafilesystem/

Reviewed by: kevans
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14418

6 years agointerp_lua: Register io/loader with regular Lua module system
cem [Sun, 18 Feb 2018 01:13:58 +0000 (01:13 +0000)]
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

6 years agostand/lua: Remove some debugging bits that snuck in... gr...
kevans [Sun, 18 Feb 2018 01:01:15 +0000 (01:01 +0000)]
stand/lua: Remove some debugging bits that snuck in... gr...

6 years agostand/lua: Fix module_path handling with multiple kernels
kevans [Sun, 18 Feb 2018 00:56:12 +0000 (00:56 +0000)]
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.

6 years agostand/lua: Fix verbiage and some typos
kevans [Sun, 18 Feb 2018 00:44:09 +0000 (00:44 +0000)]
stand/lua: Fix verbiage and some typos

"other_kernel" is decidedly not spelled "other_kern"

6 years agoFix fallout from the import of fresh dts source files from linux 4.15. It
ian [Sun, 18 Feb 2018 00:02:09 +0000 (00:02 +0000)]
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.)

6 years agoDon't call sdhci_cleanup_slot() if sdhci_init_slot() never got called.
ian [Sat, 17 Feb 2018 23:39:10 +0000 (23:39 +0000)]
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.

6 years agoDo not try to deallocate memory that wasn't allocated (you'd think that
ian [Sat, 17 Feb 2018 23:23:27 +0000 (23:23 +0000)]
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.

6 years agoImplement spin_trylock_irq() function macro in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 22:45:15 +0000 (22:45 +0000)]
Implement spin_trylock_irq() function macro in the LinuxKPI.

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

6 years agoStub more lockdep function macros in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 22:41:20 +0000 (22:41 +0000)]
Stub more lockdep function macros in the LinuxKPI.

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

6 years agoImplement get_task_pid() function macro in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 22:33:26 +0000 (22:33 +0000)]
Implement get_task_pid() function macro in the LinuxKPI.

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

6 years agoliblua: Emulate DIR, opendir, fdopendir, closedir
cem [Sat, 17 Feb 2018 22:18:39 +0000 (22:18 +0000)]
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

6 years agoliblua: Clean up io/loader C module registration
cem [Sat, 17 Feb 2018 22:17:21 +0000 (22:17 +0000)]
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

6 years agoAllow the put_user() function macro to put constant values by using the
hselasky [Sat, 17 Feb 2018 21:47:15 +0000 (21:47 +0000)]
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

6 years agoImplement BUILD_BUG_ON_INVALID() function macro in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 21:40:19 +0000 (21:40 +0000)]
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

6 years agoAdd support for printk_ratelimit() function macro and improve the existing
hselasky [Sat, 17 Feb 2018 21:25:19 +0000 (21:25 +0000)]
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

6 years agoMerge AIM and Book-E PCPU fields
jhibbits [Sat, 17 Feb 2018 20:59:12 +0000 (20:59 +0000)]
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

6 years agoAdd support for kref_read() function in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 20:56:35 +0000 (20:56 +0000)]
Add support for kref_read() function in the LinuxKPI.

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

6 years agoAdd support for mmgrab() function in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 20:52:54 +0000 (20:52 +0000)]
Add support for mmgrab() function in the LinuxKPI.

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

6 years agoAdd support for __percpu and __weak macros in the LinuxKPI.
hselasky [Sat, 17 Feb 2018 20:50:18 +0000 (20:50 +0000)]
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

6 years agoMove the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the
hselasky [Sat, 17 Feb 2018 20:37:21 +0000 (20:37 +0000)]
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

6 years agoAdd checks for valid IRQ tag before setting up or tearing down an interrupt
hselasky [Sat, 17 Feb 2018 20:09:43 +0000 (20:09 +0000)]
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

6 years agoaw_mmc: Only change the clock if it has really changed
manu [Sat, 17 Feb 2018 18:30:25 +0000 (18:30 +0000)]
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

6 years agoRevert r329448.
mjg [Sat, 17 Feb 2018 17:23:43 +0000 (17:23 +0000)]
Revert r329448.

Turns out is is actually racy, reproducible with stress2/misc/truss.sh

Requested by: kib

6 years agoRemove unused bus_autoconf section from usb.ko.
hselasky [Sat, 17 Feb 2018 14:44:03 +0000 (14:44 +0000)]
Remove unused bus_autoconf section from usb.ko.

Sponsored by: Mellanox Technologies

6 years agoRemove obsolete tool, bus_autoconf, which is replaced by devmatch(8).
hselasky [Sat, 17 Feb 2018 14:40:28 +0000 (14:40 +0000)]
Remove obsolete tool, bus_autoconf, which is replaced by devmatch(8).

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.