Commit Graph

230214 Commits

Author SHA1 Message Date
Kyle Evans
ddb76e073e stand/lua: Addres style.lua(9) concern 2018-02-19 02:01:49 +00:00
Kyle Evans
4a4fb4f8d6 stand/lua: Allow menu items to be conditionally (in)visible
This will be used to conditionally show/hide the boot environment menu.
2018-02-19 01:59:41 +00:00
Ian Lepore
eb69d1f144 Build at45d and mx25l SPI flash drivers as modules. 2018-02-19 01:49:19 +00:00
Ian Lepore
63cdf4affb Add ofw_bus_if.h to SRCS. 2018-02-19 01:39:02 +00:00
Ian Lepore
2aa5d9c4c8 Add modules/spi as a gathering point for SPI-related modules, analagous to
modules/i2c for i2c/iicbus modules.  Build spibus as a module.
2018-02-19 01:32:27 +00:00
Kyle Evans
037f68a994 Create style.lua(9)
This covers the lua style guidelines we've generally agreed on so far. It
will be revised as work continues and we run into more scenarios that need
specified.

Discussed with:	cem, jilles
Differential Revision:	https://reviews.freebsd.org/D14423
2018-02-19 01:25:52 +00:00
Mateusz Guzik
2ca66c1ef5 Fix process exit vs reap race introduced in r329449
The race manifested itself mostly in terms of crashes with "spin lock
held too long".

Relevant parts of respective code paths:

exit:				reap:
PROC_LOCK(p);
PROC_SLOCK(p);
p->p_state == PRS_ZOMBIE
PROC_UNLOCK(p);
				PROC_LOCK(p);
/* exit work */
				if (p->p_state == PRS_ZOMBIE) /* true */
					proc_reap()
					free proc
/* more exit work */
PROC_SUNLOCK(p);

Thus a still exiting process is reaped.

Prior to the change the zombie check was followed by slock/sunlock trip
which prevented the problem.

Even code prior to this commit has a bug: the proc is still accessed for
statistic collection purposes. However, the severity is rather small and
the bug may be fixed in a future commit.

Reported by:	many
Tested by:	allanjude
2018-02-19 00:54:08 +00:00
Ian Lepore
a7e31772e7 Build ofw_iicbus as a module if OPT_FDT is defined. 2018-02-19 00:47:03 +00:00
Mateusz Guzik
d257698833 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
2018-02-19 00:38:14 +00:00
Ian Lepore
747de77cd5 Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass
so other drivers can refer to them in DRIVER_MODULE() decls.
2018-02-18 23:35:23 +00:00
Warner Losh
bbd4852a9b 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).
2018-02-18 23:16:16 +00:00
Ian Lepore
dc027dc6e2 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.
2018-02-18 23:08:43 +00:00
Ian Lepore
5e2d748931 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.
2018-02-18 23:01:33 +00:00
Ian Lepore
adddeaadc4 Add iic_recover_bus.c, now part of iicbus. This should have been added
as part of r320463.
2018-02-18 22:57:04 +00:00
Ian Lepore
c99321621c Arrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain.
Whitespace only, no functional changes.
2018-02-18 22:54:19 +00:00
Mateusz Guzik
7beb60820f 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
2018-02-18 21:07:15 +00:00
Ian Lepore
af85a3d172 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.
2018-02-18 20:08:35 +00:00
Mariusz Zaborski
965cd21173 Fix broken assertion in r329520.
Reported by:	pho@ lwhsu@
2018-02-18 20:04:39 +00:00
Ian Lepore
c5fe9c7b20 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.
2018-02-18 19:33:28 +00:00
Brooks Davis
7a095112b2 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
2018-02-18 19:19:36 +00:00
Hans Petter Selasky
8f294983e9 Optimise xchg() to use atomic_swap_32() and atomic_swap_64().
Suggested by:	kib@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-02-18 18:46:56 +00:00
Hans Petter Selasky
644680491e Fix implementation of xchg() function macro in the LinuxKPI.
The exchange operation must be atomic.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-02-18 17:37:23 +00:00
Scott Long
f0779b0452 Improve command lifecycle debugging and detection of problems.
Sponsored by:	Netflix
2018-02-18 16:41:34 +00:00
Mark Johnston
2fb9a51077 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
2018-02-18 16:03:50 +00:00
Mariusz Zaborski
20641651ec Use the fdeget_locked function instead of the fget_locked in the
sys_capability.

Reviewed by:	pjd@ (earlier version)
Discussed with:	mjg@
2018-02-18 15:27:24 +00:00
Hans Petter Selasky
ead15282ae 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
2018-02-18 12:54:21 +00:00
Emmanuel Vadot
ff727b9a1d 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
2018-02-18 11:17:39 +00:00
Hans Petter Selasky
78d7441913 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
2018-02-18 09:52:30 +00:00
Hans Petter Selasky
0628fc903e 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
2018-02-18 09:31:01 +00:00
Hans Petter Selasky
0597ffb0b5 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
2018-02-18 09:10:14 +00:00
Hans Petter Selasky
7c86047355 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
2018-02-18 08:58:20 +00:00
Hans Petter Selasky
15052dc861 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
2018-02-18 08:47:15 +00:00
Hans Petter Selasky
d51be3591a 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
2018-02-18 08:40:07 +00:00
Hans Petter Selasky
b15a13af6b 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
2018-02-18 08:29:25 +00:00
Hans Petter Selasky
0424e413e7 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
2018-02-18 08:05:40 +00:00
Alexander Motin
c156ddfcb6 MFV r324198: 8081 Compiler warnings in zdb
illumos/illumos-gate@3f7978d02b
3f7978d02b

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>
2018-02-18 04:00:29 +00:00
Ian Lepore
f82eace5b3 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.
2018-02-18 02:48:54 +00:00
Ian Lepore
b107b904a6 Add a detach method so that this can be a kldunload-friendly module. 2018-02-18 02:01:41 +00:00
Alexander Motin
6c5aa8d10e MFV r323911:
8502 illumos#7955 broke delegated datasets when libshare is not present

illumos/illumos-gate@1c18e8fbd8
1c18e8fbd8

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>
2018-02-18 01:42:17 +00:00
Kyle Evans
e402cd1307 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.
2018-02-18 01:35:46 +00:00
Kyle Evans
929c9bd077 liblua: Fix missing '}' in lutil.c after r329499 2018-02-18 01:31:18 +00:00
Conrad Meyer
a108046f58 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
2018-02-18 01:16:37 +00:00
Conrad Meyer
77d4be50c9 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
2018-02-18 01:15:25 +00:00
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