Commit Graph

229194 Commits

Author SHA1 Message Date
Konstantin Belousov
4975c202ac Do not clear %RFLAGS.DF on fast syscall entry.
Hardware already did it for us due to the mask loaded into the
MSR_SF_MASK msr register.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13838
2018-01-11 12:54:33 +00:00
Konstantin Belousov
0f7c159f6b Move the hardware setup for fast syscalls into a common function.
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2018-01-11 12:40:43 +00:00
Konstantin Belousov
4275e16fa9 Rename COMMON_TSS_RSP0 to TSS_RSP0.
The symbol is just an offset in the hardware TSS structure, it is not
limited to the common_tss instance.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2018-01-11 12:28:08 +00:00
Konstantin Belousov
3ee6e65875 Update comment explaining the check, to reality.
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2018-01-11 12:07:24 +00:00
Wojciech Macek
fc1689021f PowerNV: add buffer for OPAL console
Avoid the lock in vtophys() by providing a static direct-mapped
spinlock- protected output buffer to use when the console driver
cannot acquire locks for some reason. This allows the idle thread
to use printf() (e.g. the SMP startup messages) without crashing
the kernel.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation
2018-01-11 09:42:24 +00:00
Wojciech Macek
c024897601 PowerNV: set LPCR[LPES] correctly
Make sure to set LPCR[LPES] so that external interrupts set SRR0 and SRR1
instead of HSRR0 and HSRR1. Without this, external interrupt handlers would
get the wrong MSR value when executing, causing eventual madness.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation
2018-01-11 09:39:38 +00:00
Wojciech Macek
01d7bda7b7 PowerNV: correctly start secondary CPUs
Fix AP startup, which was broken.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation
2018-01-11 09:34:33 +00:00
Wojciech Macek
32d1354a39 PowerNV: add reset, poweroff, OPAL console
Add basic power control (reset, power off) and bind
ttyuX to opal console so that init will start login there.

Created by:            Nathan Whitehorn <nw@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation
2018-01-11 09:26:28 +00:00
Wojciech Macek
f078ecf642 CXGBE: fix get_filt to be endianness-aware
Unconditional 32-bit shift is not endianness-safe.
Modify the logic to work both on LE and BE.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D13102
2018-01-11 09:17:02 +00:00
Wojciech Macek
fb3855e0e7 PowerNV: initial support for OPAL
OPAL is a dedicated firmware acting as a hypervisor.
Add generic functions to provide all access.

Created by:            Nathan Whitehorn <nw@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
2018-01-11 07:40:06 +00:00
Conrad Meyer
8fb95dc265 Zstd: Add bswap intrinsics for small MIPS systems (e.g., Onion Omega)
Reported by:	mizhka
Sponsored by:	Dell EMC Isilon
2018-01-11 06:30:50 +00:00
Kyle Evans
de45c289b9 awk(1): Add necessary bits for connecting tests, but leave disconnected
The NetBSD test suite has 24 tests for awk, and we pass exactly 4 of them.
Add the necessary pieces for interested parties to easily connect the
tests and run them, but leave them disconnected for the time being.

Some of these tests outright segfault in our awk, others just exhibit the
wrong behavior.
2018-01-11 05:36:13 +00:00
Warner Losh
045f8bc8e4 When we crash, we'll stop the scheduler before we call the
shutdown_post_sync event.  For adashutdown, this causes problems
because we need to poll for completion of the commands, but we're not
yet officially dumping yet, so the code from r326964 assumed we could
use the interrupt-driven commands rather than the polled ones. This
lead to a hang. Prevent this by also checking to see if the scheduler
is stopped to do the polling.

Reported by: markj@
Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D13845
2018-01-11 03:11:41 +00:00
John Baldwin
776a2127ef Flesh out static dtrace probes for /dev/crypto ioctl errors.
In particular, no probes were present for AEAD requests, but also for
some other error cases in other ioctl requests.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2018-01-11 00:22:24 +00:00
Conrad Meyer
dc045f499a Add encrypt+authenticate modes to cryptotest tool
Like jhb's cryptocheck (uncommitted so far), express encrypt+authenticate
modes as "-a <encalg>+<authalg>".

Example use with aesni(4) on AMD Zen family:

$ ./cryptotest -d aesni0 -a aes256        10000 $((128*1024))
   2.331 sec,   20000 aes256       crypts,  131072 bytes, 1124707930 byte/sec,  8580.8 Mb/sec
$ ./cryptotest -d aesni0 -a sha256        10000 $((128*1024))
   1.109 sec,   10000 sha256       crypts,  131072 bytes, 1181577161 byte/sec,  9014.7 Mb/sec
$ ./cryptotest -d aesni0 -a aes256+sha256 10000 $((128*1024))
   3.805 sec,   10000 sha256+aes256 crypts,  131072 bytes, 344460116 byte/sec,  2628.0 Mb/sec

Reported by:	jhb
Sponsored by:	Dell EMC Isilon
2018-01-10 23:19:32 +00:00
Conrad Meyer
e6fcf7898d x86: Document purpose of _safe variants of {rd,wr}msr()
Sponsored by:	Dell EMC Isilon
2018-01-10 22:41:00 +00:00
Conrad Meyer
0a8edd1cad malloc.9: Fix minor typo from rewording in r327796
Sponsored by:	Dell EMC Isilon
2018-01-10 22:20:49 +00:00
Landon J. Fuller
a1df0d9592 Fix minor locking issues in the Power Mac Uninorth PCI bridge driver.
- Call resource_int_value() once during attach, rather than within the
  pci_(read|write)_config() code path; this avoids taking a blocking mutex
  to read kenv variables.

- Use a spin lock to protect non-atomic config space accesses; this matches
  the behavior of Darwin's AppleMacRiscPCI driver.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D13839
2018-01-10 22:19:11 +00:00
Conrad Meyer
c02fc9607a mallocarray(9): panic if the requested allocation would overflow
Additionally, move the overflow check logic out to WOULD_OVERFLOW() for
consumers to have a common means of testing for overflowing allocations.
WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just
because an allocation won't overflow size_t does not mean it is a sane size
to request.  Callers should be imposing reasonable allocation limits far,
far, below overflow.

Discussed with:	emaste, jhb, kp
Sponsored by:	Dell EMC Isilon
2018-01-10 21:49:45 +00:00
Mark Johnston
60eddb209b Add a regression test for r327794.
MFC after:	2 weeks
2018-01-10 21:40:36 +00:00
Mark Johnston
ff9ebfc4b6 Fix an off-by-one in dt_opt_setenv().
The bug would cause incorrect behaviour when attempting to override
an already set environment variable with -x setenv, as long as the
variable is not the last one in the array.

Reported by:	Samuel Lepetit <slepetit@apple.com>
MFC after:	2 weeks
2018-01-10 21:37:11 +00:00
John Baldwin
86bbef4379 Don't store shadow copies of per-process AIO limits.
Previously the AIO subsystem would save a snapshot of the currently
configured per-process limits the first time a process used AIO.  The
process would continue to use the snapshotted limits ignoring any
changes to the global limits during the rest of its lifetime.  This
change removes the snapshotted values and changes the AIO code to
always check the global values which can be toggled at runtime.
This means an administrator can now change the effective limits of
existing processes.  This is more consistent with how other limits
configured via sysctl work in FreeBSD.

Reviewed by:	asomers, kib
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D13819
2018-01-10 21:18:46 +00:00
John Baldwin
a27a25f759 Set the 'FR' bit in the status register for N32 kernels.
This permits N32 hard-float binaries to use 64-bit floating point
registers (which is what N32 binaries expect) matching the N64 ABI.

Reviewed by:	imp, jmallett
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D13830
2018-01-10 21:08:43 +00:00
Pedro F. Giffuni
ed595433c6 linuxkpi: Simplify kmalloc_array.
kmalloc_array seems what we call mallocarray(9).
2018-01-10 20:50:06 +00:00
Ed Maste
92593573d5 Mention switch to ld.lld for amd64 in UPDATING
Sponsored by:	The FreeBSD Foundation
2018-01-10 20:49:01 +00:00
Ed Maste
737afa08a4 regen src.conf.5 after r327783, WITH_LLD_BOOTSTRAP default
(I missed the Reviewed by and review link from r327783.)

Reviewed by:	brooks, dim, bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13827
2018-01-10 20:36:16 +00:00
Ed Maste
93b7a1c153 Enable ld.lld as bootstrap linker by default on amd64
For some time we have been planning to migrate to LLVM's lld linker.
Having a man page was the last blocking issue for using ld.lld to link
the base system kernel + userland, now addressed by r327770.  Link the
kernel and userland libraries and binaries with ld.lld by default, for
additional test coverage.

This has been a long time in the making.  On 2013-04-13 I submitted an
upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's
system linker.  Since then 85 individual issues were identified, and
submitted as dependencies.  These have been addressed along with two
and a half years of other lld development and improvement.

I'd like to express deep gratitude to upstream lld developers Rui
Ueyama, Rafael Espindola, George Rimar and Davide Italiano.  They put in
substantial effort in addressing the issues we found affecting
FreeBSD/amd64.

To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set

    WITHOUT_LLD_BOOTSTRAP=yes

If you need to set this, please follow up with a PR or post to the
freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP
failed for your use case.

Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still
be used for linking ports.  ld.lld can be installed as /usr/bin/ld by
setting in /etc/src.conf

    WITH_LLD_IS_LLD=yes

A followup commit will set WITH_LLD_IS_LD by default, possibly after
Clang/LLVM/lld 6.0 is merged to FreeBSD.

Release notes:	Yes
Sponsored by:	The FreeBSD Foundation
2018-01-10 20:28:01 +00:00
Pedro F. Giffuni
c93a33340f dev/bxe: make use of mallocarray(9).
Use mallocarray in a couple of cases where a calloc-like operation is
taking place.
2018-01-10 20:05:19 +00:00
Pedro F. Giffuni
802258f46b Use mallocarray(9) in dirhash.
Basic use of mallocarray to prevent overflows. Here allocation is done
with M_NOWAIT so the code is prepared for the possibility of returning
NULL values. Since mallocarray expects unsigned parameters, unsign some
related variables to minimize sign conversions.

Reviewed by:	mckusick
2018-01-10 19:45:38 +00:00
Mark Johnston
a19e742901 Add regression tests for r327779.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2018-01-10 19:41:05 +00:00
Mark Johnston
762f440f15 Fix handling of read errors during mirror synchronization.
We would previously just free the request BIO, which would either cause
the disk to stay stuck in the SYNCHRONIZING state, or result in
synchronization completing without having copied the block which
returned an error.

With this change, if the disk which returned an error is the only active
disk in the mirror, the synchronizing disk is kicked out. Otherwise, the
read is retried.

Reported and tested by:	pho (previous version)
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2018-01-10 19:37:21 +00:00
Ed Maste
782df3ed34 src.conf.5: regen after r325692 and r326888
Sponsored by:	The FreeBSD Foundation
2018-01-10 18:15:00 +00:00
Edward Tomasz Napierala
ed5cdcb6c3 Make nullfs properly report MNT_AUTOMOUNTED set on the nullfs mount itself,
instead of copying from the underlying filesystem.

PR:		224851
Reported by:	Jamie Landeg-Jones <jamie at dyslexicfish.net>
Tested by:	Jamie Landeg-Jones <jamie at dyslexicfish.net>
MFC after:	2 weeks
2018-01-10 17:51:02 +00:00
John Baldwin
806695ffe4 Include ffsll() on riscv kernels. 2018-01-10 17:36:43 +00:00
Andriy Gapon
cf38c8c630 amdsbwd: fix handling of timeout values beyond the supported range
The driver now fully observes watchdog(9) protocol.
Previously a too large timeout was silently clamped while the correct
behavior is to disable the watchdog and leave the error as is
(i.e. to not report success).

Also, previously a too small value caused the timer to stop while the
correct behavior is to use the minimal supported value.

MFC after:	2 weeks
2018-01-10 17:35:00 +00:00
Warner Losh
a333cdf369 inittodr(0) actually sets the time, so there's no need to call
tc_setclock(). It's redundant. Tweak UPDATING based on code review of
past releases.

Relnotes: yes (for the removal of pmtimer)
2018-01-10 17:25:08 +00:00
Warner Losh
79fb96d9cf Catchup to removing this directory 2018-01-10 16:56:02 +00:00
Warner Losh
e92cdf4b43 Docuent pmtimer driver removal. 2018-01-10 16:52:00 +00:00
Warner Losh
41add9e267 Move prof_machdep.c to it's more traditional place under i386/i386. 2018-01-10 16:51:55 +00:00
Ed Maste
71e8c9b65d lld: introduce basic man page
Upstream lld has no man page. Introduce a basic one for FreeBSD based on
ld.lld --help, with a brief introduction and additional detail for some
options.

We'll continue refining this in FreeBSD, and then submit it upstream once
the first round of edits are complete.

Submitted by:	krion, Arshan Khanifar, emaste, bjk
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13813
2018-01-10 16:01:25 +00:00
Mark Johnston
00da6aa72b Remove the executable bit from some recently added test scripts. 2018-01-10 15:55:07 +00:00
Mark Johnston
792f0c3b09 Clarify the use of the gmirror flag mask constants.
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2018-01-10 15:21:36 +00:00
Warner Losh
695d254365 Retire pmtimer driver. Move time fixing into apm driver. Move
Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly
work. Call tc_settime() with our estimate of the delta we've been
alseep (the one we print) to adjust the time. Not sure what to do
about callouts, so keep the small #ifdef in place there.

Differential Revision: https://reviews.freebsd.org/D13823
2018-01-10 14:59:19 +00:00
Warner Losh
bdd31a5287 Remove vestiges of digi(4) driver, first attempted in r305235 with
more in r317426. There's nothing in the tree that references digiio.h
(apart from digictl(8)), so no driver implements it. Since digictl(8)
was only used to control digi(4) devices, it too should go.
2018-01-10 14:58:58 +00:00
Conrad Meyer
8038068a2a Finally, fix Zstd kernel build on MIPS and RISC-V
Add an implementation of the intrinsics invoked by __builtin_ctz{,ll} and
__builtin_clz{,ll}, and include this compilation unit on platforms that lack
assembly intrinsics for those builtins (MIPS and RISC-V).

Future cleanup work might involve bringing these into a mini libcompiler-rt
for the standalone kernel environment.  Or cleaning up the approach upstream
takes for builtins in standalone environments (or just FreeBSD).  For now,
at least this builds, and doesn't require modifying the vendor code.

Reported by:	jeff, markj, mizhka
Reviewed by:	jhb (earlier version), rpokala (comment text earlier version)
Sponsored by:	Dell EMC Isilon
2018-01-10 06:30:59 +00:00
Scott Long
f2592b12e9 Refactor code related to 'camcontrol devlist'
Obtained from:	Netflix
2018-01-10 05:52:24 +00:00
Scott Long
c371df4f47 Implement the ability to query NVME for its controller data so that it will
be shown when issueing the 'camcontrol devlist' command.

Obtained from:	Netflix
2018-01-10 05:29:02 +00:00
Mark Johnston
aed882a9fb Avoid referencing a possibly freed consumer after r327496.
g_mirror_regular_request() may free the gmirror consumer for a disk
if that disk is being disconnected, after which we must not dereference
the consumer pointer.

CID:		1384280
X-MFC with:	r327496
2018-01-10 05:06:21 +00:00
Mariusz Zaborski
280f3264a4 Fix markup. 2018-01-10 02:57:22 +00:00
Ian Lepore
a369070143 Convert a collection of unrelated bitwise flags to a collection of boolean
vars in the softc.  It makes the code more compact and readable, and
actually uses less memory too.
2018-01-10 02:57:03 +00:00