Commit Graph

245593 Commits

Author SHA1 Message Date
Conrad Meyer
e55890a9b8 Take arm.arm (armv5) out of universe
It's on the chopping block in two months, the CI tinderbox doesn't bother with
it anymore either, and buildworld fails today due to an issue linking clang.
It's not worth investigating and it just eats up CPU cycles running universe
builds.
2019-11-03 19:36:34 +00:00
Conrad Meyer
784a4b6bdf armv6: Switch to LLD by default
This could just be ${__TT} == "arm", except armv5 isn't slated for death until
EOY.

arm tinderbox builds.  Let's see what else shakes out.
2019-11-03 19:33:49 +00:00
Vincenzo Maffione
3e11768ee1 bhyve: add backend rx backpressure to virtio-net
If a VM is flooded with more ingress packets than the guest OS
can handle, the current virtio-net code will keep reading those
packets and drop most of them as no space is available in the
receive queue. This is an undesirable receive livelock, which
is a waste of CPU and memory resources and potentially opens to
DoS attacks.
With this change, virtio-net uses the new netbe_rx_disable()
function to disable ingress operation in the backend while the
guest is short on RX buffers. Once the guest makes more buffers
available to the RX virtqueue, ingress operation is enabled again
by calling netbe_rx_enable().

Reviewed by:	bryanv, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20987
2019-11-03 19:02:32 +00:00
Vincenzo Maffione
14d726374b bhyve: fix mistake introduced by r352841
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20973
2019-11-03 18:53:42 +00:00
Alan Cox
50e3ab6bcf Utilize ASIDs to reduce both the direct and indirect costs of context
switching.  The indirect costs being unnecessary TLB misses that are
incurred when ASIDs are not used.  In fact, currently, when we perform a
context switch on one processor, we issue a broadcast TLB invalidation that
flushes the TLB contents on every processor.

Mark all user-space ("ttbr0") page table entries with the non-global flag so
that they are cached in the TLB under their ASID.

Correct an error in pmap_pinit0().  The pointer to the root of the page
table was being initialized to the root of the kernel-space page table
rather than a user-space page table.  However, the root of the page table
that was being cached in process 0's md_l0addr field correctly pointed to a
user-space page table.  As long as ASIDs weren't being used, this was
harmless, except that it led to some unnecessary page table switches in
pmap_switch().  Specifically, other kernel processes besides process 0 would
have their md_l0addr field set to the root of the kernel-space page table,
and so pmap_switch() would actually change page tables when switching
between process 0 and other kernel processes.

Implement a workaround for Cavium erratum 27456 affecting ThunderX machines.
(I would like to thank andrew@ for providing the code to detect the affected
machines.)

Address integer overflow in the definition of TCR_ASID_16.

Setup TCR according to the PARange and ASIDBits fields from
ID_AA64MMFR0_EL1.  Previously, TCR_ASID_16 was unconditionally set.

Modify build_l1_block_pagetable so that lower attributes, such as ATTR_nG,
can be specified as a parameter.

Eliminate some unused code.

Earlier versions were tested to varying degrees by: andrew, emaste, markj

MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D21922
2019-11-03 17:45:30 +00:00
Andrew Turner
05f39d1a2d Add support for setting hardware breakpoints from ptrace on arm64.
Implement get/fill_dbregs on arm64. This is used by ptrace with the
PT_GETDBREGS and PT_SETDBREGS requests. It allows userspace to set hardware
breakpoints.

The struct dbreg is based on Linux to ease adding hardware breakpoint
support to debuggers.

Reviewed by:	jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22195
2019-11-03 15:42:08 +00:00
Toomas Soome
21da9f14f6 loader: zfs.c is missing malloc checks, fix it
malloc() can return NULL, we need to check the return value.
2019-11-03 14:36:16 +00:00
Toomas Soome
0c0a882c7a loader: we do not support booting from pool with log device
If pool has log device, stop there and tell about it.
2019-11-03 13:25:47 +00:00
Toomas Soome
f4ed004573 loader: should check malloc in zfs_dev_open
malloc can return NULL.
2019-11-03 13:03:47 +00:00
Konstantin Belousov
83ba1468ab amd64: Store %cr3 into pcpu saved_ucr3 on double fault.
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-11-03 11:52:50 +00:00
Konstantin Belousov
7ccd639deb amd64 ddb: Add printing of kernel/user and saved user %cr3 values from pcpu.
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-11-03 11:51:53 +00:00
Toomas Soome
abca0bd501 loader: calculate physical vdev psize from asize
Since physical device asize is calculated from psize and the asize is stored
in pool label, we can use asize to set the value of psize, which is used to
calculate the location of the pool labels.

MFC after:	1 week
2019-11-03 11:09:06 +00:00
Toomas Soome
bcbb1e60a1 loader: userboot/test should accept more than one disk
allow to specify multiple -d options, test -d disk1 -d disk2 ..
2019-11-03 09:14:29 +00:00
Mark Johnston
50b5a6cc0a Downgrade the firmware images imported in r354201.
Version 43 requires further modifications to iwm(4), and this was not
caught in some initial testing.  Version 34 works and is the version
available on Intel's web site.

MFC with:	r354201
Sponsored by:	The FreeBSD Foundation
2019-11-03 03:23:27 +00:00
Brandon Bergren
2128001171 powerpc: Add display of raw instruction values to x/I in ddb.
The "alternate format" character 'I' previously had the same behavior as
the "display as an instruction" character 'i'. With this change, it will now
prefix each disassembled instruction with the raw hex value.

As PowerPC instructions are always 32 bits and always aligned, and there are
no alternate modes that would affect instruction decoding or display, this
seemed to me to be the obvious interpretation of "alternate format".

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D22223
2019-11-03 02:18:45 +00:00
Brandon Bergren
2276d9024d powerpc: Fix incorrect disassembly of the cntlzw instruction in ddb.
Noticed while comparing disassembly between ddb and objdump.

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D22121
2019-11-03 01:52:50 +00:00
Cy Schubert
f1b328b32f MFV r354257:
Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100)

MFC after:	1 month
2019-11-03 01:25:46 +00:00
Alexander Motin
45577133ef Remove lock from CTL camsim frontend.
CAM does not need a SIM lock for quite a while, and CTL never needed it.

MFC after:	2 weeks
2019-11-03 00:13:23 +00:00
Toomas Soome
2b88546767 r354264 did mix up the directory path
The correct path is sys/cddl/contrib/opensolaris/common/lz4, not
sys/cddl/contrib/opensolaris/lz4

Reported by:	Michael Butler
2019-11-02 21:52:45 +00:00
Brandon Bergren
ab3f2a3861 Add support for building Book-E kernels with clang/lld.
This involved several changes:

* Since lld does not like text relocations, replace SMP boot page text relocs
in booke/locore.S with position-independent math, and track the virtual base
in the SMP boot page header.

* As some SPRs are interpreted differently on clang due to the way it handles
platform-specific SPRs, switch m*dear and m*esr mnemonics out for regular
m*spr. Add both forms of SPR_DEAR to spr.h so the correct encoding is selected.

* Change some hardcoded 32 bit things in the boot page to be pointer-sized, and
fix alignment.

* Fix 64-bit build of booke/pmap.c when enabling pmap debugging.

Additionally, I took the opportunity to document how the SMP boot page works.

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D21999
2019-11-02 21:15:56 +00:00
Toomas Soome
24e1a7ac77 r354253 did miss the fact that libzpool is built as fake kernel
We build libzpool as kernel like, use _FAKE_KERNEL check to include
kernel api in libzpool.
2019-11-02 21:02:54 +00:00
Toomas Soome
a524707b9b r354253 did miss the updates to sys/conf/files and sys/conf/kern.pre.mk
Reported by:	Brandon Bergren
2019-11-02 20:46:45 +00:00
Mitchell Horne
ec0db2d748 RISC-V: Remove EARLY_AP_STARTUP from GENERIC
This option is causing boot to fail for the Hifive Unleashed and older
versions of QEMU (3.1.1). Remove it from the GENERIC config for now.

Reported by:	br
MFC after:	1 week
2019-11-02 19:33:02 +00:00
Cy Schubert
f123a1cc3a Import sqlite3-3.30.1 (3300100) 2019-11-02 17:57:02 +00:00
Dimitry Andric
f68ff1ac1c Add __isnan()/__isnanf() aliases for compatibility with glibc and CUDA
Even though clang comes with a number of internal CUDA wrapper headers,
compiling sample CUDA programs will result in errors similar to:

In file included from <built-in>:1:
In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204:
/usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan'
  if (__isnan(a)) {
      ^~~~~~~
/usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to __device__ function from __host__ function
__DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); }
               ^

CUDA expects __isnan() and __isnanf() declarations to be available,
which are glibc specific extensions, equivalent to the regular isnan()
and isnanf().

To provide these, define __isnan() and __isnanf() as aliases of the
already existing static inline functions __inline_isnan() and
__inline_isnanf() from math.h.

Reported by:	arrowd
PR:		241550
MFC after:	1 week
2019-11-02 16:59:53 +00:00
Toomas Soome
25cf531ecd r354253 did miss lz4.c from sys/cddl/boot/zfs. 2019-11-02 15:08:19 +00:00
Toomas Soome
e499793e76 Remove duplicate lz4 implementations
Port illumos change: https://www.illumos.org/issues/11667

Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be
usable from kernel/stand/userland builds, so we can use just one single
source. Add lz4.h to declare lz4_compress() and lz4_decompress().

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D22037
2019-11-02 12:28:04 +00:00
Toomas Soome
0060947db1 loader: libi386/comconsole.c cstyle cleanup
Only cstyle, no functional changes.
2019-11-02 10:53:23 +00:00
Poul-Henning Kamp
183b6fead8 If /usr/obj is a symlink, cpio(1) needs persuation to DTRT. 2019-11-02 10:15:34 +00:00
Poul-Henning Kamp
1d03de96c1 Mention that ports/net-mgmt/libsmi is required 2019-11-02 10:14:15 +00:00
Toomas Soome
b9f745fdb1 loader: fall back to term_emu on efi console with serial backend
In case of efi console having serial backend (video + serial or only serial),
we need to stick with old emulator till we can draw console.

Eventually we would need to get console terminal emulator to be removed
from serial console because the serial link already has the terminal.

However, we need to implement comconsole on all efi platforms first, then
we need the ability to draw console, so we do not have to use SimpleTextOutput
protocol (which will write both on video and serial in case of multiplexed
ComOut).

Differential Revision:	https://reviews.freebsd.org/D22161
2019-11-02 09:50:36 +00:00
Kyle Evans
bac5966e2d lualoader: rewrite try_include using lfs + dofile
Actual modules get require()'d in, rather than try_include(). All instances
of try_include should be provided with proper hooks/API in the rest of
loader to do the work they need to do, since we can't rely on them to exist.
Convert this now to lfs + dofile since we won't really be treating them as
modules.

lfs is required because dofile will properly throw an error if the file
doesn't exist, which is not in the spirit of 'optionally included'.

Getting out of the pcall game allows us to provide a loader.exit() style
call that backs out to the common bits of loader (autoboot sequence unless
disabled with a loader.setenv("autoboot_delay", "NO")). The most ideal way
identified so far to implement loader.exit() is to throw a special
abort-style error that indicates to the caller in interp_lua that we've not
actually errored out, just continue execution. Otherwise, we have to hack in
logic to bubble up and return from loader.lua without continuing further,
which gets kind of ugly depending on the context in which we're aborting.

A compat shim is provided temporarily in case the executing loader doesn't
yet have loader.lua_path, which was just added in r354246.
2019-11-02 04:01:39 +00:00
Kyle Evans
63172bf68b liblua: add loader.lua_path
As described previously, loader.lua_path is absolute path where scripts are
installed. A future commit will use this to build paths for dofile in
try_include, rather than the current pcall/require setup that makes it more
difficult to coordinate loader aborts from local.lua -- we do not need the
flexibility of require(), and local.lua is in-fact not a 'module-like' file
as we will not be referencing anything from it.
2019-11-02 03:41:30 +00:00
Kyle Evans
ee74c23624 stand: consolidate knowledge of lua path
Multiple places coordinate to 'know' where lua scripts are installed. Knock
this down to being formally defined (and overridable) in exactly one spot,
defs.mk, and spread the knowledge to loaders and liblua alike. A future
commit will expose this to lua as loader.lua_path, so it can build absolute
paths to lua scripts as needed.

MFC after:	1 week
2019-11-02 03:37:58 +00:00
Gleb Smirnoff
abc4b11cea Fix regression from r353026. Pointer was increased instead of value
pointed to.

PR:		241646
Submitted by:	Aleksandr Fedorov <aleksandr.fedorov itglobal.com>
2019-11-02 03:09:17 +00:00
Justin Hibbits
b144826d79 powerpc/mpc85xx: Set description for the MPC85xx RC bridge 2019-11-02 02:24:53 +00:00
Warner Losh
1c028d7227 Make valdiate_rx_req_id static inline because it uses other static
inline functions. gcc complains about this, most likely due to
the subtle differences between inline and static inline functions
defined in headers.
2019-11-02 02:05:09 +00:00
Alexander Motin
3db35ffa2a Some more taskqueue optimizations.
- Optimize enqueue for two task priority values by adding new tq_hint
field, pointing to the last task inserted into the middle of the list.
In case of more then two priority values it should halve average search.
 - Move tq_active insert/remove out of the taskqueue_run_locked loop.
Instead of dirtying few shared cache lines per task introduce different
mechanism to drain active tasks, based on task sequence number counter,
that uses only cache lines already present in cache.  Since the new
mechanism does not need ordering, switch tq_active from TAILQ to LIST.
 - Move static and dynamic struct taskqueue fields into different cache
lines.  Move lock into its own cache line, so that heavy lock spinning
by multiple waiting threads would not affect the running thread.
 - While there, correct some TQ_SLEEP() wait messages.

This change fixes certain ZFS write workloads, causing huge congestion
on taskqueue lock.  Those workloads combine some large block writes to
saturate the pool and trigger allocation throttling, which uses higher
priority tasks to requeue the delayed I/Os, with many small blocks to
generate deep queue of small tasks for taskqueue to sort.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-11-01 22:49:44 +00:00
Warner Losh
08b86a1a8a We don't support configuring serial PCI cards in EFI. Make this clearer in the
source rather than obfuscaring it behind NO_PCI (nothing else declares that,
so it's not making the ifdefs clearer).
2019-11-01 21:26:43 +00:00
Leandro Lupori
9d8d120983 [PPC64] Fix GDB sigtramp detection
Current implementation of ppcfbsd_pc_in_sigtramp() seems to take only 32-bit
PowerPC in account, as on 64-bit PowerPC most kernel instruction addresses will
be wrongly reported as in sigtramp.

This change adds proper sigtramp detection for PPC64.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D22199
2019-11-01 11:28:43 +00:00
Li-Wen Hsu
c1903b634c Temporarily skip lib.libexecinfo.backtrace_test.backtrace_fmt_basic on i386
PR:		241562
Sponsored by:	The FreeBSD Foundation
2019-11-01 09:16:58 +00:00
Toomas Soome
98e28b71b2 loader: asprinf does crash arm64 due to missing NULL pointer check
PCHAR macro needs to check if d is NULL.

MFC after:	3 days
2019-11-01 06:54:07 +00:00
Kyle Evans
f852618602 mdmfs(8): add -k skel option to populate fs from a skeleton
mdmfs(8) lacks the ability to populate throwaway memory filesystems from an
existing directory.

This features permits an interesting setup where /var for instance lives on
a device where wear-leveling is something you want to avoid as much as
possible and nonetheless you don't want to lose your logs, ports metadata,
etc. Here are the steps:

1. Copy /var to /var.bak;
2. Mount an mfs into /var using -k /var.bak at startup;
3. Synchronize /var to /var.bak weekly and on shutdown.

Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag.

PR:		146254
Submitted by:	jlh (many moons ago)
MFC after:	1 week
2019-11-01 03:10:53 +00:00
Justin Hibbits
8b079fcca7 powerpc/booke: Fix TLB1 entry accounting
It's possible, with per-CPU mappings, for TLB1 indices to get out of sync.
This presents a problem when trying to insert an entry into TLB1 of all
CPUs.  Currently that's done by assuming (hoping) that the TLBs are
perfectly synced, and inserting to the same index for all CPUs.  However,
with aforementioned private mappings, this can result in overwriting
mappings on the other CPUs.

An example:

    CPU0                    CPU1
    <setup all mappings>    <idle>
        3 private mappings
      kick off CPU 1
                            initialize shared mappings (3 indices low)
                            Load kernel module, triggers 20 new mappings
      Sync mappings at N-3
                            initialize 3 private mappings.

At this point, CPU 1 has all the correct mappings, while CPU 0 is missing 3
mappings that were shared across to CPU 1.  When CPU 0 tries to access
memory in one of the overwritten mappings, it hangs while tripping through
the TLB miss handler.  Device mappings are not stored in any page table.

This fixes by introducing a '-1' index for tlb1_write_entry_int(), so each
CPU searches for an available index private to itself.

MFC after:	3 weeks
2019-11-01 02:55:58 +00:00
Alan Somers
ca64a75eda geli: raise WARNS to 6
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-01 02:48:43 +00:00
Brooks Davis
cc86d14a47 truss: centralize pointer-constructing casts.
In nearly all cases, the caller has a uintptr_t compatible argument so
this eliminates a large number of casts.

Add a print_pointer function to centralize printing pointers.

Reviewed by:	jhb
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22212
2019-10-31 22:29:13 +00:00
Vincenzo Maffione
9dd7582c12 netmap: fix build issue in netmap_user.h
The issue was a comparison of integers of different signs
on 32 bit architectures.

Reported by:	jenkins
MFC after:	1 week
2019-10-31 22:16:20 +00:00
Vincenzo Maffione
c7c7805531 add valectl to the system commands
The valectl(4) program is used to manage vale(4) switches.
Add it to the system commands so that it can be used right away.
This program was previously called vale-ctl, and stored in
tools/tools/netmap

Reviewed by:	hrs, bcr, lwhsu, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22146
2019-10-31 21:01:34 +00:00
Ed Maste
2e5f9189bb avoid kernel stack data leak in core dump thrmisc note
bzero the entire thrmisc struct, not just the padding.  Other core dump
notes are already done this way.

Reported by:	Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by:	markj
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-10-31 20:42:36 +00:00
Brooks Davis
c09aa2145a Allow bsd.compat.mk to be reliably included outside Makefile.inc1.
Replace explicit TARGET_* variables with COMPAT_* versions defined based
on where the file is being included.

Also, require that bsd.compat.mk be included directly. It's not going to
be widely used so always loading it in bsd.prog.mk doesn't make sense.
Instead users can include it directly.

Reviewed by:	 imp, bdrewery (prior revision)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22059
2019-10-31 20:37:19 +00:00