Commit Graph

225655 Commits

Author SHA1 Message Date
Scott Long
757ff64216 Start overhauling debug printing in the MPS and MPR drivers. The focus of this
commit it to make initiazation less chatty in the normal case, and more useful
and informative when real debugging is turned on.

Reviewed by:	ken (earlier version)
Sponsored by:	Netflix
2017-08-27 06:24:06 +00:00
Conrad Meyer
eee87314d3 Improve scheduler performance
Improve scheduler performance by flattening nonsensical topology layers
(layers with only one child don't serve any purpose).

This is especially relevant on non-AMD Zen systems after r322776.  On my
dual core Intel laptop, this brings the kern.sched.topology_spec table down
from three levels to two.

Submitted by:	jeff
Reviewed by:	attilio
Sponsored by:	Dell EMC Isilon
2017-08-27 05:14:48 +00:00
Warner Losh
b0fc288b1a Eliminate redunant device path matching.
Use efi_devpath_match instead of device_paths_match. They are
functionally the same. Remove device_paths_match from boot1.c and call
efi_devpath_match instead.

Sponsored by: Netflix
2017-08-27 03:10:16 +00:00
Ryan Libby
0d4e7ec5f3 amd64: drop q suffix from rd[fg]sbase for gas compatibility
Reviewed by:	kib
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12133
2017-08-26 23:13:18 +00:00
Warner Losh
4532588625 Use efi_devpath_str for debug path info.
Kill our own hand-rolled (and somewhat flawed) devpath_str in favor of
the recently added efi_devpath_str in libefi. This gives us much
better names at the expense of not being able to debug on EFI 1.2
machines (since the UEFI protocol efi_devpath_str depends on was added
in UEFI 2.0). However, this isn't the first thing that requires newer
than EFI 1.2, so it's quite possible that this doesn't change the
universe of machines we can EFI boot from. This will now give us the
full UEFI path, even for devices we don't yet know about. More
importantly, it gives us the full HD(...) part of the path, which is
sufficient by itself to locate disks that follow the rules (dd one
disk (but not partition) to another still needs the rest of the path
to disambiguate, but that isn't following the rules that require every
GPT table to have globally unique GUIDs for every partion).

This also has the side effect of shrinking boot1.efi by ~3k.

Sponsored by: Netflix
2017-08-26 23:04:19 +00:00
Warner Losh
57d7e4f502 Link in libefi for boot1
Add libefi to the list of libraries we'll link in. Move EFI table
definitions back to libefi so we don't have drift between the two
efi_main routines.

Sponsored by: Netflix
2017-08-26 18:30:14 +00:00
Warner Losh
abc3c1089d Forward declare struct dsk to avoid warnings when building libi386.
Sponsored by: Netflix
2017-08-26 18:30:08 +00:00
Warner Losh
868cb4f19e Remove useless 'static' for an enum definition.
Sponsored by: Netflix
2017-08-26 18:30:03 +00:00
Warner Losh
f4380fc45d Fix warnings due to type mismatch.
Cast ctxp to caddr_t to pass data as expected. While void * is a
universal type, char * isn't (and that's what caddr_t is defined as).
One could argue these prototypes should take void * rather than
caddr_t, but changing that is much more invasive.

Sponsored by: Netflix
2017-08-26 18:29:58 +00:00
Warner Losh
6fefa52c48 _STAND is sometimes defined on the command line. Make the define here match.
Sponsored by: Netflix
2017-08-26 18:29:53 +00:00
Warner Losh
7b900dc2be No need for MK_ZFS around these: they are by their nature only active
when MK_ZFS is true.

Sponsored by: Netflix
2017-08-26 18:29:48 +00:00
Warner Losh
0414cb13ec Use the loader.efi conventions for the various EFI tables.
Sponsored by: Netflix
2017-08-26 18:29:43 +00:00
Warner Losh
194748f6a3 Cleanup efi_main return type
Make the return type of efi_main uniform. Declare the Exit() function
as not returning. Move efi_main's declaration to the proper header.

Sponsored by: Netflix
2017-08-26 18:29:37 +00:00
Warner Losh
c40241db0f Move efi_main into efi/loader
Move the efi_main routine out of libefi into sys/boot/efi/loader.
Since boot1 has its own efi_main routine, this effectively prevents
boot1 from linking with libefi. By moving it out, we can share code
better (though though some refactoring with boot1's efi_main and
loader.efi's efi_main is definitely in order).

Sponsored by: Netflix
2017-08-26 18:29:24 +00:00
Konstantin Belousov
5e52cd4324 MFamd64 r322720, r322723:
Simplify i386 trap().

- Use more relevant name 'signo' instead of 'i' for the local variable
  which contains a signal number to send for the current exception.
- Eliminate two labels 'userout' and 'out' which point to the very end
  of the trap() function.  Instead use return directly.
- Re-indent the prot_fault_translation block by reducing if() nesting.
- Some more monor style changes.

Reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-26 18:12:25 +00:00
Konstantin Belousov
aefdf821cd Remove unused code.
The machdep.uprintf_signal sysctl replaced it in more convenient way,
not requiring recompilation to use and providing more information on
fault.

Reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-26 18:09:27 +00:00
Konstantin Belousov
325b406c49 MFamd64 r322718:
Use ANSI C declaration for trap_pfault().  Style.

Reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-26 18:06:29 +00:00
Konstantin Belousov
8ce5520255 MFamd64 r322719:
Trim excessive 'extern'.

Reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-26 18:04:29 +00:00
Pedro F. Giffuni
be53a489c6 libc: minor indent(1) cleanups.
Illumos and Schillix is adopting some of the locale code and our style(9)
sometimes matches the Solaris cstyle, so the changes are also useful as a
way to reduce diffs.

No functional change.

Discussed with: Joerg Schilling
MFC after:	1 week
2017-08-26 16:11:21 +00:00
Andrew Turner
8657387683 Work around a bug in QEMU when loading data with a load pair instruction
where the source register is also the first destination register.

If this is the case, and we raise an exception in the middle of the
instruction, for example the load is across two pages and the second page
isn't mapped, QEMU will have overwritten the address with invalid data.

This is a valid behaviour in most cases, with the exception of when a
destination register is also use in address generation. As such switch
the order of the registers to ensure the address register is second so it
will be written to second, after any exceptions have happened.

This has been acknowledged in upstream QEMU, however as the workaround is
simple also handle it here.

Sponsored by:	DARPA, AFRL
2017-08-26 15:08:27 +00:00
Mariusz Zaborski
3453dc72ad Hide length of geli passphrase during boot.
Introduce additional flag to the geli which allows to restore previous
behavior.

Reviewed by:	AllanJude@, cem@ (previous version)
MFC:		1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D11751
2017-08-26 14:07:24 +00:00
Enji Cooper
b92e8635f9 Revert r321457
It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

PR:	220989
MFC after:	2 months
MFC with:	r321369, r322855
2017-08-26 06:44:50 +00:00
Conrad Meyer
70dd00d6c0 Fix limits.h constants to have correct type on MIPS
Use correctly typed constants to avoid bogus errors like
https://lists.freebsd.org/pipermail/svn-src-all/2017-August/150400.html
(like x86 _limits.h).

Reported by:	bde, asomers
Reviewed by:	mjoras, tinderbox
Sponsored by:	Dell EMC Isilon
2017-08-26 03:21:12 +00:00
John Baldwin
a9f6545f43 Extend the workaround for LLVM bug 11663 to MIPS N32.
This fixes infinite recursion in /sbin/init for MIPS N32.

Submitted by:	Robert M. Kovacsics <rmk35@cam.ac.uk>
MFC after:	1 week
Sponsored by:	DARPA / AFRL
2017-08-26 00:17:57 +00:00
Navdeep Parhar
7cb574039b cxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-25 23:31:15 +00:00
Konstantin Belousov
f425ab8e50 Replace global swhash in swap pager with per-object trie to track swap
blocks assigned to the object pages.

- The global swhash_mtx is removed, trie is synchronized by the
  corresponding object lock.
- The swp_pager_meta_free_all() function used during object
  termination is optimized by only looking at the trie instead of
  having to search whole hash for the swap blocks owned by the object.
- On swap_pager_swapoff(), instead of iterating over the swhash,
  global object list have to be inspected. There, we have to ensure
  that we do see valid trie content if we see that the object type is
  swap.
Sizing of the swblk zone is same as for swblock zone, each swblk maps
SWAP_META_PAGES pages.

Proposed by:	alc
Reviewed by:	alc, markj (previous version)
Tested by:	alc, pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D11435
2017-08-25 23:13:21 +00:00
John Baldwin
12fb14f36d Don't grab SOCK_LOCK for soref() when queuing an AIO request.
The AIO job holds a reference on the associated file descriptor, so the
socket's count should already be > 0.  This fixes a LOR with the socket
buffer lock after recent socket locking changes in HEAD.

Sponsored by:	Chelsio Communications
2017-08-25 23:10:27 +00:00
Sean Bruno
7d0d648446 Add a different #define for the maximum number of transmit and
recieve descriptors for the igb(4) class of devices.  This will
allow a better definition for maximum going forward.  Some igb(4)
devices support more than the default 4K.

Reported by:	Jason (j@nitrology.com)
Sponsored by:	Limelight Networks
2017-08-25 22:38:55 +00:00
Warner Losh
030edcce02 Fill in reserved areas from NVMe spec in the IDENTIFY structure
(struct nvme_controller_data) as defined in the NVM Express
specification, revsion 1.3.

Sponsored by: Netflix
2017-08-25 21:38:43 +00:00
Warner Losh
696c950297 NVME Namespace ID is 32-bits, so widen interface to reflect that.
Sponsored by: Netflix
2017-08-25 21:38:38 +00:00
Warner Losh
223a9b93ac Add feature codes from NVMe 1.3 specification:
o Automomous Power State Transition
o Host Memory Buffer
o Timestamp
o Keep Alive Timer
o Host Controlled Thermal Management
o Non-Operational Power State Config

Also note that feature codes 0x78-0x7f are reserved for the NVMe
Management Interface.

Sponsored by: Netflix
2017-08-25 21:38:29 +00:00
Sean Bruno
32a04bb81d Use counter(9) for PLPMTUD counters.
Remove unused PLPMTUD sysctl counters.

Bump UPDATING and FreeBSD Version to indicate a rebuild is required.

Submitted by:	kevin.bowling@kev009.com
Reviewed by:	jtl
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D12003
2017-08-25 19:41:38 +00:00
John Baldwin
d86cddf0f0 Decode arguments passed to thr_set_name().
MFC after:	1 month
2017-08-25 19:06:36 +00:00
Alan Somers
5ad496a252 Pacify GCC on mips32 after r322893
Though technically correct, GCC complains about usingi a "%zd" format
specifier for a long.

Reported by:	cem
MFC after:	3 weeks
X-MFC-With:	322893
Sponsored by:	Spectra Logic
2017-08-25 18:51:10 +00:00
Alan Cox
a0ae476b7e Correct a regression in the previous change, r322459. Specifically, the
removal of the "blk" parameter from blst_meta_alloc() had the unintended
effect of generating an out-of-range allocation when the cursor reaches
the end of the tree if the number of managed blocks in the tree equals
the so-called "radix" (which in the blist code is not the standard notion
of what a radix is but rather the maximum number of leaves in a tree of
the current height.)  In other words, only certain swap configurations
were affected, which is why earlier testing did not reveal the problem.

Submitted by:	Doug Moore <dougm@rice.edu>
Reported by:	pho, kib
Tested by:	pho
X-MFC with:	r322459
Differential Revision:	https://reviews.freebsd.org/D12106
2017-08-25 18:47:23 +00:00
Maxim Sobolev
c7e10205ae Make spinconsole platform independent and hook it up into EFI loader on
i386 and amd64. Not enabled on ARMs, those are lacking timer routines.

MFC after:	2 moths
Sponsored by:	Sippy Software, Inc.
2017-08-25 17:29:48 +00:00
Conrad Meyer
5a28df2e13 getmntinfo(3): Scale faster, and return sooner
getmntinfo(3) is designed around a relatively static or slow growing set of
current mounts.  It tried to detect a race with somewhat concurrent mount
and re-call getfsstat(2) in that case, looping indefinitely.  It also
allocated space for a single extra mount as slop.

In the case where the user has a large number of mounts and is adding them
at a rapid pace, it fell over.

This patch makes two functional changes:

1. Allocate even more slop.  Double whatever the last getfsstat(2) returned.

2. Abort and return some known results after looping a few times
   (arbitrarily, 3).  If the list is constantly changing, we can't guarantee
   we return a full result to the user at any point anyways.

While here, add very basic functional tests for getmntinfo(3) to the libc
suite.

PR:		221743
Submitted by:	Peter Eriksson <peter AT ifm.liu.se> (earlier version)
Sponsored by:	Dell EMC Isilon
2017-08-25 16:38:21 +00:00
Benno Rice
88e2cc9eb5 Replace makefs' hand-rolled unescaping with strunvis
mtree path names and link attributes are encoded, generally using strvis. Newer
versions of mtree will use C-style escapes but previously the accepted form was
octal escapes. makefs' mtree code spots the C-style escapes but fails to deal
with octal escapes correctly.

Remove mtree's escape-decoding code (except for a few instances where it's
needed) and instead pass pathnames and link targets through strunvis prior to
use.

Reviewed by:	marcel
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12104
2017-08-25 16:10:16 +00:00
Alan Somers
77a798b30a dd(1): Incorrect casting of arguments
dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and
back again to detect whether or not the original arguments were negative.
This is not correct, and causes problems with boundary cases, for example
when count is SSIZE_MAX-1.

PR:		191263
Submitted by:	will@worrbase.com
Reviewed by:	pi, asomers
MFC after:	3 weeks
2017-08-25 15:31:55 +00:00
Ed Schouten
e71fe5ce0a Make entries for the United States more consistent.
MFC after:	1 week
2017-08-25 12:28:34 +00:00
Andrey V. Elsukov
a7fe257e0a Add melifaro@ to the calendar.freebsd
Submitted by:	melifaro
2017-08-25 11:24:45 +00:00
Ed Schouten
8212ad9a99 Sync CloudABI compatibility against the latest upstream version (v0.13).
With Flower (CloudABI's network connection daemon) becoming more
complete, there is no longer any need for creating any unconnected
sockets. Socket pairs in combination with file descriptor passing is all
that is necessary, as that is what is used by Flower to pass network
connections from the public internet to listening processes.

Remove all of the kernel bits that were used to implement socket(),
listen(), bindat() and connectat(). In principle, accept() and
SO_ACCEPTCONN may also be removed, but there are still some consumers
left.

Obtained from:	https://github.com/NuxiNL/cloudabi
MFC after:	1 month
2017-08-25 11:01:39 +00:00
Bruce Evans
f7eb827c48 Fix bugs in (mostly) not-yet-activated parts of early/emergency output:
- map the hard-coded frame buffer address above KERNBASE.  Using the
  physical address only worked because of larger mapping bugs.

  The hard-coded frame buffer address only works on x86.  Use messy ifdefs
  to try to avoid warnings about unused code for other arches.

- remove the sysctl for reading and writing the table kernel console
  attributes.  Writing only worked for emergency output since normal
  output uses unalterd copies.

- fix the test for the emergency console being usable

- explain why a hard-coded attribute is used very early.  Emergency output
  works on x86 even before the pcpu pointer is initialized.
2017-08-25 10:57:17 +00:00
Konstantin Belousov
2f9d88c7ae Protect v_rdev dereference with the vnode interlock instead of the
vnode lock.

Caller of softdep_count_dependencies() may own a buffer lock, which
might conflict with the lock order.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2017-08-25 09:51:22 +00:00
Steven Hartland
9fe191043b Add myself (smh) to calendar.freebsd
Sponsored by:	Multiplay
2017-08-25 08:21:02 +00:00
Bruce Evans
9bc7c36337 Support setting the colors of cursors for the VGA renderer.
Advertise this by changing the defaults to mostly red.  If you don't like
this, change them (almost) back using:
   vidcontrol -c charcolors,base=7,height=0
   vidcontrol -c mousecolors,base=0[,height=15]

The (graphics mode only) mouse cursor colors were hard-coded to a black
border and lightwhite interior.  Black for the border is the worst
possible default, since it is the same as the default black background
and not good for any dark background.  Reversing this gives the better
default of X Windows.  Coloring everything works better still.  Now
the coloring defaults to a lightwhite border and red interior.

Coloring for the character cursor is more complicated and mode
dependent.  The new coloring doesn't apply for hardware cursors.  For
non-block cursors, it only applies in graphics mode.  In text mode,
the cursor color was usually a hard-coded (dull)white for the background
only, unless the foreground was white when it was a hard-coded black
for the background only, unless the foreground was white and the
background was black it was reverse video.  In graphics mode, it was
always reverse video for the block cursor.  Reverse video is worse,
especially over cutmarking regions, since cutmarking still uses simple
reverse video (nothing better is possible in text mode) and double
reverse video for the cursor gives normal video.  Now, graphics mode
uses the same algorithm as the best case for text mode in all cases
for graphics mode.  The hard-coded sequence { white, black, } for the
background is now { red, white, blue, } where the first 2 colors can
be configured.  The blue color at the end is a sentinel which prevents
reverse video being used in most cases but breaks the compatibility
setting for white on black and black on white characters.  This will
be fixed later.  The compatibility setting is most needed for mono modes.

The previous commit to syscons.c changed sc_cnterm() to be more careful.
It followed null pointers in some cases.  But sc_cnterm() has been
unreachable for 15+ years since changes for multiple consoles turned
off calls to the the cnterm destructor for all console drivers.  Before
them, it was only called at boot time.  So no driver with an attached
console has ever been unloadable and not even the non-console destructors
have been tested much.
2017-08-25 07:04:41 +00:00
Warner Losh
0012e436e3 Use _Static_assert
These files are compiled in userland too, so we can't use sys/systm.h
and rely on CTASSERT. Switch to using _Static_assert instead.

MFC After: 3 days
Sponsored by: Netflix
2017-08-25 04:33:06 +00:00
Warner Losh
0c26c1992f Sanity check sizes
Add compile time sanity checks to make sure that packed structures are
the proper size, typically as defined in the NVMe standard.
2017-08-25 04:05:53 +00:00
Warner Losh
abb61405a6 Enable bus mastering on the device before resetting the device. The
card has to do PCIe transactions to complete the reset process, but
can't do them, per the PCIe spec, unless bus mastering is enabled.

Submitted by: Kinjal Patel
PR: 22166
2017-08-25 03:15:18 +00:00
Bruce Evans
0c7a1e15ad Oops, the previous commit was missing 1 line. 2017-08-25 02:41:01 +00:00