]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agocamcontrol: Label the unused command args
Warner Losh [Mon, 19 Jun 2023 20:42:48 +0000 (14:42 -0600)]
camcontrol: Label the unused command args

Remove CAM_ARG_FORMAT_{BLOCK,BLI,PHYS} since they are not used.  Label
all the unused CAM_ARG_ bits as unused in comments to make them stand
out.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40520

14 months agobhyve: Refactor vmexit_suspend() a bit
Mark Johnston [Mon, 19 Jun 2023 19:46:32 +0000 (15:46 -0400)]
bhyve: Refactor vmexit_suspend() a bit

Move some of its logic into fbsdrun_deletecpu().  This makes it easier
to split vmexit handlers into a separate file, which in turn makes
landing arm64 support easier.  Also increase the scope of the mutex and
use it to synchronize updates to the vcpu mask.  No functional change
intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40573

14 months agobhyve: Register hlt and pause vmexit handlers unconditionally
Mark Johnston [Mon, 19 Jun 2023 19:46:02 +0000 (15:46 -0400)]
bhyve: Register hlt and pause vmexit handlers unconditionally

These exit handlers might not be used if the corresponding VM
capabilities are not set, but there is no harm in putting them into the
handler table regardless.  Doing so simplifies initialization code,
makes it easier to split vmexit handlers into a separate file, and lets
us declare the handler table as const.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40572

14 months agobhyve: Include vmm.h via the usual path
Mark Johnston [Thu, 8 Jun 2023 21:25:25 +0000 (17:25 -0400)]
bhyve: Include vmm.h via the usual path

No functional change intended.

MFC after: 1 week
Sponsored by: Innovate UK

14 months agobhyve: Remove some unneeded includes of segments.h
Mark Johnston [Thu, 8 Jun 2023 21:24:45 +0000 (17:24 -0400)]
bhyve: Remove some unneeded includes of segments.h

They are not needed and are specific to x86.  No functional change
intended.

MFC after: 1 week
Sponsored by: Innovate UK

14 months agoApply llvm fix for hanging gcc builds on 32-bit arm
Dimitry Andric [Mon, 19 Jun 2023 18:32:40 +0000 (20:32 +0200)]
Apply llvm fix for hanging gcc builds on 32-bit arm

Merge commit 962c306a11d0 from llvm-project (by Florian Hahn):

  [LV] Don't consider pointer as uniform if it is also stored.

  Update isVectorizedMemAccessUse to also check if the pointer is stored.
  This prevents LV to incorrectly consider a pointer as uniform if it is
  used as both pointer and stored by the same StoreInst.

  Fixes #61396.

PR: 271992
Reported by: John F. Carr <jfc@mit.edu>
MFC after: 3 days

14 months agoservice: Add -E option to set environment variables before starting a service.
Alexander Leidinger [Wed, 30 Nov 2022 18:31:41 +0000 (19:31 +0100)]
service: Add -E option to set environment variables before starting a service.

This allows for quicker testing/debugging of rc scripts and is a pre-req
for automatic service jails.

Differential Revision: https://reviews.freebsd.org/D40369
Reviewed by: se

14 months agoifconfig: Pacify a sign comparison warning in regdomain_sort.
John Baldwin [Mon, 19 Jun 2023 17:38:18 +0000 (10:38 -0700)]
ifconfig: Pacify a sign comparison warning in regdomain_sort.

Both ic_flags values are unsigned (uint32_t), so cast them to a signed
int to generate a signed result.  Both ic_req values are also
unsigned, but since they are uint16_t, they are implicitly promited to
int before the subtraction.

Reported by: GCC -Wsign-compare
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40610

14 months agoifconfig: Consistently use uint32_t for wireless channel flags.
John Baldwin [Mon, 19 Jun 2023 17:38:07 +0000 (10:38 -0700)]
ifconfig: Consistently use uint32_t for wireless channel flags.

Reported by: GCC -Wsign-compare
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40609

14 months agoifconfig: Avoid issues with trying to negate unsigned values.
John Baldwin [Mon, 19 Jun 2023 17:37:52 +0000 (10:37 -0700)]
ifconfig: Avoid issues with trying to negate unsigned values.

The if_flags and if_cap fields hold a bitmask of flags.  If a flag is
the MSB of the field, then the logic in setifflags and setifcap which
uses a < 0 check does the wrong thing (it tries to clear the flag
rather than setting it).  Also, trying to use -<FOO> doesn't actually
work as the result is a nop.  To fix, stop overloading setifcap and
setifflags and instead add new dedicated action functions clearifcap
and clearifflags for clearing a flag.  The value passed in the
argument to the command is now always the raw flag.

This was reported by a GCC warning after raising WARNS:

sbin/ifconfig/ifconfig.c:2061:33: error: integer overflow in expression '-2147483648' of type 'int' results in '-2147483648' [-Werror=overflow]
 2061 |         DEF_CMD("-txtlsrtlmt",  -IFCAP_TXTLS_RTLMT,     setifcap),
      |                                 ^

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40608

14 months agox86: Add defines for a couple of thermal and PM bits
Mark Johnston [Mon, 19 Jun 2023 17:26:07 +0000 (13:26 -0400)]
x86: Add defines for a couple of thermal and PM bits

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

14 months agosh: also auto-complete built-ins
Piotr Pawel Stefaniak [Sat, 29 Apr 2023 15:53:58 +0000 (17:53 +0200)]
sh: also auto-complete built-ins

Reported in a comment in PR 261728.

Reported by: Oleg
Reviewed by: jilles (previous version), bapt
Differential Revision: https://reviews.freebsd.org/D39839

14 months agompi3mr: fix GCC kernel build
Ed Maste [Mon, 19 Jun 2023 13:23:45 +0000 (09:23 -0400)]
mpi3mr: fix GCC kernel build

Previously every file that included mpi3mr_app.h but did not use
mpi3mr_mgmt_info reported error: 'mpi3mr_mgmt_info' defined but not
used.

Fixes: 2d1d418e1e7b ("mpi3mr: 3rd Generation Tri-Mode NVMe/SAS/SATA...")
Reported by: amd64-gcc12 Cirrus-CI job
Sponsored by: The FreeBSD Foundation

14 months agopcib: Allocate the memory BAR with the MSI-X table.
John Baldwin [Mon, 19 Jun 2023 16:15:48 +0000 (09:15 -0700)]
pcib: Allocate the memory BAR with the MSI-X table.

This is required for pci_alloc_msix() to work and to thus use
MSI-X interrupts for PCI-e hotplug.

Reported by: cperciva
Reviewed by: cperciva
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40581

14 months agoseq: fix check for rounding error/truncation
Ed Maste [Mon, 19 Jun 2023 01:37:06 +0000 (21:37 -0400)]
seq: fix check for rounding error/truncation

Based on OpenBSD 30f0fd29ba6c:
> We need to compare the printable version of the last value displayed,
> not the floating point representation.  Otherwise, we may print the
> last value twice.

PR: 271964
Reported by: Daniel Kolesa
Reviewed by: yuripv
Obtained from: OpenBSD
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40601

14 months agoifconfig: set boolean to true rather than incrementing
Ed Maste [Mon, 19 Jun 2023 15:01:08 +0000 (11:01 -0400)]
ifconfig: set boolean to true rather than incrementing

GCC warns about "increment of a boolean expression."

Reported by: amd64-gcc12 Cirrus-CI run
Sponsored by: The FreeBSD Foundation

14 months agonameser: Fix a typo in a source code comment
Gordon Bergling [Mon, 19 Jun 2023 11:49:23 +0000 (13:49 +0200)]
nameser: Fix a typo in a source code comment

-s /unknwon/unknown/

MFC after: 3 days

14 months agoFix some shell issues by adding quotes and replace backticks with $()
Benedict Reuschling [Mon, 19 Jun 2023 11:03:06 +0000 (11:03 +0000)]
Fix some shell issues by adding quotes and replace backticks with $()

This patch fixes the following issues reported by shellcheck:
- Quote default assignments (SC2223)
- Use $() instead of backticks (SC2006)
- Double quote $@ (SC2068)
- Double quote variables in if-statements and other places (SC2086)

While here, fix a whitespace at one end of line instance in the license
text.

Approved by: manu
Differential Revision: https://reviews.freebsd.org/D40604

14 months agopf: Fix usage of pf tags with syncookies
Kajetan Staszkiewicz [Mon, 19 Jun 2023 08:21:29 +0000 (10:21 +0200)]
pf: Fix usage of pf tags with syncookies

The value stored in pf_mtag->tag comes from "tag" and "match tag"
keywords in pf.conf and must not be abused for storing other
information. A ruleset with enough tags could set or remove the bits
responsible for PF_TAG_SYNCOOKIE_RECREATED.

Move this syncookie status to pf_mtag->flags. Rename this and other
related constants in a way that will prevent such mistakes in the
future. Move PF_REASSEMBLED constant to mbuf.h and rename accordingly
because it's not a flag stored in pf_mtag, but an identifier of a
different m_tag. Change the value of the constant to avoid conflicts
with other m_tags using MTAG_ABI_COMPAT.

Rename the variables in pf_build_tcp() and pf_send_tcp() in to reduce
confusion.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40587

14 months agopf: extend use of skip steps for Ethernet rules
Kristof Provost [Thu, 15 Jun 2023 15:12:11 +0000 (17:12 +0200)]
pf: extend use of skip steps for Ethernet rules

Use the already populated PFE_SKIP_DST_ADDR and extend the skip
infrastructure to also skip on IP source/destination addresses.

This should make evaluating the rules slightly faster.

Reported by: R. Christian McDonald <rcm@rcm.sh>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40567

14 months agomotd: unbreak for source upgrade
Eugene Grosbein [Mon, 19 Jun 2023 07:49:35 +0000 (14:49 +0700)]
motd: unbreak for source upgrade

In case of source upgrade path from 12.x proper merge of new /etc
installs /etc/motd.template. Becase of that, the system in left
without symlink /etc/motd -> /var/run/motd but with stale /etc/motd contents.

Fix it creating symlink despite of presence of /etc/motd.template.

MFC after: 1 week

14 months agobhyve: add command line parameter and parsing for migration
Mihai Burcea [Mon, 19 Jun 2023 06:46:28 +0000 (08:46 +0200)]
bhyve: add command line parameter and parsing for migration

This covers warm and live migration.

Reviewed by: corvink
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34717

14 months agobhyve: use pci_next() to save/restore pci devices
Vitaliy Gusev [Mon, 15 May 2023 14:29:04 +0000 (14:29 +0000)]
bhyve: use pci_next() to save/restore pci devices

Current snapshot implementation doesn't support multiple devices with
similar type. For example, two virtio-blk or two CD-ROM-s, etc.

So the following configuration cannot be restored.

bhyve \
-s 3,virtio-blk,disk.img \
-s 4,virtio-blk,disk2.img

In some cases it is restored silently, but doesn't work. In some cases
it fails during restore stage.

This commit fixes that issue.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40109

14 months agobhyve: add .pe_snapshot method for PCI 'hostbridge'
Vitaliy Gusev [Mon, 15 May 2023 16:29:56 +0000 (16:29 +0000)]
bhyve: add .pe_snapshot method for PCI 'hostbridge'

There is no error when dump doesn't have it, but to be more
consistent this PCI devices should be saved as well.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40108

14 months agobhyve: add bus, slot and func to device name
Vitaliy Gusev [Mon, 15 May 2023 14:28:45 +0000 (14:28 +0000)]
bhyve: add bus, slot and func to device name

Each device needs a unique identifier to store and restore snapshots
properly. Adding the pci bsf information to the device name creates a
unique identifier as a bsf can't be occupied twice.

Reviewed by: corvink
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40107

14 months agobhyve: rename 'user_dev' with 'devices'
Vitaliy Gusev [Mon, 15 May 2023 14:28:14 +0000 (14:28 +0000)]
bhyve: rename 'user_dev' with 'devices'

Bhyve don't use 'user' specifier for emulated devices. And
using 'user' adds duality.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40106

14 months agobhyve: simplify restore of kernel structs
Vitaliy Gusev [Mon, 15 May 2023 14:27:29 +0000 (14:27 +0000)]
bhyve: simplify restore of kernel structs

Both devices and kernel struct can use the same 'lookup_dev'
function instead of having duplicated code.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40105

14 months agobhyve: rename 'structs' snapshot key with 'kern_structs'
Vitaliy Gusev [Mon, 15 May 2023 14:25:15 +0000 (14:25 +0000)]
bhyve: rename 'structs' snapshot key with 'kern_structs'

Using key 'structs' is ambiguous. This section contains data
related to the kernel. It should use a more informative naming.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40104

14 months agoacl_is_trivial_np(3): minor fixes
Kyle Evans [Mon, 19 Jun 2023 05:31:16 +0000 (00:31 -0500)]
acl_is_trivial_np(3): minor fixes

- Correct the document title
- This function has an _np suffix
- acl_strip_np has a manpage, xref it
- RETURN VALUES should describe acl_is_trivial_np, not acl_get_tag_type

Sponsored by: Klara, Inc.

14 months agomount_nfs.8: Note a case where the "nconnect" option does not work
Rick Macklem [Sun, 18 Jun 2023 20:02:20 +0000 (13:02 -0700)]
mount_nfs.8: Note a case where the "nconnect" option does not work

The "nconnect" NFS mount option will not work
correctly for servers where the TCP connections
might connect to different NFS clusters that do not
share NFSv4.1/4.2 state information, such as file locks.

This patch adds a sentence to the "nconnect" section
of mount_nfs.8 noting this case.

This is a content change.

Reviewed by: karels, pauamma_gundo.com (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40547

14 months agoexamples/kld/syscall: unbreak compilation
Maxim Konovalov [Sun, 18 Jun 2023 05:52:01 +0000 (05:52 +0000)]
examples/kld/syscall: unbreak compilation

modfind(9)/modstat(9) need sys/param.h.

14 months agomlx4en(4): add missing newline to debug messages
Kevin Lo [Sun, 18 Jun 2023 04:14:41 +0000 (12:14 +0800)]
mlx4en(4): add missing newline to debug messages

Add newline to debug messages after dumping uar_page_shift and reserved_uars.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40582

14 months agoamdtemp: Fix missing 49 degree offset on current EPYC CPUs
Val Packett [Sat, 17 Jun 2023 16:29:53 +0000 (13:29 -0300)]
amdtemp: Fix missing 49 degree offset on current EPYC CPUs

On an EPYC 7313P, the temperature reported by amdtemp was off, because
the offset was not applied. Turns out it needs to be applied with one
more condition: https://lkml.org/lkml/2023/4/13/1095

Reviewed by: mhorne
Tested by: mike.jakubik@gmail.com
MFC after: 1 week
Sponsored by: https://www.patreon.com/valpackett
Pull Request: https://github.com/freebsd/freebsd-src/pull/754

14 months agoarm64/disassem.c: Add shifted register definitions with ror
Mykola Hohsadze [Sat, 17 Jun 2023 15:31:25 +0000 (12:31 -0300)]
arm64/disassem.c: Add shifted register definitions with ror

Add disassembly support for the following shifted register instructions:
* mvn
* orn
* orr
* and
* ands
* bic
* bics
* eon
* eor
* tst

According to Arm64 documenation, operational pseuducode of shifted
register instruction must return `UNDEFINED` if shift type is `RESERVED`
('11'). Hence, removed "rsv" from `shift_2` array and add "ror". In case
of shift type is 3 and this type is `RESERVED`, we will return
`undefined`.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40386

14 months agotcpdump: Reconnect pfsync printer
Joseph Mingrone [Fri, 16 Jun 2023 13:40:00 +0000 (10:40 -0300)]
tcpdump: Reconnect pfsync printer

Fixes: ee67461e (tpcdump: Update to 4.99.4)

Reported by: glebius
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40578

14 months agohifn(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 17 Jun 2023 08:51:23 +0000 (10:51 +0200)]
hifn(4): Fix a typo in a source code comment

- s/regesters/registers/

MFC after: 3 days

14 months agoxdr(3): Fix a typo in a source code comment
Gordon Bergling [Sat, 17 Jun 2023 08:49:40 +0000 (10:49 +0200)]
xdr(3): Fix a typo in a source code comment

- s/curren/current/

MFC after: 3 days

14 months agozfs: merge openzfs/zfs@10e36e176
Martin Matuska [Fri, 16 Jun 2023 21:12:27 +0000 (23:12 +0200)]
zfs: merge openzfs/zfs@10e36e176

Notable upstream pull request merges:
  #14948 Remove ARC/ZIO physdone callbacks
  #14963 Store the L2ARC device ashift in the vdev label
  #14970 Switch refcount tracking from lists to AVL-trees
  #14981 Shorten arcstat_quiescence sleep time

Obtained from: OpenZFS
OpenZFS commit: 10e36e17612ba9c634b140ae76847bb62b5be68f

14 months agoshare/mk/bsd.cpu.mk: handle the default case when CPUTYPE is not specified on powerpc*
Piotr Kubaj [Fri, 16 Jun 2023 09:43:42 +0000 (11:43 +0200)]
share/mk/bsd.cpu.mk: handle the default case when CPUTYPE is not specified on powerpc*

Approved by: imp
Differential Revision: https://reviews.freebsd.org/D40576

14 months agorc.suspend: update man pages for new keyword
Johannes Totz [Fri, 16 Jun 2023 16:48:17 +0000 (13:48 -0300)]
rc.suspend: update man pages for new keyword

rc.suspend has gained an rcorder keyword recently. Document it alongside
the existing resume keyword.

Reviewed By: mhorne, Pau Amma <pauamma@gundo.com>
Differential Revision: https://reviews.freebsd.org/D40484

14 months agohwpmc(4): document debugging options
Mitchell Horne [Fri, 16 Jun 2023 16:38:43 +0000 (13:38 -0300)]
hwpmc(4): document debugging options

The debug options for hwpmc are not documented in detail anywhere, and
setting it up was error-prone the first time I had to figure it out (and
each time I've had to remember it). Add some explanation of the required
options and describe the kern.hwpmc.debugflags sysctl format.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40545

14 months agohwpmc: add error for HWPMC_DEBUG without KTR
Mitchell Horne [Fri, 16 Jun 2023 16:38:26 +0000 (13:38 -0300)]
hwpmc: add error for HWPMC_DEBUG without KTR

The option is a no-op otherwise, but this is not necessarily obvious.
Failing the compile gives the user a hint.

Reviewed by: jkoshy, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40544

14 months agopmc: clarify and strengthen statements about API/ABI
Mitchell Horne [Fri, 16 Jun 2023 16:38:19 +0000 (13:38 -0300)]
pmc: clarify and strengthen statements about API/ABI

- Make it clear that applications are not only encouraged to use the
  pmc(3) library, but use of the hwpmc(4) interface directly is a
  use-case we do not support
- Move the COMPATIBILITY section above PROGRAMMING API in hwpmc(4)
- Drop statements about the driver and library being "under development"

Reviewed by: jkoshy, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40543

14 months agohwpmc(4): more detailed SYNOPSYS
Mitchell Horne [Fri, 16 Jun 2023 16:38:03 +0000 (13:38 -0300)]
hwpmc(4): more detailed SYNOPSYS

Include some boilerplate similar to other section 4 man pages,
describing how to load the module at boot-time or include it in the
kernel.

Reviewed by: jkoshy, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40542

14 months agohwpmc(4): remove paragraph about Pentium Pro handling
Mitchell Horne [Fri, 16 Jun 2023 16:34:02 +0000 (13:34 -0300)]
hwpmc(4): remove paragraph about Pentium Pro handling

Support for these CPUs was removed in 2018 (e92a1350b50e).

Reviewed by: jkoshy, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40541

14 months agonetlink: convert to IfAPI.
Alexander V. Chernikov [Fri, 16 Jun 2023 15:58:57 +0000 (15:58 +0000)]
netlink: convert to IfAPI.

Convert to IfAPI everything except `IF_AFDATA_WLOCK` usage in neigh.c.

Reviewed By: jhibbits
Differential Revision: https://reviews.freebsd.org/D40577

14 months agoifnet: fix if_strings.h build check
Alexander V. Chernikov [Fri, 16 Jun 2023 15:54:29 +0000 (15:54 +0000)]
ifnet: fix if_strings.h build check

14 months agonetlink: dump interface capabilities with other interface data.
Alexander V. Chernikov [Fri, 16 Jun 2023 14:56:39 +0000 (14:56 +0000)]
netlink: dump interface capabilities with other interface data.

This change exports interface capabilities using the standard
Netlink attribute type, bitset, and switches `ifconfig(8)` to use
it when displaying interface data.
Bitset comes in two representations. The first one is "compact",
where the bits are exported via two arrays - "mask" listing the
"valid" bits and "values, providing the values for those bits.
The second one is more verbose, listing each bit as a separate item,
with its name, id and value. The latter option is handy when submitting
update requests.

The support for setting capabilities will be added in the upcoming diffs.

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

14 months agoperiodic: Honor kern.localbase
Juraj Lutter [Tue, 6 Jun 2023 11:40:49 +0000 (13:40 +0200)]
periodic: Honor kern.localbase

Take kern.localbase into account with fallback to /usr/local and
also allow for LOCALBASE/etc/periodic.conf (similarly to what
many other utilities do).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40435
MFC after: 2 weeks

14 months agoifconfig: fix armv6 build
Alexander V. Chernikov [Fri, 16 Jun 2023 08:23:14 +0000 (08:23 +0000)]
ifconfig: fix armv6 build

14 months agovm_phys: Fix typo in 9e8174289236
Alan Cox [Fri, 16 Jun 2023 08:12:42 +0000 (03:12 -0500)]
vm_phys: Fix typo in 9e8174289236

14 months agoipfw: add state/comment tests
Alexander V. Chernikov [Fri, 16 Jun 2023 07:24:19 +0000 (07:24 +0000)]
ipfw: add state/comment tests

14 months agoifconfig: use default (more rigid) WARNS level.
Alexander V. Chernikov [Wed, 14 Jun 2023 13:21:17 +0000 (13:21 +0000)]
ifconfig: use default (more rigid) WARNS level.

It helps catch more errors at compile time.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40536
MFC after: 2 weeks

14 months agoifconfig: remove global 'ifr' usage from ifmedia.c & remove 'ifr'.
Alexander V. Chernikov [Wed, 14 Jun 2023 13:04:10 +0000 (13:04 +0000)]
ifconfig: remove global 'ifr' usage from ifmedia.c & remove 'ifr'.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40535
MFC after: 2 weeks

14 months agoifconfig: remove (most of) the usages of global 'struct ifreq ifr'.
Alexander V. Chernikov [Wed, 14 Jun 2023 13:00:49 +0000 (13:00 +0000)]
ifconfig: remove (most of) the usages of global 'struct ifreq ifr'.

It is hard to reason about the contents of 'ifr' at any given time
as nearly every function sets random fields or pointers in this
structure.
Use local on-stack clean 'struct ifreq' for each function instead.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40534
MFC after: 2 weeks

14 months agovm_phys: add binary segment search
Doug Moore [Fri, 16 Jun 2023 06:43:45 +0000 (01:43 -0500)]
vm_phys: add binary segment search

Replace several sequential searches for a segment that contains a
phyiscal address with a call to a function that does it by binary
search.  In vm_page_reclaim_contig_domain_ext, find the first segment
to reclaim from, and reclaim from each subsequent appropriate segment.
Eliminate vm_phys_scan_contig.

Reviewed by: alc, markj
Differential Revision: https://reviews.freebsd.org/D40058

14 months agobhyve: add basic CRB interface for TPM devices
Corvin Köhne [Mon, 29 Aug 2022 10:10:43 +0000 (12:10 +0200)]
bhyve: add basic CRB interface for TPM devices

Add a basic emulation for the command and response buffer interface of
TPM devices. This commit only implements some CRB register and resets
them.

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

14 months agobhyve: add basic TPM passthrough emulation
Corvin Köhne [Mon, 15 May 2023 12:04:15 +0000 (14:04 +0200)]
bhyve: add basic TPM passthrough emulation

At the moment, the emulation only opens a file descriptor to the TPM
device. Some subsequent commits will read and write from it.

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

14 months agobhyve: add basic TPM emulation struct
Corvin Köhne [Mon, 15 May 2023 11:49:42 +0000 (13:49 +0200)]
bhyve: add basic TPM emulation struct

This struct will be used to implement various TPM emulations like a TPM
passthrough or a virtual TPM.

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

14 months agobhyve: use assert for missing TPM version
Corvin Köhne [Thu, 15 Jun 2023 08:36:37 +0000 (10:36 +0200)]
bhyve: use assert for missing TPM version

The TPM version config node should always be set. If it's not set,
there's a bug in our code. An assertion is the correct way to check for
this.

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

14 months agobhyve: pass address of OpRegion to the guest
Corvin Köhne [Wed, 10 May 2023 11:44:28 +0000 (13:44 +0200)]
bhyve: pass address of OpRegion to the guest

Don't allow access to the physical ASLS register. It contains a host
address which is meaningless for the guest. Additionally, it allows the
guest to safely rewrite this register.

This is the last commit required for GVT-d. Nevertheless, it might not
work due to missing firmware support.

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

14 months agobhyve: copy OpRegion into guest memory
Corvin Köhne [Wed, 10 May 2023 11:39:56 +0000 (13:39 +0200)]
bhyve: copy OpRegion into guest memory

This makes the OpRegion accessible by the guest. However, the guest
doesn't know the address of the OpRegion. This will be fixed by an
upcoming commit.

The range of the OpRegion is added to the e820 table. This allows the
guest firmware to easily pick up this range and to reserve it properly.

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

14 months agobhyve: read OpRegion address and size for GVT-d
Corvin Köhne [Wed, 10 May 2023 11:38:02 +0000 (13:38 +0200)]
bhyve: read OpRegion address and size for GVT-d

The OpRegion provides some configuration bits and ACPI methods used by
some Intel drivers. The guest needs access to it. In the first step,
we're reading it's address and size.

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

14 months agobhyve: emulate graphics stolen memory register
Corvin Köhne [Thu, 11 May 2023 09:18:56 +0000 (11:18 +0200)]
bhyve: emulate graphics stolen memory register

This register contains a host physical address. This address is
meaningless for the guest. We have to emulate it and set it to a valid
guest physical address.

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

14 months agobhyve: allocate guest memory for graphics stolen memory
Corvin Köhne [Thu, 11 May 2023 09:10:07 +0000 (11:10 +0200)]
bhyve: allocate guest memory for graphics stolen memory

The graphics stolen memory is only GPU accessible. So, we don't have to
copy any data to it as the guest will be unable to access it anyway. We
just have to allocate and reserve some memory. That's done by adding an
E820 entry for the graphics stolen memory. The guest firmware will pick
up the E820 and reserve this range.

Note that we try to reuse the host address as Intel states that newer
Tiger Lake platforms need this [1].

[1]
https://github.com/projectacrn/acrn-hypervisor/blob/e28d6fbfdfd556ff1bc3ff330e41d4ddbaa0f897/devicemodel/hw/pci/passthrough.c#L626-L629

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

14 months agobhyve: read out graphics stolen memory address and size
Corvin Köhne [Thu, 11 May 2023 08:53:15 +0000 (10:53 +0200)]
bhyve: read out graphics stolen memory address and size

This is the first step to emulate the graphics stolen memory register.

Note that the graphics stolen memory is somehow confusing. On the one
hand the Intel Open Source HD Graphics Programmers' Reference Manual
states that it's only GPU accessible. As the CPU can't access the area,
the guest shouldn't need it. On the other hand, the Intel GOP driver
refuses to work properly, if it's not set to a proper address.

Intel itself maps it into the guest by EPT [1]. At the moment, we're not
aware of any situation where this EPT mapping is required, so we don't
do it yet.

Intel also states that the Windows driver for Tiger Lake reads the
address of the graphics stolen memory [2]. As the GVT-d code doesn't
support Tiger Lake in its first implementation, we can't check how it
behaves. We should keep an eye on it.

[1]
https://github.com/projectacrn/acrn-hypervisor/blob/e28d6fbfdfd556ff1bc3ff330e41d4ddbaa0f897/devicemodel/hw/pci/passthrough.c#L655-L657
[2]
https://github.com/projectacrn/acrn-hypervisor/blob/e28d6fbfdfd556ff1bc3ff330e41d4ddbaa0f897/devicemodel/hw/pci/passthrough.c#L626-L629

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

14 months agobhyve: add empty GVT-d emulation
Corvin Köhne [Wed, 10 May 2023 10:31:50 +0000 (12:31 +0200)]
bhyve: add empty GVT-d emulation

Don't emulate anything yet. Just check if the user would like to pass an
Intel GPU to the guest.

Reviewed by: jhb, markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40038

14 months agoShorten arcstat_quiescence sleep time
George Amanakis [Thu, 15 Jun 2023 19:45:36 +0000 (21:45 +0200)]
Shorten arcstat_quiescence sleep time

With the latest L2ARC fixes, 2 seconds is too long to wait for
quiescence of arcstats like l2_size. Shorten this interval to avoid
having the persistent L2ARC tests in ZTS prematurely terminated.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #14981

14 months agoSYSCALL_MODULE(9): fix references to modfind(2) and modstat(2)
Ka Ho Ng [Thu, 15 Jun 2023 19:37:53 +0000 (15:37 -0400)]
SYSCALL_MODULE(9): fix references to modfind(2) and modstat(2)

Sponsored by: Juniper Networks, Inc.
Reviewed by: delphij
MFC after: 1 week

14 months agoasa: Add some unit tests.
Dag-Erling Smørgrav [Thu, 15 Jun 2023 19:23:26 +0000 (19:23 +0000)]
asa: Add some unit tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40564

14 months agoasa: Read from stdin if *argv is "-".
Dag-Erling Smørgrav [Thu, 15 Jun 2023 19:23:22 +0000 (19:23 +0000)]
asa: Read from stdin if *argv is "-".

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40563

14 months agoasa: Error out if writing to stdout failed.
Dag-Erling Smørgrav [Thu, 15 Jun 2023 19:23:19 +0000 (19:23 +0000)]
asa: Error out if writing to stdout failed.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40562

14 months agoRemove ARC/ZIO physdone callbacks.
Alexander Motin [Thu, 15 Jun 2023 17:49:03 +0000 (13:49 -0400)]
Remove ARC/ZIO physdone callbacks.

Those callbacks were introduced many years ago as part of a bigger
patch to smoothen the write throttling within a txg. They allow to
account completion of individual physical writes within a logical
one, improving cases when some of physical writes complete much
sooner than others, gradually opening the write throttle.

Few years after that ZFS got allocation throttling, working on a
level of logical writes and limiting number of writes queued to
vdevs at any point, and so limiting latency distribution between
the physical writes and especially writes of multiple copies.
The addition of scheduling deadline I proposed in #14925 should
further reduce the latency distribution.  Grown memory sizes over
the past 10 years should also reduce importance of the smoothing.

While the use of physdone callback may still in theory provide
some smoother throttling, there are cases where we simply can not
afford it.  Since dirty data accounting is protected by pool-wide
lock, in case of 6-wide RAIDZ, for example, it requires us to take
it 8 times per logical block write, creating huge lock contention.

My tests of this patch show radical reduction of the lock spinning
time on workloads when smaller blocks are written to RAIDZ pools,
when each of the disks receives 8-16KB chunks, but the total rate
reaching 100K+ blocks per second.  Same time attempts to measure
any write time fluctuations didn't show anything noticeable.

While there, remove also io_child_count/io_parent_count counters.
They are used only for couple assertions that can be avoided.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #14948

14 months agobhyve: Sort SRCS
Mark Johnston [Thu, 15 Jun 2023 16:21:54 +0000 (12:21 -0400)]
bhyve: Sort SRCS

No functional change intended.

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

14 months agoarm64: Make a debug print conditional on bootverbose
Mark Johnston [Thu, 15 Jun 2023 16:13:05 +0000 (12:13 -0400)]
arm64: Make a debug print conditional on bootverbose

It doesn't seem particularly useful to have it enabled by default, and
it spits several dozen lines into the dmesg on a test system.

Reviewed by: andrew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40499

14 months agobhyve: Remove special no-op handling for I/O port 0x488
Mark Johnston [Thu, 15 Jun 2023 16:12:25 +0000 (12:12 -0400)]
bhyve: Remove special no-op handling for I/O port 0x488

This appears to have been reserved for some kind of debug hook, but it's
not implemented and appears never to have been used.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40555

14 months agodtrace/arm64: Fix user memory access routines
Mark Johnston [Thu, 15 Jun 2023 16:39:21 +0000 (12:39 -0400)]
dtrace/arm64: Fix user memory access routines

Use unprivileged loads to access user memory.  Without this, the
accesses trap and various dtrace actions such as ustack() fail.

Reviewed by: andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40540

14 months agodtrace/arm64: Store the fault address when suppressing a page fault
Mark Johnston [Thu, 15 Jun 2023 16:11:11 +0000 (12:11 -0400)]
dtrace/arm64: Store the fault address when suppressing a page fault

Reviewed by: andrew
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40539

14 months agoarm64: Remove struct arm64_frame
Mark Johnston [Thu, 15 Jun 2023 16:10:44 +0000 (12:10 -0400)]
arm64: Remove struct arm64_frame

It was used in one place and was added specifically to support dtrace
stack unwinding code.  Write an equivalent expression using struct
unwind_state instead.  No functional change intended.

Reviewed by: andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40538

14 months agoarmv8crypto: Avoid overriding -march when compiling some source files
Mark Johnston [Thu, 15 Jun 2023 16:10:19 +0000 (12:10 -0400)]
armv8crypto: Avoid overriding -march when compiling some source files

At least one downstream (CheriBSD) overrides -march here.  Instead of
hard-coding the target, simply append the crypto extension to whatever's
already there.

No functional change intended.

Reviewed by: imp, andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40537

14 months agooce(4): deprecate
Brooks Davis [Wed, 14 Jun 2023 17:55:54 +0000 (18:55 +0100)]
oce(4): deprecate

The Emulex OneConnect NIC driver hasn't seen any commits other than ioctl
bug fixes (some severe) and sweeping commits since 2016.  There is no
indication of new parts since 2014 or earlier.  As such, deprecate the
driver with the aim of removing it prior to FreeBSD 15.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40531

14 months agooce(4): Don't directly access usespace
Brooks Davis [Wed, 14 Jun 2023 17:55:41 +0000 (18:55 +0100)]
oce(4): Don't directly access usespace

Replace direct stores to userspace addresses (never safe and broken on
modern CPUs) with a copyout.  Use a static assert on the size to ensure
we don't overflow the field.

Reviewed by: markj, jhb
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D40519

14 months agompi3mr: Add bare-bones manual
Warner Losh [Wed, 14 Jun 2023 22:12:28 +0000 (16:12 -0600)]
mpi3mr: Add bare-bones manual

The mpi3mr driver is written by Broadcom for the 9600 Series 24G PCIe
4.0 Tri-Mode RAID Adapters and eHBAs boards. This is 3rd-Generation
Tri-Mode x8 and x16 NVMe/SAS/SATA (although Broadcom/Avago did muddy the
waters by having multiple 2nd generations cards and referring to them
inconsistently).

Sponsored by: Netflix

14 months agompi3mr: 3rd Generation Tri-Mode NVMe/SAS/SATA MegaRaid / eHBA
Sumit Saxena [Wed, 14 Jun 2023 22:22:30 +0000 (16:22 -0600)]
mpi3mr: 3rd Generation Tri-Mode NVMe/SAS/SATA MegaRaid / eHBA

This is Broadcom's mpi3mr driver for FreeBSD version 8.6.0.2.0.
The mpi3mr driver supports Broadcom SAS4116-based cards in the 9600
series: 9670W-16i, 9670-24i, 9660-16i, 9620-16i, 9600-24i, 9600-16i,
9600W-16e, 9600-16e, 9600-8i8e.

Initially only available as a module and on amd64/arm64, since that's
how it has been tested to date. Future commits will add it to the kernel
build and may expand the architectures it is supported on.

Co-authored-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Feedback-by: ken (prior versions)
Reviewed-by: imp
RelNotes: yes
Differential-Revision: https://reviews.freebsd.org/D36771
Differential-Revision: https://reviews.freebsd.org/D36772

14 months agoipfw: use function return value to fetch insn argument.
Alexander V. Chernikov [Thu, 15 Jun 2023 06:46:42 +0000 (06:46 +0000)]
ipfw: use function return value to fetch insn argument.

This is a prerequsite for splitting compile_rule() into smaller
chunks.

MFC after: 2 weeks

14 months agoipfw: add eaction tests
Alexander V. Chernikov [Thu, 15 Jun 2023 06:36:16 +0000 (06:36 +0000)]
ipfw: add eaction tests

MFC after: 2 weeks

14 months agoroute.8: mention DXR in FIB_ALGO section
Marko Zec [Thu, 15 Jun 2023 05:21:51 +0000 (07:21 +0200)]
route.8: mention DXR in FIB_ALGO section

While here, add a sentence describing DPDK DIR24-8 principle of
operation.

MFC after: 2 weeks.

14 months agocaroot: update the root bundle
Kyle Evans [Thu, 15 Jun 2023 04:26:23 +0000 (23:26 -0500)]
caroot: update the root bundle

Summary:
- Zero (0) newly trusted
- Five (5) modified
- Nine (9) distrusted

MFC after: 3 days

14 months agoresizewin: Stop printing bogus NUL to TTY
Jessica Clarke [Wed, 14 Jun 2023 22:58:36 +0000 (23:58 +0100)]
resizewin: Stop printing bogus NUL to TTY

A char array has an implicit NUL terminating it, which sizeof will
include, so we need to subtract 1 here. Printing a NUL can cause issues
for things like CI environments that aren't expecting it, especially
with recent Jenkins being stricter about not putting NUL in XML files.

Fixes: 3d222369acbe ("Add a small tool, resizewin(1), to query terminal for window size")
MFC after: 1 week

14 months agotcp: add missing static keywords
Gleb Smirnoff [Wed, 14 Jun 2023 21:21:28 +0000 (14:21 -0700)]
tcp: add missing static keywords

Without them compilation with -O0 would produce kernel modules
that depend on symbol that doesn't exist.

14 months agoEC2: Default to "uefi-preferred" boot mode
Colin Percival [Wed, 7 Jun 2023 22:17:12 +0000 (15:17 -0700)]
EC2: Default to "uefi-preferred" boot mode

In EC2, UEFI boots faster than BIOS, but not all amd64 instance types
support UEFI.  AMIs need to have their boot mode designated, which
created a dilemma: Faster boots, or wider compatibility?

The recently added "uefi-preferred" option solves this: AMIs can be
marked to use UEFI where it's available, but fall back to BIOS on
instance types which do not support UEFI.

This uses bsdec2-image-upload 1.4.6, which recently landed in the
ports tree.

PR: 265697
Reviewed by: delphij, imp
MFC after: 1 week
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D40470

14 months agohwpmc: flatten conditional in pmc_process_exit()
Mitchell Horne [Wed, 14 Jun 2023 16:33:46 +0000 (13:33 -0300)]
hwpmc: flatten conditional in pmc_process_exit()

Use a goto to clarify the control flow when there is no process
descriptor. This wins back a level of indentation.

No functional change intended.

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

14 months agohwpmc: split out PMC_OP_PMCRW
Mitchell Horne [Wed, 14 Jun 2023 16:33:41 +0000 (13:33 -0300)]
hwpmc: split out PMC_OP_PMCRW

Split out the functional logic from the syscall handler into a helper
function. This keeps it separate from the syscall control-flow logic,
resulting in better readability overall. It also wins back a level of
indentation.

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

14 months agohwpmc: split out PMC_OP_PMCRELEASE
Mitchell Horne [Wed, 14 Jun 2023 16:33:35 +0000 (13:33 -0300)]
hwpmc: split out PMC_OP_PMCRELEASE

Split out the functional logic from the syscall handler into a helper
function. This keeps it separate from the syscall control-flow logic,
resulting in better readability overall. It also wins back a level of
indentation.

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

14 months agohwpmc: split out PMC_OP_PMCALLOCATE
Mitchell Horne [Wed, 14 Jun 2023 16:33:27 +0000 (13:33 -0300)]
hwpmc: split out PMC_OP_PMCALLOCATE

Split out the large chunk of functional logic from the syscall handler
into a helper function. This keeps it separate from the syscall
control-flow logic, resulting in better readability overall. It also
wins back a level of indentation.

Flip the return values of the pmc_can_allocate_row() and
pmc_can_allocate_rowindex() functions to boolean types, like their
naming implies. We weren't actually using the error codes they were
returning.

While here, make some small style cleanups. No functional change
intended.

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

14 months agohwpmc: split out PMC_OP_PMCATTACH/PMC_OP_PMCDETACH
Mitchell Horne [Wed, 14 Jun 2023 16:32:11 +0000 (13:32 -0300)]
hwpmc: split out PMC_OP_PMCATTACH/PMC_OP_PMCDETACH

Begin splitting out the large chunks of functional logic from the
syscall handler into separate helper functions. This keeps it separate
from the syscall control-flow logic, resulting in better readability
overall. It also wins back a level of indentation.

For this and the similar changes to follow, try to keep copyin() and
copyout() calls outside of the helper functions. The changes are
intended to have no functional impact, but do address style issues.

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

14 months agohwpmc: split out PMC_FN_PROCESS_EXEC
Mitchell Horne [Wed, 14 Jun 2023 16:32:01 +0000 (13:32 -0300)]
hwpmc: split out PMC_FN_PROCESS_EXEC

Move the functionality into a separate helper function. All other
actions in pmc_hook_handler() already have this.

While here make some small style improvements. Restructure one for loop.

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

14 months agohwpmc_mod.c: misc style cleanup
Mitchell Horne [Wed, 14 Jun 2023 16:31:36 +0000 (13:31 -0300)]
hwpmc_mod.c: misc style cleanup

Everything else I found worthy of adjustment.

 - Order local variable declarations per style(9)
 - Make use of __unused annotations rather than cast to void
 - Remove unnecessary casts
 - Add (void) casts to PMC class methods where the return value is
   ignored
 - A couple instances of reordering statements for clarity
 - Prefer bool type where applicable
 - unsigned int -> u_int
 - Use uintmax_t/%j in printf calls
 - Formatting of comments

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

14 months agohwpmc_mod.c: prototype style
Mitchell Horne [Wed, 14 Jun 2023 16:31:30 +0000 (13:31 -0300)]
hwpmc_mod.c: prototype style

Improve alphabetical organization, grouping, and whitespace.

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

14 months agohwpmc_mod.c: conditional and loop style
Mitchell Horne [Wed, 14 Jun 2023 16:31:24 +0000 (13:31 -0300)]
hwpmc_mod.c: conditional and loop style

 - Explicitly check the value in conditional statements, per style(9)
 - Add braces around more loops and conditionals, wherever it appears
   (to me) to aid legibility
 - Expand some assignments within if statements
 - Fix formatting around list-type FOREACH macros

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