]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoRemove unused 32-bit compatibility structures from cryptodev.
markj [Tue, 30 Jun 2020 15:57:11 +0000 (15:57 +0000)]
Remove unused 32-bit compatibility structures from cryptodev.

The counters are exported by a sysctl and have the same width on all
platforms anyway.

Reviewed by: cem, delphij, jhb
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D25465

3 years agoRemove CRYPTO_TIMING.
markj [Tue, 30 Jun 2020 15:56:54 +0000 (15:56 +0000)]
Remove CRYPTO_TIMING.

It was added a very long time ago.  It is single-threaded, so only
really useful for basic measurements, and in the meantime we've gotten
some more sophisticated profiling tools.

Reviewed by: cem, delphij, jhb
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D25464

3 years agoDocument the is_signed(), type_max() and type_min() function macros in the
hselasky [Tue, 30 Jun 2020 08:41:33 +0000 (08:41 +0000)]
Document the is_signed(), type_max() and type_min() function macros in the
LinuxKPI. Try to make the function argument more readable.

Suggested by: several
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoMake EC2 AMIs use portsnap and freebsd-update mirrors hosted in AWS
cperciva [Tue, 30 Jun 2020 06:14:34 +0000 (06:14 +0000)]
Make EC2 AMIs use portsnap and freebsd-update mirrors hosted in AWS

This adjusts freebsd-update.conf and portsnap.conf files in EC2 AMIs to
point at the new AWS-hosted mirror network.

Approved by: re (delphij)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D25498

3 years agosavecore: accept device names without the /dev/ prefix
asomers [Mon, 29 Jun 2020 22:12:23 +0000 (22:12 +0000)]
savecore: accept device names without the /dev/ prefix

dumpon has accepted device names without the prefix ever since r291207.
Since dumpon and savecore are always paired, they ought to accept the same
arguments. Prior to this change, specifying 'dumpdev="da3"' in
/etc/rc.conf, for example, would result in dumpon working just fine but
savecore complaining that "Dump device does not exist".

PR: 247618
Reviewed by: cem, bcr
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25500

3 years agoFix a panic when unloading firmware
gallatin [Mon, 29 Jun 2020 21:35:50 +0000 (21:35 +0000)]
Fix a panic when unloading firmware

LIST_FOREACH_SAFE() is not safe in the presence
of other threads removing list entries when a
mutex is released.

This is not in the critical path, so just restart
the scan each time we drop the lock, rather than
using a marker.

Reviewed by: jhb, markj
Sponsored by: Netflix

3 years agoFix printf(3) output of long doubles on RISC-V
mhorne [Mon, 29 Jun 2020 19:30:35 +0000 (19:30 +0000)]
Fix printf(3) output of long doubles on RISC-V

When the RISC-V port was initially committed to FreeBSD, GCC would
generate 64-bit long doubles, and the definitions in _fpmath.h reflected
that. This was changed to 128-bit in GCC later that year [1], but the
definitions were never updated, despite the documented workaround. This
causes printf(3) and friends to interpret only the low 64-bits of a long
double in ldtoa, thereby printing incorrect values.

Update the definitions now that both clang and GCC generate 128-bit long
doubles.

[1] https://github.com/riscv/riscv-gcc/commit/54b21fc5ae83cefec44bc2caed4a8c664c274ba0

PR: 242067
Reported by: Dennis Clarke <dclarke@blastwave.org>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25420

3 years agomailwrapper: switch mailer.conf to CONFS
kevans [Mon, 29 Jun 2020 18:06:00 +0000 (18:06 +0000)]
mailwrapper: switch mailer.conf to CONFS

This matches what was already being done in dma(8), and should again make
this merge with etcupdate/mergemaster.

Reported by: jhb

3 years agolinux: reposition the comment for bsd_to_linux_bits/linux_to_bsd_bits
kevans [Mon, 29 Jun 2020 17:47:00 +0000 (17:47 +0000)]
linux: reposition the comment for bsd_to_linux_bits/linux_to_bsd_bits

rpokala notes that splitting the definitions like this is kind of silly,
since the comment applies to both.  Move the comment up (or the definition
down, depending on your perspective on life) accordingly.

Reported by: rpokala

3 years agoStop using STATIC_CFLAGS.
jhb [Mon, 29 Jun 2020 17:19:08 +0000 (17:19 +0000)]
Stop using STATIC_CFLAGS.

This was added in r293648 to pass -mlong-calls for crt1.o and gcrt1.o.
The use of -mlong-calls was removed in r358851 for LLVM 10.0, leaving
STATIC_CFLAGS empty.

Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25305

3 years agovm: Add missing WITNESS warnings for M_WAITOK allocation
cem [Mon, 29 Jun 2020 16:54:00 +0000 (16:54 +0000)]
vm: Add missing WITNESS warnings for M_WAITOK allocation

vm_map_clip_{end,start} and lookup_clip_start allocate memory M_WAITOK
for !system_map vm_maps.  Add WITNESS warning annotation for !system_map
callers who may be holding non-sleepable locks.

Reviewed by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D25283

3 years agohexdump(1): Add EXAMPLES section
fernape [Mon, 29 Jun 2020 15:15:14 +0000 (15:15 +0000)]
hexdump(1): Add EXAMPLES section

 * Add examples showing the use of -f, -C, -s, -n
 * Rework the two already present examples that were *format* examples
 * Remove .Tn suggested by mandoc(1)
 * Remove reference to gdb(1) since it is not present in current

Approved by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D25406

3 years agoRevert r362261, "Re-apply r333944 to unbreak ports"
emaste [Mon, 29 Jun 2020 13:30:48 +0000 (13:30 +0000)]
Revert r362261, "Re-apply r333944 to unbreak ports"

A file update in 2018 broke many ports as it misidentified shared
libraries as PIE binaries.  r333944 reverted part of the change,
restoring ports builds but misidentifying objects in the opposite
direction.

Earlier this month file 5.39 was imported, and then the change
originally from r333944 was recommitted as r362261.  However, the
issue was fixed upstream, so r362261 serves no purpose.

PR: 246960, 247461 [exp-run]
Sponsored by: The FreeBSD Foundation

3 years agoImplement is_signed(), type_max() and type_min() function macros in the
hselasky [Mon, 29 Jun 2020 13:08:40 +0000 (13:08 +0000)]
Implement is_signed(), type_max() and type_min() function macros in the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoCoresight: provide device_attach method for FDT bus.
br [Mon, 29 Jun 2020 12:59:09 +0000 (12:59 +0000)]
Coresight: provide device_attach method for FDT bus.

Sponsored by: DARPA, AFRL

3 years agogre(4): Add a STANDARDS section
gbe [Mon, 29 Jun 2020 10:30:43 +0000 (10:30 +0000)]
gre(4): Add a STANDARDS section

Expand the mentioned RFC in the SEE ALSO section
and reference RFC1701 and RFC1702.

PR: 240250
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
Obtained from: OpenBSD
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D25504

3 years agoFix the spelling of identify in the arm64 identcpu code
andrew [Mon, 29 Jun 2020 09:37:07 +0000 (09:37 +0000)]
Fix the spelling of identify in the arm64 identcpu code

Sponsored by: Innovate UK

3 years agoCreate a kernel arm64 ID register view
andrew [Mon, 29 Jun 2020 09:08:36 +0000 (09:08 +0000)]
Create a kernel arm64 ID register view

In preparation for using ifuncs in the kernel is is useful to have a common
view of the arm64 ID registers across all CPUs. Add this and extract the
logic for finding the lower value of two fields to a new helper function.

Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25463

3 years agoFix CTYPE for ja_JP.eucJP and ja_JP.SJIS.
hrs [Mon, 29 Jun 2020 03:23:13 +0000 (03:23 +0000)]
Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS.

PR: 163168
MFC after: 3 days

3 years agolinuxolator: implement memfd_create syscall
kevans [Mon, 29 Jun 2020 03:09:14 +0000 (03:09 +0000)]
linuxolator: implement memfd_create syscall

This effectively mirrors our libc implementation, but with minor fudging --
name needs to be copied in from userspace, so we just copy it straight into
stack-allocated memfd_name into the correct position rather than allocating
memory that needs to be cleaned up.

The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS, have
also been implemented now that we support them.

Note that this implementation is still not quite at feature parity w.r.t.
the actual Linux version; some caveats, from my foggy memory:

- Need to implement SHM_GROW_ON_WRITE, default for memfd (in progress)
- LTP wants the memfd name exposed to fdescfs
- Linux allows open() of an fdescfs fd with O_TRUNC to truncate after dup.
  (?)

Interested parties can install and run LTP from ports (devel/linux-ltp) to
confirm any fixes.

PR: 240874
Reviewed by: kib, trasz
Differential Revision: https://reviews.freebsd.org/D21845

3 years agobhyve: fix NVMe Active Namespace list
chuck [Mon, 29 Jun 2020 00:32:24 +0000 (00:32 +0000)]
bhyve: fix NVMe Active Namespace list

The NVMe specification requires unused entries in the Identify, Active
Namespace ID data to be zero. Fix is bzero the provided page, similar to
what is done for the Namespace Descriptors list.

Fixes UNH Tests 2.6 and 2.9

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24901

3 years agobhyve: NVMe handle zero length DSM ranges
chuck [Mon, 29 Jun 2020 00:32:21 +0000 (00:32 +0000)]
bhyve: NVMe handle zero length DSM ranges

Dataset Management range specifications may have a zero length (a.k.a.
an empty range definition). Handle the case of all ranges being empty by
completing with Success (DSM commands are advisory only). For
Deallocate, skip empty range definitions when sending TRIM's to the
backing storage.

Fixes UNH Test 2.2.4

Reviewed by: imp
Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24900

3 years agobhyve: fix NVMe Get Features, Predictable Latency
chuck [Mon, 29 Jun 2020 00:32:18 +0000 (00:32 +0000)]
bhyve: fix NVMe Get Features, Predictable Latency

If the Predictable Latency Mode is not supported, NVMe Controllers must
return Invalid Field in Command status for the Get Features command
with IDs:
 - Predictable Latency Mode Config
 - Predictable Latency Mode Window

Fixes UNH Tests 3.6

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24899

3 years agobhyve: add NVMe Feature Interrupt Vector Config
chuck [Mon, 29 Jun 2020 00:32:15 +0000 (00:32 +0000)]
bhyve: add NVMe Feature Interrupt Vector Config

This adds support for NVMe Get Features, Interrupt Vector Config
parameter error checking done by the UNH compliance tests.

Fixes UNH Tests 1.6.8 and 5.5.6

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24898

3 years agobhyve: add basic NVMe Firmware Commit support
chuck [Mon, 29 Jun 2020 00:32:11 +0000 (00:32 +0000)]
bhyve: add basic NVMe Firmware Commit support

This commit updates the Identify Controller data to advertise the
Controller supports a single firmware slot and that firmware slot 1 is
read-only. Additionally, it returns an "Invalid Firmware Slot" error
when the host issues any Firmware Commit command (a.k.a. Firmware
Activate).

Fixes UNH Test 5.5.3

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24897

3 years agobhyve: Add AER support to NVMe emulation
chuck [Mon, 29 Jun 2020 00:32:08 +0000 (00:32 +0000)]
bhyve: Add AER support to NVMe emulation

This adds support to bhyve's NVMe device emulation for processing Async
Event Requests but not returning them (i.e. Async Event Notifications).

Fixes UNH Test 5.5.2

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24896

3 years agobhyve: validate the NVMe LBA start and count
chuck [Mon, 29 Jun 2020 00:32:04 +0000 (00:32 +0000)]
bhyve: validate the NVMe LBA start and count

Add checks that the combination of Starting LBA and Number of Logical
Blocks in a command will not exceed the range of the underlying storage.

Note that because NVMe specifices the Starting LBA as a uint64_t, care
must be taken when converting it and the block count to avoid an integer
overflow.

Fixes UNH Tests 2.2.3, 2.3.2, and 2.4.2

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24895

3 years agobhyve: implement NVMe SMART data I/O statistics
chuck [Mon, 29 Jun 2020 00:32:01 +0000 (00:32 +0000)]
bhyve: implement NVMe SMART data I/O statistics

SMART data in NVMe includes statistics for number of read and write
commands issued as well as the number of "data units" read and written.
NVMe defines "data unit" as thousands of 512 byte blocks (e.g. 1 data
unit is 1-1,000 512 byte blocks, 3 data units are 2,001-3,000 512 byte
blocks).

This patch implements counters for:
 - Data Units Read
 - Data Units Written
 - Host Read Commands
 - Host Write Commands
and exposes the values when the guest reads the SMART/Health Log Page.

Fixes UNH Test 1.3.8

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24894

3 years agobhyve: validate NVMe deallocate range values
chuck [Mon, 29 Jun 2020 00:31:58 +0000 (00:31 +0000)]
bhyve: validate NVMe deallocate range values

For NVMe emulation, validate the Data Set Management LBA ranges do not
exceed the capacity of the backing storage. If they do, return an "LBA
Out of Range" error.

Fixes UNH Test 2.2.3

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24893

3 years agobhyve: base pci_nvme_ioreq size on advertised MDTS
chuck [Mon, 29 Jun 2020 00:31:54 +0000 (00:31 +0000)]
bhyve: base pci_nvme_ioreq size on advertised MDTS

NVMe controllers advertise their Max Data Transfer Size (MDTS) to limit
the number of page descriptors in an I/O request. Take advantage of this
and size the struct pci_nvme_ioreq accordingly.

Ensuring these values match both future-proofs the code and allows
removing some complexity which only exists to handle this possibility.

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24891

3 years agobhyve: refactor NVMe I/O read/write
chuck [Mon, 29 Jun 2020 00:31:51 +0000 (00:31 +0000)]
bhyve: refactor NVMe I/O read/write

Split the NVM I/O function (i.e. nvme_opc_write_read) into separate
functions - one for RAM based backing-store and another for disk based
backing-store for easier maintenance. No functional changes.

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24890

3 years agobhyve: implement NVMe Format NVM command
chuck [Mon, 29 Jun 2020 00:31:47 +0000 (00:31 +0000)]
bhyve: implement NVMe Format NVM command

The Format NVM command mainly allows the host to specify the block size
and protection information used for the Namespace. As the bhyve
implementation simply maps the capabilities of the backing storage
through to the guest, there isn't anything to implement. But a side
effect of the format is the NVMe Controller shall not return any data
previously written (i.e. erase previously written data). This patch
implements this later behavior to provide a compliant implementation.

Fixes UNH Test 1.6

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24889

3 years agobhyve: make unsupported NVMe commands a debug message
chuck [Mon, 29 Jun 2020 00:31:44 +0000 (00:31 +0000)]
bhyve: make unsupported NVMe commands a debug message

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24888

3 years agobhyve: add more compliant NVMe Get/Set Features
chuck [Mon, 29 Jun 2020 00:31:41 +0000 (00:31 +0000)]
bhyve: add more compliant NVMe Get/Set Features

Create a generic Get/Set Features by saving off the contents of CDW11
from the Set command and returning the saved value in the completion of
the Get command. Implementation allows providing optional implementation
for both Set and Get.

Add infrastructure to determine which feature ID's are namespace
specific and flag violations of this category of error.

Also adds the feature specific behavior of Set Features, Number of
Queues to only allow this command once per Controller reset.

Fixes UNH Tests 1.2, 5.4, and 5.5.6

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24887

3 years agobhyve: fix NVMe queue creation and deletion
chuck [Mon, 29 Jun 2020 00:31:37 +0000 (00:31 +0000)]
bhyve: fix NVMe queue creation and deletion

Add checks for various types of invalid I/O Queue Create and Delete
command parameters, including:
 - QID=0
 - QID>MAX
 - QID already in use
 - Delete an Active CQ
 - Invalid QSIZE
 - Invalid CQID (SQ creation)
 - Invalid interrupt vector (CQ creation)

Fixes UNH Tests 1.4.2-5,7-8

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24886

3 years agobhyve: fix NVMe Get Log Page command
chuck [Mon, 29 Jun 2020 00:31:34 +0000 (00:31 +0000)]
bhyve: fix NVMe Get Log Page command

Fix the logic in nvme_opc_get_log_page to calculate the number of DWORDS
(uint32_t) instead of WORDS (uint16_t) for the byte length. And only
return the allowed number of Log Page bytes as determined by the user
request and actual size of the requested log page.

Fixes UNH Test 1.3

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24885

3 years agobhyve: implement NVMe Namespace Identification Descriptor
chuck [Mon, 29 Jun 2020 00:31:30 +0000 (00:31 +0000)]
bhyve: implement NVMe Namespace Identification Descriptor

NVMe 1.3 compliant controllers must implement the Namespace
Identification Descriptor structure (i.e. CNS=3). Previously this was
unimplemented.

Fixes UNH Test 1.1.4-0

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24884

3 years agobhyve: Consolidate NVMe CQ update
chuck [Mon, 29 Jun 2020 00:31:27 +0000 (00:31 +0000)]
bhyve: Consolidate NVMe CQ update

Consolidate the code which writes Completion Queue entries and updates
the CQ doorbell value. While in the neighborhood, convert the "toggle CQ
phase bit" code to use an XOR operation instead of an "if/else" branch.

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24882

3 years agobhyve: add locks around NVMe queue accesses
chuck [Mon, 29 Jun 2020 00:31:24 +0000 (00:31 +0000)]
bhyve: add locks around NVMe queue accesses

The NVMe code attempted to ensure thread safety through a combination of
using atomics and a "busy" flag. But this approach leads to unavoidable
race conditions.

Fix is to use per-queue mutex locks to ensure thread safety within the
queue processing code. While in the neighborhood, move all the queue
initialization code to a common function.

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19841

3 years agobhyve: add a comment explaining NVME dsm option
chuck [Mon, 29 Jun 2020 00:31:20 +0000 (00:31 +0000)]
bhyve: add a comment explaining NVME dsm option

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24881

3 years agobhyve: implement NVMe Flush command
chuck [Mon, 29 Jun 2020 00:31:17 +0000 (00:31 +0000)]
bhyve: implement NVMe Flush command

This adds support for the NVMe I/O command Flush. For block-based
devices, submit a DIOCGFLUSH to the backing storage. Otherwise, command
is treated like a NOP and completes with a Successful status.

Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24880

3 years agobhyve: refactor NVMe IO command handling
chuck [Mon, 29 Jun 2020 00:31:14 +0000 (00:31 +0000)]
bhyve: refactor NVMe IO command handling

This refactors the NVMe I/O command processing function to make adding
new commands easier. The main change is to move command specific
processing (i.e. Read/Write) to separate functions for each NVMe I/O
command and leave the common per-command processing in the existing
pci_nvme_handle_io_cmd() function.

While here, add checks for some common errors (invalid Namespace ID,
invalid opcode, LBA out of range).

Add myself to the Copyright holders

Reviewed by: imp
Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24879

3 years agobhyve: convert NVMe logging statements
chuck [Mon, 29 Jun 2020 00:31:11 +0000 (00:31 +0000)]
bhyve: convert NVMe logging statements

Convert the debug and warning logging macros to be parameterized and
correctly use bhyve's PRINTLN macro.

Reviewed by: imp
Tested by: Jason Tubnor
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24878

3 years agoDo not use macros in the argument to -width
0mp [Sun, 28 Jun 2020 22:04:52 +0000 (22:04 +0000)]
Do not use macros in the argument to -width

This patch improves the presentation of the FILES section dramatically.

MFC after: 2 weeks

3 years agoDocument that Intel Dual Band Wireless AC 8265 is supported by iwm(4)
0mp [Sun, 28 Jun 2020 21:48:56 +0000 (21:48 +0000)]
Document that Intel Dual Band Wireless AC 8265 is supported by iwm(4)

MFC after: 2 weeks

3 years agoFix UMA's first-touch policy on systems with empty domains.
markj [Sun, 28 Jun 2020 21:35:04 +0000 (21:35 +0000)]
Fix UMA's first-touch policy on systems with empty domains.

Suppose a thread is running on a CPU in a NUMA domain with no physical
RAM.  When an item is freed to a first-touch zone, it ends up in the
cross-domain bucket.  When the bucket is full, it gets placed in another
domain's bucket queue.  However, when allocating an item, UMA will
always go to the keg upon a per-CPU cache miss because the empty
domain's bucket queue will always be empty.  This means that a non-empty
domain's bucket queues can grow very rapidly on such systems.  For
example, it can easily cause mbuf allocation failures when the zone
limit is reached.

Change cache_alloc() to follow a round-robin policy when running on an
empty domain.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25355

3 years agoRemove some redundant assignments and computations.
markj [Sun, 28 Jun 2020 21:34:38 +0000 (21:34 +0000)]
Remove some redundant assignments and computations.

Reported by: alc
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25400

3 years agosh/tests: Re-enable bin.sh.execution.functional_test.bg12.0
jilles [Sun, 28 Jun 2020 21:33:08 +0000 (21:33 +0000)]
sh/tests: Re-enable bin.sh.execution.functional_test.bg12.0

This reverts r362646.

PR: 247559
MFC after: 1 week

3 years agosh/tests: Fix flaky execution/bg12.0
jilles [Sun, 28 Jun 2020 21:15:29 +0000 (21:15 +0000)]
sh/tests: Fix flaky execution/bg12.0

When job control is not enabled, the shell ignores SIGINT while waiting for
a foreground process unless that process exits on SIGINT. In this case, the
foreground process is sleep and it does not exit on SIGINT because the
signal is only sent to the shell. Depending on order of events, this could
cause the SIGINT to be unexpectedly ignored.

On lightly loaded bare metal, the chance of this happening tends to be less
than 0.01% but with higher loads and/or virtualization it becomes more
likely.

Starting the sleep in background and using the wait builtin ensures SIGINT
will not be ignored.

PR: 247559
Reported by: lwhsu
MFC after: 1 week

3 years agoConfigure rx_delay/tx_delay values for RK3399/RK3328 GMAC
gonzo [Sun, 28 Jun 2020 21:11:10 +0000 (21:11 +0000)]
Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC

For 1000Mb mode to work reliably TX/RX delays need to be configured
between the TX/RX clock and the respective signals on the PHY
to compensate for differing trace lengths on the PCB.

Reviewed by: manu
MFC after: 1 week

3 years agoMake linux(4) support SO_PROTOCOL. Running Python test suite
trasz [Sun, 28 Jun 2020 18:56:32 +0000 (18:56 +0000)]
Make linux(4) support SO_PROTOCOL.  Running Python test suite
with python3.8 from Focal triggers those.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25491

3 years agoFix llvm-strings.1 not installing, this was a copy/paste error.
dim [Sun, 28 Jun 2020 18:02:51 +0000 (18:02 +0000)]
Fix llvm-strings.1 not installing, this was a copy/paste error.

MFC after: 3 weeks

3 years agoRemove older llvm-ranlib.1 entry from ObsoleteFiles.inc, as it has
dim [Sun, 28 Jun 2020 18:02:12 +0000 (18:02 +0000)]
Remove older llvm-ranlib.1 entry from ObsoleteFiles.inc, as it has
gotten its own manpage now, and should be no longer be removed by "make
delete-old".

MFC after: 3 weeks

3 years agoAdapt documentation of kern.tty_info_kstacks.
grembo [Sun, 28 Jun 2020 17:28:11 +0000 (17:28 +0000)]
Adapt documentation of kern.tty_info_kstacks.

s/stack/kernel stack/, as this feature only shows kernel stacks.

Reported by: jhb
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D25488

3 years agoUse EFI memory map to determine attributes for Acpi mappings on arm64.
andrew [Sun, 28 Jun 2020 15:03:07 +0000 (15:03 +0000)]
Use EFI memory map to determine attributes for Acpi mappings on arm64.

AcpiOsMapMemory is used for device memory when e.g. an _INI method wants
to access physical memory, however, aarch64 pmap_mapbios is hardcoded to
writeback. Search for the correct memory type to use in pmap_mapbios.

Submitted by: Greg V <greg_unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D25201

3 years agoDon't send packets containing ERROR chunks in response to unknown
tuexen [Sun, 28 Jun 2020 14:11:36 +0000 (14:11 +0000)]
Don't send packets containing ERROR chunks in response to unknown
chunks when being in a state where the verification tag to be used
is not known yet.

MFC after: 1 week

3 years agoDon't check ch for not being NULL, since that is true.
tuexen [Sun, 28 Jun 2020 11:12:03 +0000 (11:12 +0000)]
Don't check ch for not being NULL, since that is true.

MFC after: 1 week

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Sun, 28 Jun 2020 07:43:43 +0000 (07:43 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.1-rc2-0-g77d76b71d7d.

Also add a few more llvm utilities under WITH_CLANG_EXTRAS:

* llvm-dwp, a utility for merging DWARF 5 Split DWARF .dwo files into
  .dwp (DWARF package files)
* llvm-size, a size(1) replacement
* llvm-strings, a strings(1) replacement

MFC after: 3 weeks

3 years ago[fifolog] wrap the recno when we hit the end of the provided file size.
adrian [Sun, 28 Jun 2020 06:52:39 +0000 (06:52 +0000)]
[fifolog] wrap the recno when we hit the end of the provided file size.

Without this the log just keeps growing to infinity.

Reviewed by: phk
Differential Revision: https://reviews.freebsd.org/D25478

3 years agotop: do not try to use sysctl machdep.smp_active.
kib [Sun, 28 Jun 2020 00:29:21 +0000 (00:29 +0000)]
top: do not try to use sysctl machdep.smp_active.

The sysctl was removed by r76078 in 2001.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoUpdate VFS_CHECKEXP.9 to reflect how it is currently used by the NFS server.
rmacklem [Sat, 27 Jun 2020 21:37:48 +0000 (21:37 +0000)]
Update VFS_CHECKEXP.9 to reflect how it is currently used by the NFS server.

Reported by: pluknet
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D25333

3 years agoExplain how to learn about possible recognized locale names
joerg [Sat, 27 Jun 2020 20:55:47 +0000 (20:55 +0000)]
Explain how to learn about possible recognized locale names

Posix says that the interpretation of the locale string is
"implementation-defined", so we ought to document what is
actually recognized.

Also add a cross reference to locale(1).

PR: 247553
MFC after: 1 week

3 years agops(1): don't try to handle non-SMP systems
pstef [Sat, 27 Jun 2020 20:01:56 +0000 (20:01 +0000)]
ps(1): don't try to handle non-SMP systems

As reported by kib, sysctl machdep.smp_active doesn't exist and on UP we
return CPU 0 for all threads anyway.

Reported by: kib

3 years agoamd64 pmap: explain ptepindex.
kib [Sat, 27 Jun 2020 19:29:07 +0000 (19:29 +0000)]
amd64 pmap: explain ptepindex.

Reviewed by: markj
Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25187

3 years agops(1): reuse keyword "cpu" to show CPU number
pstef [Sat, 27 Jun 2020 19:09:33 +0000 (19:09 +0000)]
ps(1): reuse keyword "cpu" to show CPU number

This flag will now show the processor number on which a process is running.

This change was inspired by PR129965. Initially I didn't think that the
patch attached to it was correct -- it sacrificed ki_estcpu use in "cpu"
for ki_lastcpu and I thought that the old functionality should be kept and
the new (cpu#) one added to it. But I've since discovered that ki_estcpu is
sched_4bsd-specific. What's worse, it represents the same thing as
ki_pctcpu, except ki_pctcpu is universal -- so "%cpu" has been using it
successfully. Therefore, I've decided to replace information based on
ki_estcpu with information based on ki_oncpu/ki_lastcpu.

Key parts of the code and manual changes were borrowed from top(1).

PR: 129965
Reported by: Nikola Knežević
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25377

3 years agoVendor import of llvm-project branch release/10.x
dim [Sat, 27 Jun 2020 18:34:17 +0000 (18:34 +0000)]
Vendor import of llvm-project branch release/10.x
llvmorg-10.0.1-rc2-0-g77d76b71d7d.

3 years agoDocument new kern.tty_info_kstacks tunable.
grembo [Sat, 27 Jun 2020 16:31:04 +0000 (16:31 +0000)]
Document new kern.tty_info_kstacks tunable.

Reviewed by: manpages (imp), 0mp
Differential Revision: https://reviews.freebsd.org/D25488

3 years agoMake linux(4) warn about unsupported SA_ flags.
trasz [Sat, 27 Jun 2020 15:50:35 +0000 (15:50 +0000)]
Make linux(4) warn about unsupported SA_ flags.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25453

3 years agoRegen.
trasz [Sat, 27 Jun 2020 14:43:29 +0000 (14:43 +0000)]
Regen.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoAdd proper types for linux message queue syscalls; mostly taken
trasz [Sat, 27 Jun 2020 14:42:08 +0000 (14:42 +0000)]
Add proper types for linux message queue syscalls; mostly taken
from 32-bit Linuxulator.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25386

3 years agoAdd syscall definitions for linux xattr syscalls.
trasz [Sat, 27 Jun 2020 14:39:44 +0000 (14:39 +0000)]
Add syscall definitions for linux xattr syscalls.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25387

3 years agoAdjust types of linuxulator syscalls, to match include/linux/syscalls.h
trasz [Sat, 27 Jun 2020 14:37:36 +0000 (14:37 +0000)]
Adjust types of linuxulator syscalls, to match include/linux/syscalls.h
in vanilla Linux git tree.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25385

3 years agoixl.4: Use a -bullet list instead of -item
0mp [Sat, 27 Jun 2020 13:33:31 +0000 (13:33 +0000)]
ixl.4: Use a -bullet list instead of -item

Now the list looks like a list. Using -item only makes sense if the list is
meant to be a list of terms and definitions.

MFC after: 3 days

3 years agoImport new 2-clause BSD licenced implementation of the bc and dc commands
se [Sat, 27 Jun 2020 12:02:01 +0000 (12:02 +0000)]
Import new 2-clause BSD licenced implementation of the bc and dc commands

These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:

- They do not depend on external large number functions (i.e. no dependency
  on OpenSSL or any other large number library)

- They implements all features found in GNU bc/dc (with the exception of
  the forking of sub-processes, which the author of this version considers
  as a security issue).

- They are significantly faster than the current code in base (more than
  2 orders of magnitude in some of my tests, e.g. for 12345^100000).

- They should be fully compatible with all features and the behavior of the
  current implementations in FreeBSD (not formally verified).

- They support POSIX message catalogs and come with localized messages in
  Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
  and Russian.

- They offer very detailed man-pages that provide far more information than
  the current ones.

The upstream sources contain a large number of tests, which are not
imported with this commit. They could be integrated into our test
framework at a latter time.

Installation of this version is controlled by the option "MK_GH_BC=yes".
This option will be set to yes by default in 13-CURRENT, but will be off
by default in 12-STABLE.

Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
MFC after: 4 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D19982

3 years agoFollow-up to r362679, add more entries to OptionalObsoleteFiles.inc
dim [Sat, 27 Jun 2020 12:00:08 +0000 (12:00 +0000)]
Follow-up to r362679, add more entries to OptionalObsoleteFiles.inc

MFC after: 3 days
X-MFC-With: r362679

3 years agoRegenerate ReStructuredText based manpages for llvm-project tools:
dim [Sat, 27 Jun 2020 11:56:49 +0000 (11:56 +0000)]
Regenerate ReStructuredText based manpages for llvm-project tools:

* bugpoint.1
* clang.1
* llc.1
* lldb.1
* lli.1
* llvm-ar.1
* llvm-as.1
* llvm-bcanalyzer.1
* llvm-cov.1
* llvm-diff.1
* llvm-dis.1
* llvm-dwarfdump.1
* llvm-extract.1
* llvm-link.1
* llvm-mca.1
* llvm-nm.1
* llvm-pdbutil.1
* llvm-profdata.1
* llvm-symbolizer.1
* llvm-tblgen.1
* opt.1

Add newly generated manpages for:

* llvm-addr2line.1 (this is an alias of llvm-symbolizer)
* llvm-cxxfilt.1
* llvm-objcopy.1
* llvm-ranlib.1 (this is an alias of llvm-ar)

Note that llvm-objdump.1 is an exception, as upstream has both a plain
.1 file, and a .rst variant. These will have to be reconciled upstream
first.

MFC after: 3 days

3 years agokillall(1): Clarify -d, -s and -v options
fernape [Sat, 27 Jun 2020 11:28:11 +0000 (11:28 +0000)]
killall(1): Clarify -d, -s and -v options

-d and -v are not equivalent options. The former is more verbose than the
latter and the former does not actually send the signals while the latter does.
Let them have their own paragraphs.

From the point of view of the output, -v is equivalent to -s, so describe them
close to each other. The difference is that former actually sends the signals
and the latter doesn't.

PR: 247411
Approved by: manpages(0mp)
Differential Revision: https://reviews.freebsd.org/D25413

3 years agorev(1): Add EXAMPLES section
fernape [Sat, 27 Jun 2020 11:19:18 +0000 (11:19 +0000)]
rev(1): Add EXAMPLES section

Very simple example.

Approved by: imp, 0mp, manpages(bcr)
Differential Revision: https://reviews.freebsd.org/D25468

3 years agoFix trailing-comma-related typos in the tree when the Xr macro is used
0mp [Sat, 27 Jun 2020 11:13:45 +0000 (11:13 +0000)]
Fix trailing-comma-related typos in the tree when the Xr macro is used

MFC after: 1 week

3 years agoFix a typo, use Lk for links and use HTTPS where applicable
0mp [Sat, 27 Jun 2020 11:03:18 +0000 (11:03 +0000)]
Fix a typo, use Lk for links and use HTTPS where applicable

MFC after: 3 days

3 years agortwn: Add a USB ID for Buffalo WI-U2-433DHP
lwhsu [Sat, 27 Jun 2020 07:34:15 +0000 (07:34 +0000)]
rtwn: Add a USB ID for Buffalo WI-U2-433DHP

PR: 247573
Submitted by: HATANO Tomomi <hatanou@infolab.ne.jp>
MFC after: 1 week

3 years ago[ath_hal] Add KeyMiss for AR5212/AR5416 series chips.
adrian [Sat, 27 Jun 2020 02:59:51 +0000 (02:59 +0000)]
[ath_hal] Add KeyMiss for AR5212/AR5416 series chips.

This is a flag from the MAC that says the received packet didn't match
a keycache slot.  This isn't technically a problem as WEP keys don't
match keycache slots (they're "global" keys), but it could be useful
for tracking down CCMP decryption failures.

Right now it's a no-op - it mirrors what the AR9300 HAL does and it
just increments a counter.  But, hey, maybe one day I'll use it for
diagnosing keycache/CCMP decrypt issues.

3 years agovm_page_free_prep(): correct description of the required page and object state.
kib [Sat, 27 Jun 2020 02:31:39 +0000 (02:31 +0000)]
vm_page_free_prep(): correct description of the required page and object state.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25482

3 years agoFix libnv build post rename
mmacy [Sat, 27 Jun 2020 02:17:04 +0000 (02:17 +0000)]
Fix libnv build post rename

Submitted by: Neel Chauhan
Differential Revision: https://reviews.freebsd.org/D25481

3 years agoFix "current" variable name conflict with openzfs
mmacy [Sat, 27 Jun 2020 00:57:48 +0000 (00:57 +0000)]
Fix "current" variable name conflict with openzfs

The variable "current" is an alias for curthread
in openzfs. Rename all variable uses of current
in dtrace.c to curstate.

3 years agoRename nvpair.c to bsd_nvpair.c to not conflict with openzfs' version.
mmacy [Sat, 27 Jun 2020 00:55:03 +0000 (00:55 +0000)]
Rename nvpair.c to bsd_nvpair.c to not conflict with openzfs' version.

3 years agoChroot first appeared in 4.3-Reno, not in 4.4 in the BSD world,
imp [Fri, 26 Jun 2020 22:23:15 +0000 (22:23 +0000)]
Chroot first appeared in 4.3-Reno, not in 4.4 in the BSD world,
but in System III in the AT&T world.

Examination of the TUHS archives shows this was present in 4.3-Reno
and System III.

Reviewed by: 0mp@, allanjude@
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D25479

3 years agoChroot actually appeared in 7th Edition Unix.
imp [Fri, 26 Jun 2020 22:05:23 +0000 (22:05 +0000)]
Chroot actually appeared in 7th Edition Unix.

Chroot appeared during the development of 7th edition Unix. The FreeBSD jail
documents, incorrectly, that Bill Joy added this to 4.2BSD on 18 March
1982. That was when Bill Joy converted from a statically coded system call glue
to dynamically generated assembler. Chroot was present in 32V, 3BSD, 4.0BSD, 4.1BSD
and 4.1cBSD well in advance of this. Kirk McKusick agrees with this analysis.

See also:
V7: https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/libc/sys/chroot.s
32V: https://minnie.tuhs.org/cgi-bin/utree.pl?file=32V/usr/src/libc/sys/chroot.s
3BSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/libc/sys/chroot.s
4BSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/libc/sys/chroot.s
4.1cBSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/libc/sys/chroot.s

The 6th and earlier editions do not have this system call, nor do they have
anything named chroot in the trees available from TUHS.

Reviewed by: allanjude@
Differential Revision: https://reviews.freebsd.org/D25475

3 years agoloader: can not read zfs pool with slog removed
tsoome [Fri, 26 Jun 2020 21:21:35 +0000 (21:21 +0000)]
loader: can not read zfs pool with slog removed

The vdev_init() does check for "known" vdev types, the [log] device removal will create "hole"
device, but vdev_init() does not allow it.

Obtained from: illumos
MFC after: 1 week

3 years agoAdd mostly dummy hw.pci.enable_aspm tunable.
mav [Fri, 26 Jun 2020 19:55:11 +0000 (19:55 +0000)]
Add mostly dummy hw.pci.enable_aspm tunable.

The only thing this tunable enables now is reporting to ACPI _OSC that
Active State Power Management and Clock Power Management Capability are
"supported" by the OS.

I've found that at least some Supermicro server boards do not allow OS
to support native PCIe hot-plug unless it reports those capabilities.
After spending significant time in PCIe specs I have found very little
motivation for that, and none of it applies to those motherboards, not
enabling ASPM themselves.  So unless OS explicitly wants to save power,
I see nothing for it to do there actually.

I guess it may get sense to support ASPM when we get Thunderbolt support.
Otherwise I have no system with PCIe hot-plug where power saving matters.

It would be nice to enable this by default, but I worry that it affect
power saving of some laptops, even though I haven't noticed that myself.

3 years agoOnly include object files from .ALLSRC when linking crt1 objects.
jhb [Fri, 26 Jun 2020 19:46:30 +0000 (19:46 +0000)]
Only include object files from .ALLSRC when linking crt1 objects.

Reported by: np, peterj
Reviewed by: kib, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25469

3 years agoTemporarily skip flakey sys.kern.sysv_test.msg in CI
lwhsu [Fri, 26 Jun 2020 17:58:10 +0000 (17:58 +0000)]
Temporarily skip flakey sys.kern.sysv_test.msg in CI

PR: 233649

3 years agoifconfig(8): optimize -f ether:dash mode
allanjude [Fri, 26 Jun 2020 16:20:34 +0000 (16:20 +0000)]
ifconfig(8): optimize -f ether:dash mode

Switch to the simplified while loop suggest by Aaron LI

Post commit review via: https://reviews.freebsd.org/rS301185#inline-232

Submitted by: Aaron LI <aly@aaronly.me>
Sponsored by: Klara Inc.

3 years agoifconfig(8): remove duplicate line from man page
allanjude [Fri, 26 Jun 2020 15:14:03 +0000 (15:14 +0000)]
ifconfig(8): remove duplicate line from man page

Reported by: Weitian LI <liweitianux@live.com>
Sponsored by: Klara Inc.

3 years agoAdd MATCH option for CONFIG_MATCH_IFACE.
cy [Fri, 26 Jun 2020 14:18:08 +0000 (14:18 +0000)]
Add MATCH option for CONFIG_MATCH_IFACE.

If the interfaces on which wpa_supplicant is to run are not known or do
not exist, wpa_supplicant can match an interface when it arrives. Each
matched interface is separated with -M argument and the -i argument now
allows for pattern matching.

As an example, the following command would start wpa_supplicant for a
specific wired interface called lan0, any interface starting with wlan
and lastly any other interface. Each match has its own configuration
file, and for the wired interface a specific driver has also been given.

wpa_supplicant \
-M -c wpa_wired.conf -ilan0 -D wired \
-M -c wpa1.conf -iwlan* \
-M -c wpa2.conf

PR: 247177
Reported by: greg@unrelenting.technology
MFC after: 1 month
Related to: ports r540412

3 years agosound/hda: fix interrupt handler endless loop after r362294
avg [Fri, 26 Jun 2020 09:46:03 +0000 (09:46 +0000)]
sound/hda: fix interrupt handler endless loop after r362294

Not all interrupt sources that affect CIS bit were acknowledged.
Specifically, bits in STATESTS (aka WAKESTS) were left set.

The fix is to disable WAKEEN and clear STATESTS bits before the HDA
interrupt is enabled.  This way we should never get any STATESTS bits.

I also added placeholders for all event bits that we currently do not
enable, do not handle and do not clear.  This might get useful when / if
we enable any of them.

Reported by: kib (Apollo Lake hardware)
Tested by: kib (earlier, different change)
MFC after: 2 weeks
X-MFC with: r362294

3 years agoTemporarily skip flakey bin.sh.execution.functional_test.bg12 in CI
lwhsu [Fri, 26 Jun 2020 09:39:23 +0000 (09:39 +0000)]
Temporarily skip flakey bin.sh.execution.functional_test.bg12 in CI

PR: 238870
Sponsored by: The FreeBSD Foundation

3 years agoena: fix module build after r362530
avg [Fri, 26 Jun 2020 09:32:57 +0000 (09:32 +0000)]
ena: fix module build after r362530

Somehow I missed the makefile when moving the change from phabricator to
svn.

MFC after: 1 week
X-MFC with: r362530

3 years agoPrevent calling USB backends multiple times.
grehan [Fri, 26 Jun 2020 08:20:38 +0000 (08:20 +0000)]
Prevent calling USB backends multiple times.

The TRB processing loop could potentially call a back-end twice
with the same status transaction. While this was generally benign,
some code paths in the tablet backend weren't set up to handle
this case, resulting in a NULL dereference.

Fix by
 - returning a STALL error when an invalid request was seen in the backend
 - skipping a call to the backend if the number of packets in a status
   transaction was zero (this code fragment was taken from the Intel ACRN
   xhci backend)

PR: 246964
Reported by:  Ali Abdallah
Discussed with: Leon Dang (author)
Reviewed by: jhb (#bhyve), Leon Dang
Approved by: jhb
Obtained from:  Intel ACRN (partially)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25228

3 years agoUpdate bhyve maintainers.
grehan [Fri, 26 Jun 2020 06:11:50 +0000 (06:11 +0000)]
Update bhyve maintainers.

Suggested by: jhb
Approved by:  jhb, tychon