]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 months agobhyve: Implement MSR_MISC_FEATURES_ENABLES
Warner Losh [Thu, 27 Oct 2022 17:32:18 +0000 (11:32 -0600)]
bhyve: Implement MSR_MISC_FEATURES_ENABLES

Linux reads MISC_FEATURES_ENABLES to manage the CPUID faulting feature
(undocumented in the Intel SDM, but documented in 323850-004 (Intel
Virtualization Technology FlexMigration Application Note). Since bhyve
doesn't emulate this feature, we always return 0. Neither does bhyve
support the MONITOR/MWAIT fault bit also in this MSR (which is
documented in the sdm), so always return 0.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D36602

(cherry picked from commit 1d21f64149224000d74e0c850686e85aefd25ef9)

17 months agobhyve: Remove an unused parameter from pci_nvme_append_iov_req()
Mark Johnston [Thu, 27 Oct 2022 14:47:17 +0000 (10:47 -0400)]
bhyve: Remove an unused parameter from pci_nvme_append_iov_req()

No functional change intended.

MFC after: 1 week
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37116

(cherry picked from commit ae71263c6689a475f3df293475058048c0810dd7)

17 months agobhyve: Address signed/unsigned comparison warnings in the AHCI model
Mark Johnston [Tue, 25 Oct 2022 13:39:07 +0000 (09:39 -0400)]
bhyve: Address signed/unsigned comparison warnings in the AHCI model

No functional change intended.

MFC after: 1 week

(cherry picked from commit f0553616cf78c94e7589921d2354477b948e4876)

17 months agobhyve: Address some signed/unsigned comparison warnings
Mark Johnston [Sun, 23 Oct 2022 14:32:45 +0000 (10:32 -0400)]
bhyve: Address some signed/unsigned comparison warnings

MFC after: 1 week

(cherry picked from commit ed7216843133c9d6748251b5e180ee90410131f0)

17 months agobhyve: Address signed/unsigned comparison warnings in the e1000 model
Mark Johnston [Tue, 25 Oct 2022 13:54:50 +0000 (09:54 -0400)]
bhyve: Address signed/unsigned comparison warnings in the e1000 model

No functional change intended.

MFC after: 1 week

(cherry picked from commit cea34d0705ccd3944cce1bed5b4ff31aad05d983)

17 months agobhyve: Address warnings in blockif_proc()
Mark Johnston [Tue, 25 Oct 2022 13:16:23 +0000 (09:16 -0400)]
bhyve: Address warnings in blockif_proc()

- Use unsigned types for all arithmetic.  Use a new signed variable for
  holding the return value of pread() and pwrite().
- Handle short I/O from pwrite().

MFC after: 1 week

(cherry picked from commit 46f5c828961e64646c46ff9e3bc8e55f46f3e7bb)

17 months agobhyve: Drop a bogus const qualifier
Mark Johnston [Mon, 24 Oct 2022 21:35:16 +0000 (17:35 -0400)]
bhyve: Drop a bogus const qualifier

No functional change intended.

MFC after: 1 week

(cherry picked from commit eefd863cbae9d7b2f5c83948b45be13951a0c495)

17 months agobhyve: Put the prototype for vmexit_task_switch() in a header
Mark Johnston [Sun, 23 Oct 2022 14:21:50 +0000 (10:21 -0400)]
bhyve: Put the prototype for vmexit_task_switch() in a header

No functional change intended.

MFC after: 1 week

(cherry picked from commit f703dc0ef0e1d6ac1697cb8d6662870bd5e0fba6)

17 months agobhyve: Annotate an unused function as such
Mark Johnston [Sun, 23 Oct 2022 14:46:39 +0000 (10:46 -0400)]
bhyve: Annotate an unused function as such

No functional change intended.

MFC after: 1 week

(cherry picked from commit eb805f4e0f6a7b1567aa4cf4eb1c4484dac67ae5)

17 months agobhyve: USB device model structures can be qualified with "static"
Mark Johnston [Sat, 22 Oct 2022 17:39:01 +0000 (13:39 -0400)]
bhyve: USB device model structures can be qualified with "static"

No functional change intended.

MFC after: 1 week

(cherry picked from commit cd49c066a3565a37551d50d759c8d1b5a90b3859)

17 months agobhyve: Fix some warnings in the snapshot code
Mark Johnston [Sat, 22 Oct 2022 17:41:33 +0000 (13:41 -0400)]
bhyve: Fix some warnings in the snapshot code

- Qualify unexported symbols with "static".
- Drop some unnecessary and incorrect casts.
- Avoid arithmetic on void pointers.
- Avoid signed/unsigned comparisons in loops which use nitems() as a
  bound.

No functional change intended.

MFC after: 1 week

(cherry picked from commit c9faf6987406781debb06ec5e40aa1de6d11ac4f)

17 months agobhyve: Put the prototype for vga_render() in a header
Mark Johnston [Sun, 23 Oct 2022 14:22:39 +0000 (10:22 -0400)]
bhyve: Put the prototype for vga_render() in a header

No functional change intended.

MFC after: 1 week

(cherry picked from commit 84633b9d5244c5bd0438d2969e021ec01066b107)

17 months agobhyve: Use the proper type for string literals
Mark Johnston [Sat, 22 Oct 2022 17:37:46 +0000 (13:37 -0400)]
bhyve: Use the proper type for string literals

No functional change intended.

MFC after: 1 week

(cherry picked from commit 7039bdd5351a080e648c6519636227bcd38a255c)

17 months agobhyve: Avoid arithmetic on void pointers
Mark Johnston [Sat, 22 Oct 2022 17:40:20 +0000 (13:40 -0400)]
bhyve: Avoid arithmetic on void pointers

No functional change intended.

MFC after: 1 week

(cherry picked from commit 63898728b544763d85c062c8515c12a0c3a60e0a)

17 months agobhyve: Address some warnings in bhyverun.c
Mark Johnston [Sat, 22 Oct 2022 17:34:00 +0000 (13:34 -0400)]
bhyve: Address some warnings in bhyverun.c

- Annotate unused parameters as such.
- Avoid shadowing the global "vmexit".

No functional change intended.

MFC after: 1 week

(cherry picked from commit 4a1c23a708f98c1588a196041cda5d55795e2f0c)

17 months agobhyve: Make hda_ops function tables const
Mark Johnston [Sun, 23 Oct 2022 14:43:06 +0000 (10:43 -0400)]
bhyve: Make hda_ops function tables const

No functional change intended.

MFC after: 1 week

(cherry picked from commit 489392feb7dd784b6036dd6511c690e4df9726e3)

17 months agobhyve: Annotate unused function parameters
Mark Johnston [Sat, 8 Oct 2022 15:22:38 +0000 (11:22 -0400)]
bhyve: Annotate unused function parameters

MFC after: 1 week

(cherry picked from commit 98d920d9cf0b439ea351c60353626946971684f6)

17 months agobhyve: Use designated initializers for virtio_consts tables
Mark Johnston [Thu, 29 Sep 2022 15:53:04 +0000 (11:53 -0400)]
bhyve: Use designated initializers for virtio_consts tables

This is easier to read and addresses some compiler warnings.

One might expect these tables to be read-only but it seems that the
snapshot/restore code may modify them.

MFC after: 2 weeks

(cherry picked from commit 6cb261620da3a9888f7a09244a8efe691c12ae47)

17 months agobhyve: Address some warnings in bhyverun.c
Mark Johnston [Thu, 8 Sep 2022 23:08:10 +0000 (19:08 -0400)]
bhyve: Address some warnings in bhyverun.c

- Add const and __unused qualifiers where appropriate.
- Localize some global variables.
- Consistently spell vmexit state as "vme" in vmexit handlers, to avoid
  shadowing the global vm_exit state array.
- Similarly, avoid shadowing "optarg".

MFC after: 2 weeks

(cherry picked from commit 65b8109b4e07ea1fe105ab10539d5baa0a613a14)

17 months agobhyve nvme: Fix Controller init error cases
Chuck Tuffli [Sun, 14 Aug 2022 14:47:34 +0000 (07:47 -0700)]
bhyve nvme: Fix Controller init error cases

Fuzzing of bhyve uncovered an assertion failure in the NVMe emulation.
Investigation uncovered several corner cases the code did not handle.
This change handles several Controller initialization errors, including
 - bad AQ sizes
 - bad AQ vm_map_gpa
 - doorbell writes prior to RDY
 - doorbell writes to uninitialized queue
 - CSTS.RDY if CFS set

PR: 256317,256319,256320,256322
Reported by: Cheolwoo Myung <cwmyung@snu.ac.kr>
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D35453

(cherry picked from commit d7d1becad4b692b97dd1f32706947aae5118294b)

17 months agovmm: Fix snapshots for AMD CPUs
Mihai Burcea [Thu, 30 Jun 2022 23:11:17 +0000 (16:11 -0700)]
vmm: Fix snapshots for AMD CPUs

This patch fixes the AMD implementation for snapshotting.  It removes
unnecessary vmcb fields that should not be saved and duplicates.

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

(cherry picked from commit 9aa02d5120ab02bcbbc16fddb63e575df4ed6f61)

17 months agolibvmmapi: Add vm_close()
Vitaliy Gusev [Thu, 30 Jun 2022 21:21:57 +0000 (14:21 -0700)]
libvmmapi: Add vm_close()

Currently there is no way to safely free a vm structure without
leaking the fd.  vm_destroy() closes the fd but also destroys the VM
whereas in some cases a VM needs to be opened (vm_open) and then
closed (vm_close).

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D35073

(cherry picked from commit f0880ab791a510391a12f2ab7b01889b6774bca0)

17 months agobhyve: Snapshot impovements for 'blockif' backend
Vitaliy Gusev [Thu, 23 Jun 2022 18:46:06 +0000 (11:46 -0700)]
bhyve: Snapshot impovements for 'blockif' backend

When pausing a block I/O device model as part of suspending a VM, wait
for all active block I/O requests to finish before saving snapshot
data.  This avoids having to save information about in-flight requests
both in the block_if layer and in storage device models.

For the AHCI device model, the queues are now guaranteed to be idle
when taking a snapshot, so remove the code to save queue state and
rely on the initial state in a resumed VM having all queues already
idle.

This will also simplify adding NVMe snapshot support in the future.

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D26267

(cherry picked from commit cd9618bdb274375139080ee4e33ccbdc980513f3)

17 months agobhyve: Enable suspend/resume support for virtio-blk.
Vitaliy Gusev [Thu, 23 Jun 2022 18:46:06 +0000 (11:46 -0700)]
bhyve: Enable suspend/resume support for virtio-blk.

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D26267

(cherry picked from commit a85bbbea91bddbd27d080fb2ad55a9f5c316adad)

17 months agobhyve: Report an error for invalid UUIDs.
James Mintram [Thu, 16 Jun 2022 20:17:44 +0000 (13:17 -0700)]
bhyve: Report an error for invalid UUIDs.

Reviewed by: rgrimes, grehan, jhb
Differential Revision: https://reviews.freebsd.org/D30050

(cherry picked from commit e16b709e2dcc45f01cf96b5e7f6d48474feff8d7)

17 months agovmm_instruction_emul.c: fix bhyve build
Robert Wing [Sun, 10 Apr 2022 21:37:24 +0000 (13:37 -0800)]
vmm_instruction_emul.c: fix bhyve build

The __diagused macro was used to cure a "set but not used" warning. This
broke the build for bhyve since __diagused is only defined in the
kernel. Define __diagused when not building the kernel.

Fixes: 5241577a223d ("vmm: fix set but not used warning")
Reported by:    Jenkins

(cherry picked from commit d4e8207317ca1827ba2529203d5cc4e67d836fcb)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:19 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 5a17f489d5848085307e1d5fa7ca142694b4946b)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:16 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 5241577a223d805282f726cb443a566aca653b9f)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:14 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 3587bfa797cd66dce2e94ca93df5ce41def555df)

17 months agovmm: fix set but not used warnings
Robert Wing [Sun, 10 Apr 2022 18:30:11 +0000 (10:30 -0800)]
vmm: fix set but not used warnings

(cherry picked from commit 5c272efaba291f744191dca86f04418bfe90b222)

17 months agovmm: fix set but not used warnings
Robert Wing [Sun, 10 Apr 2022 18:30:08 +0000 (10:30 -0800)]
vmm: fix set but not used warnings

(cherry picked from commit f877977a034b41bedacdf507e79e4233b28a8bfc)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:05 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 893a3dd697ef4ac0a432ca8ce8790661884eb1ea)

17 months agoFix a typo in previous commit.
John Baldwin [Fri, 8 Apr 2022 19:01:33 +0000 (12:01 -0700)]
Fix a typo in previous commit.

Reported by: npn
Pointy hat to: jhb
Fixes: 572edd3dae9f vmm: Re-quiet set but unused warnings.

(cherry picked from commit 6a33ecdc2f649234cc3160daec8c329f33860f45)

17 months agovmm amdvi: Move ctrl under #ifdef AMDVI_DEBUG_CMD.
John Baldwin [Fri, 8 Apr 2022 00:01:29 +0000 (17:01 -0700)]
vmm amdvi: Move ctrl under #ifdef AMDVI_DEBUG_CMD.

(cherry picked from commit a7d876f7010068d93f1d9b4bb62d1370c9a0798f)

17 months agovmm: Re-quiet set but unused warnings.
John Baldwin [Fri, 8 Apr 2022 00:01:29 +0000 (17:01 -0700)]
vmm: Re-quiet set but unused warnings.

__diagused is no longer used for KTR, so instead use #ifdef KTR or
expand KTR-only variables into their values in traces.

(cherry picked from commit 572edd3dae9fc3e67dfb1cb9ba023e8d3fe2a9bb)

17 months agovmm: fix "set but not used" warnings
Robert Wing [Tue, 1 Mar 2022 00:09:32 +0000 (15:09 -0900)]
vmm: fix "set but not used" warnings

(cherry picked from commit 2062ce996ddd39ba7a36c2caf8c898686d9cb2fe)

17 months agovmm: fix "set but not used" warnings
Robert Wing [Mon, 28 Feb 2022 23:55:37 +0000 (14:55 -0900)]
vmm: fix "set but not used" warnings

(cherry picked from commit 39d87a023567f633c6990ac7fcc3a20691a1efd6)

17 months agovmm: fix "set but not used" warnings
Robert Wing [Mon, 28 Feb 2022 23:46:08 +0000 (14:46 -0900)]
vmm: fix "set but not used" warnings

(cherry picked from commit 73505a10760c8b6f459b9c790bbf3a365f990a0b)

17 months agobhyve: Fix virtio-console legacy configuration parsing
Yan Ka Chiu [Fri, 6 May 2022 19:31:56 +0000 (15:31 -0400)]
bhyve: Fix virtio-console legacy configuration parsing

virtio-console is currently missing .pe_legacy_config, which prevents any
portN configuration from being parsed, and therefore no sockets will be
created.

Reviewed by: khng
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35142

(cherry picked from commit 3cdfaefa4b88c928bfb62e7fb6c7f7742d81f31c)

17 months agoman pages: Fix typo
Christian Weisgerber [Wed, 6 Apr 2022 14:46:39 +0000 (16:46 +0200)]
man pages: Fix typo

s/the the/the/

Approved by: ygy (doc)

(cherry picked from commit 81d1214e8a9435aa7c09b622fa6916e89138dc5c)

17 months agobhyve: missing mutex initializations
Andy Fiddaman [Wed, 16 Mar 2022 03:50:36 +0000 (19:50 -0800)]
bhyve: missing mutex initializations

Explicitly initialize the mutex that a PCI virtio module passes back to
virtio.

It so happens that these mutexes were being initialized regardless, no
functional change intended.

Reviewed by:    chuck, jhb
Differential Revision:  https://reviews.freebsd.org/D34372

(cherry picked from commit f6f357efb1067b79678d8f348333ffdfec66ad20)

17 months agobhyve: plug memory leak in topology_parse()
Andy Fiddaman [Thu, 24 Feb 2022 17:36:41 +0000 (08:36 -0900)]
bhyve: plug memory leak in topology_parse()

Reviewed by:    jhb, rew
Differential Revision:  https://reviews.freebsd.org/D34301

(cherry picked from commit ad3da82996ffe8a7959fda4a84374b1907ebb116)

17 months agobhyve: Fix getaddrinfo() error handling
Mark Johnston [Tue, 8 Feb 2022 17:34:03 +0000 (12:34 -0500)]
bhyve: Fix getaddrinfo() error handling

- Use errx() since errno will not be set.
- Print the message returned by gai_strerror().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 927aa5fefd4c69e72d44189a04fadf80e42d0ad8)

17 months agobhyve: clean up trailing whitespaces
Toomas Soome [Sun, 26 Dec 2021 07:52:38 +0000 (09:52 +0200)]
bhyve: clean up trailing whitespaces

Clean up trailing whitespaces. No functional changes.

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

(cherry picked from commit c2fa905cf6c1cf1938a0353679e3bd0b617ca179)

17 months agobhyve.8: Fix markup of the -G flag
Mateusz Piotrowski [Tue, 12 Oct 2021 14:06:52 +0000 (16:06 +0200)]
bhyve.8: Fix markup of the -G flag

(cherry picked from commit 775f6f459595c5373ab389a43bdf1a8467233f1a)

17 months agobhyve: Fix pci device node key in bhyve_config.5
Ka Ho Ng [Sun, 12 Sep 2021 20:31:19 +0000 (04:31 +0800)]
bhyve: Fix pci device node key in bhyve_config.5

PCI device node key in the manual page is wrong. It should be
pci.bus.slot.function.

MFC after: 3 days

(cherry picked from commit e31cc1d526dcdfcbe5666deb8b11decc5126a871)

17 months agobhyve: change a default address from ANY to localhost
Mariusz Zaborski [Thu, 19 Aug 2021 18:00:35 +0000 (20:00 +0200)]
bhyve: change a default address from ANY to localhost

Discussed with:     grehan, jhb

(cherry picked from commit 3a92927bb69f2d3fcd3dec4c909aab2191f4b848)

17 months agobhyve: enhance debug info for memory range clash
Robert Crowston [Sat, 10 Apr 2021 19:16:02 +0000 (20:16 +0100)]
bhyve: enhance debug info for memory range clash

Explain what the two clashing regions are.

Reivewed by: grehan, jhb
Differential Revision: https://reviews.freebsd.org/D29696
Pull Request: https://github.com/freebsd/freebsd-src/pull/463

(cherry picked from commit efec757b20425ac68171acc7f9cec8be750db688)

17 months agobhyve: Fix build when BHYVE_SNAPSHOT is set
Filipe da Silva Santos [Tue, 13 Sep 2022 06:30:41 +0000 (08:30 +0200)]
bhyve: Fix build when BHYVE_SNAPSHOT is set

Fixes: 9cc9abf409cc ("bhyve: create all vcpus on startup")
Sponsored by: Beckhoff Automation GmbH & Co. KG
X-MFC-With: 9cc9abf409cc

(cherry picked from commit 10c6af344108a8cfdc431b5b304de9c0fddcec47)

17 months agobhyve/snapshot: ..back to SOCK_STREAM
Robert Wing [Thu, 28 Apr 2022 15:43:01 +0000 (07:43 -0800)]
bhyve/snapshot: ..back to SOCK_STREAM

Now that nvlist_send()/nvlist_recv() are being used, ditch the datagram
socket.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34863

(cherry picked from commit 690b7ea081790eef2c890f63a4fe7e195cf51df0)

17 months agobhyve: use linker set for ipc commands
Robert Wing [Sun, 10 Apr 2022 02:46:00 +0000 (18:46 -0800)]
bhyve: use linker set for ipc commands

Reviewed by: markj, jhb
Differential Revision: https://reviews.freebsd.org/D34760

(cherry picked from commit c79331a42c308139828c1117f49224bb83617a53)

17 months agobhyve: sweep MAX_VMNAME
Robert Wing [Fri, 18 Mar 2022 05:55:52 +0000 (21:55 -0800)]
bhyve: sweep MAX_VMNAME

MAX_VMNAME is no longer used.

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

(cherry picked from commit 3ebe1109348f53f64b395293578416abedef4090)

17 months agobhyve/snapshot: limit snapshot filename to NAME_MAX
Robert Wing [Fri, 18 Mar 2022 05:51:31 +0000 (21:51 -0800)]
bhyve/snapshot: limit snapshot filename to NAME_MAX

NAME_MAX is a better fit since strcat_extension() constructs the
filename of the snapshot file.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34291

(cherry picked from commit 961e6a12efdbd48d92516beaf0772ff50008457d)

17 months agolibvmm: constify vm_get_name()
Robert Wing [Fri, 18 Mar 2022 05:26:54 +0000 (21:26 -0800)]
libvmm: constify vm_get_name()

Allows callers of vm_get_name() to retrieve the vm name without having
to allocate a buffer.

While in the vicinity, do minor cleanup in vm_snapshot_basic_metadata().

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

(cherry picked from commit 3efc45f34e13c63cb37a77a67fea39937004b75a)

17 months agobhyvectl: drop vm_get_name()
Robert Wing [Fri, 18 Mar 2022 05:22:43 +0000 (21:22 -0800)]
bhyvectl: drop vm_get_name()

Grab the vm name from bhyvectl's --vm flag instead.

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

(cherry picked from commit ee0ebaa42028aee9886e06b6b995c8b2389e89f4)

17 months agobhyve/snapshot: use a string for cmd element in the nvlist
Robert Wing [Tue, 15 Feb 2022 17:12:15 +0000 (08:12 -0900)]
bhyve/snapshot: use a string for cmd element in the nvlist

The nvlist for a checkpoint request will now look like:

    { cmd="checkpoint", suspend="true/false", filename="afilename" }

Reviewed by: jhb
Suggested by:   jhb
Differential Revision: https://reviews.freebsd.org/D34237

(cherry picked from commit 4379c1da56faa43ecc925e47707a2f51b488614e)

17 months agobhyve/snapshot: switch to nvlist for snapshot requests
Robert Wing [Wed, 9 Feb 2022 17:11:57 +0000 (08:11 -0900)]
bhyve/snapshot: switch to nvlist for snapshot requests

Switch to using an nvlist with nvlist_send()/nvlist_recv() to
communicate from bhyvectl(8) to bhyve(8).

The idea is that a bhyve process receives a command with with a set of
arguments. The nvlist here is structured to reflect that premise.

For example, to snapshot the vm, the expected nvlist looks like:

    { cmd=START_CHECKPOINT, filename="filename" }

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D33977

(cherry picked from commit edfb339d3868bbd36393efb2738287e170767784)

17 months agobhyve/snapshot: fix pthread_create() error check
Robert Wing [Wed, 19 Jan 2022 17:40:06 +0000 (08:40 -0900)]
bhyve/snapshot: fix pthread_create() error check

pthread_create() returns 0 on success or an error number on failure.

Reviewed by: khng, markj
Differential Revision: https://reviews.freebsd.org/D33930

(cherry picked from commit 51fbd894ddadd6a1bc4cb72de8ac4e92c013bd36)

17 months agobhyve/snapshot: split up mutex/cond initialization from socket creation
Robert Wing [Sat, 15 May 2021 19:58:21 +0000 (11:58 -0800)]
bhyve/snapshot: split up mutex/cond initialization from socket creation

Move initialization of the mutex/condition variables required by the
save/restore feature to their own function.

The unix domain socket that facilitates communication between bhyvectl
and bhyve doesn't rely on these variables in order to be functional.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D30281

(cherry picked from commit fdbc86cf79784f56fab8115f2d565962e1111b2e)

17 months agobhyve/snapshot: provide a way to send other messages/data to bhyve
Robert Wing [Wed, 3 Mar 2021 06:05:47 +0000 (21:05 -0900)]
bhyve/snapshot: provide a way to send other messages/data to bhyve

This is a step towards sending messages (other than suspend/checkpoint)
from bhyvectl to bhyve.

Introduce a new struct, ipc_message - this struct stores the type of
message and a union containing message specific structures for the type
of message being sent.

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

(cherry picked from commit d4870e3a7256704905655e997b37a866024c2894)

17 months agobhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM
Robert Wing [Mon, 8 Mar 2021 00:23:29 +0000 (15:23 -0900)]
bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM

The save/restore feature uses a unix domain socket to send messages
from bhyvectl(8) to a bhyve(8) process. A datagram socket will suffice
for this.

An added benefit of using a datagram socket is simplified code. For
bhyve, the listen/accept calls are dropped; and for bhyvectl, the
connect() call is dropped.

EPRINTLN handles raw mode for bhyve(8), use it to print error messages.

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

(cherry picked from commit 38dfb0626fd35c64b2e2d5faae2c90e7981a3307)

17 months agobhyve/snapshot: rename and bump size of MAX_SNAPSHOT_VMNAME
Robert Wing [Sat, 27 Feb 2021 21:07:35 +0000 (12:07 -0900)]
bhyve/snapshot: rename and bump size of MAX_SNAPSHOT_VMNAME

MAX_SNAPSHOT_VMNAME is a macro used to set the size of a character
buffer that stores a filename or the path to a file - this file is used
by the save/restore feature.

Since the file doesn't have anything to do with a vm name, rename
MAX_SNAPSHOT_VMNAME to MAX_SNAPSHOT_FILENAME. Bump the size to PATH_MAX
while here.

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

(cherry picked from commit d656ce199d72f1aeeef1b2e28b4a284c968a8d03)

17 months agobhyvectl: reduce code duplication
Robert Wing [Sat, 27 Feb 2021 21:05:52 +0000 (12:05 -0900)]
bhyvectl: reduce code duplication

Combine send_start_checkpoint() and send_start_suspend() into a
single function named snapshot_request().

snapshot_request() is equivalent to send_start_checkpoint() and
send_start_suspend() except that it takes an additional argument. The
additional argument, enum ipc_opcode, is used to determine the type of
snapshot request being performed. Also, switch to using strlcpy instead
of strncpy.

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

(cherry picked from commit da9713917eb26b67bafc740384ccd44f7dff09f2)

17 months agobhyve/snapshot: rename checkpoint_opcodes to be more generic
Robert Wing [Sat, 27 Feb 2021 21:03:03 +0000 (12:03 -0900)]
bhyve/snapshot: rename checkpoint_opcodes to be more generic

Generalize the naming here since the domain socket that uses these codes
might be used for purposes other than the save/restore feature.

- rename checkpoint_opcodes to ipc_opcode

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

(cherry picked from commit b7fd9c4e5ebc69934205980d9f628ef8f21fb288)

17 months agobhyve/snapshot: drop mkdir when creating the unix domain socket
Robert Wing [Fri, 19 Feb 2021 02:48:40 +0000 (17:48 -0900)]
bhyve/snapshot: drop mkdir when creating the unix domain socket

Add /var/run/bhyve/ to BSD.var.dist so we don't have to call mkdir when
creating the unix domain socket for a given bhyve vm.

The path to the unix domain socket for a bhyve vm will now be
/var/run/bhyve/vmname instead of /var/run/bhyve/checkpoint/vmname

Move BHYVE_RUN_DIR from snapshot.c to snapshot.h so it can be shared
to bhyvectl(8).

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

(cherry picked from commit 5ce2d4a1c2922821b9940473213c0d75469755fc)

17 months agolibvmm: clean up vmmapi.h
Robert Wing [Fri, 29 Jan 2021 08:30:31 +0000 (23:30 -0900)]
libvmm: clean up vmmapi.h

struct checkpoint_op, enum checkpoint_opcodes, and
MAX_SNAPSHOT_VMNAME are not vmm specific, move them out of the vmmapi
header.

They are used for the save/restore functionality that bhyve(8)
provides and are better suited in usr.sbin/bhyve/snapshot.h

Since bhyvectl(8) requires these, the Makefile for bhyvectl has been
modified to include usr.sbin/bhyve/snapshot.h

Reviewed by:    kevans, grehan
Differential Revision:  https://reviews.freebsd.org/D28410

(cherry picked from commit 4f4065e0a220a57afa03420d4f8fa97dbcb5644c)

17 months agobhyve/ioapic: improve the tracking of IRR bit
Roger Pau Monné [Tue, 19 Jan 2021 11:52:28 +0000 (12:52 +0100)]
bhyve/ioapic: improve the tracking of IRR bit

One common method of EOI'ing an interrupt at the IO-APIC level is to
switch the pin to edge triggering mode and then back into level mode.
That would cause the IRR bit to be cleared and thus further interrupts
to be injected. FreeBSD does indeed use that method if the IO-APIC EOI
register is not supported.

The bhyve IO-APIC emulation code didn't clear the IRR bit when doing
that switch, and was also missing acknowledging the IRR state when
trying to inject an interrupt in vioapic_send_intr.

Reviewed by: grehan
Differential revision: https://reviews.freebsd.org/D28238

(cherry picked from commit 5ea878684f6cfff4ad05186346ff3a4828d980ca)

17 months agobhyve/ioapic: only account for asserted line in level mode
Roger Pau Monné [Tue, 19 Jan 2021 12:41:03 +0000 (13:41 +0100)]
bhyve/ioapic: only account for asserted line in level mode

After modifying a redirection entry only try to inject an interrupt if
the pin is in level mode, pins in edge mode shouldn't take into
account the line assert status as they are triggered by edge changes,
not the line status itself.

Reviewed by: grehan
Differential revision: https://reviews.freebsd.org/D28237

(cherry picked from commit d7d067698a38a3464a58eb34f68f63e529c45136)

17 months agobhyve/vioapic: remove an extra pin masked check
Roger Pau Monné [Tue, 19 Jan 2021 11:52:44 +0000 (12:52 +0100)]
bhyve/vioapic: remove an extra pin masked check

vioapic_send_intr does already check whether the pin is masked before
injecting the interrupt, there's no need to do it in vioapic_write
also.

No functional change intended.

Reviewed by: grehan
Differential revision: https://reviews.freebsd.org/D28236

(cherry picked from commit 49429cf9be7f43c37723175f90c56b29e29d1680)

17 months agozfs: merge openzfs/zfs@92e0d9d18 (zfs-2.1-release) into stable/13
Martin Matuska [Thu, 26 Jan 2023 16:50:13 +0000 (17:50 +0100)]
zfs: merge openzfs/zfs@92e0d9d18 (zfs-2.1-release) into stable/13

OpenZFS release 2.1.9

Notable upstream pull requeset merges:
  #12829 zfs diff -h/ZFS_DIFF_NO_MANGLE, diff cleanups
  #14181 zed: unclean disk attachment faults the vdev
  #14252 Activate filesystem features only in syncing context
  #14253 Allow reciever to override encryption property in case of replication
  #14254 Restrict visibility of per-dataset kstats inside FreeBSD jails
  #14255 Zero end of embedded block buffer in dump_write_embedded()
  #14261 FreeBSD: zfs_register_callbacks() must implement error check correctly
  #14264 Miscellaneous fixes
  #14272 Change ZEVENT_POOL_GUID to ZEVENT_POOL to display pool names
  #14287 FreeBSD: Remove stray debug printf
  #14288 Colorize zfs diff output
  #14291 FreeBSD: Fix potential boot panic with bad label
  #14328 FreeBSD: catch up to 1400077

Obtained from: OpenZFS
OpenZFS tag: zfs-2.1.9
OpenZFS commit: 92e0d9d183ce6752cd52f7277c8321d81df9ffee
Relnotes: yes

17 months agonetlink: allow netlink to be build in the kernel
Alexander V. Chernikov [Thu, 22 Dec 2022 14:51:36 +0000 (14:51 +0000)]
netlink: allow netlink to be build in the kernel

Differential Revision: https://reviews.freebsd.org/D37781

(cherry picked from commit c9313a0bad682351858e2e326cdb0f1d0bc2d1d8)

17 months agonetlink: fix standalone module build
Gleb Smirnoff [Tue, 4 Oct 2022 21:38:40 +0000 (14:38 -0700)]
netlink: fix standalone module build

(cherry picked from commit a87d2d1830933b81caaf30a67a4bef0a253ecd0b)

17 months agolinuxolator: add netlink support
Alexander V. Chernikov [Fri, 26 Aug 2022 14:34:15 +0000 (14:34 +0000)]
linuxolator: add netlink support

Add the glue code to support netlink in Linuxolator.
linux_common(4) now depends on netlink(4).

All netlink protocol constants are consistent with the Linux version.
However, certain OS-specific constants such as AF_INET6, interface
flags or default routing table id, are different between FreeBSD and
Linux. Thus, it may be needed to rewrite some message parts or even
rewrite the whole message, adding or removing some TLVs. The core
netlink implementation code provides efficient rewriting callbacks
 which Linuxolator now uses.

Reviewed by: dchagin
Differential Revision: https://reviews.freebsd.org/D36361
MFC after: 2 months

(cherry picked from commit 7c40e2d5f68516dd402073b28095ea5516fe3114)

17 months agogrowfs(7): conditionalize mention of adding dump device
Mike Karels [Mon, 23 Jan 2023 14:37:07 +0000 (08:37 -0600)]
growfs(7): conditionalize mention of adding dump device

The growfs_fstab script will add a new swap partition as a dump
device as well, but only if dumpdev is set to AUTO.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D38166

(cherry picked from commit 7d189f669836b81dbdeb7bc7178040a43ab9d1fe)

17 months agoath(4): Fix a sysctl description and a typo in a comment
Gordon Bergling [Thu, 19 Jan 2023 13:16:05 +0000 (14:16 +0100)]
ath(4): Fix a sysctl description and a typo in a comment

- s/delimeter/delimiter/

(cherry picked from commit e4b7980c5ca9c701242f3c395a042360db0ad7a7)

17 months agoMFC: MFV: xz 5.4.1.
Xin LI [Mon, 23 Jan 2023 00:49:43 +0000 (16:49 -0800)]
MFC: MFV: xz 5.4.1.

(cherry picked from commit 047153b416415605f127a3950e08c61f1910e9cb)

17 months agokgssapi: Increase timeout for kernel to gssd(8) upcalls
Rick Macklem [Wed, 11 Jan 2023 21:20:31 +0000 (13:20 -0800)]
kgssapi: Increase timeout for kernel to gssd(8) upcalls

It turns out that the underlying problem that caused
a Kerberized NFS mount with the "gssname" option to
fail was that the kernel upcall to the gssd(8) daemon
would time out prematurely after 25 seconds.  The
gss_acquire_cred() GSSAPI library call
takes about 27 seconds for the case where a desired_name
argument is specified.  A similarly long delay occurs
when the gss_init_sec_context() call is made and the
user principal's TGT has expired.

Once the upcall timed out, the kernel code assumed that
the gssd(8) daemon had died and closed the socket.
Ironically, closing the socket did cause the gssd(8)
daemon to terminate via a SIGPIPE signal.

This patch increases the timeout to 5 minutes.  Since
a timeout should only occur when the gssd(8) daemon
has died, a long timeout should be ok and seems to fix this
problem.

I still think that commit c33509d49a should remain in the
system, since it allows the mount to complete quickly
and not take nearly 30 seconds.

PR: 268823

(cherry picked from commit e3c26ce5cb410e4e58e131dfea7054e0bf11e3ca)

17 months agonfscl: Improve NFSv4 error message for NFSERR_WRONGSEC
Rick Macklem [Wed, 11 Jan 2023 21:28:44 +0000 (13:28 -0800)]
nfscl: Improve NFSv4 error message for NFSERR_WRONGSEC

The usual reason for an NFSv4 server replying NFSERR_WRONGSEC
to an operation is that a Kerberos credential is required.
This patch replaces a cryptic "err=10016" with a message
suggesting that a Kerberos TGT is probably needed.

(cherry picked from commit 39633fc1731c3feeed36aa452bbdfb7968a86383)

17 months agostand/mips: retire BERI boot loader
Warner Losh [Wed, 25 Jan 2023 18:31:00 +0000 (11:31 -0700)]
stand/mips: retire BERI boot loader

The folks that created the BERI boot loader no longer need it. They've
long since moved on to other research platforms. Since BERI loader
contains yet another copy of code that I've consolodated; and since it's
impossible to test this platform; and since there are no users, retire
it completely to ease future MFCs.

OK'd by: brooks@
Sponsored by: Netflix

This is a direct commit to stable/13

17 months agostand: updated MFC info.
Warner Losh [Wed, 25 Jan 2023 18:26:44 +0000 (11:26 -0700)]
stand: updated MFC info.

This is a direct commit to stable/13

17 months agostand/mips64: Make beri loader compile
Warner Losh [Wed, 25 Jan 2023 15:14:45 +0000 (08:14 -0700)]
stand/mips64: Make beri loader compile

The devdesc reorgs in main were done after mips was deleted. Make the
minimal changes to beri's devicename.c needed after that. I have no
ability to test this, however, so it builds with similar warnings to
before all my MFC changes.

This is a direct commit to stable/13

17 months agostand: update mips uboot to uboot reorg
Warner Losh [Wed, 25 Jan 2023 14:54:03 +0000 (07:54 -0700)]
stand: update mips uboot to uboot reorg

uboot reorg in main happened after the mips support was removed. Go
ahead and do the same reorg here. Move the mips files from mips/uboot to
uboot/arch/mips. Move mips/uboot/Makefile to
uboot/arch/mips/Makefile.inc and cut out the common lines. Split uboot
target into uboot and uboot.bin to better fit into reorg.

This is a direct commit to stable/13

17 months agostand/uboot: Remove -fPIC here
Warner Losh [Wed, 25 Jan 2023 15:03:08 +0000 (08:03 -0700)]
stand/uboot: Remove -fPIC here

When needed, -fPIC is added in defs.mk. While not in main, mips on
stable/13 can't tolerate it. Remove it here.

MFC After: now (it's a build issue)
Sponsored by: Netflix

(cherry picked from commit 4410e857965edef0e3be42ae323356ec08d2aaad)

17 months agopci_info: update to 2022-12-04
Baptiste Daroussin [Thu, 8 Dec 2022 15:07:54 +0000 (16:07 +0100)]
pci_info: update to 2022-12-04

(cherry picked from commit 07d1c4a919c0a7bdbf846e75e730d1c10c72eef6)

17 months agodma(8): add newaliases to mailer.conf
Baptiste Daroussin [Tue, 6 Dec 2022 07:30:19 +0000 (08:30 +0100)]
dma(8): add newaliases to mailer.conf

Reported by: karels
MFC After: 3 days

(cherry picked from commit d525abd2771692b8da01e23bc6f3333c7dd7f669)

17 months agoflua: chown(2) binding, fix bad copy/paste
Baptiste Daroussin [Fri, 25 Nov 2022 08:05:40 +0000 (09:05 +0100)]
flua: chown(2) binding, fix bad copy/paste

(cherry picked from commit 280f11f1be54370fcc289ee259a1b86637170ea1)

17 months agoflua: add a chown(2) binding
Baptiste Daroussin [Thu, 24 Nov 2022 08:16:05 +0000 (09:16 +0100)]
flua: add a chown(2) binding

The main difference with the chown in luaposix, is that it checks
and reports if a user or a group do exist when a string is passed
as arguments

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D37479

(cherry picked from commit a1ab15abe2e2a1ed92cbad056df71afff7e8794e)

17 months agoumodem: ignore CDC_CM descriptor for baltech smartcard reader
Steffen Dirkwinkel [Fri, 4 Nov 2022 14:46:07 +0000 (15:46 +0100)]
umodem: ignore CDC_CM descriptor for baltech smartcard reader

The CDC_CM descriptor points to the wrong interface for serial port use.
Ignore it to use the CDC_UNION descriptor.

usbconfig dump (spec at: https://usb.org/sites/default/files/CDC1.2_WMC1.1_012011.zip):
ugen0.2: <Baltech AG Smartcard Reader> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (300mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x13ad
  idProduct = 0xf019
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <Baltech AG>
  iProduct = 0x0002  <Smartcard Reader>
  iSerialNumber = 0x0003  <45031910>
  bNumConfigurations = 0x0001

 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x0064
    bNumInterfaces = 0x0003
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x0096

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0003  <HID device>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x21
      bDescriptorSubType = 0x11
       RAW dump:
       0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0xd0,
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040
        bInterval = 0x0001
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x08
      bDescriptorType = 0x0b
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x08, 0x0b, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00

    Interface 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0002  <Communication device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x00
       RAW dump:
       0x00 | 0x05, 0x24, 0x00, 0x10, 0x01

      Additional Descriptor

      bLength = 0x04
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x04, 0x24, 0x02, 0x00

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump:
       0x00 | 0x05, 0x24, 0x06, 0x01, 0x02

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x05, 0x24, 0x01, 0x00, 0x01

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0085  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0008
        bInterval = 0x0010
        bRefresh = 0x0000
        bSynchAddress = 0x0000

    Interface 2
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0002
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x000a  <CDC-data>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0086  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0006  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

Reviewed by: manu
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37942

(cherry picked from commit 8580e334b0757c8d55e51b8dc7fc4051521beedf)

17 months agoumodem: add quirk to ignore CDC_CM descriptor
Steffen Dirkwinkel [Tue, 17 Jan 2023 07:58:46 +0000 (08:58 +0100)]
umodem: add quirk to ignore CDC_CM descriptor

Some devices have CDC_CM descriptors that would point us to
the wrong interfaces. Add a quirk to ignore those (prefering the
CDC_UNION descriptor effectively)

Reviewed by: manu
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37942

(cherry picked from commit 73c3e8b1dee6cd42de32287ea8a57762b961d8ee)

17 months agostand: mfc notes
Warner Losh [Wed, 25 Jan 2023 04:19:48 +0000 (21:19 -0700)]
stand: mfc notes

MFCing stand is getting complicated. This file contains notes about
merging from 14, in summary:
o UFS changes have already been merged.
o The ZFS changes, on the whole, cannot be merged because OpenZFS
  versions are different.
o MIPS is still present in 13, so commits to tear down mips
  support.
o Some of the 14 GELI changes depend on crypto changes not yet merged.
o One change bumped the version to 14.x, and that shouldn't be merged.

The hashes listed should not be merged, unless something changes.

This is a direct commit to stable/13.

17 months agoRevert "mips: remove saf1761"
Warner Losh [Wed, 25 Jan 2023 04:00:23 +0000 (21:00 -0700)]
Revert "mips: remove saf1761"

Mips is still in stable/13, so this should not have been merged.

This reverts commit 622ab2c4834068312b6cd33fd7ac961f31240350.

Sponsored by: Netflix

17 months agoRevert "Bump the FreeBSD kernel version in kernel boot shim."
Warner Losh [Wed, 25 Jan 2023 03:56:41 +0000 (20:56 -0700)]
Revert "Bump the FreeBSD kernel version in kernel boot shim."

This should not have been merged.

This reverts commit 8cc2156f85bb5cd0c4bae6882b72b215281b1fc5.

Sponsored by: Netflix

17 months agoRevert "stand: remove mips support"
Warner Losh [Wed, 25 Jan 2023 03:54:38 +0000 (20:54 -0700)]
Revert "stand: remove mips support"

This change slipped through my checks, and should not have been merged.
mips is still supported in stable/13.

This reverts commit e006859bce01b2f10349a804cade3688f40557e3.

17 months agoTag zfs-2.1.9
Tony Hutter [Tue, 24 Jan 2023 23:41:54 +0000 (15:41 -0800)]
Tag zfs-2.1.9

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
17 months agolinux 6.2 compat: zpl_set_acl arg2 is now struct dentry
Coleman Kane [Tue, 24 Jan 2023 19:20:50 +0000 (14:20 -0500)]
linux 6.2 compat:  zpl_set_acl arg2 is now struct dentry

Linux 6.2 changes the second argument of the set_acl operation to be a
"struct dentry *" rather than a "struct inode *". The inode* parameter
is still available as dentry->d_inode, so adjust the call to the _impl
function call to dereference and pass that pointer to it.

Also document that the get_acl -> get_inode_acl member name change from
commit 884a693 was an API change also introduced in Linux 6.2.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #14415

17 months agoRevert "ztest fails assertion in zio_write_gang_member_ready()"
Tony Hutter [Tue, 24 Jan 2023 23:31:09 +0000 (15:31 -0800)]
Revert "ztest fails assertion in zio_write_gang_member_ready()"

This reverts commit 0156253d29a303bdcca3e535958e754d8f086e33.

That commit was identified as causing IO errors on a user's
encrypted dataset:
https://github.com/openzfs/zfs/issues/14413

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
17 months agobyteswap.h: Add a glibc/linux compatible byteswap.h
Warner Losh [Fri, 20 Jan 2023 23:33:37 +0000 (16:33 -0700)]
byteswap.h: Add a glibc/linux compatible byteswap.h

For endian.h to work instead of sys/endian.h, some software needs
byteswap.h available. It must define {__,}byteswap_{16,32,64}.
Included sys/_endian.h to get an appropriate __byteswap16, etc
and defines the new macros in terms of them. Enhance _endian.h
to allow it to be included from here too.

Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32051

(cherry picked from commit 1761b09bf42d2842e82c1ac614c23d31c4d4c0dc)

17 months agolinux: For better compatibility, provide compatible endian.h
Warner Losh [Fri, 20 Jan 2023 23:32:45 +0000 (16:32 -0700)]
linux: For better compatibility, provide compatible endian.h

Add endian.h. This includes sys/endian.h and then adds extra defines
that glibc defines with double underscores for our
_{BIG,BYTE,LITTLE,PDP}_ENDIAN macros. We also define __FLOAT_WORD_ORDER
to be the same as _BYTE_ENDIAN since FreeBSD doesn't currently define
this, and the default with glibc is exactly this for our platforms.
Move common parts of endian.h and sys/endian.h into sys/_endian.h
to limit namespace pollution from endian.h

All this gives us good compatibility with Linux. There may be one or two
upstreams that haven't integrated the patches I tried to send up.

There are some minor differences:
o The extra glibc macros are not defined. These are all
  controlled with either __ at the start, or only defined
  when glibc is being built. We also don't define macros
  that are used internally in glibc that would pollute
  the namespace.
o For complete compatibility, this change must also be
  paired with providing a glibc-compatible byteswap.h.

Sponsored by: Netflix
Reviewed by: mhorne, markj, jhb
Differential Revision: https://reviews.freebsd.org/D31962

(cherry picked from commit 30e0d2a51026830e5141ce3dd43854819bba910c)

17 months agoendian.h: Use the __bswap* versions
Warner Losh [Tue, 21 Sep 2021 04:02:35 +0000 (22:02 -0600)]
endian.h: Use the __bswap* versions

Make it possible to have all these macros work without bswap* being
defined. bswap* is part of the application namespace and applications
are free to redefine those functions.

Reviewed by: emaste,jhb,markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31964

(cherry picked from commit 44fb3c695f5e672ec00bdef0fa0f13793e6269a1)

17 months agoepoch: replace hand coded assertion
Brooks Davis [Fri, 20 Jan 2023 18:03:39 +0000 (18:03 +0000)]
epoch: replace hand coded assertion

The assertion is equivalent to kstack_contains() so use that rather
than spelling it out.

Suggested by: jhb
Reviewed by: jhb
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D38107

(cherry picked from commit fa1d803c0f652d72840a3c59139baf9d30792860)