]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agodiff: read whole files to determine if they are ASCII text
Piotr Pawel Stefaniak [Sun, 22 Aug 2021 19:57:13 +0000 (21:57 +0200)]
diff: read whole files to determine if they are ASCII text

Before this change, only the first BUFSIZE bytes were checked.

(cherry picked from commit 3cbf98e2bee91db9ed9118ff557e02cdd449f49a)

2 years agodiff: don't output carriage returns that were stripped on input
Piotr Pawel Stefaniak [Sun, 22 Aug 2021 16:05:59 +0000 (18:05 +0200)]
diff: don't output carriage returns that were stripped on input

--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.

(cherry picked from commit af2f0164318455433db95adce07af829285b78ad)

2 years agosh: improve command completion
Piotr Pawel Stefaniak [Wed, 22 Sep 2021 16:23:29 +0000 (18:23 +0200)]
sh: improve command completion

When there are many matches, find the longest common substring starting
from the beginning of each command and use that to replace input.

As an example: on my system, llv<tab> will be autocompleted to llvm-
and another <tab> will print all matching llvm commands.

(cherry picked from commit c866d0c798a20b8f0a92df524f4ddd0d81511c88)

2 years agosh: reset sh bindings on bind -e, bind -v
Piotr Pawel Stefaniak [Sun, 19 Sep 2021 20:17:01 +0000 (22:17 +0200)]
sh: reset sh bindings on bind -e, bind -v

Until this change, any bindings set in histedit() were lost on calls to
bindcmd().

Only bind -e and bind -v call libedit's keymacro_reset(). Currently you
cannot fool libedit/map.c:map_bind() by trying something like bind -le
as when p[0] == '-', it does a switch statement on p[1].

(cherry picked from commit 9413dfd331e705a1d7909fe41f06a30e43c442f7)

2 years agosh: improve command completion
Piotr Pawel Stefaniak [Sat, 18 Sep 2021 11:26:51 +0000 (13:26 +0200)]
sh: improve command completion

When multiple matches are found, we keep the provided string on the
input line and print unique matches as suggestions.

But the multiple matches might be the same command found in different
directories, so we should deduplicate the matches first and then decide
whether to autocomplete the command or not, based on the number of
unique matches.

(cherry picked from commit b8ff849cbddfee3404d6550cf98f53d6bb617707)

2 years agofstyp: bump WARNS to default and work around warnings
Piotr Pawel Stefaniak [Tue, 17 Aug 2021 15:46:08 +0000 (17:46 +0200)]
fstyp: bump WARNS to default and work around warnings

(cherry picked from commit da0c0e0121574a1d82f417cc7e245ecd5506325c)

2 years agoUpdate a sysctl name to nbuffers_pcpu in hwpmc.4 and pmcstat.c
Piotr Pawel Stefaniak [Sat, 28 Aug 2021 08:01:19 +0000 (10:01 +0200)]
Update a sysctl name to nbuffers_pcpu in hwpmc.4 and pmcstat.c

This change was missed in r333509 (e6b475e0af).

(cherry picked from commit 0939f965d80d00e783b3319a57e7d71e0b3f202e)

2 years agoUpdate leap-seconds to leap-seconds.3676924800.
Xin LI [Mon, 20 Sep 2021 05:26:22 +0000 (22:26 -0700)]
Update leap-seconds to leap-seconds.3676924800.

Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800.
MFC after: 3 days

(cherry picked from commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f)

2 years agounix: Fix a use-after-free in unp_drop()
Mark Johnston [Sat, 18 Sep 2021 14:38:39 +0000 (10:38 -0400)]
unix: Fix a use-after-free in unp_drop()

We need to load the socket pointer after locking the PCB, otherwise
the socket may have been detached and freed by the time that unp_drop()
sets so_error.

This previously went unnoticed as the socket zone was _NOFREE.

Reported by: pho

(cherry picked from commit 50b07c1f7131fd535bbe1b53a3a2e4dfcdcc2e51)

2 years agosocket: Add assertions around naked refcount decrements
Mark Johnston [Fri, 17 Sep 2021 16:26:56 +0000 (12:26 -0400)]
socket: Add assertions around naked refcount decrements

Sockets in a listen queue hold a reference to the parent listening
socket.  Several code paths release this reference manually when moving
a child socket out of the queue.

Replace comments about the expected post-decrement refcount value with
assertions.  Use refcount_load() instead of a plain load.  No functional
change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6b288408ca32e68c74f6ab12324448ab4862a045)

2 years agosocket: Fix a use-after-free in soclose()
Mark Johnston [Fri, 17 Sep 2021 16:26:06 +0000 (12:26 -0400)]
socket: Fix a use-after-free in soclose()

After releasing the fd reference to a socket "so", we should avoid
testing SOLISTENING(so) since the socket may have been freed.  Instead,
directly test whether the list of unaccepted sockets is empty.

Fixes: f4bb1869ddd2 ("Consistently use the SOLISTENING() macro")
Pointy hat: markj
Sponsored by: The FreeBSD Foundation

(cherry picked from commit dfcef8771484271f2bccdb1dbc088a838441c5a7)

2 years agouma: Show the count of free slabs in each per-domain keg's sysctl tree
Mark Johnston [Fri, 17 Sep 2021 16:13:47 +0000 (12:13 -0400)]
uma: Show the count of free slabs in each per-domain keg's sysctl tree

This is useful for measuring the number of pages that could be freed
from a NOFREE zone under memory pressure.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit d6e77cda9be1509ea170142cca3ff0d3b9f12e35)

2 years agorpc: Convert an SOLISTENING check to an assertion
Mark Johnston [Fri, 17 Sep 2021 16:13:02 +0000 (12:13 -0400)]
rpc: Convert an SOLISTENING check to an assertion

Per the comment, this socket should always be a listening socket.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7fabaac2211e7ed1cec9650e46f4e03428411dcf)

2 years agoefi loader: Typo
Mark Johnston [Tue, 21 Sep 2021 16:09:55 +0000 (12:09 -0400)]
efi loader: Typo

(cherry picked from commit 0e3ce6d082b34154e41e220757c03d66d881a47b)

2 years agoe1000: Catch up commit with DPDK
Kevin Bowling [Fri, 17 Sep 2021 02:30:49 +0000 (19:30 -0700)]
e1000: Catch up commit with DPDK

Various syncs with the e1000 shared code from DPDK:
"cid-gigabit.2020.06.05.tar.gz released by ND"

Approved by: imp
Obtained from: DPDK
MFC after: 1 week

(cherry picked from commit 984d1616be883bc2c351aff9aa69b1abd7d1214c)

2 years agoe1000: prevent ULP flow if cable connected
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:03 +0000 (10:51 +0800)]
e1000: prevent ULP flow if cable connected

Enabling ulp on link down when cable is connect caused an infinite
loop of linkup/down indications in the NDIS driver.
After discussed, correct flow is to enable ULP only when cable is
disconnected.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Approved by: imp
Obtained from: DPDK (4bff263d54d299269966365f9697941eecaa241b)
MFC after: 1 week

(cherry picked from commit 40fa6e53f53cde84f6f5c7330f89e4ae373d7d93)

2 years agoe1000: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:15 +0000 (16:03 +0100)]
e1000: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: 'link' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  if (link) {

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Approved by: imp
Obtained from: DPDK (46136031f19107f4e9b6b3a952cb7f57877a7f0f)
MFC after: 1 week

(cherry picked from commit 089cdb3990f47be3cd34d1a57567a2e89c917929)

2 years agoe1000: fix multicast setting in VF
Yong Wang [Tue, 21 Feb 2017 09:33:23 +0000 (04:33 -0500)]
e1000: fix multicast setting in VF

In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior
to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW".
And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST".

Fix it by moving the second line prior to the first one that mentioned
above.

Fixes: dffbaf7880a8 ("e1000: revert fix for multicast in VF")
Cc: stable@dpdk.org
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Approved by: imp
Obtained from: DPDK (f58ca2f9ef6)
MFC after: 1 week

(cherry picked from commit ecf2a89a997ad4a14339b6a2f544e44b422620a0)

2 years agoe1000: fix timeout for shadow RAM write
Chengwen Feng [Wed, 21 Apr 2021 09:15:35 +0000 (17:15 +0800)]
e1000: fix timeout for shadow RAM write

This fixes the timed out for shadow RAM write EEWR can't be detected.

Fixes: 5a32a257f957 ("e1000: more NICs in base driver")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Approved by: imp
Obtained from: DPDK (4a8ab48ec47b3616272e50620b8e1a9599358ea6)
MFC after: 1 week

(cherry picked from commit f6517a7e69c10c6057d6c990a9f3ea22a2b62398)

2 years agoe1000: cleanup pre-processor tags
Guinan Sun [Mon, 6 Jul 2020 08:12:20 +0000 (08:12 +0000)]
e1000: cleanup pre-processor tags

The codes has been exposed correctly, so remove pre-processor tags.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (a50e998a0fd94e5db508710868a3417b1846425c)
MFC after: 1 week

(cherry picked from commit 9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b)

2 years agoe1000: introduce DPGFR register
Guinan Sun [Mon, 6 Jul 2020 08:12:19 +0000 (08:12 +0000)]
e1000: introduce DPGFR register

Defined DPGFR, Dynamic Power Gate Force Control Register.

Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (1469e5aceffbdcebe834292aadb40b1bd1602867)
MFC after: 1 week

(cherry picked from commit 7fb2111413c799414c86d7bfdcc72bc1c6302726)

2 years agoe1000: expose FEXTNVM registers and masks
Guinan Sun [Mon, 6 Jul 2020 08:12:16 +0000 (08:12 +0000)]
e1000: expose FEXTNVM registers and masks

Adding defines for FEXTNVM8 and FEXTNVM12 registers with new masks for
future use.

Signed-off-by: Nir Efrati <nir.efrati@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (6d208ec099cd870a73c6b444b350a82c7a26c5e4)
MFC after: 1 week

(cherry picked from commit de965d042fa4d341cec3fa7cacac0f30f224bde4)

2 years agoe1000: add missed define for VFTA
Guinan Sun [Mon, 6 Jul 2020 08:12:13 +0000 (08:12 +0000)]
e1000: add missed define for VFTA

VLAN filtering using the VFTA (VLAN Filter Table Array) and
should be initialized prior to setting rx mode.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (fc9933953c90e99970aa867c38f9c6e6c5d0488d)
MFC after: 1 week

(cherry picked from commit a8bb4ab7cfb84195ef8af3c788fecdc8830fc960)

2 years agoe1000: increase timeout for ME ULP exit
Guinan Sun [Mon, 6 Jul 2020 08:12:09 +0000 (08:12 +0000)]
e1000: increase timeout for ME ULP exit

Due timing issues in WHL and since recovery by host is
not always supported, increased timeout for Manageability Engine(ME)
to finish Ultra Low Power(ULP) exit flow for Nahum before timer expiration.

Signed-off-by: Nir Efrati <nir.efrati@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (cf1f3ca45d33e793ca581200b4000c39a798113e)
MFC after: 1 week

(cherry picked from commit e8e3171d992f3255cc8e5a0f59912d07679cc94c)

2 years agoe1000: add missing register defines
Guinan Sun [Mon, 6 Jul 2020 08:12:08 +0000 (08:12 +0000)]
e1000: add missing register defines

Added defines for the EEC, SHADOWINF and FLFWUPDATE registers needed for
the nvmupd_validate_offset function to correctly validate the NVM update
offset.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (2c7fe65ab9a31e6ebf438dad7ccc59bcde83a89f)
MFC after: 1 week

(cherry picked from commit 09888d4bc1a2c45d121046f79be5c01e4889a67e)

2 years agoe1000: add PCIm function state
Guinan Sun [Mon, 6 Jul 2020 08:12:07 +0000 (08:12 +0000)]
e1000: add PCIm function state

Added define to pcim function state.

Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (7ee1a3b273c7f321b50e6ba17c3d9537b1b08347)
MFC after: 1 week

(cherry picked from commit a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1)

2 years agoe1000: expose MAC functions
Guinan Sun [Mon, 6 Jul 2020 08:12:06 +0000 (08:12 +0000)]
e1000: expose MAC functions

Now the functions are being accessed outside of the file, we need
to properly expose them for silicon families to use.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (df01c0ee277d51f81d7d72501dba97550d3b6c4a)
MFC after: 1 week

(cherry picked from commit d1c37752e2afb51dfb2e08afe714a799788b6ede)

2 years agoe1000: update for i210 slow system clock
Guinan Sun [Mon, 6 Jul 2020 08:11:56 +0000 (08:11 +0000)]
e1000: update for i210 slow system clock

This code is required for the update for system clock.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (3f0188c8f29847038bc9f306b2570ace57e3811c)
MFC after: 1 week

(cherry picked from commit 1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9)

2 years agoe1000: remove duplicated phy codes
Guinan Sun [Mon, 6 Jul 2020 08:12:05 +0000 (08:12 +0000)]
e1000: remove duplicated phy codes

Add two files base.c and base.h to reduce the redundancy
in the silicon family code.
Remove the code duplication from e1000_82575 files.
Clean family specific functions from base.
Fix up a stray and duplicate function declaration.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (44dddd14059f151f39f7e075b887decfc9a10f11)
MFC after: 1 week

(cherry picked from commit 6b9d35fac12bf657cd1df8f1521c70704ff62b61)

2 years agoe1000: modify HW level time sync mechanisms
Guinan Sun [Mon, 6 Jul 2020 08:12:04 +0000 (08:12 +0000)]
e1000: modify HW level time sync mechanisms

Add additional configuration space access to allow HW
level time sync mechanism.

Signed-off-by: Evgeny Efimov <evgeny.efimov@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (d53391f1fe2e0eba8818517fdf285f893d95dcc8)
MFC after: 1 week

(cherry picked from commit d50f362b505e9026fbd33d00dc43e09cac26a209)

2 years agoe1000: fix minor issues and improve code style
Guinan Sun [Mon, 6 Jul 2020 08:12:03 +0000 (08:12 +0000)]
e1000: fix minor issues and improve code style

Fix typo in piece of code of NVM access for SPT.
And cleans up the remaining instances in the shared code
where it was not adhering to the Linux code standard.
Wrong description was found in the mentioned file, so fix them.
Remove shadowing variable declarations.

Relating to operands in bitwise operations having different sizes.
Unreachable code since *clock_in_i2c_* always return success.
Don't return unused s32 and don't check for constants.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Signed-off-by: Doug Dziggel <douglas.a.dziggel@intel.com>
Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (b8592c89c8fbc871d22313dcac0b86c89a7d5a62)
MFC after: 1 week

(cherry picked from commit 6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756)

2 years agoe1000: add function parameter descriptions
Guinan Sun [Mon, 6 Jul 2020 08:12:02 +0000 (08:12 +0000)]
e1000: add function parameter descriptions

Add function parameter descriptions to address gcc 7 warnings.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (1bf35d435c9764e83be76042fa6489dd127b6c40)
MFC after: 1 week

(cherry picked from commit 5b426b3e8cbd5abdb3a57ff49cd27c36cac03427)

2 years agoe1000: expose xMDIO methods
Guinan Sun [Mon, 6 Jul 2020 08:12:00 +0000 (08:12 +0000)]
e1000: expose xMDIO methods

Move read and write xmdio methods to e1000_phy.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (b14d20f1b2bb0e6d95f19963c5d7f55374e0ead9)
MFC after: 1 week

(cherry picked from commit da24467c7a162691a14f2f74d90ff8dedb816cfc)

2 years agoe1000: add missing device ID
Guinan Sun [Mon, 6 Jul 2020 08:12:10 +0000 (08:12 +0000)]
e1000: add missing device ID

Adding Intel(R) I210 Gigabit Network Connection 15F6 device ID for SGMII
flashless automotive device.

Signed-off-by: Kamil Bednarczyk <kamil.bednarczyk@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (586d770bfefc01d4af97c0ddf17c960c3e49ec22)
MFC after: 1 week

(cherry picked from commit 82a9d0c2c1ef75703d16e49e96d1e7b0bf046882)

2 years agoe1000: support flashless i211 PBA
Guinan Sun [Mon, 6 Jul 2020 08:11:59 +0000 (08:11 +0000)]
e1000: support flashless i211 PBA

Add support to print PBA when using flashless.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (d3c41d90dfd5b39dec14c74cf53086f4e6634aed)
MFC after: 1 week

(cherry picked from commit de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce)

2 years agoe1000: Update copyrights and readme
Kevin Bowling [Thu, 16 Sep 2021 11:35:45 +0000 (04:35 -0700)]
e1000: Update copyrights and readme

Copyrights in sync with "cid-gigabit.2020.06.05.tar.gz released by ND"
(from DPDK).

README from the latest em-7.7.8 on intel.com

Approved by: imp
MFC after: 1 week

(cherry picked from commit 702cac6c6bf20ca43db26c38185f65fc9ed1935e)

2 years agoreadelf: document that -u / --unwind is not yet implemented
Ed Maste [Fri, 17 Sep 2021 13:59:41 +0000 (09:59 -0400)]
readelf: document that -u / --unwind is not yet implemented

ELF tool chain readelf accepts -u / --unwind but just ignores the
option.  This was previously undocumented, which could be confusing for
someone encountering `readelf -u` (in a script or GNU readelf example).

Reported by: markj (in D32003)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8)

2 years agoreadelf: include notes (-n) and unwind (-u) in --all/-a
Ed Maste [Fri, 17 Sep 2021 12:06:27 +0000 (08:06 -0400)]
readelf: include notes (-n) and unwind (-u) in --all/-a

This matches the GNU and LLVM versions of readelf.

As markj noted in the review -u is not actually implemented yet and has
no effect.  The option is accepted and just ignored.

Reported by: andrew
Reviewed by: andrew, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32003

(cherry picked from commit f161abf9f2cd7fdd28543f9774de82c89675477c)

2 years agoproccontrol(1): Add wxmap control
Konstantin Belousov [Wed, 1 Sep 2021 23:27:58 +0000 (02:27 +0300)]
proccontrol(1): Add wxmap control

(cherry picked from commit ac8af1938085dae0df32db3229c9d5cb659b90a4)

2 years agoprocctl(2): Add PROC_WXMAP_CTL/STATUS
Konstantin Belousov [Thu, 2 Sep 2021 00:59:10 +0000 (03:59 +0300)]
procctl(2): Add PROC_WXMAP_CTL/STATUS

(cherry picked from commit 796a8e1ad1ae3f7b8e4c9f97bebbef5d7d5a2c16)

2 years agoStyle
Konstantin Belousov [Wed, 1 Sep 2021 23:23:02 +0000 (02:23 +0300)]
Style

(cherry picked from commit 1349891a0eed79625faafa5ad354d65ff9ea6012)

2 years agoproccontrol(1): implement 'nonewprivs'
Edward Tomasz Napierala [Fri, 2 Jul 2021 07:49:20 +0000 (08:49 +0100)]
proccontrol(1): implement 'nonewprivs'

(cherry picked from commit acb1f1269c6f4ff89a0d28ba742f6687e9ef779d)

2 years agoprocctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS
Edward Tomasz Napierala [Thu, 1 Jul 2021 08:11:11 +0000 (09:11 +0100)]
procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS

(cherry picked from commit db8d680ebe9b12c7d9e0eb8bf9940fcef709f5ec)

2 years agobuffer pager: allow get_blksize method to return error
Konstantin Belousov [Thu, 16 Sep 2021 23:53:58 +0000 (02:53 +0300)]
buffer pager: allow get_blksize method to return error

(cherry picked from commit 197a4f29f39e6ae6215a6dbd28ef449d305e6d49)

2 years agoVOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag
Rick Macklem [Wed, 8 Sep 2021 00:35:26 +0000 (17:35 -0700)]
VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag

Although it is not specified in the RFCs, the concept that
the NFSv4 server should reply to an RPC request within a
reasonable time is accepted practice within the NFSv4 community.

Without this patch, the NFSv4.2 server attempts to reply to
a Copy operation within 1second by limiting the copy to
vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at
best, given the large variation in I/O subsystem performance.

This patch adds a kernel only flag COPY_FILE_RANGE_TIMEO1SEC
that the NFSv4.2 can specify, which tells VOP_COPY_FILE_RANGE()
to return after approximately 1 second with a partial result and
implements this in vn_generic_copy_file_range(), used by
vop_stdcopyfilerange().

Modifying the NFSv4.2 server to set this flag will be done in
a separate patch.  Also under consideration is exposing the
COPY_FILE_RANGE_TIMEO1SEC to userland for use on the FreeBSD
copy_file_range(2) syscall.

Although this technically does change the VFS/VOP KAPI, I do not
think the MFC will cause problems.

(cherry picked from commit c5128c48df3c2f3828432aff2ea536bb9c887e14)

2 years agohkbd(4): Fix build on 32bit platforms
Vladimir Kondratyev [Thu, 9 Sep 2021 22:49:26 +0000 (01:49 +0300)]
hkbd(4): Fix build on 32bit platforms

(cherry picked from commit 38d2e9314b127b3466e8ae4120e21fe1ad076dfc)

2 years agohkbd(4): Fix key repeats on multireport keyboards
Vladimir Kondratyev [Thu, 9 Sep 2021 21:40:13 +0000 (00:40 +0300)]
hkbd(4): Fix key repeats on multireport keyboards

Currently hkbd counts all key states to be "Up" at the start of
interrupt callback. That results in generation of "Key Up" event for
each key that has been downed before but is not listed in current
report while is still downed.

Fix that with clearing of temporary key data storage bits only for
keys contained in processed report.

Reported by: Greg V
Obtained from: sysutils/iichid

(cherry picked from commit 598f0580f6822e2492231d055f49465a5b55d270)

2 years agohkbd(4): Use bitstring(3) KPI for key bitmaps processing.
Vladimir Kondratyev [Thu, 9 Sep 2021 21:39:46 +0000 (00:39 +0300)]
hkbd(4): Use bitstring(3) KPI for key bitmaps processing.

No functional changes intended.

(cherry picked from commit 04918395f18dfb115dc0fe2865780dc607c5dc71)

2 years agohkbd(4): Reduce diff with ukbd(4)
Vladimir Kondratyev [Thu, 9 Sep 2021 21:39:05 +0000 (00:39 +0300)]
hkbd(4): Reduce diff with ukbd(4)

(cherry picked from commit 3ef9023f935ff721f72ed44cf26911b9af72dba1)

2 years agopsm(4): Disable KVM switch "jitter" clamping for absolute touchpads.
Vladimir Kondratyev [Thu, 9 Sep 2021 21:37:40 +0000 (00:37 +0300)]
psm(4): Disable KVM switch "jitter" clamping for absolute touchpads.

r123442 introduced solution for clamping of PS/2 mice jitter when using
a KVM. Solution is to buffer mouse packets for 0.050ms if mouse activity
has not been seen for more than 0.5 seconds. Then flush that data to driver
if no validation errors found or drop the entire queue otherwise.

While it works well with relative devices it has issues with absolute ones
Depending on history buffering may results in delaying of the touch front
edge for 0.050ms that affects gesture processing (tap detection).

As absolute touchpads usually are built-in devices we can safely disable
bufferization and KVM jitter clamping to avoid such a delays.

(cherry picked from commit bedf31ad7e15c7d3e3ff9e5295bfd5454fbb42fa)

2 years agodirect commit: fix KBI for pci_dev
Warner Losh [Wed, 22 Sep 2021 14:47:12 +0000 (08:47 -0600)]
direct commit: fix KBI for pci_dev

Move all the new elemenets to the end of the structure for 13. We
allocate this inside the linuxkpi code, so the size isn't enccoded in
client modules. However, the offsets to the different fields are
encoded. Tihs modifies 04456f71185340a215e38a4d, and 3a606aadf2e7
and will likely create merge conflicts there (and that's a good thing
since the elements need to be moved to the end of the structure when
merging).

Tweak irq_ent to be binary compatible. Since this is inlined into the
clients, all clients have to agree on the irq_ent offsets.

Restore visibility to linux_kmem_cache_free_rcu
linux_kmem_cache_free_rcu was made static in 10235ad0567f, however
client drivers depended on calling it directly. Make it visible again to
restore the 13.0-Release KBI for linuxkpi.

Bump FreeBSD_version to 1300515 for restoration of 13.0 KBI. Since this
commmit changes the linuxkpi KBI (this time back to 13.0 release to
restore the status quo of), you'll need to recompile everything that
uses it (you needed to earlier as well, but those were silent
recompilation events). The plus side is that our packages (built using
13.0) for drm-kmod 5.4 work again on -stable systems.

Reviewed by: bz, wulf
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31363

2 years agogenoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations
Warner Losh [Tue, 7 Sep 2021 16:08:51 +0000 (10:08 -0600)]
genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations

Linux fails to build now because the mkdtemp in the bootstrapped
environment wants 6 or more X's. Use 10 out of an abundance of caution.

Sponsored by: Netflix
Reviewed by: arichards
Differential Revision: https://reviews.freebsd.org/D31863

(cherry picked from commit ecfbb2e30241ee460617ad4e0c0be16d9930945a)

2 years agocdefs.h: Remove redundant #ifdefs
Warner Losh [Tue, 7 Sep 2021 15:34:02 +0000 (09:34 -0600)]
cdefs.h: Remove redundant #ifdefs

Remove redunant #ifdef __GNUC__ inside an #if defined(__GNUC__)
block. They are nops.

Sponsored by: Netflix

(cherry picked from commit 1e7b5f950b2d54ddb257d008592563c4d753aa54)

2 years agoppbus: Set the lock for pps interface, update to latest api
Warner Losh [Wed, 1 Sep 2021 19:37:27 +0000 (13:37 -0600)]
ppbus: Set the lock for pps interface, update to latest api

Since we take a lock when we enter the ioctl, we need to set driver_mtx
in the pps structure so it can be dropped while sleeping during a call
to timepps_fetch() with a non-zero timeout (PPS_CANWAIT feature).

MFC After: 5 days
Sponsored by: Netflix
Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D31763

(cherry picked from commit c62aa65b2a7a6492e712a69c58a35347aa441a98)

2 years agogrep: fix combination of quiet and count flag
Mariusz Zaborski [Fri, 9 Jul 2021 12:09:14 +0000 (14:09 +0200)]
grep: fix combination of quiet and count flag

When the quiet (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns
0 or 1 (which is unexpected). GNU grep with c and q flags doesn't
print anything.

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

(cherry picked from commit 24c681a7f6d6c777221fdbd289da64ff65ad8785)

2 years agoCleanup unused USB enums.
Hans Petter Selasky [Thu, 15 Jul 2021 10:38:16 +0000 (12:38 +0200)]
Cleanup unused USB enums.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agosound(4): Implement playback and recording mode sysctl(8).
Hans Petter Selasky [Wed, 28 Jul 2021 11:22:52 +0000 (13:22 +0200)]
sound(4): Implement playback and recording mode sysctl(8).

The dev.pcm.<N>.mode sysctl(8) gives information if a sound device
supports hardware mixing, playback or recording.

Submitted by: Christos Margiolis <christos@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D31320
MFC after: 1 week
Sponsored by: NVIDIA Networking

(cherry picked from commit ed2196e5df0c8b5b81563d2fffdcb32bb7ebe966)

2 years agoImplement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.
Hans Petter Selasky [Tue, 20 Jul 2021 17:02:41 +0000 (19:02 +0200)]
Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.

These two ioctls are not part of the current version of OSS and were
considered obsolete. However, their behaviour is not the same as their
old one, so this implementation is specific to FreeBSD.

Older OSS versions had the MUTE ioctls take and return an integer with
a value of 0 or 1, which meant that the _whole_ mixer is unmuted or
muted respectively. In my implementation, the ioctl takes and returns
a bitmask that tells us which devices are muted.

This allows us to mute and unmute only the devices we want, instead of the
whole mixer. The bitmask works the same way as in DEVMASK, RECMASK and
RECSRC.

Integrated the hardware volume feature with the new mute system.

Submitted by: Christos Margiolis <christos@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D31130
MFC after: 1 week
Sponsored by: NVIDIA Networking

(cherry picked from commit 0f8dafb45859569aa36b63ca2bb4a1c35c970d1e)

2 years agosound(4): Fix typos.
Hans Petter Selasky [Wed, 28 Jul 2021 11:25:01 +0000 (13:25 +0200)]
sound(4): Fix typos.

Submitted by: Christos Margiolis <christos@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D31320
MFC after: 1 week
Sponsored by: NVIDIA Networking

(cherry picked from commit 132fca6335939b308f230d4942ba15ba2b56ceb7)

2 years agoUpdate the mlx5en(4) manual page.
Hans Petter Selasky [Tue, 20 Jul 2021 16:00:13 +0000 (18:00 +0200)]
Update the mlx5en(4) manual page.

Differential Revision: https://reviews.freebsd.org/D31228
Reviewed by: kib@
MFC after: 1 week
Sponsored by: NVIDIA Networking

(cherry picked from commit 575945f10b9e11be0f217117c86dd480de6c5f30)

2 years agomlx5/mlx4: Bump driver version to 3.7
Hans Petter Selasky [Wed, 16 Jun 2021 13:02:03 +0000 (15:02 +0200)]
mlx5/mlx4: Bump driver version to 3.7

While at it only output driver version to dmesg(8) when hardware is present.

Differential Revision: https://reviews.freebsd.org/D29100
MFC after: 1 week
Reviewed by: kib and markj
Sponsored by: NVIDIA Networking

(cherry picked from commit d2cbfbc57b20700d6eb04dbfc4d636ce6c92997c)

2 years agoimport nvi 2.2.0-3bbdfe4
Baptiste Daroussin [Fri, 21 May 2021 20:50:50 +0000 (22:50 +0200)]
import nvi 2.2.0-3bbdfe4

(cherry picked from commit 6680e5a52f8abf059bbbd3e0be66d9dce476cdf9)

2 years agopci_vendors: update to 2021.09.19
Baptiste Daroussin [Tue, 27 Jul 2021 16:56:39 +0000 (18:56 +0200)]
pci_vendors: update to 2021.09.19

(cherry picked from commit 00582fa66051cbdf263a6ce0f10c64ea17a0e9a8)
(cherry picked from commit dcd882f30236fdac6ce7f42129462d72a64daf0c)

2 years agolibfetch: use more portable getline() interface
Daniel Kolesa [Tue, 17 Aug 2021 14:01:46 +0000 (16:01 +0200)]
libfetch: use more portable getline() interface

this is for better portability in order to avoid using a function
which is BSD-only or available via libbsd

(cherry picked from commit ee3ca711a898cf41330c320826ea1e0e6e451f1d)
(cherry picked from commit 635eb7ac7990a2bb29e1992b739617a9db012bf2)

2 years agoports.7: catchup with the package extension name since pkg 1.17
Baptiste Daroussin [Thu, 22 Jul 2021 08:49:45 +0000 (10:49 +0200)]
ports.7: catchup with the package extension name since pkg 1.17

(cherry picked from commit d6ed0d3d310633ecf9294bc332e93f2766b24ded)

2 years agohmt(4): Add support for touchpads with no "button type" or
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:51 +0000 (22:33 +0300)]
hmt(4): Add support for touchpads with no "button type" or

"maximum number of contacts" usages.

Assume touchpad to be a clickpad if it has only internal button.
Set number of contacts to 5 for touchpads and to 10 for touchscreens.
Check for fetched report length to avoid reading of stalled data.
Fixes Dell Precision 7550 laptop.

Tested by: Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
PR: 257992

(cherry picked from commit 9d04336b615d16faa631da2824ee719683540276)

2 years agohpen(4): Add support for legacy MS-compatible single touch protocol
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:24 +0000 (22:33 +0300)]
hpen(4): Add support for legacy MS-compatible single touch protocol

It is used by many pre- and post- 2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>

(cherry picked from commit a36bdfc2b6525e814388f38c6862cf4b24dc6bee)

2 years agohidbus(4): Add routine to check presence of collection of given usage
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:57 +0000 (22:32 +0300)]
hidbus(4): Add routine to check presence of collection of given usage

(cherry picked from commit d51e437669e4ac35ac4be366241ae6ba4a16c378)

2 years agohidmap: Do not forget to initialize bitmap items to unset state
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:14 +0000 (22:32 +0300)]
hidmap: Do not forget to initialize bitmap items to unset state

(cherry picked from commit bbed4b41c9f193996f704b3262126e59810b30c9)

2 years agohidmap: Implement forbidden flag for hidmap item.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:51 +0000 (22:31 +0300)]
hidmap: Implement forbidden flag for hidmap item.

If HID usage is mapped to evdev event by hidmap item marked with this
flag than entire driver attachment is blocked.

(cherry picked from commit cded1fdb3763ba1f0f3663e605a5e63089dc8e22)

2 years agohmt(4): Add support for serial packet reporting mode
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:17 +0000 (22:31 +0300)]
hmt(4): Add support for serial packet reporting mode

In Serial mode, each packet contains information that describes a
single physical contact point. Multiple contacts are streamed
serially. In this mode, devices report all contact information in a
series of packets. The device sends a separate packet for each
concurrent contact.

Serial packet reporting mode is used by post-2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>

(cherry picked from commit 0075742d1834d52b5e24a606aca63ad7e67e81f3)

2 years agopsm: Use evdev autorelease feature for Synaptics and Elantech drivers
Vladimir Kondratyev [Thu, 2 Sep 2021 19:30:29 +0000 (22:30 +0300)]
psm: Use evdev autorelease feature for Synaptics and Elantech drivers

(cherry picked from commit 744fcd5ad2a3e572585615df259eb3e2f0b624ef)

2 years agopsm: Enable touch-tracking for late Synaptics PS/2 touchpads.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:29:49 +0000 (22:29 +0300)]
psm: Enable touch-tracking for late Synaptics PS/2 touchpads.

They are true multitouch internally but Synaptics PS/2 protocol
limitations do not all allow to export touch identificators.

(cherry picked from commit c21171af687e20173b6b39e33db55999ba8d715e)

2 years agocyapa(4): Adapt to recent evdev KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:05 +0000 (22:28 +0300)]
cyapa(4): Adapt to recent evdev KPI changes

(cherry picked from commit 4836af0d42cf9d299ba9203a835bdcfa797a74c2)

2 years agowmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:27:02 +0000 (22:27 +0300)]
wmt(4): Adapt to recent KPI changes

(cherry picked from commit 527b6d60f86953a40136abcf2f38cc4e70118954)

2 years agohmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:25:27 +0000 (22:25 +0300)]
hmt(4): Adapt to recent KPI changes

(cherry picked from commit 9d8ebe5ea1bedee50856aea7537310bc860bfede)

2 years agocompiler-rt: add aarch64 init function for LSE atomics
Dimitry Andric [Mon, 6 Sep 2021 19:23:10 +0000 (21:23 +0200)]
compiler-rt: add aarch64 init function for LSE atomics

As reported by Ronald, adding the out-of-line LSE atomics helpers for
aarch64 to compiler-rt was not sufficient to link programs using these,
as they also require a __aarch64_have_lse_atomics global. This is
initialized in compiler-rt's lib/builtins/cpu_model.c, roughly similar
to the x86 CPU model and feature detection in that file.

Since upstream does not yet have a FreeBSD specific implementation for
getting the required information, add a simple one that should work for
now, while I try to get it sorted with the LLVM people.

Reported by: Ronald Klop <ronald-lists@klop.ws>
Fixes: cc55ee8009a5
PR: 257392

(cherry picked from commit efe67f33c322265eb303ec0ab40275100795b22a)

2 years agoffs: remove unused thread argument from ffs_reload()
Robert Wing [Sat, 4 Sep 2021 20:25:10 +0000 (12:25 -0800)]
ffs: remove unused thread argument from ffs_reload()

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D31127

(cherry picked from commit 440320b620a29fdc4033a2b9b67eb4401cb903bb)

2 years agosctp: Allow blocking on I/O locks even with non-blocking sockets
Mark Johnston [Tue, 14 Sep 2021 13:02:05 +0000 (09:02 -0400)]
sctp: Allow blocking on I/O locks even with non-blocking sockets

There are two flags to request a non-blocking receive on a socket:
MSG_NBIO and MSG_DONTWAIT.  They are handled a bit differently in that
soreceive_generic() and soreceive_stream() will block on the socket I/O
lock when MSG_NBIO is set, but not if MSG_DONTWAIT is set.  In general,
MSG_NBIO seems to mean, "don't block if there is no data to receive" and
MSG_DONTWAIT means "don't go to sleep for any reason".

SCTP's soreceive implementation did not allow blocking on the I/O lock
if either flag is set, but this violates an assumption in
aio_process_sb(), which specifies MSG_NBIO but nonetheless
expects to make progress if data is available to read.  Change
sctp_sorecvmsg() to block on the I/O lock only if MSG_DONTWAIT
is not set.

Reported by: syzbot+c7d22dbbb9aef509421d@syzkaller.appspotmail.com
Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e6c19aa94da4a799472f8b82f196ffc42d0dbdaf)

2 years agoswap_pager: Handle large swap_pager_reserve() requests
Mark Johnston [Tue, 7 Sep 2021 18:03:52 +0000 (14:03 -0400)]
swap_pager: Handle large swap_pager_reserve() requests

This interface is used solely by md(4) when the MD_RESERVE flag is
specified, as in `mdconfig -a -t swap -s 1G -o reserve`.  It
pre-allocates swap blocks for the entire object.

The number of blocks to be reserved is specified as a vm_size_t, but
swp_pager_getswapspace() can allocate at most INT_MAX blocks.  vm_size_t
also seems like the incorrect type to use here it refers only to the
size of the VM object, not the size of a mapping.  So:
- change the type of "size" in swap_pager_reserve() to vm_pindex_t, and
- clamp the requested number of blocks for a single
  swp_pager_getswapspace() call to INT_MAX.

Reported by: syzkaller
Reviewed by: dougm, alc, kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 686aa9287c6b3658daa2ca0ef1917f2e70a6c07e)

2 years agond6: Make the DAD callout MPSAFE
Mark Johnston [Tue, 7 Sep 2021 13:49:47 +0000 (09:49 -0400)]
nd6: Make the DAD callout MPSAFE

Interface addresses with pending duplicate address detection (DAD) live
in a global queue.  In this case, a callout is associated with each
entry.  The callout transmits neighbour solicitations until the system
decides the address is no longer tentative, or until a duplicate address
is discovered.  At this point the entry is dequeued and freed.  DAD may
be manually stopped as well.

The callout currently runs (and potentially transmits packets) with
Giant held.  Reorganize DAD queue locking to interlock properly with the
callout:

- Configure the callout to acquire the DAD queue lock before running.
  The lock is dropped before transmitting any packets.  Stop protecting
  the callout with Giant.
- When looking up DAD queue entries for an incoming NS or NA, don't
  bother fiddling with the DAD queue entry reference count.
- Split nd6_dad_starttimer() so that the caller is responsible to
  transmitting a NS if it so desires.
- Remove the DAD entry from the queue before stopping the timer.  Use a
  temporary reference to make sure that the entry doesn't get freed by
  the callout while we're draining.

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

(cherry picked from commit 9a94097cd0f46aacf688973d15b3b462c79f0008)

2 years agodebugnet: Include some required headers
Mark Johnston [Tue, 14 Sep 2021 14:53:15 +0000 (10:53 -0400)]
debugnet: Include some required headers

Don't depend on pollution from net/vnet.h.

PR: 258496
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b1746faad6d690e43ac78ba3a9bca96c767ea729)

2 years agoip6mrouter: Make the expiration callout MPSAFE
Mark Johnston [Tue, 7 Sep 2021 15:15:49 +0000 (11:15 -0400)]
ip6mrouter: Make the expiration callout MPSAFE

- Protect the `expire_upcalls` callout with the MFC6 mutex.  The callout
  handler needs this mutex anyway.
- Convert the MROUTER6 mutex to a sleepable sx lock.  It is only used
  when configuring the global v6 multicast routing socket, so is only
  used in system call paths where sleeping is safe.  This lets us drain
  the callout without having to drop the lock.
- For all locking macros in the file, convert to using a _LOCKPTR macro.

Reported by: mav
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 353783964c605e9cd71f359444c1230226d5782f)

2 years agosocket: De-duplicate SBLOCKWAIT() definitions
Mark Johnston [Tue, 14 Sep 2021 13:01:32 +0000 (09:01 -0400)]
socket: De-duplicate SBLOCKWAIT() definitions

Sponsored by: The FreeBSD Foundation

(cherry picked from commit fa0463c384b652e1e962d5e8e70396e6a876f01b)

2 years agovm_page_startup: correct calculation of the starting page
Konstantin Belousov [Fri, 17 Sep 2021 18:48:42 +0000 (21:48 +0300)]
vm_page_startup: correct calculation of the starting page

(cherry picked from commit bd3a668087efb02e8e84315f7cc29d3813270dff)

2 years agovm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys...
Konstantin Belousov [Tue, 14 Sep 2021 12:25:37 +0000 (15:25 +0300)]
vm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys segments

(cherry picked from commit 181bfb42fd01bfa9f4636e803ccb3eeed8ac8ba4)

2 years agoixl(4): Fix 2.5 and 5G speeds reporting and update shared code
Krzysztof Galazka [Mon, 13 Sep 2021 20:39:59 +0000 (13:39 -0700)]
ixl(4): Fix 2.5 and 5G speeds reporting and update shared code

Fix 2.5 and 5G speeds reporting and update shared code with recent
changes:
- Update expected FW API versions for X710 and X722 adapters
- Define pointers related to Preservation Rules Module
- Add definitions for Shadow RAM pointers to new modules: 5th and 6th
  FPA, and Preservation Rules Module.
- Add I40E_RX_PTYPE_PARSER_ABORTED definition, so the driver will know
  opcode for parser aborted packets.
- Add the new filter types needed for custom cloud filters.
- Add support for Minimum Rollback Revision
- Fix RX_ONLY mode for unicast promiscuous on VLAN
- Add EEE LPI status check for X722 adapters
- Fix PHY type identifiers for 2.5G and 5G adapters
- Fix update link data for X722
- Increase the timeout value for PF reset to give PF more time to finish
  reset if it is loaded with filters.
- Added support for Min Rollback Revision for 4 more X722 modules
- Fix reporting of Active Optical Cable media type
- Add flags and fields for double VLAN processing
- Fix potentially uninitialized variables in NVM code

Reviewed by: kbowling@, mike.jakubik@gmail.com
Tested by: gowtham.kumar.ks@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D31565

(cherry picked from commit abf774528d7e497460510b0026db85e30f054142)

2 years agoixl(4): Fix reporting of unqualified transceivers
Krzysztof Galazka [Fri, 20 Aug 2021 21:12:28 +0000 (14:12 -0700)]
ixl(4): Fix reporting of unqualified transceivers

When link_active_on_if_down flag is disabled and link is brought down
with ifconfig, FW reports a false positive link event about an
unqualified transceiver. The condition used in the driver to filter out
those false positive events was incorrect and caused that unqualified
module event to also not be reported when the event was valid.

Change the condition to rely on IFF_UP flag instead of
link_active_on_if_down and bump driver version to 2.3.1-k.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: stallamr@netapp.com, erj@
Tested by: gowtham.kumar.ks@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D30733

(cherry picked from commit c4622b01d2f12b889b57ff7d0b03a38dfcb00fd8)

2 years agoixl(4): Add tunable to override Flow Control settings
Krzysztof Galazka [Mon, 5 Apr 2021 18:08:33 +0000 (11:08 -0700)]
ixl(4): Add tunable to override Flow Control settings

Add flow_control to hw.ixl tunables tree to let override
initial flow control configuration for all interfaces.
Keep using configuration set by NVM by default.

Reviewed by: erj@, gallatin@
Tested by: gowtham.kumar.ks_intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D29338

(cherry picked from commit 20a52706c814ccfd91c65586404abd2a1563a330)

2 years agolibprocstat: extend zfs_defs hack for .pieo
Ed Maste [Sun, 12 Sep 2021 23:04:31 +0000 (19:04 -0400)]
libprocstat: extend zfs_defs hack for .pieo

By default _pie.a archives are built only for INTERNALLIBs, so there is
usually no need for zfs_defs.pieo to exist.  However, some experimental
work builds _pie.a archives for everything.  Extend the existing set of
zfs_defs hacks to build zfs_defs.pieo as well.

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

(cherry picked from commit b9df18d6e8917a9bfb62babb7cf9efeca23aa2fc)

2 years agotarg(4): Remove D_NEEDGIANT.
Alexander Motin [Sat, 21 Aug 2021 15:20:54 +0000 (11:20 -0400)]
targ(4): Remove D_NEEDGIANT.

I don't believe this code needs Giant, if ever needed.

MFC after: 1 month

(cherry picked from commit f3dcedd3de27b1a8f493c8256103e8a7fb93f5a4)

2 years agoamd64 wakeup: rework trampoline page allocation
Konstantin Belousov [Sun, 12 Sep 2021 19:41:51 +0000 (22:41 +0300)]
amd64 wakeup: rework trampoline page allocation

(cherry picked from commit 1c56781cc915d1d2957e5b53717513193476d777)

2 years agox86: duplicate acpi_wakeup.c per i386 and amd64
Konstantin Belousov [Sun, 12 Sep 2021 19:24:33 +0000 (22:24 +0300)]
x86: duplicate acpi_wakeup.c per i386 and amd64

(cherry picked from commit 2b6eec531a1b52621223316f7c2940ed1e293886)

2 years agoamd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table
Konstantin Belousov [Sat, 11 Sep 2021 18:36:38 +0000 (21:36 +0300)]
amd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table

PR: 258432

(cherry picked from commit db2ba218d9fe6a541a4f537a641cce95f952fd98)

2 years agox86 acpi_install_wakeup_handler(): style
Konstantin Belousov [Sat, 11 Sep 2021 18:26:51 +0000 (21:26 +0300)]
x86 acpi_install_wakeup_handler(): style

(cherry picked from commit ceca8ac1ce47e1f87ba09463aa84eb1c879c37d9)

2 years agoamd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI
Konstantin Belousov [Sat, 11 Sep 2021 18:19:27 +0000 (21:19 +0300)]
amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI

(cherry picked from commit e99255c8a6cae324aeede7f5013d080a2d361e3f)

2 years agobsd.lib.mk: add conditions for building _pie.a archives
Ed Maste [Sun, 12 Sep 2021 16:45:50 +0000 (12:45 -0400)]
bsd.lib.mk: add conditions for building _pie.a archives

As with other .a targets, build _pie.a archives only if LIB is set.

At present we build _pie.a only for INTERNALLIBs, and none of them
include bsd.lib.mk without setting LIB.  However, we might want to build
_pie.a for non-INTERNALLIBs in the future.

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

(cherry picked from commit 7c0226cad3f36a05832f9c5216dfa3dadb91c92d)

2 years agotest/ptrace/scescx.c: fix printing of braces for syscalls without args
Konstantin Belousov [Thu, 16 Sep 2021 17:23:11 +0000 (20:23 +0300)]
test/ptrace/scescx.c: fix printing of braces for syscalls without args

(cherry picked from commit 9a8eb5db55964c2fc7aca0db5939d8300badc9ab)

2 years agoAdd -Wno-error=unused-but-set-variable when building with Clang 13+
Dimitry Andric [Thu, 26 Aug 2021 15:36:03 +0000 (17:36 +0200)]
Add -Wno-error=unused-but-set-variable when building with Clang 13+

This warning triggers many times while building world. Downgrade it to a
warning until all occurrences have been fixed. Once the Clang warnings
have been fixed we should be able to turn it on for GCC as well. See
also f4fed768bba45a406f73ed1491d7e52fd1a8711d which did the same for the
kernel builds.

Reviewed by: arichardson, imp
Differential Revision: https://reviews.freebsd.org/D31927

(cherry picked from commit 45feade38ec3e8e30086dedc6ee81cbf816293e3)

2 years agozfs: merge openzfs/zfs@71c609852 (zfs-2.1-release) into stable/13
Martin Matuska [Sat, 18 Sep 2021 18:30:40 +0000 (20:30 +0200)]
zfs: merge openzfs/zfs@71c609852 (zfs-2.1-release) into stable/13

OpenZFS release 2.1.1

Notable upstream pull request merges:
  #11997 FreeBSD: Don't force xattr mount option
  #11997 FreeBSD: Implement xattr=sa
  #11997 FreeBSD: Use SET_ERROR to trace xattr name errors
  #12022 Fix endianness issues with zstd
  #12161 Restore FreeBSD sysctl processing for arc.min and arc.max
  #12183 Optimize small random numbers generation
  #12246 arc: Drop an incorrect assert
  #12271 Tinker with slop space accounting with dedup
  #12279 Fix ARC ghost states eviction accounting
  #12281 Move gethrtime() calls out of vdev queue lock
  #12289 Compact dbuf/buf hashes and lock arrays
  #12294 Upstream: dmu_zfetch_stream_fini leaks refcount
  #12295 Fix abd leak, kmem_free correct size of abd_t
  #12297 Avoid vq_lock drop in vdev_queue_aggregate()
  #12299 file reference counts can get corrupted
  #12300 Introduce dsl_dir_diduse_transfer_space()
  #12314 Optimize allocation throttling
  #12320 FreeBSD: Use unmapped I/O for scattered/gang ABD buffers
  #12328 FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE
  #12339 Read past end of argv array in zpool_do_import()
  #12348 Minor ARC optimizations
  #12365 Fixes in persistent L2ARC
  #12375 FreeBSD: Ignore make_dev_s() errors
  #12378 FreeBSD: Switch from MAXPHYS to maxphys on FreeBSD 13+
  #12383 Fixes for KMSAN reports
  #12397 Run arc_evict thread at higher priority
  #12398 Remove b_pabd/b_rabd allocation from arc_hdr_alloc()
  #12422 Fix/improve dbuf hits accounting
  #12428 Fix unfortunate NULL in spa_update_dspace
  #12443 Fixed data integrity issue when underlying disk returns error
  #12446 Allow disabling of unmapped I/O on FreeBSD
  #12473 Initialize parity blocks before RAID-Z reconstruction benchmarking
  #12511 Make 'zpool labelclear -f' work on offlined disks
  #12514 FreeBSD: Don't remove SA xattr if not SA znode
  #12522 Compressed receive with different ashift can result in incorrect
         PSIZE on disk
  #12535 Verify embedded blkptr's in arc_read()
  #12541 Allow sending corrupt snapshots even if metadata is corrupted

Manually included upstream 2.1 backport pull request #12573:
  #12282 FreeBSD: fix compilation of FreeBSD world after 29274c9

Obtained from: OpenZFS
OpenZFS commit: 71c6098526c6d5fbfa84a58cefe6cdc403488d8c
OpenZFS tag: zfs-2.1.1
Relnotes: yes