]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agofrag6: do less work in frag6_slowtimo if possible
Mateusz Guzik [Fri, 13 Aug 2021 11:32:03 +0000 (13:32 +0200)]
frag6: do less work in frag6_slowtimo if possible

frag6_slowtimo avoidably uses CPU on otherwise idle boxes

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31528

(cherry picked from commit 8afe9481cfa382337b8a885f358fe888bddf5982)

2 years agofrag6: drop the volatile keyword from frag6_nfrags and mark with __exclusive_cache_line
Mateusz Guzik [Fri, 13 Aug 2021 11:28:39 +0000 (13:28 +0200)]
frag6: drop the volatile keyword from frag6_nfrags and mark with __exclusive_cache_line

The keyword adds nothing as all operations on the var are performed
through atomic_*

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31528

(cherry picked from commit c17ae18080b4412435aa2fb91cd6e81dd6cd180b)

2 years agoip_reass: do less work in ipreass_slowtimo if possible
Mateusz Guzik [Fri, 13 Aug 2021 09:32:16 +0000 (11:32 +0200)]
ip_reass: do less work in ipreass_slowtimo if possible

ipreass_slowtimo avoidably uses CPU on otherwise idle boxes

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31526

(cherry picked from commit 3be3cbe06d6107486d67d8eb80480d34d084c39c)

2 years agoip_reass: drop the volatile keyword from nfrags and mark with __exclusive_cache_line
Mateusz Guzik [Fri, 13 Aug 2021 09:29:57 +0000 (11:29 +0200)]
ip_reass: drop the volatile keyword from nfrags and mark with __exclusive_cache_line

The keyword adds nothing as all operations on the var are performed
through atomic_*

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31526

(cherry picked from commit d2b95af1c27ed51d72bef5d9f3d89860edc4fd40)

2 years agoMark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now
Alex Richardson [Tue, 17 Aug 2021 16:44:40 +0000 (17:44 +0100)]
Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now

I enabled these options again in 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3,
but unfortunately only my specific build configuration worked whereas the
build with default options is still broken.

(cherry picked from commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5)

2 years agoAdd missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap
Alex Richardson [Mon, 16 Aug 2021 08:56:17 +0000 (09:56 +0100)]
Add missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap

This causes build failures on macOS where the build can end up invoking
an incompatible m4 binary.

Fxies: 2de949cf85d0 ("Remove mkcsmapper_static and mkesdb_static from build-tools")
(cherry picked from commit cc1345056b113d57f0c65b0ecf3e3d5da3f34276)

2 years agoar: remove invalid extra param in bsdar_warnc calls
Ed Maste [Wed, 11 Aug 2021 17:22:23 +0000 (13:22 -0400)]
ar: remove invalid extra param in bsdar_warnc calls

A number of warnings passed an exit status code to bsdar_warnc, but it
does not take exit status (as a warning, it does not exit).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 09319f7d3f8aefe8a6b37b1c2a6d842126a2c181)

2 years ago[multipath][nhops] Fix random crashes with high route churn rate.
Alexander V. Chernikov [Sun, 1 Aug 2021 09:46:05 +0000 (09:46 +0000)]
[multipath][nhops] Fix random crashes with high route churn rate.

When certain multipath route begins flapping really fast, it may
 result in creating multiple identical nexthop groups. The code
 responsible for unlinking unused nexthop groups had an implicit
 assumption that there could be only one nexthop group for the
 same combination of nexthops with weights. This assumption resulted
 in always unlinking the first "identical" group, instead of the
 desired one. Such action, in turn, produced a used-but-unlinked
 nhg along with freed-and-linked nhg, ending up in random crashes.

Similarly, it is possible that multiple identical nexthops gets
 created in the case of high route churn, resulting in the same
 problem when deleting one of such nexthops.

Fix by matching the nexthop/nexhop group pointer when deleting the item.

Reported by: avg
(cherry picked from commit 054948bd81bb9e4e32449cf351b62e501b8831ff)

2 years agobuild.7: Describe the default value for LOCAL_MODULES
Mark Johnston [Tue, 10 Aug 2021 17:34:57 +0000 (13:34 -0400)]
build.7: Describe the default value for LOCAL_MODULES

Suggested by: jhb

(cherry picked from commit 805c3af898a8fed6a92caa069011c0ce7fa542ef)

2 years agobuild.7: Document LOCAL_MODULES and LOCAL_MODULES_DIR
Mark Johnston [Tue, 10 Aug 2021 15:42:35 +0000 (11:42 -0400)]
build.7: Document LOCAL_MODULES and LOCAL_MODULES_DIR

Reviewed by: 0mp, imp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e7a13643b17c3ec7357b26324986587dab810da5)

2 years agoe1000: rctl/srrctl buffer size init, rfctl fix
Kevin Bowling [Tue, 10 Aug 2021 19:47:22 +0000 (12:47 -0700)]
e1000: rctl/srrctl buffer size init, rfctl fix

Simplify the setup of srrctl.BSIZEPKT on igb class NICs.
Improve the setup of rctl.BSIZE on lem and em class NICs.
Don't try to touch rfctl on lem class NICs.
Manipulate rctl.BSEX correctly on lem and em class NICs.

Approved by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31457

(cherry picked from commit 12e8addd320df995bfb2b00f51c233541f741ae4)

2 years agoe1000: fix build after b761f264926a (orig c1655b0f)
Marius Strobl [Wed, 27 Jan 2021 14:28:25 +0000 (15:28 +0100)]
e1000: fix build after b761f264926a (orig c1655b0f)

(cherry picked from commit c262e8e87e7b59b768c717c1779ef1ba28507f44)

2 years agoe1000: consistently use the hw variables
Marius Strobl [Sat, 23 Jan 2021 18:18:28 +0000 (19:18 +0100)]
e1000: consistently use the hw variables

It's rather confusing when adapter->hw and hw are mixed and matched
within a particular function.
Some of this was missed in cd1cf2fc1d49c509ded05dcd41b7600a5957fb9a
and r353778 respectively.

(cherry picked from commit c1655b0f8998f9e842a004f33e7c9c01c5d9e879)

2 years agopkgbase: Add nfsiod to the FreeBSD-nfs package
Emmanuel Vadot [Thu, 5 Aug 2021 16:17:34 +0000 (18:17 +0200)]
pkgbase: Add nfsiod to the FreeBSD-nfs package

Missed in 081fb644925f

(cherry picked from commit e06b8f11280397d7fdaa27d8d6f8eec9e4c707b3)

2 years agopkgbase: make only vital packages vital, not their sub-packages
Mina Igalic [Sun, 28 Mar 2021 10:16:45 +0000 (12:16 +0200)]
pkgbase: make only vital packages vital, not their sub-packages

make "vital" a replaceable, which defaults to "false" and only set it for
the main clib, utilities and runtime packages, not their sub-packages

PR: 254174
Differential Revision: https://reviews.freebsd.org/D29224

(cherry picked from commit 1c1ff7979571bf07c05a48e857b7b285b037410f)

2 years agopkgbase: Add an src.conf option for splitting man pages
Emmanuel Vadot [Tue, 16 Mar 2021 06:11:56 +0000 (07:11 +0100)]
pkgbase: Add an src.conf option for splitting man pages

Man pages can be big in total, add an options to split man pages
in -man packages so we produce smaller packages.
This is useful for small jails or mfsroot produced of pkgbase.
The option is off by default.

Reviewed by: bapt, Mina Galić <me@igalic.co>
Differential Revision: https://reviews.freebsd.org/D29169
MFC after:      2 weeks

(cherry picked from commit c7e6cb9e08d6b51e677a9f5546b8e36d678687d0)

2 years agoarm64: Only check for freebsd,dts-version if we are booted in FDT mode.
Emmanuel Vadot [Tue, 23 Mar 2021 15:37:25 +0000 (16:37 +0100)]
arm64: Only check for freebsd,dts-version if we are booted in FDT mode.

Reported by:   andrew

(cherry picked from commit 6bcba8dac9a4ddaeabf84ad8d31b1113a9dcf8c2)

2 years agoarm64: Check dtb version against the one we're expecting to find
Emmanuel Vadot [Tue, 23 Mar 2021 14:24:14 +0000 (15:24 +0100)]
arm64: Check dtb version against the one we're expecting to find

Do for arm64 what was done for armv7 in e63faa9ba832b6

(cherry picked from commit 63f344024a0d336b116f3563a1604fbd9b4253c7)

2 years agovfs: Avoid a comparison with an uninitialized field in setutimes()
Mark Johnston [Mon, 9 Aug 2021 17:27:20 +0000 (13:27 -0400)]
vfs: Avoid a comparison with an uninitialized field in setutimes()

Some filesystems, e.g., devfs, do not populate va_birthtime in their
GETATTR implementations.  To handle this, make sure that va_birthtime is
initialized to the quasi-standard value of { VNOVAL, 0 } before calling
VOP_GETATTR.

Reported by: KMSAN
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit eca9ac5a32e432313b1c7f52f43dd11504fceef4)

2 years agoin6: Enter the net epoch in in6_tmpaddrtimer()
Mark Johnston [Mon, 9 Aug 2021 17:14:23 +0000 (13:14 -0400)]
in6: Enter the net epoch in in6_tmpaddrtimer()

We need to do so to safely traverse the ifnet list.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8ee0826f75136f6ac6443f32c582882bc31abd73)

2 years agoamd64: Fix output operand specs for the stmxcsr and vmread intrinsics
Mark Johnston [Mon, 9 Aug 2021 17:28:08 +0000 (13:28 -0400)]
amd64: Fix output operand specs for the stmxcsr and vmread intrinsics

This does not appear to affect code generation, at least with the
default toolchain.

Noticed because incorrect output specifications lead to false positives
from KMSAN, as the instrumentation uses them to update shadow state for
output operands.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e54ae8258d6433ad2f2411dbeaa1fde6b817d5ef)

2 years agovmm: Make iommu ops tables const
Mark Johnston [Mon, 9 Aug 2021 17:28:27 +0000 (13:28 -0400)]
vmm: Make iommu ops tables const

While here, use designated initializers and rename some AMD iommu method
implementations to match the corresponding op names.  No functional
change intended.

Reviewed by: grehan
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 41335c6b7f636f9ca59d0afba5728cf90020d6b1)

2 years agond6: Mark several callouts as MPSAFE
Mark Johnston [Mon, 9 Aug 2021 17:21:43 +0000 (13:21 -0400)]
nd6: Mark several callouts as MPSAFE

The use of Giant here is vestigal and does not provide any useful
synchronization.  Furthermore, non-MPSAFE callouts can cause the
softclock threads to block waiting for long-running newbus operations to
complete.

Reported by: mav
Reviewed by: bz
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 663428ea17e3a81f4c514d2571b90a13c065b1e8)

2 years agonfs_write(): do not call ncl_pager_setsize() after clearing TDP2_SBPAGES
Konstantin Belousov [Sat, 23 Jan 2021 21:40:07 +0000 (23:40 +0200)]
nfs_write(): do not call ncl_pager_setsize() after clearing TDP2_SBPAGES

(cherry picked from commit bd01a69f4836994b50b492883fb5367db41fb506)

2 years agonfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write
Konstantin Belousov [Fri, 22 Jan 2021 21:47:06 +0000 (23:47 +0200)]
nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write

(cherry picked from commit aa8c1f8d84d2638a354e71f9593e978d00878243)

2 years agobhyve.8: Fix mandoc -Tlint issues
Mateusz Piotrowski [Sun, 18 Apr 2021 23:53:06 +0000 (01:53 +0200)]
bhyve.8: Fix mandoc -Tlint issues

While here, keep network backends section consistent with other
sections.

MFC after: 2 weeks

(cherry picked from commit 8d9fefe64334818a27812658bf9efd0371fbc77c)

2 years agobhyve: Document the format for HD audio backends
Mateusz Piotrowski [Sun, 18 Apr 2021 23:50:29 +0000 (01:50 +0200)]
bhyve: Document the format for HD audio backends

- This change is done for consistency with other backend definitions.

MFC after: 2 weeks

(cherry picked from commit 061f37d280976e0f79f823c732fa80825ce48ded)

2 years agobhyve.8: Improve AHCI backends documentation
Mateusz Piotrowski [Sun, 18 Apr 2021 23:44:23 +0000 (01:44 +0200)]
bhyve.8: Improve AHCI backends documentation

- Document the backend format.

MFC after: 2 weeks

(cherry picked from commit d5fcc4b6066e878ed70bce7a52d6aca605befde5)

2 years agobhyve.8: Improve documentation of NVME backend
Mateusz Piotrowski [Sun, 18 Apr 2021 23:16:51 +0000 (01:16 +0200)]
bhyve.8: Improve documentation of NVME backend

- Document the configuration format.
- Document two additional configuration options: eui64 and dsm.

MFC after: 2 weeks

(cherry picked from commit 6eff58acc776d8308863f49b89664997d4642a4e)

2 years agobhyve.8: Improve framebuffer backends description
Mateusz Piotrowski [Sun, 18 Apr 2021 22:59:44 +0000 (00:59 +0200)]
bhyve.8: Improve framebuffer backends description

- Use appropriate mdoc macros
- Document that tcp= is a synonym to rfb= (tcp is used in the examples,
  but never mentioned)
- Clarify the IP address specification

MFC after: 2 weeks

(cherry picked from commit 8b97e97548bdc74cf3b4939a0b21cfdd27d8c11c)

2 years agobhyve.8: Clean up virtio console device backends description
Mateusz Piotrowski [Sun, 18 Apr 2021 22:23:26 +0000 (00:23 +0200)]
bhyve.8: Clean up virtio console device backends description

MFC after: 2 weeks

(cherry picked from commit 3f4c771f64e816750de08ab6fd7e7bf29398f5fb)

2 years agobhyve.8: Clean up TTY, boot ROM, and pass-through descriptions
Mateusz Piotrowski [Sun, 18 Apr 2021 22:09:22 +0000 (00:09 +0200)]
bhyve.8: Clean up TTY, boot ROM, and pass-through descriptions

MFC after: 2 weeks

(cherry picked from commit 2fda01a1b7e958e6cfffda512954b8d6c40a064e)

2 years agobhyve.8: Clean up 9P device backends section
Mateusz Piotrowski [Sun, 18 Apr 2021 21:52:48 +0000 (23:52 +0200)]
bhyve.8: Clean up 9P device backends section

MFC after: 2 weeks

(cherry picked from commit 2d00b57022f09561706afef9050e0b527c41314a)

2 years agobhyve.8: Clean up SCSI device backends section
Mateusz Piotrowski [Sun, 18 Apr 2021 21:49:18 +0000 (23:49 +0200)]
bhyve.8: Clean up SCSI device backends section

MFC after: 2 weeks

(cherry picked from commit 7c5829c942822561688c9b8239900773c6d82db4)

2 years agobhyve.8: Clean up block storage device backends description
Mateusz Piotrowski [Sun, 18 Apr 2021 21:39:53 +0000 (23:39 +0200)]
bhyve.8: Clean up block storage device backends description

MFC after: 2 weeks

(cherry picked from commit 5232a35f1ed7b8fa4f378897598438c2056ef60e)

2 years agobhyve.8: Clean up network backends section
Mateusz Piotrowski [Sun, 18 Apr 2021 21:29:30 +0000 (23:29 +0200)]
bhyve.8: Clean up network backends section

- Reformat the format lists, use appropriate mdoc macros for
  readability.
- Add a missing Oxford comma.

MFC after: 2 weeks

(cherry picked from commit 7fb22729816ef6c9e65e5c544047e669edd2f06d)

2 years agobhyve.8: Improve emulation description of the -s flag
Mateusz Piotrowski [Sun, 18 Apr 2021 21:08:39 +0000 (23:08 +0200)]
bhyve.8: Improve emulation description of the -s flag

- Set width of the list to the longest key word for readability.
- Separate descriptions of amd_hostbridge and hostbridge emulations.
  Also, wordsmith their descriptions for consistency with other entries.
- Use Cm instead of Li for command modifiers.
- Do not stylize AMD with Li, there's no need to do it.
- Mention COM3 and COM4 in the definition of lpc.
- Fix a typo in the definition of ahci-hd ("hard drive" instead of
  "hard-drive").

MFC after: 2 weeks

(cherry picked from commit 7014cb2393594ee4a8389c65d507afacf729c041)

2 years agobhyve.8: Clean up the slot description of -s
Mateusz Piotrowski [Sun, 18 Apr 2021 20:56:19 +0000 (22:56 +0200)]
bhyve.8: Clean up the slot description of -s

Also, remove the macros of the nested list which contained slot,
emulation and conf. This decreases the indention of the -s description.
It was necessary to clean up the slot description.

MFC after: 2 weeks

(cherry picked from commit 234d8c470b44160fe0cbce49b972b3b19f246a89)

2 years agobhyve.8: Clean-up synopsis of -s
Mateusz Piotrowski [Sun, 18 Apr 2021 20:28:47 +0000 (22:28 +0200)]
bhyve.8: Clean-up synopsis of -s

- Document "-s help" separately for readability.
- Use appropriate mdoc macros.

MFC after: 2 weeks

(cherry picked from commit 449f0e48e902ed36ec0de31279eefad9e6200cdc)

2 years agobhyve.8: Fix indention in the signals table
Mateusz Piotrowski [Sun, 18 Apr 2021 20:06:12 +0000 (22:06 +0200)]
bhyve.8: Fix indention in the signals table

MFC after: 2 weeks

(cherry picked from commit 3357e9482fe8a0ee153ec62d4bd8cb96966bbf26)

2 years agobhyve.8: Clean up description of -r
Mateusz Piotrowski [Sun, 18 Apr 2021 20:03:40 +0000 (22:03 +0200)]
bhyve.8: Clean up description of -r

There is no need to wrap those flags in Op macros.

MFC after: 2 weeks

(cherry picked from commit b24eea8c7a2ff2bf19b1bdbb2838d185e578581a)

2 years agobhyve.8: Fix the synopsis of -p
Mateusz Piotrowski [Sun, 18 Apr 2021 20:01:30 +0000 (22:01 +0200)]
bhyve.8: Fix the synopsis of -p

Use appropriate mdoc macros.

MFC after: 2 weeks

(cherry picked from commit 90df54374f1ce1b94c10c34c2a5b06be0353ebae)

2 years agobhyve.8: Improve the description of the -m flag
Mateusz Piotrowski [Sun, 18 Apr 2021 19:56:13 +0000 (21:56 +0200)]
bhyve.8: Improve the description of the -m flag

- Stylize the synopsis with proper mdoc macros
- Do some wordsmithing on the description for consistency.

MFC after: 2 weeks

(cherry picked from commit 7e0cb3df687695212ae20cc90d5f2f48bd42eba7)

2 years agobhyve.8: Improve the description and synopsis of -l
Mateusz Piotrowski [Sun, 18 Apr 2021 19:41:15 +0000 (21:41 +0200)]
bhyve.8: Improve the description and synopsis of -l

- Describe "-l help" separately for readability.
- List all the supported comX devices explicitly
- Use Cm instead of Ar for command modifiers (i.e., literal values a
  user can specify as an argument to the command).
- Explain where to get more information about the possible values of the
  conf argument.

MFC after: 2 weeks

(cherry picked from commit 4c08b978b276f8cfc25f72715e97898f629f7f89)

2 years agobhyve.8: Sort the options in the OPTIONS section
Mateusz Piotrowski [Sun, 18 Apr 2021 18:26:04 +0000 (20:26 +0200)]
bhyve.8: Sort the options in the OPTIONS section

No content change intended. Just moving the option descriptions around
to follow the order suggested by style(9).

MFC after: 2 weeks

(cherry picked from commit ccb1c87a6aa563a927a98a6f9175d95929535b21)

2 years agobhyve: Improve the option description in the usage message
Mateusz Piotrowski [Sun, 18 Apr 2021 18:13:54 +0000 (20:13 +0200)]
bhyve: Improve the option description in the usage message

- Sort options as suggested by style(9)
- Capitalize some words like CPU and HLT
- Add a missing description for the -G flag

MFC after: 2 weeks

(cherry picked from commit b6a572d03f654236b929b91d376ad1a6dfaa2e9a)

2 years agobhyve: Fix synopsis in the usage message
Mateusz Piotrowski [Sun, 18 Apr 2021 18:04:12 +0000 (20:04 +0200)]
bhyve: Fix synopsis in the usage message

In particular:
- Sort short options to align with style(9)
- Add two missing flags: -G and -r
- Drop unnecessary angle brackets for consistency
- Rename the "vm" argument to vmname for consistency with the manual
  page

MFC after: 2 weeks

(cherry picked from commit 03c3e5e40d6497afa33df1d0b43857157c086729)

2 years agobhyve.8: Make synopsis more readable
Mateusz Piotrowski [Sun, 18 Apr 2021 17:54:45 +0000 (19:54 +0200)]
bhyve.8: Make synopsis more readable

There is no need to squeeze all the possible options into one synopsis
entry. Let "-l help" and "-s help" be listed separately.

While here, keep -s and its arguments on the same line.

MFC after: 2 weeks

(cherry picked from commit bfe40b692d087cdd5fdeea69e18496ab2a7f67ac)

2 years agoipfw(8): Fix a typo in an error message
Gordon Bergling [Wed, 11 Aug 2021 07:53:01 +0000 (09:53 +0200)]
ipfw(8): Fix a typo in an error message

- s/suport/support/

(cherry picked from commit 809ad8170aa97e570ef5e1e414b4c25e4b58044c)

2 years agoiscontrol(8): Fix a typo in a struct
Gordon Bergling [Wed, 11 Aug 2021 07:55:08 +0000 (09:55 +0200)]
iscontrol(8): Fix a typo in a struct

- s/suport/support/

(cherry picked from commit 1e1fbf3b47d7296896593b1e477141263b0c555f)

2 years agoe1000: Fix lem/em UDP rx csum offload
Kevin Bowling [Mon, 9 Aug 2021 21:29:31 +0000 (14:29 -0700)]
e1000: Fix lem/em UDP rx csum offload

Rebase on igb code and unify lem/em implementations.

PR: 257642
Reported by: Nick Reilly <nreilly@blackberry.com>
Reviewed by: karels, emaste
Tested by: Nick Reilly <nreilly@blackberry.com>
Approved by: grehan
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31449

(cherry picked from commit 015075f383489fcbedbe8aae7c1c64a3d55ca75e)

2 years agopsm(4): Probe Synaptics touchpad with active multiplexing mode enabled
Vladimir Kondratyev [Wed, 14 Jul 2021 10:30:26 +0000 (13:30 +0300)]
psm(4): Probe Synaptics touchpad with active multiplexing mode enabled

if it is only multiplexed device. Also enable syncbit checks for them.
This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop.

Reported by: Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
PR: 253279
Differential revision: https://reviews.freebsd.org/D28502

(cherry picked from commit f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2)

2 years agoiichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts
Vladimir Kondratyev [Fri, 9 Jul 2021 19:32:59 +0000 (22:32 +0300)]
iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts

during suspend/resume cycle. Previously used bus_generic_suspend_intr and
bus_generic_resume_intr may cause interrupt storm because of missed
interrupt acknowledges caused by blocking of intr handler.

Reported by: J.R. Oldroyd <jr_AT_opal_DOT_com>

(cherry picked from commit 82626fef6253a9172163df137097f54e93e3c209)

2 years agoiichid(4): disable interrupt on suspend
J.R. Oldroyd [Mon, 31 May 2021 19:33:07 +0000 (22:33 +0300)]
iichid(4): disable interrupt on suspend

Commit message of the identical change in Linux driver says:
"When an I2C HID device is powered off during system sleep, as a result
of removing its power resources (by the ACPI core) the interrupt line
might go low as well.  This results inadvertent interrupts."

This change fixes suspend/resume on Asus S510UQ laptops.

While here add a couple of typo fixes as well as a slight change to the
iichid_attach() code to have the power_on flag set properly.

Submitted by: J.R. Oldroyd <jr_AT_opal_DOT_com>
Reviewed by: wulf

(cherry picked from commit 5236888db77194c194706b122675af7355fe7ceb)

2 years agonfscl: Set correct lockowner for "oneopenown" mount option
Rick Macklem [Wed, 28 Jul 2021 22:23:05 +0000 (15:23 -0700)]
nfscl: Set correct lockowner for "oneopenown" mount option

For NFSv4.1/4.2, the client may use either an open, lock or
delegation stateid as the stateid argument for an I/O operation.
RFC 5661 defines an order of preference of delegation, then lock
and finally open stateid for the argument, although NFSv4.1/4.2
servers are expected to handle any stateid type.

For the "oneopenown" mount option, the lock owner was not being
correctly generated and, as such, the I/O operation would use an
open stateid, even when a lock stateid existed.  Although this
did not and should not affect an NFSv4.1/4.2 server's behaviour,
this patch makes the behaviour for "oneopenown" the same as when
the mount option is not specified.

Found during inspection of packet captures.  No failure during
testing against NFSv4.1/4.2 servers of the unpatched code occurred.

(cherry picked from commit 54ff3b3986741b9cd06ce20b90c96711cbe146d0)

2 years agonfscl: Cache an open stateid for the "oneopenown" mount option
Rick Macklem [Wed, 28 Jul 2021 22:48:27 +0000 (15:48 -0700)]
nfscl: Cache an open stateid for the "oneopenown" mount option

For NFSv4.1/4.2, if the "oneopenown" mount option is used,
there is, at most, only one open stateid for each NFS vnode.
When an open stateid for a file is acquired, set a pointer to
the open structure in the NFS vnode.  This pointer can be used to
acquire the open stateid without searching the open linked list
when the following is true:
- No delegations have been issued for the file.  Since delegations
  can outlive an NFS vnode for a file, use the global
  NFSMNTP_DELEGISSUED flag on the mount to determine this.
- No lock stateid has been issued for the file.  To determine
  this, a new NFS vnode flag called NMIGHTBELOCKED is set when a lock
  stateid is issued, which can then be tested.

When this open structure pointer can be used, it avoids the need to
acquire the NFSCLSTATELOCK() and searching the open structure list for
an open.  The NFSCLSTATELOCK() can be highly contended when there are
a lot of opens issued for the NFSv4.1/4.2 mount.

This patch only affects NFSv4.1/4.2 mounts when the "oneopenown"
mount option is used.

(cherry picked from commit efea1bc1fd93831c29fa7594d67094e0c125fb88)

2 years agogetprogname.3: Add an example
Mateusz Piotrowski [Sat, 17 Apr 2021 21:26:54 +0000 (23:26 +0200)]
getprogname.3: Add an example

It shows the difference between getprogname() and argv[0].

Reviewed by: yuripv
Approved by: yuripv (src)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27204

(cherry picked from commit 1ffdcdadf61423dd02ddad82fc4f3f6c39090c8c)

2 years agoports.7: Document DEBUG_FLAGS and the process of debugging ports
Mateusz Piotrowski [Sat, 17 Apr 2021 20:51:54 +0000 (22:51 +0200)]
ports.7: Document DEBUG_FLAGS and the process of debugging ports

Loosely based on https://wiki.freebsd.org/BenWoods/DebuggingPorts.

Reviewed by: crees
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27296

(cherry picked from commit d25f7d324a9d0c33655876b920ba590918d16f4c)

2 years agogrep: Fix an incorrect description of the -C flag
Mateusz Piotrowski [Fri, 5 Feb 2021 18:38:09 +0000 (19:38 +0100)]
grep: Fix an incorrect description of the -C flag

It seems that the number of lines is no longer an optional parameter to
the -C flag. Document it accordingly both in the manual page and the
usage message.

Reviewed by: yuripv
Approved by: yuripv
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28509

(cherry picked from commit be6b8b7a3a18acb3b044e144d946392fca05e5d0)

2 years agoigc: sync igc_txrx with igb(4)
Kevin Bowling [Sat, 31 Jul 2021 15:00:16 +0000 (08:00 -0700)]
igc: sync igc_txrx with igb(4)

Reviewed by: grehan
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31227

(cherry picked from commit d02e436353d292e6fd50f70ea80507095543764e)

2 years agoMFC 517904de5cca: igc(4): Introduce new driver for the Intel I225 Ethernet controller.
Peter Grehan [Mon, 12 Jul 2021 04:50:15 +0000 (14:50 +1000)]
MFC 517904de5cca: igc(4): Introduce new driver for the Intel I225 Ethernet controller.

This controller supports 2.5G/1G/100MB/10MB speeds, and allows
tx/rx checksum offload, TSO, LRO, and multi-queue operation.

The driver was derived from code contributed by Intel, and modified
by Netgate to fit into the iflib framework.

Thanks to Mike Karels for testing and feedback on the driver.

Reviewed by: bcr (manpages), kbowling, scottl, erj
Relnotes: yes
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30668

(cherry picked from commit 517904de5ccac643589c71ac0d2751797f89e4f9)

2 years agohms(4): Fix a typo in sysctl description
Gordon Bergling [Thu, 12 Aug 2021 13:37:47 +0000 (15:37 +0200)]
hms(4): Fix a typo in sysctl description

- s/threshhold/threshold/

(cherry picked from commit 4b4850aefe3ff9d9c29c7ed8bd8907bbd6142e86)

2 years agoAdd ElfW() macro for compatibility with Linux
Dimitry Andric [Thu, 5 Aug 2021 18:57:22 +0000 (20:57 +0200)]
Add ElfW() macro for compatibility with Linux

Some Linux software using ELF headers assumes the existence of an
ElfW(type) macro, which concatenates 'Elf', the default ELF word size,
and the given type. This is identical to our __ElfN(x) macro in
<sys/elf_generic.h>. Add the macro for compatibility, with a comment
that we prefer the __ElfN() macro for FreeBSD.

Reviewed by: emaste, kib
Differential Revision: https://reviews.freebsd.org/D31427
MFC after: 1 week

(cherry picked from commit 34e7e4b6a059eee5e4e3e34de5b9d5f0d6e589f9)

2 years agoApply upstream lld fix for compressed input sections on BE targets
Dimitry Andric [Sat, 7 Aug 2021 11:14:11 +0000 (13:14 +0200)]
Apply upstream lld fix for compressed input sections on BE targets

Merge commit c6ebc651b6fa from llvm git (by Simon Atanasyan):

  [LLD] Support compressed input sections on big-endian targets

  This patch enables compressed input sections on big-endian targets by
  checking the target endianness and selecting an appropriate `Chdr`
  structure.

  Fixes PR51369

  Differential Revision: https://reviews.llvm.org/D107635

Reported by: emaste

(cherry picked from commit d69d07569ee2404705ff4c4abb45dc0b884eeb35)

Follow-up to d69d07569ee2 by bumping lld local version

This makes it easier to detect that lld's support for compressed input
sections on BE targets is fixed.

(cherry picked from commit cd38d9cf26db9264f709c52469f0f4e9684d62bb)

2 years agonull_vput_pair(): release use reference on dvp earlier
Konstantin Belousov [Sun, 7 Mar 2021 21:08:38 +0000 (23:08 +0200)]
null_vput_pair(): release use reference on dvp earlier

(cherry picked from commit 16dea8341024b8ee8be619c27d4e63bd81bd9b6c)

2 years agovlrureclaim: only skip vnode with resident pages if it own the pages
Konstantin Belousov [Sat, 6 Mar 2021 21:09:16 +0000 (23:09 +0200)]
vlrureclaim: only skip vnode with resident pages if it own the pages

(cherry picked from commit 44691b33cc99d0e17262368b6e0f64e531994a23)

2 years agosoftdep_unmount: assert that no dandling dependencies are left
Konstantin Belousov [Sat, 6 Mar 2021 09:52:10 +0000 (11:52 +0200)]
softdep_unmount: assert that no dandling dependencies are left

(cherry picked from commit 0b3948e73b749b0fefc3f9d4fc61f356542bb9b9)

2 years agoFFS: assign fully initialized struct mount_softdeps to um_softdep
Konstantin Belousov [Wed, 3 Mar 2021 22:02:30 +0000 (00:02 +0200)]
FFS: assign fully initialized struct mount_softdeps to um_softdep

(cherry picked from commit 7a8d4b4da69af966bff4892acb2fd101a95a4848)

2 years agoAssert that um_softdep is NULL on free(ump), i.e. softdep_unmount() was called
Konstantin Belousov [Wed, 3 Mar 2021 19:40:34 +0000 (21:40 +0200)]
Assert that um_softdep is NULL on free(ump), i.e. softdep_unmount() was called

(cherry picked from commit 2af934cc15bd8e7daa2daeb806321d0daddf3b7a)

2 years agoffs_mount: when remounting ro->rw and sbupdate failed, cleanup softdeps
Konstantin Belousov [Wed, 3 Mar 2021 18:02:13 +0000 (20:02 +0200)]
ffs_mount: when remounting ro->rw and sbupdate failed, cleanup softdeps

(cherry picked from commit f776c54cee81b4297b59ffe87a0f154e3924ee7f)

2 years agosoftdep_unmount: handle spurious wakeups
Konstantin Belousov [Sun, 28 Feb 2021 22:46:21 +0000 (00:46 +0200)]
softdep_unmount: handle spurious wakeups

(cherry picked from commit d7e5e374167fe98e998b80691824750f44bb050d)

2 years agosoftdep_flush(): do not access ump after we acked FLUSH_EXIT and unlocked SU lock
Konstantin Belousov [Sun, 28 Feb 2021 22:45:04 +0000 (00:45 +0200)]
softdep_flush(): do not access ump after we acked FLUSH_EXIT and unlocked SU lock

(cherry picked from commit fabbc3d879cce5c37df25707107a0fcb64267346)

2 years agoffs: clear MNT_SOFTDEP earlier when remounting rw to ro
Konstantin Belousov [Sun, 28 Feb 2021 18:55:35 +0000 (20:55 +0200)]
ffs: clear MNT_SOFTDEP earlier when remounting rw to ro

(cherry picked from commit 7c7a6681fab2c0453085d30424f479c0f766904d)

2 years agoRework MOUNTED/DOING SOFTDEP/SUJ macros
Konstantin Belousov [Wed, 3 Mar 2021 17:43:17 +0000 (19:43 +0200)]
Rework MOUNTED/DOING SOFTDEP/SUJ macros

(cherry picked from commit 7f682bdcabdaf95ded6a69994344ddbc84fd36db)

2 years agoffs softdep: clear ump->um_softdep on softdep_unmount()
Konstantin Belousov [Wed, 3 Mar 2021 17:42:24 +0000 (19:42 +0200)]
ffs softdep: clear ump->um_softdep on softdep_unmount()

(cherry picked from commit 81cdb19e04e57a934e8a5dd76e5c7e0afcba1acb)

2 years agoffs_extern.h: Add comments for ffs_vgetf() flags
Konstantin Belousov [Thu, 11 Mar 2021 07:02:16 +0000 (09:02 +0200)]
ffs_extern.h: Add comments for ffs_vgetf() flags

(cherry picked from commit a285d3edacf602e555a918119d787d94f342fe90)

2 years agoAdd FFSV_FORCEINODEDEP flag for ffs_vgetf()
Konstantin Belousov [Wed, 3 Mar 2021 17:40:56 +0000 (19:40 +0200)]
Add FFSV_FORCEINODEDEP flag for ffs_vgetf()

(cherry picked from commit fd97fa64638d810b415af7afcc86634c9709ad12)

2 years agosimplify journal_mount: move the out label after success block
Konstantin Belousov [Thu, 4 Mar 2021 18:55:33 +0000 (20:55 +0200)]
simplify journal_mount: move the out label after success block

(cherry picked from commit 25aac48d2ce322355e7890a1de0f045a15d1cc09)

2 years agomkimg(1): Correct a typo in the usage output
Gordon Bergling [Mon, 9 Aug 2021 11:53:30 +0000 (13:53 +0200)]
mkimg(1): Correct a typo in the usage output

- s/partion/partition/

(cherry picked from commit 6bddade6114abacacb30ef2c28781f1af331c106)

2 years agoncurses: Apply a tputs() fix from patch 20210403
Mark Johnston [Wed, 11 Aug 2021 16:54:29 +0000 (12:54 -0400)]
ncurses: Apply a tputs() fix from patch 20210403

From the (substantially larger) upstream commit:
+ call delay_output_sp to handle BSD-style padding when tputs_sp is
  called, whether directly or internally, to ensure that the SCREEN
  pointer is passed correctly (reports by Henric Jungheim, Juraj
  Lutter).

This fixes bison segfaults observed when colourized output is enabled.
Thanks to jrtc27@ for identifying the upstream fix.

PR: 256731
MFC after: 3 days

(cherry picked from commit b2da1032397e3339fbeebcd57b1f179e1d8a2e19)

2 years agoClean up orphaned indirdep dependency structures after disk failure.
Kirk McKusick [Thu, 29 Jul 2021 23:11:58 +0000 (16:11 -0700)]
Clean up orphaned indirdep dependency structures after disk failure.

(cherry picked from commit 412b5e40a721430adba1b4abae210641f733f976)
(cherry picked from commit a91716efeb684c50289c0e1136f5432f880dc873)

2 years agoipsec_set_policy(3): fix sentence
Konstantin Belousov [Mon, 9 Aug 2021 10:37:41 +0000 (13:37 +0300)]
ipsec_set_policy(3): fix sentence

(cherry picked from commit ba3896e16913fd6f9f227d84038171f1fdf5496b)

2 years agoip(4): Mention IP_IPSEC_POLICY ip-level socket option
Konstantin Belousov [Mon, 9 Aug 2021 11:07:18 +0000 (14:07 +0300)]
ip(4): Mention IP_IPSEC_POLICY ip-level socket option

(cherry picked from commit 4a5a67fe679d6b29957bf87dbf2e7c08ff97bb30)

2 years agonetipsec/key.c: Use ANSI C definition for key_random()
Konstantin Belousov [Tue, 3 Aug 2021 01:24:31 +0000 (04:24 +0300)]
netipsec/key.c: Use ANSI C definition for key_random()

(cherry picked from commit 8b000bf5bcddea30e66e0b4e1158e2d7b328b262)

2 years agonetipsec/keydb.h: fix typo
Konstantin Belousov [Sat, 31 Jul 2021 01:41:13 +0000 (04:41 +0300)]
netipsec/keydb.h: fix typo

(cherry picked from commit fd4751b3892973f3d329f6fb516da6b01be6f71f)

2 years agoFix panic in IPv6 multicast code.
Andrey V. Elsukov [Thu, 5 Aug 2021 08:51:46 +0000 (11:51 +0300)]
Fix panic in IPv6 multicast code.

Add check that ifp supports IPv6 multicasts in in6_getmulti.
This fixes panic when user application tries to join into multicast
group on an interface that doesn't support IPv6 multicasts, like
IFT_PFLOG interfaces.

PR:             257302
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D31420

(cherry picked from commit d477a7feed177d0ad5c12bc6e2cce804d427ed38)

2 years agocoretemp(4): Switch to smp_rendezvous_cpus().
Alexander Motin [Fri, 30 Jul 2021 03:16:22 +0000 (23:16 -0400)]
coretemp(4): Switch to smp_rendezvous_cpus().

Use of smp_rendezvous_cpus() instead of sched_bind() allows to not
block indefinitely if target CPU is running some thread with higher
priority, while all we need is single rdmsr/wrmsr instruction call.
I guess it should also be much cheaper than full thread migration.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

(cherry picked from commit 74f80bc1af2ffd56ec290f610c80e46f768731a0)

2 years agoipmi(4): Add more watchdog error checks.
Alexander Motin [Fri, 30 Jul 2021 03:39:04 +0000 (23:39 -0400)]
ipmi(4): Add more watchdog error checks.

Add request submission status checks before checking req->ir_compcode,
otherwise it may be zero just because of initialization.

Add checks for req->ir_compcode errors in ipmi_reset_watchdog() and
ipmi_set_watchdog().  In first case explicitly check for 0x80, which
means timer was not previously set, that I found happening after BMC
cold reset.  This change makes watchdog timer to recover instead of
permanently ignoring reset errors after BMC reset or upgraded.

MFC after: 2 weeks
Sponsored by:   iXsystems, Inc.

(cherry picked from commit 9d3b47abbba74830661e90206cc0f692b159c432)

2 years agobhyve vtblk: Inform guests of disk resize events.
John Baldwin [Sat, 12 Jun 2021 00:59:46 +0000 (17:59 -0700)]
bhyve vtblk: Inform guests of disk resize events.

Register a resize callback with the blockif interface.  When the
callback fires, update the size of the disk and notify the guest via a
configuration change interrupt.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30506

(cherry picked from commit 2349cda44fea17c089b026e743ec8f03199019eb)

2 years agobhyve: Split out a lower-level helper for VirtIO interrupts.
John Baldwin [Sat, 12 Jun 2021 00:59:35 +0000 (17:59 -0700)]
bhyve: Split out a lower-level helper for VirtIO interrupts.

This allows device models to assert VirtIO interrupts for reasons
other than publishing changes to a VirtIO ring such as configuration
changes.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30505

(cherry picked from commit c06676bee3d228ac18c5ed3604304e932eb84c1e)

2 years agobhyve: Add support for handling disk resize events to block_if.
John Baldwin [Sat, 12 Jun 2021 00:59:25 +0000 (17:59 -0700)]
bhyve: Add support for handling disk resize events to block_if.

Allow clients of blockif to register a resize callback handler.  When
a callback is registered, register an EVFILT_VNODE kevent watching the
backing store for a change in the file's attributes.  If the size has
changed when the kevent fires, invoke the clients' callback.

Currently resize detection is limited to backing stores that support
EVFILT_VNODE kevents such as regular files.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30504

(cherry picked from commit 8794846a91c5429c612ba939c61ebf8f1ff1a628)

2 years agobhyve: Add support for EVFILT_VNODE mevents.
John Baldwin [Sat, 12 Jun 2021 00:59:13 +0000 (17:59 -0700)]
bhyve: Add support for EVFILT_VNODE mevents.

This allows registering an event to watch for changes to a file's
attributes.  This is a bit imperfect as it would be nice to have a way
to determine if an fd can use EVFILT_VNODE successfully.  mevent's
current structure does not permit that and a failure to register a
single kevent impacts several other kevents.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30503

(cherry picked from commit 67d60dcce62c08250dceedaf761cb48bc74c75a4)

2 years agobhyve: Register new kevents synchronously.
John Baldwin [Sat, 12 Jun 2021 00:58:54 +0000 (17:58 -0700)]
bhyve: Register new kevents synchronously.

Change mevent_add*() to synchronously add the new kevent.  This
permits reporting event registration failures to the caller and avoids
failing the registration of other, unrelated events queued up in the
same batch.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30502

(cherry picked from commit e8424e2947dd8a0e1d3f08295432941b5c5aafb9)

2 years agolink_elf_obj: Invoke fini callbacks
Mark Johnston [Thu, 29 Jul 2021 13:46:25 +0000 (09:46 -0400)]
link_elf_obj: Invoke fini callbacks

This is required for KASAN: when a module is unloaded, poisoned regions
(e.g., pad areas between global variables) are left as such, so if they
are reused as KLDs are loaded, false positives can arise.

Reported by: pho, Jenkins
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9e575fadf491152fb3445d4837d49a9cb87dd6e2)

2 years agoamd64: Set MSR_KGSBASE to 0 during AP startup
Mark Johnston [Thu, 29 Jul 2021 14:14:05 +0000 (10:14 -0400)]
amd64: Set MSR_KGSBASE to 0 during AP startup

There is no reason to initialize it to anything else, and this matches
initialization of the BSP.  No functional change intended.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e1537450838134daaf584d1f17e661673b2c4c76)

2 years agoamd64: Set GS.base before calling init_secondary() on APs
Mark Johnston [Thu, 29 Jul 2021 14:22:37 +0000 (10:22 -0400)]
amd64: Set GS.base before calling init_secondary() on APs

KMSAN instrumentation requires thread-local storage to track
initialization state for function parameters and return values.  This
buffer is accessed as part of each function prologue.  It is provided by
the KMSAN runtime, which looks up a pointer in the current thread's
structure.

When KMSAN is configured, init_secondary() is instrumented, but this
means that GS.base must be initialized first, otherwise the runtime
cannot safely access curthread.  Work around this by loading GS.base
before calling init_secondary(), so that the runtime can at least check
curthread == NULL and return a pointer to some dummy storage.  Note that
init_secondary() still must reload GS.base after calling lgdt(), which
loads a selector into %gs, which in turn clears the base register.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4b136ef259cefedc9b6404afc09138aeb8acbd91)

2 years agoAdd vn_lktype_write()
Konstantin Belousov [Wed, 4 Aug 2021 02:34:48 +0000 (05:34 +0300)]
Add vn_lktype_write()

(cherry picked from commit 0ef5eee9d94162ac3cefa0bd8aedf1bfa6f87192)

2 years ago_Exit(3): document implementation
Konstantin Belousov [Thu, 5 Aug 2021 16:04:44 +0000 (19:04 +0300)]
_Exit(3): document implementation

(cherry picked from commit ee62fb2e1e14eab35d4e4e92535bcac9fc91eeb8)

2 years agofork(2): comment about doubtful use of stdio and exit(3) in example
Konstantin Belousov [Thu, 5 Aug 2021 16:03:03 +0000 (19:03 +0300)]
fork(2): comment about doubtful use of stdio and exit(3) in example

(cherry picked from commit 2a51e8823a60180feb534176bc41d5d10e2a01b1)

2 years agofork.2: correct minor typo in manpage.
Ceri Davies [Thu, 5 Aug 2021 18:36:33 +0000 (19:36 +0100)]
fork.2: correct minor typo in manpage.

(cherry picked from commit 383dbdb2ebffabf8c0efadd8928f8ef3e45ab9e5)