Commit Graph

229724 Commits

Author SHA1 Message Date
Rodney W. Grimes
40d9195e37 Add -n <network device emulation type> to usage synopsis
forgotten in r328695.

Fix long lines in usage.
Consistently use "default:" rather than "default is"

Approved by:	grehan (mentor)
MFC after:	3 days
2018-02-01 19:39:33 +00:00
Rodney W. Grimes
cb797f517d Add option '-n' network device emulation type which has a default of virtio-net
PR:		225558
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Approved by:	grehan (mentor)
MFC after:	3 days
2018-02-01 17:59:14 +00:00
Hans Petter Selasky
3f3735db30 Make sure the LinuxKPI's internal ERESTARTSYS error code gets translated
into ERESTART for mmap and page fault calls aswell.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-02-01 17:32:45 +00:00
Andrew Turner
c81131d9ec Disable EARLY_PRINTF from the Armada 3700 uart, it breaks when we want
to use EARLY_PRINTF on other SoCs.

Sponsored by:	DARPA, AFRL
2018-02-01 15:05:17 +00:00
Kyle Evans
7dd7c3d5ee D14130: stand/fdt: Rip out FDT VA tracking
Whether we should be overwriting the loaded FDT module with the 'fixed up'
version or not was questionable when this was added, and now that overlays
are possible this is downright wrong.

Overlays can increase the size of the blob, so writing it back to the
original VA will generally write past the end of the block and start
clobbering other things in memory.

Rip it out- it was questionable to begin with, it's doing bad things now,
and it serves no purpose since the modified blob will be copied into place
rather than relying on this to reflect the changes.

Reviewed by:	gonzo
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D14130
2018-02-01 14:31:12 +00:00
Andrew Turner
faa3fd222a Only promote userspace mappings to superpages. This was dropped in r328510,
however due to the break-before-make requirement on arm64 is is currently
unsafe to promote kernel pages.

Sponsored by:	DARPA, AFRL
2018-02-01 14:26:26 +00:00
Kristof Provost
c201b5644d pf: Avoid warning without INVARIANTS
When INVARIANTS is not set the 'last' variable is not used, which can generate
compiler warnings.
If this invariant is ever violated it'd result in a KASSERT failure in
refcount_release(), so this one is not strictly required.
2018-02-01 07:52:06 +00:00
Nathan Whitehorn
619282986d Change the default MSR values used when starting userland and kernel
threads from compile-time defines to global variables. This removes a
significant amount of duplicated runtime patches to the compile-time
defines, centralizing the conditional logic in the early startup code.

Reviewed by:	jhibbits
2018-02-01 05:31:24 +00:00
Nathan Whitehorn
564ac41556 Fix build on 32-bit PowerPC, broken in r328537. 2018-02-01 05:28:02 +00:00
Kirk McKusick
5d84ae8b49 Null out journal softc pointer earlier to avoid a segment fault
that can otherwise occur.

PR:           221804
Submitted by: Andreas Longwitz <longwitz at incore.de>
MFC after:    1 week
2018-01-31 23:30:49 +00:00
Warner Losh
1f0e303c47 Bump .Dd 2018-01-31 23:16:54 +00:00
Warner Losh
13368c3830 Add the new armv7 architecture. 2018-01-31 23:16:19 +00:00
Kirk McKusick
0d37a428f0 When reading a cylinder group, break out reporting of check hash errors
from other types of errors so that the error is correctly reported.
2018-01-31 23:13:37 +00:00
Kirk McKusick
5a35a04255 One of the vnode fields listed by vn_printf is the union of pointers
whose type depends on the type of vnode. Correct vn_printf so that
it correctly identifies the name of the pointer that it is printing.

Submitted by: Andreas Longwitz <longwitz at incore.de>
MFC after: 1 week
2018-01-31 22:49:50 +00:00
Warner Losh
79a6a17abd Break out the interpreters (simple and forth) w/o ifdefs. This is
akin to what Pedro Souza and Wojciech Koszek did in the lua GSoC with
interp.h, interp_simple.c and changes to interp.c and interp_forth.c,
but completely redone from scratch.

This effectively restores the spirit of r326712 (my first attempt to
bring in Pedro's and Wojciech's work) updated for new requirements
that had silently broke their original work.  This change also differs
by using fixed function names instead of function pointers to simply
things. Only one interpreter at a time may be compiled in.

Also of note: we take a mutable string, pass it in via a const char *
pointer into intrp_forth's interp_run(). We then cast away the const
to pass into ficlExec since ficl would require extensive changes to
properly const-poison. See Sections 6.5.2.5 and 6.7.3 of C11 standard
noting it's only UB if you modify a const object through a non-const
pointer, but not char [] -> const char * -> char * as here.
2018-01-31 22:46:05 +00:00
Kyle Evans
839bbb1c21 dtc(1): Revert WARNS change from r328173
WARNS > 3 breaks xtoolchain builds to varying degrees. Revert it.

Reported by:	lwhsu, jhb
MFC after:	3 days
2018-01-31 22:20:33 +00:00
Vladimir Kondratyev
f20ad0fa5b psm: Add a kludge to support 0x46 identity middle byte Synaptics touchpads
Most synaptics touchpads return 0x47 in middle byte in responce to identify
command as stated in p.4.4 of "Synaptics PS/2 TouchPad Interfacing Guide".
But some devices e.g. found on HP EliteBook 9470m return 0x46 here.
Allow them to be identified as Synaptics as well as 0x47.
ExtendedQueries return incorrect data on such a touchpads so we ignore
their result and set conservative defaults.

PR:		222667
Reported by:	Neel Chauhan <neel@neelc.org>
Tested by:	Neel Chauhan <neel@neelc.org>
Approved by:	gonzo
2018-01-31 22:17:52 +00:00
Marius Strobl
c2a2eeff5c Account for the fact that jemalloc 5.0.0 dropped STATIC_PAGE_SHIFT
in favor for using LG_PAGE directly and, thus, for the fact that
host and target don't necessarily use pages of the same sizes.

Approved by:	jasone
2018-01-31 21:56:23 +00:00
Vladimir Kondratyev
f451e00544 psm(4): Reduce psm watchdog verbosity
Modern touchpads do not issue interrupts on inactivity so "lost interrupt"
message became annoying spam nowadays. This change quiets the message
if debug.psm.loglevel=5 (or less) is set in /boot/loader.conf

Approved by:	gonzo
2018-01-31 21:46:37 +00:00
Glen Barber
9de4d0b11e Fix build by escaping a line break.
PR:		225597
Submitted by:	cbnfinley at gmail.com
Sponsored by:	The FreeBSD Foundation
2018-01-31 21:41:42 +00:00
Vladimir Kondratyev
7d1460a4b1 psm(4): Add support for HP EliteBook 1040 ForcePads.
ForcePads do not have any physical buttons, instead they detect click
based on finger pressure. Forcepads erroneously report button click
if there are 2 or more fingers on the touchpad breaking multifinger
gestures. To workaround this start reporting a click only after
4 consecutive single touch packets has been received. Skip these packets
in case more contacts appear.

PR:		223369
Reported by:	Neel Chauhan <neel@neelc.org>
Tested by:	Neel Chauhan <neel@neelc.org>
Reviewed by:	gonzo
Approved by:	gonzo
2018-01-31 21:14:59 +00:00
John Baldwin
2c4bb7e326 Don't include long double routines on architectures with small long double.
Reviewed by:	emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D13874
2018-01-31 18:13:33 +00:00
John Baldwin
68e709cb29 Update limits on makecontext() arguments in the setcontext_link test.
sparc64 and riscv do not support 10 arguments, but MIPS now does.
While here, combine clauses for architectures that support the same
number of arguments to reduce duplication.

Sponsored by:	DARPA / AFRL
2018-01-31 18:03:40 +00:00
John Baldwin
acf1f71044 Add a new set of simple tests for makecontext().
In contrast to the existing NetBSD setcontext_link test, these tests
verify that passing from 1 to 6 arguments through to the callback function
work correctly which can be useful for testing ABIs which split arguments
between registers and the stack.

Sponsored by:	DARPA / AFRL
2018-01-31 18:02:02 +00:00
John Baldwin
b16fa5e718 Remove limitation of 6 arguments for makecontext() on mips.
This implementation spills additional arguments on the stack so works
fine with more than 6 arguments.  I believe the check was just copied
over from sparc64 (which doesn't support spilling onto the stack)

Sponsored by:	DARPA / AFRL
2018-01-31 18:00:23 +00:00
John Baldwin
80996ef878 Remove bogus checks against NCARGS.
NCARGS isn't a limit on the number of arguments to pass to a function,
but the number of bytes that can be consumed by arguments to exec.  As
such, it is not suitable for a limit on the count of arguments passed
to makecontext().

Sponsored by:	DARPA / AFRL
2018-01-31 17:57:59 +00:00
John Baldwin
7193311b15 Clarify that the additional arguments to makecontext() are of type int.
MFC after:	1 week
Sponsored by:	DARPA / AFRL
2018-01-31 17:56:36 +00:00
John Baldwin
ec56d65061 Consistently use 16-byte alignment for MIPS N32 and N64.
- Add a new <machine/abi.h> header to hold constants shared between C
  and assembly such as CALLFRAME_SZ.
- Add a new STACK_ALIGN constant to <machine/abi.h> and use it to
  replace hardcoded constants in the kernel and makecontext().  As a
  result of this, ensure the stack pointer on N32 and N64 is 16-byte
  aligned for N32 and N64 after exec(), after pthread_create(), and
  when sending signals rather than 8-byte aligned.

Reviewed by:	jmallett
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D13875
2018-01-31 17:36:39 +00:00
Konstantin Belousov
f7f14d9dea When switching IBRS on, also enable STIBP (Single Thread Indirect
Branch Predictors) mitigation.

DOcument 336996-001 promises that CPUs which implement IBRS but not
STIBP silently ignore setting of the bit instead of trapping.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2018-01-31 16:56:02 +00:00
Konstantin Belousov
b31b965e7c Expand IBRS TLA in sysctl help lines.
Requested by:	bz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2018-01-31 16:54:05 +00:00
Andriy Gapon
1fc46a9ba0 zfs_rezget: drop cached pages before doing anything else
We did that in the case of success to prevent the use of stale cached
data, but it makes even less sense to keep the cached data when we fail.

Ideally, we should call vgone() on the vnode in the case of zfs_rezget
failure, but the current lock order prevents us from doing that.

The change also rearranges the order of unlinked check and the size
change check.

While there, add missing SET_ERROR in one of the error paths.

MFC after:	2 weeks
2018-01-31 14:44:51 +00:00
Konstantin Belousov
319117fd57 IBRS support, AKA Spectre hardware mitigation.
It is coded according to the Intel document 336996-001, reading of the
patches posted on lkml, and some additional consultations with Intel.

For existing processors, you need a microcode update which adds IBRS
CPU features, and to manually enable it by setting the tunable/sysctl
hw.ibrs_disable to 0.  Current status can be checked in sysctl
hw.ibrs_active.  The mitigation might be inactive if the CPU feature
is not patched in, or if CPU reports that IBRS use is not required, by
IA32_ARCH_CAP_IBRS_ALL bit.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D14029
2018-01-31 14:36:27 +00:00
Konstantin Belousov
3b5319325e Do not enable PTI when IA32_ARCH_CAP_RDCL_NO bit is set.
Intel document 336996-001 claims that this will be the way to inform
about Meltdown correction.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2018-01-31 14:25:42 +00:00
Hans Petter Selasky
cb57d1dd30 Properly implement the cond_resched() function macro in the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-01-31 13:40:36 +00:00
Andriy Gapon
6a8b7aa424 vmm/svm: post LAPIC interrupts using event injection, not virtual interrupts
The virtual interrupt method uses V_IRQ, V_INTR_PRIO, and V_INTR_VECTOR
fields of VMCB to inject a virtual interrupt into a guest VM.  This
method has many advantages over the direct event injection as it
offloads all decisions of whether and when the interrupt can be
delivered to the guest.  But with a purely software emulated vAPIC the
advantage is also a problem.  The problem is that the hypervisor does
not have any precise control over when the interrupt is actually
delivered to the guest (or a notification about that).  Because of that
the hypervisor cannot update the interrupt vector in IRR and ISR in the
same way as real hardware would.  The hypervisor becomes aware that the
interrupt is being serviced only upon the first VMEXIT after the
interrupt is delivered.  This creates a window between the actual
interrupt delivery and the update of IRR and ISR.  That means that IRR
and ISR might not be correctly set up to the point of the
end-of-interrupt signal.

The described deviation has been observed to cause an interrupt loss in
the following scenario.  vCPU0 posts an inter-processor interrupt to
vCPU1.  The interrupt is injected as a virtual interrupt by the
hypervisor.  The interrupt is delivered to a guest and an interrupt
handler is invoked.  The handler performs a requested action and
acknowledges the request by modifying a global variable.  So far, there
is no VMEXIT and the hypervisor is unaware of the events.  Then, vCPU0
notices the acknowledgment and sends another IPI with the same vector.
The IPI gets collapsed into the previous IPI in the IRR of vCPU1.  Only
after that a VMEXIT of vCPU1 occurs.  At that time the vector is cleared
in the IRR and is set in the ISR.  vCPU1 has vAPIC state as if the
second IPI has never been sent.
The scenario is impossible on the real hardware because IRR and ISR are
updated just before the interrupt handler gets started.

I saw several possibilities of fixing the problem.  One is to intercept
the virtual interrupt delivery to update IRR and ISR at the right
moment.  The other is to deliver the LAPIC interrupts using the event
injection, same as legacy interrupts.  I opted to use the latter
approach for several reasons.  It's equivalent to what VMM/Intel does
(in !VMX case).  It appears to be what VirtualBox and KVM do.  The code
is already there (to support legacy interrupts).

Another possibility was to use a special intermediate state for a vector
after it is injected using a virtual interrupt and before it is known
whether it was accepted or is still pending.
That approach was implemented in https://reviews.freebsd.org/D13828
That method is more complex and does not have any clear advantage.

Please see sections 15.20 and 15.21.4 of "AMD64 Architecture
Programmer's Manual Volume 2: System Programming" (publication 24593,
revision 3.29) for comparison between event injection and virtual
interrupt injection.

PR:		215972
Reported by:	ajschot@hotmail.com, grehan
Tested by:	anish, grehan,  Nils Beyer <nbe@renzel.net>
Reviewed by:	anish, grehan
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D13780
2018-01-31 11:14:26 +00:00
Adrian Chadd
cadf7a004a [arswitch] Fix ATU programming on the AR8327 switch.
Doing a flush actually requires setting this bit.
2018-01-31 07:37:33 +00:00
Adrian Chadd
2c6ceccade [arswitch] Fix ATU flushing on AR8216/AR8316 and most of the later chips.
The switch hardware requires this bit to be set in order to kick start the
actual ATU update.  This was being masked on some chips by the learning
programming (what to do when a MAC address moves, hash table collision, etc)
which is currently inconsistent between chips.

Tested:

* AR9344 SoC (AR7240 style switch internal)
2018-01-31 07:36:51 +00:00
Adrian Chadd
676e92f22d [arswitch] add a new debug section for upcoming address table management. 2018-01-31 07:20:34 +00:00
Wojciech Macek
d32802f0c3 PowerNV: fix compilation on non-NV platforms
Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
2018-01-31 06:42:01 +00:00
Warner Losh
3a8a081b9d Update stand.h for changes for strto*l
Move prototypes to proper section now that we don't have modified
versions of strtol and strtoul in libsa. Add prototypes for new
strtoll and strtoull. Use prototypes copied from stdlib.h instead of
the old hand-rolled ones.

(I forgot to move this file form my lua branch in r328613)
2018-01-31 05:07:43 +00:00
Warner Losh
3a7d8294f0 Move libstand.3 to libsa.3. Update libsa.3 to include functions
recently added. More are likely missing.
2018-01-31 04:29:05 +00:00
Warner Losh
afa643ba9a Kill copies of strtol and strtoul. Use the ones that are in libc,
since they suffice. Create xlocale_private.h which provides the most
minimal locale implementation we can get away with. Add strtoll and
strtoull from libc.
2018-01-31 04:29:00 +00:00
Warner Losh
5fe6063df9 Move strtold wrapper from strtol.c to its own strtold.c. This code
was written by theraven@ (David Chisnall) entirely, there's no
original Berkeley code left here so just copy his copyright over.
2018-01-31 03:05:14 +00:00
Alexander Motin
6e76bc32d4 Try to preallocate receive memory early.
We may not have enough contiguous memory later, when NTB connection get
established.  It is quite likely that NTB windows are symmetric and this
allocation remain, but even if not, we will just reallocate it later.

MFC after:	2 weeks
2018-01-31 01:04:36 +00:00
John Baldwin
05d56d83b6 Ensure 'name' is not NULL before passing to strcmp().
This avoids a nested page fault when obtaining a stack trace in DDB if
the address from the first frame does not resolve to a known symbol.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2018-01-30 23:29:27 +00:00
John Baldwin
f17985319d Export tcp_always_keepalive for use by the Chelsio TOM module.
This used to work by accident with ld.bfd even though always_keepalive
was marked as static. LLD honors static more correctly, so export this
variable properly (including moving it into the tcp_* namespace).

Reviewed by:	bz, emaste
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D14129
2018-01-30 23:01:37 +00:00
Alan Somers
af63bbd0f0 zfsd: Don't spare a vdev that's being replaced
If a zfs pool contains a replacing vdev (either created manually by "zpool
replace" or by zfsd(8) via autoreplace by physical path) and then new spares
get added to the pool, zfsd shouldn't use one to replace the drive that is
already being replaced.  That's a waste of resources that just slows down
the rebuild.

PR:		225547
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2018-01-30 21:25:43 +00:00
Sean Bruno
71e9130584 Add missing non-POWERPC case to give the scr value something non-zero.
This fixes the instant reboot of netbooting after r328536 on x86 systems.

Reviewed by:	peter
Sponsored by:	Limelight Networks
2018-01-30 20:00:12 +00:00
Ed Maste
37880089ac makesyscalls: permit a range of syscall numbers for UNIMPL
Some ABIs have large gaps in syscall numbers.  Allow gaps to be filled
as ranges of UNIMPL, with an entry like:

248-1023	AUE_NULL	UNIMPL	unimplemented

Reviewed by:	jhb, gnn
Sponsored by:	Turing Robotic Industries Inc.
Differential Revision:	https://reviews.freebsd.org/D14122
2018-01-30 18:29:38 +00:00
Ed Maste
e5c2ece714 Pull in r322131 from upstream llvm trunk (by Rafael Espíndola):
Use a MCExpr for the size of MCFillFragment.

  This allows the size to be found during ralaxation. This fixes
  [LLVM] pr35858.

Requested by:	royger
2018-01-30 16:43:20 +00:00