]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFhead@r322957
Enji Cooper [Mon, 28 Aug 2017 00:05:24 +0000 (00:05 +0000)]
MFhead@r322957

7 years agonet80211: fix a typo (premable -> preamble).
Andriy Voskoboinyk [Sun, 27 Aug 2017 22:13:03 +0000 (22:13 +0000)]
net80211: fix a typo (premable -> preamble).

7 years agoEnhance debugibility of sysctl leaf re-use warnings
Conrad Meyer [Sun, 27 Aug 2017 17:12:30 +0000 (17:12 +0000)]
Enhance debugibility of sysctl leaf re-use warnings

Print the full conflicting oid path, and include the function name in the
warning so it is clear that the warnings are sysctl-related.

PR: 221853
Submitted by: Fabian Keil <fk AT fabiankeil.de> (earlier version)
Sponsored by: Dell EMC Isilon

7 years agoRevert change (r322952) that was not yet destined for ^/head
Enji Cooper [Sun, 27 Aug 2017 17:08:08 +0000 (17:08 +0000)]
Revert change (r322952) that was not yet destined for ^/head

This unbreaks the build.

This happened because of a botched "svn switch".

Reported by: cem

7 years agoTry and rebase the bsd.lib.mk changes after ^/head@r322824 was merged in
Enji Cooper [Sun, 27 Aug 2017 16:46:51 +0000 (16:46 +0000)]
Try and rebase the bsd.lib.mk changes after ^/head@r322824 was merged in

Unfortunately the snippet's now broken -- need to get the matching expressions to
work properly.

7 years agoRespect MK_TCSH with build-tools and native-xtools
Enji Cooper [Sun, 27 Aug 2017 16:15:37 +0000 (16:15 +0000)]
Respect MK_TCSH with build-tools and native-xtools

This helps reduce the WORLDTMP footprint slightly.

Based on a patch I submitted 5 years ago to GNATS.

PR: 174051
MFC after: 2 weeks
Relnotes: yes (anyone who cross-builds with MK_TCSH=yes will run into
     build failures if the host doesn't have tcsh(1))
Reminded by: Fabian Keil <fk@fabiankeil.de>

7 years agortwn(4): deduplicate r92c_write_txpower().
Andriy Voskoboinyk [Sun, 27 Aug 2017 13:02:51 +0000 (13:02 +0000)]
rtwn(4): deduplicate r92c_write_txpower().

7 years agortwn(4): change type for Tx power values (RTL8192C / RTL8188EU).
Andriy Voskoboinyk [Sun, 27 Aug 2017 12:44:56 +0000 (12:44 +0000)]
rtwn(4): change type for Tx power values (RTL8192C / RTL8188EU).

Tx power values can easily fit into uint8_t + only 8 bits are written
to registers; values may overflow only in case if ROM contains
malformed data (but limit is checked anyway).

Tested with RTL8188CUS, dev.rtwn.1.debug=0x2000 (no changes).

7 years agoLet g_access() log the actual error number.
Konstantin Belousov [Sun, 27 Aug 2017 12:24:25 +0000 (12:24 +0000)]
Let g_access() log the actual error number.

Submitted by:  Fabian Keil <fk@fabiankeil.de>
PR: 221855
MFC after: 1 week

7 years agoAdd PCI Id for MosChip MCS9900.
Konstantin Belousov [Sun, 27 Aug 2017 11:37:07 +0000 (11:37 +0000)]
Add PCI Id for MosChip MCS9900.

Submitted by: Robert Clausecker <fuz@fuz.su>
PR: 214670
MFC after: 1 week

7 years agoStart overhauling debug printing in the MPS and MPR drivers. The focus of this
Scott Long [Sun, 27 Aug 2017 06:24:06 +0000 (06:24 +0000)]
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

7 years agoImprove scheduler performance
Conrad Meyer [Sun, 27 Aug 2017 05:14:48 +0000 (05:14 +0000)]
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

7 years agoEliminate redunant device path matching.
Warner Losh [Sun, 27 Aug 2017 03:10:16 +0000 (03:10 +0000)]
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

7 years agoamd64: drop q suffix from rd[fg]sbase for gas compatibility
Ryan Libby [Sat, 26 Aug 2017 23:13:18 +0000 (23:13 +0000)]
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

7 years agoUse efi_devpath_str for debug path info.
Warner Losh [Sat, 26 Aug 2017 23:04:19 +0000 (23:04 +0000)]
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

7 years agoLink in libefi for boot1
Warner Losh [Sat, 26 Aug 2017 18:30:14 +0000 (18:30 +0000)]
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

7 years agoForward declare struct dsk to avoid warnings when building libi386.
Warner Losh [Sat, 26 Aug 2017 18:30:08 +0000 (18:30 +0000)]
Forward declare struct dsk to avoid warnings when building libi386.

Sponsored by: Netflix

7 years agoRemove useless 'static' for an enum definition.
Warner Losh [Sat, 26 Aug 2017 18:30:03 +0000 (18:30 +0000)]
Remove useless 'static' for an enum definition.

Sponsored by: Netflix

7 years agoFix warnings due to type mismatch.
Warner Losh [Sat, 26 Aug 2017 18:29:58 +0000 (18:29 +0000)]
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

7 years ago_STAND is sometimes defined on the command line. Make the define here match.
Warner Losh [Sat, 26 Aug 2017 18:29:53 +0000 (18:29 +0000)]
_STAND is sometimes defined on the command line. Make the define here match.

Sponsored by: Netflix

7 years agoNo need for MK_ZFS around these: they are by their nature only active
Warner Losh [Sat, 26 Aug 2017 18:29:48 +0000 (18:29 +0000)]
No need for MK_ZFS around these: they are by their nature only active
when MK_ZFS is true.

Sponsored by: Netflix

7 years agoUse the loader.efi conventions for the various EFI tables.
Warner Losh [Sat, 26 Aug 2017 18:29:43 +0000 (18:29 +0000)]
Use the loader.efi conventions for the various EFI tables.

Sponsored by: Netflix

7 years agoCleanup efi_main return type
Warner Losh [Sat, 26 Aug 2017 18:29:37 +0000 (18:29 +0000)]
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

7 years agoMove efi_main into efi/loader
Warner Losh [Sat, 26 Aug 2017 18:29:24 +0000 (18:29 +0000)]
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

7 years agoMFamd64 r322720, r322723:
Konstantin Belousov [Sat, 26 Aug 2017 18:12:25 +0000 (18:12 +0000)]
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

7 years agoRemove unused code.
Konstantin Belousov [Sat, 26 Aug 2017 18:09:27 +0000 (18:09 +0000)]
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

7 years agoMFamd64 r322718:
Konstantin Belousov [Sat, 26 Aug 2017 18:06:29 +0000 (18:06 +0000)]
MFamd64 r322718:
Use ANSI C declaration for trap_pfault().  Style.

Reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoMFamd64 r322719:
Konstantin Belousov [Sat, 26 Aug 2017 18:04:29 +0000 (18:04 +0000)]
MFamd64 r322719:
Trim excessive 'extern'.

Reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agolibc: minor indent(1) cleanups.
Pedro F. Giffuni [Sat, 26 Aug 2017 16:11:21 +0000 (16:11 +0000)]
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

7 years agoWork around a bug in QEMU when loading data with a load pair instruction
Andrew Turner [Sat, 26 Aug 2017 15:08:27 +0000 (15:08 +0000)]
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

7 years agoHide length of geli passphrase during boot.
Mariusz Zaborski [Sat, 26 Aug 2017 14:07:24 +0000 (14:07 +0000)]
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

7 years agoMFhead@r322921
Enji Cooper [Sat, 26 Aug 2017 07:05:29 +0000 (07:05 +0000)]
MFhead@r322921

7 years agoRevert r321457
Enji Cooper [Sat, 26 Aug 2017 06:44:50 +0000 (06:44 +0000)]
Revert r321457

It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

PR: 220989
MFC after: 2 months
MFC with: r321369, r322855

7 years agoFix limits.h constants to have correct type on MIPS
Conrad Meyer [Sat, 26 Aug 2017 03:21:12 +0000 (03:21 +0000)]
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

7 years agoExtend the workaround for LLVM bug 11663 to MIPS N32.
John Baldwin [Sat, 26 Aug 2017 00:17:57 +0000 (00:17 +0000)]
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

7 years agocxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX.
Navdeep Parhar [Fri, 25 Aug 2017 23:31:15 +0000 (23:31 +0000)]
cxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agoReplace global swhash in swap pager with per-object trie to track swap
Konstantin Belousov [Fri, 25 Aug 2017 23:13:21 +0000 (23:13 +0000)]
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

7 years agoDon't grab SOCK_LOCK for soref() when queuing an AIO request.
John Baldwin [Fri, 25 Aug 2017 23:10:27 +0000 (23:10 +0000)]
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

7 years agoAdd a different #define for the maximum number of transmit and
Sean Bruno [Fri, 25 Aug 2017 22:38:55 +0000 (22:38 +0000)]
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

7 years agoFill in reserved areas from NVMe spec in the IDENTIFY structure
Warner Losh [Fri, 25 Aug 2017 21:38:43 +0000 (21:38 +0000)]
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

7 years agoNVME Namespace ID is 32-bits, so widen interface to reflect that.
Warner Losh [Fri, 25 Aug 2017 21:38:38 +0000 (21:38 +0000)]
NVME Namespace ID is 32-bits, so widen interface to reflect that.

Sponsored by: Netflix

7 years agoAdd feature codes from NVMe 1.3 specification:
Warner Losh [Fri, 25 Aug 2017 21:38:29 +0000 (21:38 +0000)]
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

7 years agoUse counter(9) for PLPMTUD counters.
Sean Bruno [Fri, 25 Aug 2017 19:41:38 +0000 (19:41 +0000)]
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

7 years agoDecode arguments passed to thr_set_name().
John Baldwin [Fri, 25 Aug 2017 19:06:36 +0000 (19:06 +0000)]
Decode arguments passed to thr_set_name().

MFC after: 1 month

7 years agoPacify GCC on mips32 after r322893
Alan Somers [Fri, 25 Aug 2017 18:51:10 +0000 (18:51 +0000)]
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

7 years agoCorrect a regression in the previous change, r322459. Specifically, the
Alan Cox [Fri, 25 Aug 2017 18:47:23 +0000 (18:47 +0000)]
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

7 years agoMake spinconsole platform independent and hook it up into EFI loader on
Maxim Sobolev [Fri, 25 Aug 2017 17:29:48 +0000 (17:29 +0000)]
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.

7 years agogetmntinfo(3): Scale faster, and return sooner
Conrad Meyer [Fri, 25 Aug 2017 16:38:21 +0000 (16:38 +0000)]
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

7 years agoReplace makefs' hand-rolled unescaping with strunvis
Benno Rice [Fri, 25 Aug 2017 16:10:16 +0000 (16:10 +0000)]
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

7 years agodd(1): Incorrect casting of arguments
Alan Somers [Fri, 25 Aug 2017 15:31:55 +0000 (15:31 +0000)]
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

7 years agoMake entries for the United States more consistent.
Ed Schouten [Fri, 25 Aug 2017 12:28:34 +0000 (12:28 +0000)]
Make entries for the United States more consistent.

MFC after: 1 week

7 years agoAdd melifaro@ to the calendar.freebsd
Andrey V. Elsukov [Fri, 25 Aug 2017 11:24:45 +0000 (11:24 +0000)]
Add melifaro@ to the calendar.freebsd

Submitted by: melifaro

7 years agoSync CloudABI compatibility against the latest upstream version (v0.13).
Ed Schouten [Fri, 25 Aug 2017 11:01:39 +0000 (11:01 +0000)]
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

7 years agoFix bugs in (mostly) not-yet-activated parts of early/emergency output:
Bruce Evans [Fri, 25 Aug 2017 10:57:17 +0000 (10:57 +0000)]
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.

7 years agoProtect v_rdev dereference with the vnode interlock instead of the
Konstantin Belousov [Fri, 25 Aug 2017 09:51:22 +0000 (09:51 +0000)]
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

7 years agoAdd myself (smh) to calendar.freebsd
Steven Hartland [Fri, 25 Aug 2017 08:21:02 +0000 (08:21 +0000)]
Add myself (smh) to calendar.freebsd

Sponsored by: Multiplay

7 years agoSupport setting the colors of cursors for the VGA renderer.
Bruce Evans [Fri, 25 Aug 2017 07:04:41 +0000 (07:04 +0000)]
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.

7 years agoUse _Static_assert
Warner Losh [Fri, 25 Aug 2017 04:33:06 +0000 (04:33 +0000)]
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

7 years agoSanity check sizes
Warner Losh [Fri, 25 Aug 2017 04:05:53 +0000 (04:05 +0000)]
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.

7 years agoEnable bus mastering on the device before resetting the device. The
Warner Losh [Fri, 25 Aug 2017 03:15:18 +0000 (03:15 +0000)]
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

7 years agoMFhead@r322870
Enji Cooper [Fri, 25 Aug 2017 02:48:31 +0000 (02:48 +0000)]
MFhead@r322870

7 years agoOops, the previous commit was missing 1 line.
Bruce Evans [Fri, 25 Aug 2017 02:41:01 +0000 (02:41 +0000)]
Oops, the previous commit was missing 1 line.

7 years agoFix missing switching of the terminal emulator when switching the
Bruce Evans [Fri, 25 Aug 2017 02:37:32 +0000 (02:37 +0000)]
Fix missing switching of the terminal emulator when switching the
terminal state for kernel console output.

r56043 in 2000 added many complications to support dynamic selection
of the terminal emulator using modules and the ioctl CONS_SETTERM.
This was never completed.  There are still no modules, but it is easy
to restore the scterm and dumb emulators at compile time.  Then
boot-time configuration for the preferred one doesn't work right, but
CONS_SETTERM almost works after fixing this bug.  CONS_SETTERM only
switches the emulator for the user state, leaving the kernel state(s)
still using the boot-time emulator.  The fix is especially important
when switching from sc to scteken, since the scteken state has pointers
in it.

Rename kernel_console_ts to sc_kts.

7 years agoFix 100.chksetuid and 110.neggrpperm for mountpoints with spaces
Alan Somers [Fri, 25 Aug 2017 00:28:56 +0000 (00:28 +0000)]
Fix 100.chksetuid and 110.neggrpperm for mountpoints with spaces

Also, fix them for mountpoints with tabs.

PR: 48325
Reported by: pguyot@kallisys.net, aaron@baugher.biz
MFC after: 3 weeks

7 years agoGarbage collect RT_NORTREF, which is no longer in use after FLOWTABLE removal.
Gleb Smirnoff [Thu, 24 Aug 2017 23:08:12 +0000 (23:08 +0000)]
Garbage collect RT_NORTREF, which is no longer in use after FLOWTABLE removal.

7 years agoixv(4): Add more robust mailbox API negotiation
Eric Joyner [Thu, 24 Aug 2017 22:56:22 +0000 (22:56 +0000)]
ixv(4): Add more robust mailbox API negotiation

The previous update to the driver to 3.2.12-k changed the VF's API version
to 1.2, but did not let the VF fall back to 1.1 or 1.0 versions. So, this
patch tries 1.2 first, then the older versions in succession if that fails.

This should allow the VF driver to negotiate 1.1 and work with older PF
drivers, such as the one used in Amazon's EC2 service.

PR: 220872
Submitted by: Jeb Cramer <jeb.j.cramer@intel.com>
MFC after: 1 week
Sponsored by: Intel Corporation

7 years agoExpand the latency tracking array from 1.024s to 8.192s to help track
Warner Losh [Thu, 24 Aug 2017 22:11:10 +0000 (22:11 +0000)]
Expand the latency tracking array from 1.024s to 8.192s to help track
extreme outliers from dodgy drives. Adjust comments to reflect this,
and make sure that the number of latency buckets match in the two
places where it matters.

7 years agoFix 32-bit overflow on latency measurements
Warner Losh [Thu, 24 Aug 2017 22:10:58 +0000 (22:10 +0000)]
Fix 32-bit overflow on latency measurements

o Allow I/O scheduler to gather times on 32-bit systems. We do this by shifting
  the sbintime_t over by 8 bits and truncating to 32-bits. This gives us 8.24
  time. This is sufficient both in range (256 seconds is about 128x what current
  users need) and precision (60ns easily meets the 1ms smallest bucket size
  measurements). 64-bit systems are unchanged. Centralize all the time math so
  it's easy to tweak tha range / precision tradeoffs in the future.
o While I'm here, the I/O scheduler should be using periph_data rather than
  sim_data since it is operating on behalf of the periph.

Differential Review: https://reviews.freebsd.org/D12119

7 years agoAdd a test case for a connection on accept queue that is reset before
Gleb Smirnoff [Thu, 24 Aug 2017 20:52:02 +0000 (20:52 +0000)]
Add a test case for a connection on accept queue that is reset before
it is accepted.  In that case accept(2) shall return ECONNABORTED.
Accept filters provide help with easily replicating that case.

7 years agoThird take on the r319685 and r320480. Actually allow for call soisconnected()
Gleb Smirnoff [Thu, 24 Aug 2017 20:49:19 +0000 (20:49 +0000)]
Third take on the r319685 and r320480.  Actually allow for call soisconnected()
via soisdisconnected(), and in the earlier unlock earlier to avoid lock
recursion.

This fixes a situation when a socket on accept queue is reset before being
accepted.

Reported by: Jason Eggleston <jeggleston llnw.com>

7 years agoUpgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
Dimitry Andric [Thu, 24 Aug 2017 20:19:27 +0000 (20:19 +0000)]
Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
the upstream release_50 branch.

As of this version, lib/msun's trig test should also work correctly
again (see bug 220989 for more information).

PR: 220989
MFC after: 2 months
X-MFC-with: r321369

7 years agozfsd(8): Close a race condition when onlining a disk paritition
Alan Somers [Thu, 24 Aug 2017 19:48:41 +0000 (19:48 +0000)]
zfsd(8): Close a race condition when onlining a disk paritition

When inserting a partitioned disk, devfs and geom will announce the whole
disk before they announce the partition. If the partition containing ZFS
extends to one of the disk's extents, then zfsd will see a ZFS label on the
whole disk and attempt to online it. ZFS is smart enough to activate the
partition instead of the whole disk, but only if GEOM has already created
the partition's provider.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Add a zpool_read_all_labels method. It's similar to
zpool_read_label, but it will return the number of labels found.

cddl/usr.sbin/zfsd/zfsd_event.cc
When processing a DevFS CREATE event, only online a VDEV if we can
read all four ZFS labels.

Reviewed by: mav
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11920

7 years agoRemove unused declaration and update ddb.4
Conrad Meyer [Thu, 24 Aug 2017 19:16:25 +0000 (19:16 +0000)]
Remove unused declaration and update ddb.4

A follow-up to r322836.

Warnings for the unused declaration were breaking some second tier
architectures, but did not show up in Clang on x86.

Reported by: markj (ddb.4), emaste (declaration)
Sponsored by: Dell EMC Isilon

7 years agoFix qlnx_tso_check() so that every window of
David C Somayajulu [Thu, 24 Aug 2017 19:09:42 +0000 (19:09 +0000)]
Fix qlnx_tso_check() so that every window of
(ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr) has atleast
ETH_TX_LSO_WINDOW_MIN_LEN bytes

MFC after:5 days

7 years agoVendor import of lldb release_50 branch r311606:
Dimitry Andric [Thu, 24 Aug 2017 16:35:38 +0000 (16:35 +0000)]
Vendor import of lldb release_50 branch r311606:
https://llvm.org/svn/llvm-project/lldb/branches/release_50@311606

7 years agoVendor import of compiler-rt release_50 branch r311606:
Dimitry Andric [Thu, 24 Aug 2017 16:35:23 +0000 (16:35 +0000)]
Vendor import of compiler-rt release_50 branch r311606:
https://llvm.org/svn/llvm-project/compiler-rt/branches/release_50@311606

7 years agoVendor import of clang release_50 branch r311606:
Dimitry Andric [Thu, 24 Aug 2017 16:35:14 +0000 (16:35 +0000)]
Vendor import of clang release_50 branch r311606:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@311606

7 years agoVendor import of llvm release_50 branch r311606:
Dimitry Andric [Thu, 24 Aug 2017 16:35:02 +0000 (16:35 +0000)]
Vendor import of llvm release_50 branch r311606:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@311606

7 years agoMerge print_lockchain and print_sleepchain
Conrad Meyer [Thu, 24 Aug 2017 15:12:16 +0000 (15:12 +0000)]
Merge print_lockchain and print_sleepchain

When debugging a deadlock, it is useful to follow the full chain of locks as
far as possible.

Reviewed by: jhb
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12115

7 years agoStop masking FSGSBASE and SMEP features under monitors.
Konstantin Belousov [Thu, 24 Aug 2017 10:57:34 +0000 (10:57 +0000)]
Stop masking FSGSBASE and SMEP features under monitors.

Not enabling FSGSBASE in %cr4 does not prevent reporting of the
feature by the CPUID instruction (blame Int*l).  As result, kernels
which were run under monitors pretended that usermode cannot modify
TLS base without the syscall, while libc noted right combination of
capable CPU and the new kernel version, trying to use the WRFSBASE
instruction.

Really old hypervisors that cannot handle enablement of these features
in %cr4 would require the manual configuration, by setting the loader
tunable hw.cpu_stdext_disable=0x81

Reported by: lwhsu, mjoras
Sponsored by: The FreeBSD Foundation
MFC after: 18 days

7 years agoSave KGSBASE in pcb before overriding it with the guest value.
Konstantin Belousov [Thu, 24 Aug 2017 10:49:53 +0000 (10:49 +0000)]
Save KGSBASE in pcb before overriding it with the guest value.

Reported by: lwhsu, mjoras
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 18 days

7 years agoOnly emit the trailing new line added in r322613 when not operating in quiet
Lawrence Stewart [Thu, 24 Aug 2017 08:20:23 +0000 (08:20 +0000)]
Only emit the trailing new line added in r322613 when not operating in quiet
mode.

Reported by: pho
MFC after: 1 week
X-MFC-with: r322210

7 years agoCompile fixes for LINT on 32-bit platforms.
Hans Petter Selasky [Thu, 24 Aug 2017 08:09:42 +0000 (08:09 +0000)]
Compile fixes for LINT on 32-bit platforms.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies

7 years agoAdd "xlnx,zynq-7000" to zedboard and zybo compatible property
Oleksandr Tymoshenko [Thu, 24 Aug 2017 02:08:52 +0000 (02:08 +0000)]
Add "xlnx,zynq-7000" to zedboard and zybo compatible property

This property is required to boot CURRENT on zedboard and zybo

PR: 221208
Submitted by: Thomas Skibo <thoma555-bsd@yahoo.com>

7 years agobsdgrep: add a primitive literal matcher
Kyle Evans [Thu, 24 Aug 2017 01:23:33 +0000 (01:23 +0000)]
bsdgrep: add a primitive literal matcher

fgrep/grep -F will error out at runtime if compiled with a regex(3)
that does not define REG_NOSPEC or REG_LITERAL. glibc is one such regex(3)
implementation, and as it turns out they don't support literal matching at
all.

Provide a primitive literal matcher for use with glibc and other
implementations that don't support literal matching so that we don't
completely lose fgrep/grep -F if compiled against libgnuregex on stable/10,
stable/11, or other systems that we don't necessarily support.

This is a wholly unoptimized implementation with no plans to optimize it as
of now. This is due to both its use-case being primarily on unsupported
systems in the near-distant future and that it's reinventing the wheel that
we already have available as a feature of regex(3).

Reviewed by: cem, emaste, ngie
Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12056

7 years agobsdgrep: add some additional tests for fgrep
Kyle Evans [Thu, 24 Aug 2017 01:20:52 +0000 (01:20 +0000)]
bsdgrep: add some additional tests for fgrep

Previously added tests only check that fgrep is somewhat sane and works. Add
some more tests that check that the implementation is basically functional
and not producing incorrect results with various flags.

Reviewed by: cem, emaste, ngie
Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12056

7 years agoImprove the coverage of debug symbols for MK_DEBUG_FILES.
John Baldwin [Wed, 23 Aug 2017 23:30:25 +0000 (23:30 +0000)]
Improve the coverage of debug symbols for MK_DEBUG_FILES.

- Include debug symbols in static libraries.  This permits binaries
  to include debug symbols for functions obtained from static libraries.
- Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be
  overridden by setting DEBUG_FILES_CFLAGS.  Use this to limit the debug
  information for llvm libraries and binaries.

Reviewed by: emaste
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D12025

7 years agoiflib: call device's if_init function during vlan initialization.
Sean Bruno [Wed, 23 Aug 2017 21:49:56 +0000 (21:49 +0000)]
iflib:  call device's if_init function during vlan initialization.

Submitted by: bhargava.marreddy@broadcom.com
Reviewed by: shurd
Sponsored by: Broadcom
Differential Revision: https://reviews.freebsd.org/D12098

7 years agoAdd missing restart_queue initialization.
Alexander Motin [Wed, 23 Aug 2017 19:00:06 +0000 (19:00 +0000)]
Add missing restart_queue initialization.

MFC after: 1 week

7 years agotop: use __mips__ and __NetBSD__ for consistency
Ed Maste [Wed, 23 Aug 2017 17:56:55 +0000 (17:56 +0000)]
top: use __mips__ and __NetBSD__ for consistency

r322767 fixed the mips64 build failure with Clang with a minimal change
to use __FreeBSD__ instead of FreeBSD in a #if test.  For consistency
and to facilitate possible upstreaming change the other macros in the
test to their canonical form.

Discussed with: jhb

7 years agoFix a resource leak in an error case in camdd_buf_sg_create().
Kenneth D. Merry [Wed, 23 Aug 2017 17:52:49 +0000 (17:52 +0000)]
Fix a resource leak in an error case in camdd_buf_sg_create().

Submitted by: Coverity
CID: 1341622
MFC after: 3 days
Sponsored by: Spectra Logic

7 years agoSet the bus number field when attaching a PCI device.
Mark Johnston [Wed, 23 Aug 2017 16:50:10 +0000 (16:50 +0000)]
Set the bus number field when attaching a PCI device.

MFC after: 1 week

7 years agoAvoid TCP log messages which are false positives.
Michael Tuexen [Wed, 23 Aug 2017 15:08:51 +0000 (15:08 +0000)]
Avoid TCP log messages which are false positives.

This is https://svnweb.freebsd.org/changeset/base/322812, just for
alternate TCP stacks.

XMFC with:  322812

7 years agoAvoid TCP log messages which are false positives.
Michael Tuexen [Wed, 23 Aug 2017 14:50:08 +0000 (14:50 +0000)]
Avoid TCP log messages which are false positives.

The check for timestamps are too early to handle SYN-ACK correctly.
So move it down after the corresponing processing has been done.

PR: 216832
Obtained from: antonfb@hesiod.org
MFC after: 1 week

7 years agoSet MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools
Ed Maste [Wed, 23 Aug 2017 12:47:10 +0000 (12:47 +0000)]
Set MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools

LLD_BOOTSTRAP is intended to control the linker used to link world and
kernel, while LLD_IS_LD is intended to control the linker installed in
that world.

Force LLD_IS_LD equal to LLD_BOOTSTRAP for the cross-tools build and
install phase, so that lld will be installed as the ld to run on the
host, when LLD_BOOTSTRAP is set.

PR: 221543
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12072

7 years agoAdd new mlx5ib(4) driver to the kernel source tree which supports
Hans Petter Selasky [Wed, 23 Aug 2017 12:09:37 +0000 (12:09 +0000)]
Add new mlx5ib(4) driver to the kernel source tree which supports
Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of
PCI express network cards.

There is currently no user-space support and this driver only supports
kernel side non-routable RoCE V1. The krping kernel module can be used
to test this driver. Full user-space support including RoCE V2 will be
added as part of the ongoing upgrade to ibcore from Linux 4.9. Otherwise
this driver is feature equivalent to mlx4ib(4). The mlx5ib(4) kernel
module will only be built when WITH_OFED=YES is specified.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies

7 years agoOnly populate GCNOS if running clean or install targets
Enji Cooper [Wed, 23 Aug 2017 03:54:34 +0000 (03:54 +0000)]
Only populate GCNOS if running clean or install targets

7 years agoCorrect typo in usage string.
Benno Rice [Tue, 22 Aug 2017 23:55:09 +0000 (23:55 +0000)]
Correct typo in usage string.

Submitted by: peterpakos (GitHub username)
MFC after: 1 day

7 years agoFix size to copyout(9) for cpuset_getid(2).
Jung-uk Kim [Tue, 22 Aug 2017 20:46:29 +0000 (20:46 +0000)]
Fix size to copyout(9) for cpuset_getid(2).

MFC after: 3 days

7 years agoFix off-by-one error when parsing SRAT table.
Alexander Motin [Tue, 22 Aug 2017 19:56:30 +0000 (19:56 +0000)]
Fix off-by-one error when parsing SRAT table.

Reviewed by: jhb
MFC after: 1 week