freebsd.git
2 years agoaarch64: Add constants for fields in the PMEVTYPERn_EL0 event registers.
John Baldwin [Fri, 11 Mar 2022 19:29:45 +0000 (11:29 -0800)]
aarch64: Add constants for fields in the PMEVTYPERn_EL0 event registers.

Reviewed by: andrew
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34526

2 years agoloader: support numeric and named bright colors (8-15)
Ed Maste [Wed, 9 Mar 2022 21:08:04 +0000 (16:08 -0500)]
loader: support numeric and named bright colors (8-15)

Accept "bright" or "light" prefix for named colors.

For numeric colors, update error message to specify that values 0 to 15
are allowed, and verify that values are in that range.

Reviewed by: imp, tsoome (both earlier version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34512

2 years agoRevert "Add the PMCR_EL0.N arm64 register field"
Andrew Turner [Fri, 11 Mar 2022 17:51:27 +0000 (17:51 +0000)]
Revert "Add the PMCR_EL0.N arm64 register field"

This reverts commit b6fd96ed0b40e5a42eaea662b5461070c93a1c6c.

2 years agoratecheck: mininterval is const
Eric van Gyzen [Fri, 11 Mar 2022 17:35:41 +0000 (11:35 -0600)]
ratecheck: mininterval is const

Reflect this in the man page.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 years agolindebugfs: Make single_release() NULL safe.
Hans Petter Selasky [Fri, 11 Mar 2022 16:39:44 +0000 (17:39 +0100)]
lindebugfs: Make single_release() NULL safe.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agolindebugfs: The Linux file operations use negative return values in the kernel.
Hans Petter Selasky [Fri, 11 Mar 2022 16:37:46 +0000 (17:37 +0100)]
lindebugfs: The Linux file operations use negative return values in the kernel.

Fix sign.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agolindebugfs: Zero the linux_file structure before use.
Hans Petter Selasky [Fri, 11 Mar 2022 16:29:54 +0000 (17:29 +0100)]
lindebugfs: Zero the linux_file structure before use.

This avoids clients using garbage values on the stack and makes
debugging easier.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoAdd more arm64 register op* and CR* values
Andrew Turner [Fri, 11 Mar 2022 11:19:05 +0000 (11:19 +0000)]
Add more arm64 register op* and CR* values

These will be used by bhyve/arm64.

Sponsored by: Innovate UK

2 years agoAdd the PMCR_EL0.N arm64 register field
Andrew Turner [Fri, 11 Mar 2022 11:06:44 +0000 (11:06 +0000)]
Add the PMCR_EL0.N arm64 register field

Sponsored by: Innovate UK

2 years agoCorrect the location of the arm64 PMCR register
Andrew Turner [Fri, 11 Mar 2022 10:56:42 +0000 (10:56 +0000)]
Correct the location of the arm64 PMCR register

This was one of the last registers to not be in alphabetical order in
armreg.h. Fix this to make it easier to find.

Sponsored by: Innovate UK

2 years agoSort the M* and P* arm64 registers
Andrew Turner [Fri, 11 Mar 2022 10:31:05 +0000 (10:31 +0000)]
Sort the M* and P* arm64 registers

Sponsored by: Innovate UK

2 years agopci_vendors: update to 2022.03.06
Baptiste Daroussin [Fri, 11 Mar 2022 09:48:04 +0000 (10:48 +0100)]
pci_vendors: update to 2022.03.06

2 years agolibgeom(3): Use calloc instead of malloc and bzero.
Hans Petter Selasky [Thu, 10 Mar 2022 09:16:27 +0000 (10:16 +0100)]
libgeom(3): Use calloc instead of malloc and bzero.

Pull Request: https://github.com/freebsd/freebsd-src/pull/546
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agops(1): Use calloc instead of malloc and memset.
Alfonso [Mon, 4 Oct 2021 16:46:57 +0000 (12:46 -0400)]
ps(1): Use calloc instead of malloc and memset.

Pull Request: https://github.com/freebsd/freebsd-src/pull/546
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agonewfs(8): Fix a bug in initialization of sblock.fs_maxbsize .
Wuyang Chung [Tue, 8 Mar 2022 13:52:17 +0000 (21:52 +0800)]
newfs(8): Fix a bug in initialization of sblock.fs_maxbsize .

Fixes: 1c85e6a35d93195e896b030d9a55f7ac4ccee2c3 (SVN r98542)
Pull Request: https://github.com/freebsd/freebsd-src/pull/587
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agodf: do not report a 100% full inode usage on fs without inodes
Baptiste Daroussin [Thu, 10 Mar 2022 14:28:50 +0000 (15:28 +0100)]
df: do not report a 100% full inode usage on fs without inodes

Before:
devfs    2        2         0   100%       0          0  100%   /dev

After:
devfs    2        2         0   100%       0          0     -   /dev

The previous behaviour was confusing for end users and many monitoring tools

Note the linux df tools is also using the same syntax '-' for such filesystem

MFC After: 2 weeks
Reviewed by: manu, emaste, imp
Differential Revision: https://reviews.freebsd.org/D34515

2 years agozfs: update zfs_config.h and zfs_gitrev.h
Martin Matuska [Fri, 11 Mar 2022 06:45:48 +0000 (07:45 +0100)]
zfs: update zfs_config.h and zfs_gitrev.h

Update zfs_config.h and zfs_gitrev.h as missed in c03c5b1c8

2 years agoicl_soft: Use PHYS_TO_DMAP instead of pmap_map_io_transient.
John Baldwin [Fri, 11 Mar 2022 02:20:28 +0000 (18:20 -0800)]
icl_soft: Use PHYS_TO_DMAP instead of pmap_map_io_transient.

The latter API is not actually MI but is only supported on amd64,
arm64, and RISC-V.

Sponsored by: Chelsio Communications

2 years agocxgbei: Support unmapped I/O requests.
John Baldwin [Thu, 10 Mar 2022 23:50:52 +0000 (15:50 -0800)]
cxgbei: Support unmapped I/O requests.

- Add icl_pdu_append_bio and icl_pdu_get_bio methods.

- Add new page pod routines for allocating and writing page pods for
  unmapped bio requests.  Use these new routines for setting up DDP
  for iSCSI tasks with a SCSI I/O CCB which uses CAM_DATA_BIO.

- When ICL_NOCOPY is used to append data from an unmapped I/O request
  to a PDU, construct unmapped mbufs from the relevant pages backing
  the struct bio.  This also requires changes in the t4_push_pdus path
  to support unmapped mbufs.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34383

2 years agoiscsi: Support unmapped I/O requests in the default initiator.
John Baldwin [Thu, 10 Mar 2022 23:50:26 +0000 (15:50 -0800)]
iscsi: Support unmapped I/O requests in the default initiator.

- Add icl_pdu_append_bio and icl_pdu_get_bio methods.

- When ICL_NOCOPY is used to append data from an unmapped I/O request
  to a PDU, construct unmapped mbufs from the relevant pages backing
  the struct bio.

- Use m_apply with a helper to compute crc32 digests on mbuf chains
  to handle unmapped mbufs.  Since m_apply requires PMAP_HAS_DMAP
  for unmapped mbufs, only support unmapped requests when PMAP_HAS_DMAP
  is true.

Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D34406

2 years agoiscsi: Handle unmapped I/O requests.
John Baldwin [Thu, 10 Mar 2022 23:49:53 +0000 (15:49 -0800)]
iscsi: Handle unmapped I/O requests.

Don't assume that csio->data_ptr is pointer to a data buffer that can
be passed to icl_get_pdu_data and icl_append_data.  For unmapped I/O
requests, csio->data_ptr is instead a pointer to a struct bio as
indicated by CAM_DATA_BIO.  To support these requests, add
icl_pdu_append_bio and icl_pdu_get_bio methods which pass a pointer to
the bio and an offset and length relative to the bio's buffer.

Note that only backends supporting unmapped requests need to implement
these hooks.

Implement simple no-op hooks for the iser backend.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34382

2 years agoiser: Fix check for opcodes in iser_conn_pdu_append_data.
John Baldwin [Thu, 10 Mar 2022 23:49:37 +0000 (15:49 -0800)]
iser: Fix check for opcodes in iser_conn_pdu_append_data.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34487

2 years agoiscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.
John Baldwin [Thu, 10 Mar 2022 23:48:20 +0000 (15:48 -0800)]
iscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.

The associated csio ccb will not be completed via xpt_done() until
after the associated PDUs are transmitted to the other side and either
the original PDU is acked with a SCSI response, or a response is
received for a subsequent abort CCB (which means the earlier PDU has
also been sent since it would have been sent before the abort PDU).

This does assume that once an I/O request has been aborted, no further
PDUs with data payload are queued for that I/O request.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34405

2 years agogcore: Use PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.
John Baldwin [Thu, 10 Mar 2022 23:40:44 +0000 (15:40 -0800)]
gcore: Use PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.

Add a elf_putregnote() helper to build the ELF note for a register
set.  Once nice result of this approach is that this reuses the
kernel's support for generating 32-bit register sets for 32-bit
processes avoiding the need to duplicate that logic in elf32core.c.

Reviewed by: markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34447

2 years agoStore core dump notes for all valid register sets for FreeBSD processes.
John Baldwin [Thu, 10 Mar 2022 23:40:19 +0000 (15:40 -0800)]
Store core dump notes for all valid register sets for FreeBSD processes.

In particular, use a generic wrapper around struct regset rather than
requiring per-regset helpers.  This helper replaces the MI
__elfN(note_prstatus) and __elfN(note_fpregset) helpers.  It also
removes the need to explicitly dump NT_ARM_ADDR_MASK in the arm64
__elfN(dump_thread).

Reviewed by: markj, emaste
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34446

2 years agolibpmcstat: Fix a few ARM-specific issues with function symbols.
John Baldwin [Thu, 10 Mar 2022 23:39:53 +0000 (15:39 -0800)]
libpmcstat: Fix a few ARM-specific issues with function symbols.

- Refine the checks for ARM mapping symbols and apply them on arm64 as
  well as 32-bit arm.  In particular, mapping symbols can have
  additional characters and are not strictly limited to just "$a" but
  can append additional characters (e.g. "$a.1").  Add "$x" to the
  list of mapping symbol prefixes.

- Clear the LSB of function symbol addresses.  Thumb function
  addresses set the LSB to enable Thumb mode.  However, the actual
  function starts at the aligned address with LSB clear.  Not clearing
  the LSB can cause pmcannotate to pass misaligned addresses to
  objdump when extracting disassembly.

Reviewed by: andrew
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34416

2 years agoddb: Add 'show gic <name>' and 'show all gics' commands.
John Baldwin [Thu, 10 Mar 2022 23:39:37 +0000 (15:39 -0800)]
ddb: Add 'show gic <name>' and 'show all gics' commands.

To handle the different register layouts for different versions, add a
GIC_DB_SHOW() method.  Currently this hook is only implemented for
versions 1 and 2.

Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34415

2 years agolinuxkpi: fix module build outside of kernel build environment
Eugene Grosbein [Thu, 10 Mar 2022 21:31:23 +0000 (04:31 +0700)]
linuxkpi: fix module build outside of kernel build environment

MFC after: 3 days

2 years agovt: clarify comments on kbd add/release
Ed Maste [Thu, 24 Feb 2022 15:38:16 +0000 (10:38 -0500)]
vt: clarify comments on kbd add/release

PR: 247498

2 years agofwcontrol: eliminate set but not used warning
Ed Maste [Sun, 27 Feb 2022 19:04:09 +0000 (14:04 -0500)]
fwcontrol: eliminate set but not used warning

The variable was used in an #if 0 block; just move the variable
definition and setting into the same block since Firewire is mainly of
historical interest and is unlikely to see ongoing development in
FreeBSD.

Sponsored by: The FreeBSD Foundation

2 years agoRemove an unneeded memset from the arm64 pmap
Andrew Turner [Thu, 10 Mar 2022 19:13:49 +0000 (19:13 +0000)]
Remove an unneeded memset from the arm64 pmap

There is no need to zero pagetable_dmap as we already did it when
creating the page tables in locore.S

Sponsored by: The FreeBSD Foundation

2 years agoSplit out creating the arm64 L2 dmap entries
Andrew Turner [Thu, 10 Mar 2022 18:00:40 +0000 (18:00 +0000)]
Split out creating the arm64 L2 dmap entries

When creating the DMAP region we may need to create level 2 page table
entries at the start and end of a block of memory. The code to do this
was almost identical so we can merge into a single function.

Sponsored by: The FreeBSD Foundation

2 years agoRemove l1ptfrom pmap_early_vtophys on arm64
Andrew Turner [Thu, 10 Mar 2022 18:10:40 +0000 (18:10 +0000)]
Remove l1ptfrom pmap_early_vtophys on arm64

The first argument was unused as we use an address translation
instruction to get the physical address.

Sponsored by: The FreeBSD Foundation

2 years agoscript: use %n at the end of default tstamp_fmt
Simon J. Gerraty [Thu, 10 Mar 2022 17:42:55 +0000 (09:42 -0800)]
script: use %n at the end of default tstamp_fmt

Since we are only outputting time-stamps when they differ
ending it with a newline, interferes with the output less.

2 years agopf: hoist the unlinked rules lock out of the mass rule removal loop
Mateusz Guzik [Mon, 28 Feb 2022 10:39:02 +0000 (11:39 +0100)]
pf: hoist the unlinked rules lock out of the mass rule removal loop

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: add PF_UNLNKDRULES_ASSERT
Mateusz Guzik [Mon, 28 Feb 2022 10:37:30 +0000 (11:37 +0100)]
pf: add PF_UNLNKDRULES_ASSERT

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: remove spurious zeroing from pf_ioctl_addrule
Mateusz Guzik [Fri, 25 Feb 2022 16:18:13 +0000 (17:18 +0100)]
pf: remove spurious zeroing from pf_ioctl_addrule

Newly allocated counters are guaranteed to be 0.

This removes 5 IPIs for each loaded rule.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agobhyve.8: Fix a typo
Mateusz Piotrowski [Thu, 10 Mar 2022 16:43:39 +0000 (17:43 +0100)]
bhyve.8: Fix a typo

The Li macro is deprecated. Also, the Cm macro should be used here
instead for consistency with the rest of the manual and style.mdoc(5).

Fixes: e47fe3183e1f bhyve: add ROM emulation
MFC after: 1 month

2 years agodiff: Re-add void argument to usage
Tom Jones [Thu, 10 Mar 2022 16:24:02 +0000 (16:24 +0000)]
diff: Re-add void argument to usage

Previous commit (8cf449db88b2c7a505bc241a78f9736b43f2ede5)
unintentionally dropped the 'void' argument to usage, reinstate it.

Sponsored by: Klara Inc.

2 years agodiff: add support for --help and --version
Tom Jones [Thu, 10 Mar 2022 16:15:39 +0000 (16:15 +0000)]
diff: add support for --help and --version

Add support for --help and --version to be compatible with gnu diff.

gnu diff --help writes to stdout, do the same to be compatible

Reviewed by: bapt, pstef, debrup, Pau Amma
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34508

2 years agopfdenied: support reporting on additional anchors
Matteo Riondato [Wed, 9 Mar 2022 14:02:11 +0000 (15:02 +0100)]
pfdenied: support reporting on additional anchors

The security/520-pfdenied script only reports blocked packets from the
main ruleset or any blocklistd(8) anchor.

Add an option to periodic.conf(5) to make it possible to specify
additional anchors to report.

PR: 262446
Reviewed by: kp

2 years agobhyve/usage: memory size is not in MB
Corvin Köhne [Thu, 10 Mar 2022 10:30:17 +0000 (11:30 +0100)]
bhyve/usage: memory size is not in MB

For backward compatibility, the memory size will be interpreted in MB if
it's smaller than1 MB and has no suffix. Nowadays, the -m switch accepts
more than just MB. Respect it in the usage message.

Differential Revision: https://reviews.freebsd.org/D34506
Reviewed by: grehan
Sponsored by:   Beckhoff Automation GmbH & Co. KG
MFC after:      1 month

2 years agobhyve: add ROM emulation
Corvin Köhne [Thu, 10 Mar 2022 10:28:06 +0000 (11:28 +0100)]
bhyve: add ROM emulation

Some PCI devices especially GPUs require a ROM to work properly.
The ROM is executed by boot firmware to initialize the device.
To add a ROM to a device use the new ROM option for passthru device
(e.g. -s passthru,0/2/0,rom=<path>/<to>/<rom>).

It's necessary that the ROM is executed by the boot firmware.
It won't be executed by any OS.
Additionally, the boot firmware should be configured to execute the
ROM file.
For that reason, it's only possible to use a ROM when using
OVMF with enabled bus enumeration.

Differential Revision: https://reviews.freebsd.org/D33129
Sponsored by:   Beckhoff Automation GmbH & Co. KG
MFC after:      1 month

2 years agobhyve: export funcs for read/write pci config
Corvin Köhne [Thu, 10 Mar 2022 10:26:19 +0000 (11:26 +0100)]
bhyve: export funcs for read/write pci config

Export functions for reading and writing the pci config space from passthru
device to be used by other devices.
This is required for lpc devices to set their vendor/device ids to their
physical values.
Otherwise, GPU passthrough for integrated Intel GPUs won't work properly.

Differential Revision: https://reviews.freebsd.org/D33769
Reviewed by: markj
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 month

2 years agoExtend device_get_property API
Kornel Duleba [Fri, 28 Jan 2022 09:28:37 +0000 (10:28 +0100)]
Extend device_get_property API

In order to support various types of data stored in device
tree properties or ACPI _DSD packages, create a new enum so
the caller can specify the expected type of a property they
want to read, according to the binding. The bus logic will use
that information to process the underlying data.

For example in DT all integer properties are stored in BE format.
In order to get constant results across different platforms we
need to convert its endianness to match the host.

Another example are ACPI_TYPE_INTEGER properties stored
as uint64_t. Before this patch the ACPI logic would refuse
to read them if the provided buffer was smaller than 8 bytes.
Now this can be handled by using DEVICE_PROP_UINT32 type.

Modify the existing consumers of this API to reflect the changes
and update the man pages accordingly.

Reviewed by: mw
Obtained from: Semihalf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33457

2 years agobus_if: Add a default implementation of get_property
Kornel Duleba [Tue, 25 Jan 2022 10:10:55 +0000 (11:10 +0100)]
bus_if: Add a default implementation of get_property

There are multiple buses that pretend to be ofw compatible,
e.g ofw_pci, mii_fdt. We now need to provide an implementation
of BUS_GET_PROPERTY for every one of them. Instead of modifying
them one by one it's better to just provide a default
implementation that simply traverses up the device tree.
Remove the now unneeded BUS_GET_PROPERTY implementation in mii_fdt.

Reviewed by: andrew, bz
Obtained from: Semihalf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34031

2 years agoFix the arm64 DMAP start address in a comment
Andrew Turner [Thu, 10 Mar 2022 11:00:44 +0000 (11:00 +0000)]
Fix the arm64 DMAP start address in a comment

Sponsored by: The FreeBSD Foundation

2 years agoFix the TCR_TG0 values
Andrew Turner [Thu, 10 Mar 2022 10:54:39 +0000 (10:54 +0000)]
Fix the TCR_TG0 values

They are in a different order to the TCR_TG1 values but appear to have
been copied incorrectly.

While here use TCR_TG0_4K in locore.S to make it explicit the userspace
page size is 4K.

Sponsored by: The FreeBSD Foundation

2 years agoFix the spelling of EFI_PAGE_SIZE
Andrew Turner [Wed, 9 Mar 2022 12:59:01 +0000 (12:59 +0000)]
Fix the spelling of EFI_PAGE_SIZE

We assume EFI_PAGE_SIZE is the same as PAGE_SIZE, however this may not
be the case. Use the former when working with a list of pages from the
UEFI firmware so the correct size is used.

This will be needed on arm64 where PAGE_SIZE could be 16k or 64k in the
future. The other architectures have been updated to be consistent.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34510

2 years agoAdd more arm64 PAC identification fields
Andrew Turner [Tue, 8 Mar 2022 12:46:47 +0000 (12:46 +0000)]
Add more arm64 PAC identification fields

Sponsored by: The FreeBSD Foundation

2 years agovfs: [2/2] fix stalls in vnode reclaim by only counting attempts
Mateusz Guzik [Mon, 7 Mar 2022 10:38:17 +0000 (11:38 +0100)]
vfs: [2/2] fix stalls in vnode reclaim by only counting attempts

... and ignoring if they succeded, which matches historical behavior.

Reported by: pho

2 years agovfs: [1/2] fix stalls in vnode reclaim by not requeieing from vnlru
Mateusz Guzik [Mon, 7 Mar 2022 10:33:59 +0000 (11:33 +0100)]
vfs: [1/2] fix stalls in vnode reclaim by not requeieing from vnlru

Reported by: pho

2 years agoscript -T skip timstamps for same second
Simon J. Gerraty [Thu, 10 Mar 2022 06:19:53 +0000 (22:19 -0800)]
script -T skip timstamps for same second

The result is much more readable if we only output the time-stamp
when it is at least 1s since last one.

2 years agonfsd: Do not exempt NFSv3 Fsinfo from the TLS check
Rick Macklem [Thu, 10 Mar 2022 00:52:42 +0000 (16:52 -0800)]
nfsd: Do not exempt NFSv3 Fsinfo from the TLS check

The Fsinfo RPC is exempt from the check for
Kerberized NFS being required, as recommended
by RFC2623.  However, there is no reason to
exempt Fsinfo from the requirement to use TLS.

This patch fixes the code so that the exemption
only applies to Kerberized NFS and not
NFS-over-TLS.

This only affects NFS-over-TLS for an NFSv3
mount when it is required, but the client does
not do so.

MFC after: 1 month

2 years agodumpon: use underlying device if encrypted swap is in use
Ed Maste [Mon, 7 Mar 2022 19:17:01 +0000 (14:17 -0500)]
dumpon: use underlying device if encrypted swap is in use

/etc/rc.d/dumpon runs before /etc/rc.d/swap.  When encrypted swap is in
use the .eli or .bde device will not exist at the time dumpon runs.

Even if this is addressed it does not make sense to dump core to
encrypted swap, as the encryption key will not be available after
reboot rendering the dump useless.  Thus, for the case that dumpdev=AUTO
and encrypted swap is in use, strip the extension and use the underlying
device.

Emit a warning if we are using the underlying device and the user has not
configured dump encryption, so that the user knows that the will not be
encrypted.

PR: 238301
Reported by: Ivan Rozhuk
Reviewed by: jilles
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34474

2 years agobhyve: Remove VM_MAXCPU from the userspace API/ABI.
John Baldwin [Wed, 9 Mar 2022 23:39:28 +0000 (15:39 -0800)]
bhyve: Remove VM_MAXCPU from the userspace API/ABI.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34494

2 years agobhyve: Use vm_get_topology to query kernel's maximum vCPU count.
John Baldwin [Wed, 9 Mar 2022 23:39:23 +0000 (15:39 -0800)]
bhyve: Use vm_get_topology to query kernel's maximum vCPU count.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34493

2 years agobhyve: Don't force an upper bound on vCPUs when parsing pinning.
John Baldwin [Wed, 9 Mar 2022 23:39:16 +0000 (15:39 -0800)]
bhyve: Don't force an upper bound on vCPUs when parsing pinning.

Even today it is possible to specify pinning for a vCPU higher than
the configured number of CPUs but lower than VM_MAXCPU without raising
an error.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34492

2 years agobhyve: Allocate dynamic arrays to hold per-VCPU state.
John Baldwin [Wed, 9 Mar 2022 23:39:08 +0000 (15:39 -0800)]
bhyve: Allocate dynamic arrays to hold per-VCPU state.

This avoids hardcoding VM_MAXCPU in userspace.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34491

2 years agobhyve: Make the MADT dynamically sized.
John Baldwin [Wed, 9 Mar 2022 23:38:58 +0000 (15:38 -0800)]
bhyve: Make the MADT dynamically sized.

Use basl_ncpu instead of VM_MAXCPU in MADT_SIZE.  Since several of the
offsets are no longer compile time constants, unroll the loop
generating ACPI tables.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34490

2 years agobhyve: Allocate mmio_hint array based on number of guest CPUs.
John Baldwin [Wed, 9 Mar 2022 23:38:49 +0000 (15:38 -0800)]
bhyve: Allocate mmio_hint array based on number of guest CPUs.

This avoids an instance of hardcoding VM_MAXCPU in userspace.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34489

2 years agoscript add -T fmt to print time-stamps
Simon J. Gerraty [Wed, 9 Mar 2022 21:33:03 +0000 (13:33 -0800)]
script add -T fmt to print time-stamps

script -r is useful for recording time-stamps of when output
happened.  With -T, rather than playback the script in real-time
we simply print the time-stamps to show when the output happened.

This is very useful for example, for analyzing boot time activity.

If the fmt provided contains no % characters the default
%n@ %s [%Y-%m-%d %T]
is used, which lends itself to analysis by tools as well as humans.

Sponsored by: Juniper Networks, Inc.

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

2 years agoBuild compiler-rt against libunwind, not libcxxrt
Dimitry Andric [Wed, 9 Mar 2022 21:23:35 +0000 (22:23 +0100)]
Build compiler-rt against libunwind, not libcxxrt

Parts of compiler-rt are also built for libgcc_eh and libgcc_s, and
these were already pointing to the libunwind unwind.h. For the sake of
consistency, also build compiler-rt itself against the libunwind
unwind.h, not the libcxxrt one.

MFC after: 3 days

2 years agoMerge libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6
Dimitry Andric [Wed, 9 Mar 2022 19:45:01 +0000 (20:45 +0100)]
Merge libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6

Interesting fixes:
47661d0 Match libc++abi/libsupc++ when demangling array types
e44a05c Fix unitialized variable in __cxa_demangle_gnu3 after #6 (#8)
5088b05 Remove some code duplication.
fd484be Atomics cleanup (#11)

MFC after: 2 weeks

2 years agoImport libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6
Dimitry Andric [Wed, 9 Mar 2022 19:36:12 +0000 (20:36 +0100)]
Import libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6

Interesting fixes:
47661d0 Match libc++abi/libsupc++ when demangling array types
e44a05c Fix unitialized variable in __cxa_demangle_gnu3 after #6 (#8)
5088b05 Remove some code duplication.
fd484be Atomics cleanup (#11)

2 years agozfs: Fix typo in module Makefile
Ryan Moeller [Wed, 9 Mar 2022 18:19:42 +0000 (18:19 +0000)]
zfs: Fix typo in module Makefile

Fixes: c03c5b1c8091
Sponsored by: iXsystems, Inc.

2 years agocontrib/bc: include assert.h when building with C11 or newer
Stefan Eßer [Wed, 9 Mar 2022 17:57:30 +0000 (18:57 +0100)]
contrib/bc: include assert.h when building with C11 or newer

This chunk should have been committed with the MFV commit
23210c9f42af94dc but was missing for an unknown reasn.

MFC after: 3 days

2 years agoRemove compat hacks from libcxxrt's _Unwind_Exception
Dimitry Andric [Tue, 8 Mar 2022 21:53:16 +0000 (22:53 +0100)]
Remove compat hacks from libcxxrt's _Unwind_Exception

This reverts 9097e3cbcac4, which was in itself a revert of upstream
libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM
unwind") and b96169641f79 ("Updated Itanium unwind"), and a
reapplication of our commit 3c4fd2463bb2 ("libcxxrt: add padding in
__cxa_allocate_* to fix alignment").

The editors/libreoffice port will be patched to be able to cope with the
standards-compliant alignment of _Unwind_Exception and consequently,
that of __cxa_exception. The layouts and sizes of these structures
should then be completely the same for libcxxrt, libunwind and
libc++abi.

PR: 262008
Reviewed by: emaste, jhb, theraven
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34488

2 years agodiff: set cflag when passed to diff
Tom Jones [Tue, 8 Mar 2022 16:58:25 +0000 (16:58 +0000)]
diff: set cflag when passed to diff

In b5541f456d641d23e0c46874daff0b62552bf3cb when flags were converted to
be boolean, the setting of cflag as an integer was removed, but no
boolean set was added.

This effects the output format of dates, but the context type was set to
D_CONTEXT so other functionality worked.

Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34481

2 years agodtrace tests: Fix expected outout for tst.system.d
Li-Wen Hsu [Wed, 9 Mar 2022 03:39:12 +0000 (11:39 +0800)]
dtrace tests: Fix expected outout for tst.system.d

This is follow up of d500a85e640d1cd270747c12e17c511b53864436

PR: 262415
Sponsored by: The FreeBSD Foundation

2 years agoUpdate smartqpi driver to vendor's latest submission
Warner Losh [Wed, 9 Mar 2022 00:01:04 +0000 (17:01 -0700)]
Update smartqpi driver to vendor's latest submission

Newly added features & bug fixes

o Fixed an issue smartpqi debug log messages are flooding kernel logs.
o Fixed an issue where devices are shown as RAID 0 in display info.
o Feature: Changed 32 bit dma address to 64 bit address
o Added new controlller ids.

Submitted by: Microsemi
Reviewed by: Scott Benesh (Microsemi), imp
Differential Revision: https://reviews.freebsd.org/D34469
MFC After: 3 days

Sponsored by: Netflix

2 years agocxgbe tom: Compile fix for disabled KTR trace.
John Baldwin [Tue, 8 Mar 2022 22:07:51 +0000 (14:07 -0800)]
cxgbe tom: Compile fix for disabled KTR trace.

Sponsored by: Chelsio Communications

2 years agocxgbe tom: Use VM_PAGE_TO_PHYS().
John Baldwin [Tue, 8 Mar 2022 18:10:59 +0000 (10:10 -0800)]
cxgbe tom: Use VM_PAGE_TO_PHYS().

Sponsored by: Chelsio Communications

2 years agocxgbe tom: Use be64toh instead of htobe64 to convert to host order.
John Baldwin [Tue, 8 Mar 2022 18:26:45 +0000 (10:26 -0800)]
cxgbe tom: Use be64toh instead of htobe64 to convert to host order.

This is a no-op but more accurately conveys intent.

Sponsored by: Chelsio Communications

2 years agocxgbe tom: Use vm_paddr_t for physical addresses in page pod routines.
John Baldwin [Tue, 8 Mar 2022 18:25:41 +0000 (10:25 -0800)]
cxgbe tom: Use vm_paddr_t for physical addresses in page pod routines.

Sponsored by: Chelsio Communications

2 years agossh: update sshd_config(5) for RSA/SHA-1 signature removal
Ed Maste [Tue, 8 Mar 2022 21:56:04 +0000 (16:56 -0500)]
ssh: update sshd_config(5) for RSA/SHA-1 signature removal

OpenSSH 8.8p1 removed RSA/SHA-1 signatures by default, but failed to
update sshd_config(5).  It was updated upstream after the release in
b711bc01a7ec and da4035523406.

Fixes: 8c22023ca5e1 ("ssh: disable RSA/SHA-1 signatures")
Sponsored by: The FreeBSD Foundation

2 years agogpart: Avoid geom_gettree() call in "bootcode -b".
Alexander Motin [Tue, 8 Mar 2022 18:44:22 +0000 (13:44 -0500)]
gpart: Avoid geom_gettree() call in "bootcode -b".

geom_gettree() may be pretty expensive on large systems, and it is
not needed if only -b flag specified, that is processed by kernel.

MFC after: 1 month

2 years agousb(4): Don't skip calling uhub_explore_sub() even on HUB port errors.
Hans Petter Selasky [Tue, 8 Mar 2022 18:57:38 +0000 (19:57 +0100)]
usb(4): Don't skip calling uhub_explore_sub() even on HUB port errors.

This should fix an issue where the "udev->re_enumerate_wait" field never gets
processed and reset. In this case usbconfig will wait forever and never return.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agozfs: merge openzfs/zfs@a86e08941 (master) into main
Martin Matuska [Tue, 8 Mar 2022 17:52:10 +0000 (18:52 +0100)]
zfs: merge openzfs/zfs@a86e08941 (master) into main

Notable upstream pull request merges:
  #9078:  log xattr=sa create/remove/update to ZIL
  #11919: Cross-platform xattr user namespace compatibility
  #13014: Report dnodes with faulty bonuslen
  #13016: FreeBSD: Fix zvol_cdev_open locking
  #13019: spl: Don't check FreeBSD rwlocks for double initialization
  #13027: Fix clearing set-uid and set-gid bits on a file when
          replying a write
  #13031: Add enumerated vdev names to 'zpool iostat -v' and
          'zpool list -v'
  #13074: Enable encrypted raw sending to pools with greater ashift
  #13076: Receive checks should allow unencrypted child datasets
  #13098: Avoid dirtying the final TXGs when exporting a pool
  #13172: Fix ENOSPC when unlinking multiple files from full pool

Obtained from: OpenZFS
OpenZFS commit: a86e089415679cf1b98eb424a159bb36aa2c19e3

2 years agolibzfs_core: lzc_send_wraper: maximise pipe buffer for existing pipes
наб [Mon, 21 Feb 2022 18:51:48 +0000 (19:51 +0100)]
libzfs_core: lzc_send_wraper: maximise pipe buffer for existing pipes

This reduces scheduler overhead by letting the reader consume bigger
chunks (64k => 128k at full throttle)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoZTS: /dev/null: accept no substitutes
Rich Ercolani [Fri, 17 Dec 2021 04:19:22 +0000 (23:19 -0500)]
ZTS: /dev/null: accept no substitutes

Instead of writing to "devnull" and rming it later, just
> /dev/null to not have to cleanup later.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoRevert "ZTS: Avoid piping send directly to /dev/null"
наб [Mon, 21 Feb 2022 01:43:49 +0000 (02:43 +0100)]
Revert "ZTS: Avoid piping send directly to /dev/null"

This reverts commit 1a79f7e86021c5de33d3518dd9a0f14f924ee345.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoRevert "Added error for writing to /dev/ on Linux"
наб [Sun, 20 Feb 2022 13:41:10 +0000 (14:41 +0100)]
Revert "Added error for writing to /dev/ on Linux"

This reverts commit 860051f1d1ef7ee995188b852d8da36bce85b1dc.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agolibzfs, libzfs_core: send: always write to pipe
наб [Mon, 21 Feb 2022 01:31:32 +0000 (02:31 +0100)]
libzfs, libzfs_core: send: always write to pipe

By introducing lzc_send_wrapper() and routing all ZFS_IOC_SEND*
users through it, we fix a Linux 5.10-introduced bug (see comment)

This is all /transparent/ to the users API, ABI, and usage-wise,
and disabled on FreeBSD and if the output is already a pipe,
and transparently nestable (i.e. zfs_send_one() is wrapped,
but so is lzc_send_redacted() it calls to ‒ this wouldn't be strictly
necessary if ZFS_IOC_SEND_PROGRESS wasn't strictly denominational w.r.t.
the descriptor the send is happening on)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11445
Closes #13133

2 years agolibzfs_core: simplify max_pipe_buffer(), return new max
наб [Sun, 20 Feb 2022 19:17:22 +0000 (20:17 +0100)]
libzfs_core: simplify max_pipe_buffer(), return new max

We do still check and only optionally set because all F_SETPIPE_SZ
directives reallocate the pipe buffer

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agolibzfs: migrate single-use libzfs_set_pipe_max() to libzfs_core
наб [Sun, 20 Feb 2022 14:04:49 +0000 (15:04 +0100)]
libzfs: migrate single-use libzfs_set_pipe_max() to libzfs_core

Notably, this also means that the pipe is expanded before each
dataset is received, so updates to /p/s/f/pipe-max-size are reflected
for each new dataset

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoCleaning up a couple of ZTS tests setup scripts
Brian Atkinson [Mon, 7 Mar 2022 23:22:01 +0000 (16:22 -0700)]
Cleaning up a couple of ZTS tests setup scripts

With the zfs_destroy ZTS test case the setup script needed to call
default_setup_noexit so compression could be turned off. Also, added
log_must to setting compression off in the reservation setup script for
turning off compression.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #13173

2 years agoAdded noexit variant for Raidz setup in ZTS tests
Brian Atkinson [Fri, 4 Mar 2022 01:18:07 +0000 (18:18 -0700)]
Added noexit variant for Raidz setup in ZTS tests

The regular default_raidz_setup function in the ZFS test suite called
log_pass after creating the zpool. However, with compression now being
on by default 56fa4aa, there is no way to turn compression off in the
setup.ksh scripts when creating a raidz VDEV. The addition of the
function default_raidz_setup_noexit allows for a raidz VDEV to be
created, additional zfs property settings to be applied and for the
setup.ksh script itself to call log_pass.

With the addition of default_raidz_setup_noexit some stray log_pass
calls were removed from any setup.ksh scripts that call
default_raidz_setup.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #13173

2 years agoFix ENOSPC when unlinking multiple files from full pool
Brian Behlendorf [Tue, 8 Mar 2022 17:16:35 +0000 (09:16 -0800)]
Fix ENOSPC when unlinking multiple files from full pool

When unlinking multiple files from a pool at 100% capacity, it was
possible for ENOSPC to be returned after the first unlink.  e.g.

    rm -f /mnt/fs/test1.0.0 /mnt/fs/test1.1.0 /mnt/fs/test1.2.0
    rm: cannot remove '/mnt/fs/test1.1.0': No space left on device
    rm: cannot remove '/mnt/fs/test1.2.0': No space left on device

After waiting for the pending deferred frees from the first unlink to
be processed the remaining files can then be unlinked.  This is caused
by the quota limit in dsl_dir_tempreserve_impl() being temporarily
decreased to the allocatable pool capacity less any deferred free
space.

This is resolved using the existing mechanism of returning ERESTART
when over quota as long as we know enough space will shortly be
available after processing the pending deferred frees.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ryan Moeller <freqlabs@FreeBSD.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13172

2 years agogeom: Allow "load" command for already loaded modules.
Alexander Motin [Tue, 8 Mar 2022 17:04:42 +0000 (12:04 -0500)]
geom: Allow "load" command for already loaded modules.

I see more user-friendly to do nothing if the module is already
loaded, rather than returning quite confusing error message.

As side effect it allows to avoid std_list_available() call, using
quite expensive on large systems geom_gettree().

MFC after: 1 month

2 years agogpioths(4): Correct the sysctl names in manual page
Juraj Lutter [Sun, 6 Mar 2022 21:33:29 +0000 (22:33 +0100)]
gpioths(4): Correct the sysctl names in manual page

Temperature is exposed via 'temperature' leaf, humidity via 'humidity'
leaf. Align the manual page with the actual variable names.

Approved by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34460

2 years agopfctl: remove unused variable
Kristof Provost [Tue, 8 Mar 2022 11:22:50 +0000 (12:22 +0100)]
pfctl: remove unused variable

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agolibpfct: factor out pfctl_get_rules_info()
Kristof Provost [Fri, 4 Mar 2022 16:12:01 +0000 (17:12 +0100)]
libpfct: factor out pfctl_get_rules_info()

Introduce pfctl_get_rules_info(), similar to pfctl_get_eth_rules_info()
to retrieve rules information (ticket and total number of rules).

Use the new function in pfctl.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34443

2 years agolibpfctl: support flushing rules/nat/eth
Kristof Provost [Fri, 4 Mar 2022 14:50:43 +0000 (15:50 +0100)]
libpfctl: support flushing rules/nat/eth

Move the code to flush regular rules, nat rules and Ethernet rules into
libpfctl for easier re-use.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34442

2 years agobcm5974(4): set mode again on resume
Greg V [Tue, 8 Mar 2022 12:51:07 +0000 (15:51 +0300)]
bcm5974(4): set mode again on resume

This is necessary to not break SPI devices on suspend-resume.

Reviewed by:    wulf
MFC with:       5aa839c9e2c373275091b8bf529c1311d0b84d76
Differential revision:  https://reviews.freebsd.org/D34434

2 years agobcm5974(4): fix endian conversion signedness bug
Greg V [Tue, 8 Mar 2022 12:51:06 +0000 (15:51 +0300)]
bcm5974(4): fix endian conversion signedness bug

This fixes wrong coordinates resulting in weird behavior.

Reviewed by: wulf
MFC with: 5aa839c9e2c373275091b8bf529c1311d0b84d76
Differential revision: https://reviews.freebsd.org/D34433

2 years agomlx5/mlx4: Bump driver version to 3.7.1
Hans Petter Selasky [Tue, 8 Mar 2022 11:16:00 +0000 (12:16 +0100)]
mlx5/mlx4: Bump driver version to 3.7.1

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoMake the arm64 get_pcpu a function again
Andrew Turner [Tue, 8 Mar 2022 11:38:51 +0000 (11:38 +0000)]
Make the arm64 get_pcpu a function again

We assume the pointer returned from get_pcpu will be consistent even
if the thread is moved to a new CPU. Fix this by partially reverting
63c858a04d565 to make get_pcpu a function again.

Sponsored by: The FreeBSD Foundation

2 years agoPrint the instruction for the unknown exception
Andrew Turner [Tue, 8 Mar 2022 11:02:02 +0000 (11:02 +0000)]
Print the instruction for the unknown exception

The arm64 unknown exception will be raised when we execute an
instruction that id invalid or disabled. To help debug these print
the instruction that failed.

Sponsored by: The FreeBSD Foundation

2 years agopfctl: support recursive printing of nat rules
Kristof Provost [Sat, 5 Mar 2022 16:55:48 +0000 (17:55 +0100)]
pfctl: support recursive printing of nat rules

PR: 252617
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34455