Commit Graph

230268 Commits

Author SHA1 Message Date
Warner Losh
c798d98e75 More verbose output. 2018-02-20 05:35:00 +00:00
Kyle Evans
bb4b11cf98 style.lua(9): Clarify local variable guideline
The intent of this guideline is to avoid creating global variables in module
scope. Its main purpose is to serve as a reminder that variables at module
scope also need to be declared.

We want to avoid global variables in general, but this is easier to mess up
when designing things in the module scope.
2018-02-20 05:21:58 +00:00
Kyle Evans
699578a6b8 stand/lua: Insert helpful comment for drawer.branddefs 2018-02-20 05:12:39 +00:00
Kyle Evans
df74a61f09 stand/lua: Stick a copyright notice on drawer.lua 2018-02-20 05:11:17 +00:00
Kyle Evans
752b2d40e4 stand/lua: Use 'graphic' instead of 'logo' for table depicting graphics
This is a more sensible name that offers less redundancy when referring to
it (vs. logodef.logo). Switch to it while the getting is good.
2018-02-20 05:10:26 +00:00
Alexander Motin
89dabdb4ea MFC r316910: 7812 Remove gender specific language
illumos/illumos-gate@48bbca8168
48bbca8168

https://www.illumos.org/issues/7812
  This change removes all gendered language that did not refer specifically
  to an individual person or pet. The convention taken was to use
  variations on "they" when referring to users and/or human beings, while
  using "it" when referring to code, functions, and/or libraries.
  Additionally, we took the liberty to fix up any whitespace issues that
  were found in any files that were already being modified.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Chris Williamson <chris.williamson@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Daniel Hoffman <dj.hoffman@delphix.com>
2018-02-20 05:07:21 +00:00
Kyle Evans
29aa5794d0 stand/lua: Refactor brands into drawer.branddefs 2018-02-20 05:06:11 +00:00
Kyle Evans
bb26c57ded stand/lua: Refactor logos into drawer.logodefs table
This refactor makes it straightforward to add new logos for drawing and
organizes logo definitions in a logical manner.

The graphic to be drawn for each logo may again be modified outside of
drawer, but it must be done on a case-by-case basis as a modification to the
loader_logo.
2018-02-20 04:56:03 +00:00
Alexander Motin
3542f1bd3a MFV r307315:
7301 zpool export -f should be able to interrupt file freeing

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Author: Alek Pinchuk <alek@nexenta.com>

Closes #175
2018-02-20 04:36:51 +00:00
Kyle Evans
02122e53a8 stand/lua: Reduce exposure of the drawer module
As part of an effort to slowly reduce our exports overall to a set of stable
properties/functions, go ahead and reduce what drawer exposes to others.

The graphics should generally not be modified on their own, but their
position could be modified if additional grahics also need to be drawn.
Export position/shift information, but leave the actual graphic local to
the module.

The next step will be to create a 'menudef' that gets exported instead, with
each entry in the menudef table describing the graphic to be drawn along
with specific positioning information.
2018-02-20 04:23:43 +00:00
Alexander Motin
4a0867c8d2 MFV r302649: 7016 arc_available_memory is not 32-bit safe
illumos/illumos-gate@0dd053d7d8
0dd053d7d8

https://www.illumos.org/issues/7016
  upstream DLPX-39446 arc_available_memory is not 32-bit safe
  https://github.com/delphix/delphix-os/commit/
  6b353ea3b8a1610be22e71e657d051743c64190b
  related to this upstream:
  DLPX-38547 delphix engine hang
  https://github.com/delphix/delphix-os/commit/
  3183a567b3e8c62a74a65885ca60c86f3d693783
  DLPX-38547 delphix engine hang (fix static global)
  https://github.com/delphix/delphix-os/commit/
  22ac551d8ef085ad66cc8f65e51ac372b12993b9
  DLPX-38882 system hung waiting on free segment
  https://github.com/delphix/delphix-os/commit/
  cdd6beef7548cd3b12f0fc0328eeb3af540079c2

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Gordon Ross <gordon.ross@nexenta.com>
Author: Prakash Surya <prakash.surya@delphix.com>
2018-02-20 04:14:12 +00:00
Kyle Evans
da56fe38d5 stand/lua: Move drawer.menu_name_handlers further up
As a good candidate for modification, move this table further up in the
module to improve visibility.
2018-02-20 04:11:48 +00:00
Kyle Evans
2413c411f8 stand/lua: Add and use drawer.menu_name_handlers
Pull out specialized naming behavior into drawer.menu_name_handlers. This is
currently only needed for the carousel entry, where naming is based on the
current choice and the menu item purposefully does not store this state.

The setup was designed so that every type can have a special name handler,
and the default action is to simply use the result of entry.name().
2018-02-20 03:58:45 +00:00
Ian Lepore
42c52f36e4 Add missing MODULE_DEPENDS(). 2018-02-20 03:51:09 +00:00
Kyle Evans
8d415029e1 stand/lua: Extract menu handlers out into menu.handlers table
This is a bit cleaner than our former method of an if ... else chain of
handlers. Store handlers in the menu.handlers table so that they may be
added to or removed dynamically.

All handlers take the current menu and selected entry as parameters, and
their return value indicates whether the menu processor should continue or
not. An omitted return value or 'true' will indicate that we should
continue, while returning 'false' will indicate that we should exit the
current menu.

The omitted return value behavior is due to continuing the loop being the
more common situation.
2018-02-20 03:40:16 +00:00
Mateusz Guzik
81d68271d7 Reduce contention on the proctree lock during heavy package build.
There is a proctree -> allproc ordering established.

Most of the time it is either xlock -> xlock or slock -> slock.

On fork however there is a slock -> xlock pair which results in
pathological wait times due to threads keeping proctree held for
reading and all waiting on allproc. Switch this to xlock -> xlock.
Longer term fix would get rid of proctree in this place to begin with.
Right now it is necessary to walk the session/process group lists to
determine which id is free. The walk can be avoided e.g. with bitmaps.

The exit path used to have one place which dealt with allproc and
then with proctree. Move the allproc acquire into the section protected
by proctree. This reduces contention against threads waiting on proctree
in the fork codepath - the fork proctree holder does not have to wait
for allproc as often.

Finally, move tidhash manipulation outside of the area protected by
either of these locks. The removal from the hash was already unprotected.
There is no legitimate reason to look up thread ids for a process still
under construction.

This results in about 50% wait time reduction during -j 128 package build.
2018-02-20 02:18:30 +00:00
Kyle Evans
6f412147b2 stand/lua: Don't set ACPI off just because we can't detect it.
This should unbreak EFI/!i386 cases.

Reported by:	Peter Lei <peter.lei@ieee.org>
2018-02-20 02:03:29 +00:00
Jeff Roberson
06220fa737 Further parallelize the buffer cache.
Provide multiple clean queues partitioned into 'domains'.  Each domain manages
its own bufspace and has its own bufspace daemon.  Each domain has a set of
subqueues indexed by the current cpuid to reduce lock contention on the cleanq.

Refine the sleep/wakeup around the bufspace daemon to use atomics as much as
possible.

Add a B_REUSE flag that is used to requeue bufs during the scan to approximate
LRU rather than locking the queue on every use of a frequently accessed buf.

Implement bufspace_reserve with only atomic_fetchadd to avoid loop restarts.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	Netflix, Dell/EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D14274
2018-02-20 00:06:07 +00:00
Kyle Evans
4b6da14cfa stand/lua: Wrap tuple assignment earlier for readability 2018-02-19 22:56:04 +00:00
Kyle Evans
e84e7ed5d5 style.lua(9): Note that wrapping at 80-columns is not rigid 2018-02-19 22:54:10 +00:00
Kyle Evans
9a0904b0e0 stand/lua: Cache swapped menu, and don't create locals for swapping
Building the swapped welcome menu (first two items swapped) is kind of a
sluggish, because it requires a full (recrusive) shallow copy of the welcome
menu. Cache the result of that and re-use it later, instead of building it
everytime.

While here, don't create temporary locals just for swapping. The following
is just as good:

x, y = y, x;

Reported by:	Alexander Nasonov <alnsn@yandex.ru> (swapping)
2018-02-19 22:29:16 +00:00
Alan Somers
d23662ec2e tail: fix "tail -r" for piped input that begins with '\n'
A subtle logic bug, probably introduced in r311895, caused tail to print the
first two lines of piped input in forward order, if the very first character
was a newline.

PR:		222671
Reported by:	Jim Long <freebsd-bugzilla@umpquanet.com>, pprocacci@gmail.com
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2018-02-19 22:09:49 +00:00
Bryan Venteicher
88126356cf Add more virtqueue getter methods
MFC after:	2 weeks
2018-02-19 19:31:18 +00:00
Bryan Venteicher
985ed053e3 Add VirtIO bus config_generation method
VirtIO buses (PCI, MMIO) can provide a generation field so a driver
can ensure either a 64-bit or array read was stable.

MFC after:	2 weeks
2018-02-19 19:28:24 +00:00
Konstantin Belousov
9f74642385 Do not free(9) uninitialized pointer.
Reported and tested by:	allanjude
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
2018-02-19 19:08:25 +00:00
Eitan Adler
1983a2326b tools/80211: correct array index
wh->i_dur is a two byte value; not a single byte set twice

Reported by:	swildner@DragonFlyBSD.org
2018-02-19 19:01:46 +00:00
Bryan Venteicher
7a16dacdfa Add PCI methods to iterate over the PCI capabilities
VirtIO V1 provides configuration in multiple VENDOR capabilities so this
allows all of the configuration to be discovered.

Reviewed by:	jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D14325
2018-02-19 18:41:56 +00:00
Kyle Evans
21d5bcbe67 stand/lua: Add copyright notice in places
I've made some not-insignificant changes to config, menu, and password bits
of our lua scripts. Add a copyright notice to them to reflect.
2018-02-19 18:11:35 +00:00
Kyle Evans
c851839897 stand/lua: Re-order locals after copyright notice; require comes first 2018-02-19 17:54:22 +00:00
Kyle Evans
1f5696c7fd stand/lua: Round up some more style.lua(9) concerns 2018-02-19 17:51:33 +00:00
Kyle Evans
5c1b516581 stand/lua: Change boot menu items' names when swapped
[Enter] should be moved to the single user menu item when we swap them.

Define a non-standard menu entry function "alternate_name" to use for this
purpose for ultimate flexibility if we change our minds later. When we're
booting single user, make a shallow copy of the menu that we'd normally
display and swap the items and their name functions to use alternate_name
instead. Toggling single user in the options menu and going back to the main
menu will now correctly reflect the current boot setting with the first two
menu options and "[Enter]" will always be on the right one.

This shallow copy technique has the chance of being quite slow since it's
done on every redraw, but in my testing it does not seem to make any obvious
difference.

shallowCopyTable could likely belong better in a general-purpose utility
module, but this (and the key constnats) are the only candidates we have at
the moment so we'll drop it into our core stuff for the moment and consider
re-organization at a later date.
2018-02-19 17:40:19 +00:00
Kyle Evans
e6db469bfa stand/lua: Remove inaccurate comment after r329590
lualoader does a pretty good job of reverting any environment changes now.
It will even wipe out boot_verbose if it's set explicitly in loader.conf(5)
and overwritten in the boot options menu.

Future work will likely change this, as explicit choices made in the menu
should probably override the new loader.conf(5). I don't suspect this will
cause much grief, though, so it is not a high priority until boot
environment support actually lands.
2018-02-19 17:09:29 +00:00
Kyle Evans
ce4a5da5a9 stand/lua: Restore environment upon config reload
This restores environment to whatever defaults we had coming into lualoader.
2018-02-19 17:01:21 +00:00
Kyle Evans
df8a9d464a stand/lua: Track env changes that come in via loader.conf(5)
This will be used when boot environment support lands to make a good-faith
effort to apply any new loader.conf(5) environment settings atop the default
configuration that we started with.
2018-02-19 16:59:28 +00:00
Kyle Evans
fd2b19b3ee stand/lua: Re-wrap menu.lua now that I've added indentation... 2018-02-19 16:42:06 +00:00
Kyle Evans
303253e55c stand/lua: Swap single-/multi- user boot entries as needed 2018-02-19 16:36:29 +00:00
Kyle Evans
2e716cec23 stand/lua: Call menu_entries if it's a function
If we've fetched menu.entries and it turns out it's a function, call it to
get the actual menu entries.

This will be used to swap multi-/single- user boot options if we're booting
single user by default (boot_single="YES" in loader.conf(5)). It can also be
used fairly easily for other non-standard situations.
2018-02-19 16:35:46 +00:00
Kyle Evans
e07fc39c14 stand/lua: Add core.isSingleUserBoot 2018-02-19 16:34:23 +00:00
Hans Petter Selasky
e44fa94c09 Implement list_safe_reset_next() 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-19 16:31:19 +00:00
Kyle Evans
d87577468f stand/lua: Store menu entries in an "entries" table
Instead of directly listing them in menu.welcome and menu.boot_options,
store them at menu.welcome.entries and welcome.boot_options.entries.

This will come into play later when we need to re-order the welcome menu if
boot_single is specified.
2018-02-19 16:25:43 +00:00
Kyle Evans
280e990ba7 stand/lua: Remove some unused local declarations
Menus are actually defined as entries in the 'menu' table. These local
declarations have not been used in the history of our in-tree lua scripts,
so give them the boot.
2018-02-19 15:49:27 +00:00
Nathan Whitehorn
65184f89b6 Set internal error returns for OF_peer(), OF_child(), and OF_parent() to
zero, matching the IEEE 1275 standard. Since these internal error paths
have never, to my knowledge, been taken, behavior is unchanged.

Reported by:	gonzo
MFC after:	2 weeks
2018-02-19 15:49:14 +00:00
Kyle Evans
57099121d5 stand/lua: Menu style.lua(9) nits 2018-02-19 15:47:09 +00:00
Kyle Evans
b140d14b02 stand/lua: Rename bootserial for clarity 2018-02-19 15:42:20 +00:00
Kyle Evans
fa4a2394a7 stand/lua: Defer kernel/module loading until boot or menu escape
Loading the kernel and modules can be really slow. Loading before the menu
draws and every time one changes kernel/boot environment is even more
painful.

Defer loading until we either boot, auto-boot, or escape to loader prompt.
We still need to deal with configuration changes as the boot environment
changes, but this is generally much quicker.

This commit strips all ELF loading out of config.load/config.reload so that
these are purely for configuration. config.loadelf has been created to deal
with kernel/module loads. Unloading logic has been ripped out, as we won't
need to deal with it in the menu anymore.

Discussed in part with:	allanjude
2018-02-19 14:21:56 +00:00
Andrey V. Elsukov
15bf717a93 Remove unused variables and sysctl declaration.
MFC after:	1 week
2018-02-19 12:20:51 +00:00
Andrey V. Elsukov
6ca39da354 Check packet length to do not make out of bounds access. Also save ah_nxt
value to use it later, since ah pointer can become invalid.

Reported by:	Maxime Villard <max at m00nbsd dot net>
MFC after:	5 days
2018-02-19 11:14:38 +00:00
Andriy Gapon
8cebd0e419 relax an assert in zfsctl_snapdir_lookup to match r323578
Since r323578 we may remove the last reference to a covered vnode with
vrele() instead of vput().  So, v_usecount may be decremented before
the vnode is locked and zfsctl_snapdir_lookup may "catch" the vnode
with v_usecount of zero and v_holdcnt of one.

PR:		225795
Reported by:	asomers
MFC after:	1 week
2018-02-19 08:55:22 +00:00
Hans Petter Selasky
0f839f3a6d When stepping the radix tree in the LinuxKPI make sure we
clear the least significant bits, so that no entries are
skipped.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-02-19 06:11:58 +00:00
Xin LI
74709ed038 MFV r329552: less v530.
MFC after:	2 weeks
2018-02-19 05:10:22 +00:00