]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agodwc: Use mii_fdt function
Emmanuel Vadot [Sun, 11 Apr 2021 19:34:57 +0000 (21:34 +0200)]
dwc: Use mii_fdt function

Use the helper function to get phy mode and configure dwc accordingly.

Reviewed by: ian

3 years agommccam: probe*: Style(9)
Emmanuel Vadot [Fri, 23 Apr 2021 12:51:13 +0000 (14:51 +0200)]
mmccam: probe*: Style(9)

3 years agommcprobe_done: Style(9)
Emmanuel Vadot [Fri, 23 Apr 2021 12:50:04 +0000 (14:50 +0200)]
mmcprobe_done: Style(9)

3 years agodwmmc: Add \n to a debug printf
Emmanuel Vadot [Thu, 22 Apr 2021 19:41:56 +0000 (21:41 +0200)]
dwmmc: Add \n to a debug printf

3 years agommc: dwmmc: Convert driver to use the mmc_sim interface
Emmanuel Vadot [Wed, 21 Apr 2021 11:56:27 +0000 (13:56 +0200)]
mmc: dwmmc: Convert driver to use the mmc_sim interface

A lot more generic cam related things are done in mmc_sim so this simplify
the driver a lot.

Differential Revision: https://reviews.freebsd.org/D27487
Reviewed by: kibab

3 years agoallwinner: aw_mmc: Convert driver to use the mmc_sim interface
Emmanuel Vadot [Wed, 21 Apr 2021 11:54:25 +0000 (13:54 +0200)]
allwinner: aw_mmc: Convert driver to use the mmc_sim interface

A lot more generic cam related things are done in mmc_sim so this simplify
the driver a lot.

Differential Revision: https://reviews.freebsd.org/D27486
Reviewed by: imp

3 years agommccam: Add mmc_sim, a generic sim for mmc driver to use
Emmanuel Vadot [Wed, 21 Apr 2021 11:52:29 +0000 (13:52 +0200)]
mmccam: Add mmc_sim, a generic sim for mmc driver to use

This adds a generic sim that abstract a lot of what needs to be implemented
in a driver for mmccam support.
A new interface with three methods is added :

 - mmc_sim_get_tran_settings: Use to get what the controller supports in term
   of capabilities, freq etc ...
 - mmc_sim_set_tran_settings: Use to change the speed/freq/etc of the
   sdcard host controller
 - mmc_sim_cam_request: Used for MMCIO requests

Differential Revision: https://reviews.freebsd.org/D27485
Reviewed by: kibab

3 years agoConsider the broken card detect flag that comes from 'broken-cd;'
Ruslan Bukin [Tue, 27 Apr 2021 11:19:05 +0000 (12:19 +0100)]
Consider the broken card detect flag that comes from 'broken-cd;'
dts property.

This fixes operation on Intel Stratix 10 devices.

Tested on Terasic DE10-Pro.

Reviewed by: manu
Sponsored by: UKRI
Differential revision: https://reviews.freebsd.org/D29999

3 years agosctp: cleanup verification of INIT and INIT-ACK chunks
Michael Tuexen [Tue, 27 Apr 2021 10:45:14 +0000 (12:45 +0200)]
sctp: cleanup verification of INIT and INIT-ACK chunks

3 years agopf tests: Test using '<ifgroup>:network' in tables
Kristof Provost [Sun, 25 Apr 2021 10:18:48 +0000 (12:18 +0200)]
pf tests: Test using '<ifgroup>:network' in tables

MFC after: 1 week

3 years agopfctl: Revert "pfctl: Another set skip <group> fix"
Kristof Provost [Mon, 26 Apr 2021 08:07:07 +0000 (10:07 +0200)]
pfctl: Revert "pfctl: Another set skip <group> fix"

This reverts commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a.
This fix broke using '<ifgroup>:network' in tables.

MFC after: 1 week

3 years ago[fib algo] always commit static routes synchronously.
Alexander V. Chernikov [Tue, 27 Apr 2021 08:23:29 +0000 (08:23 +0000)]
[fib algo] always commit static routes synchronously.

Modular fib lookup framework features logic that allows
 route update batching for the algorithms that cannot easily
 apply the routing change without rebuilding. As a result,
 dataplane lookups may return old data until the the sync
 takes place. With the default sync timeout of 50ms, it is
 possible that new binary like ping(8) executed exactly after
 route(8) will still use the old fib data.

To address some aspects of the problem, framework executes
 all rtable changes without RTF_GATEWAY synchronously.

To fix the aforementioned problem, this diff extends sync
 execution for all RTF_STATIC routes (e.g. ones maintained by
 route(8).
This fixes a bunch of tests in the networking space.

Reported by: ci, arichardson
MFC after: 2 weeks

3 years agoFix rtsock sockaddr alignment.
Alexander V. Chernikov [Tue, 27 Apr 2021 08:04:19 +0000 (08:04 +0000)]
Fix rtsock sockaddr alignment.

b31fbebeb3 introduced alloc_sockaddr_aligned() which, in fact,
 failed to produce aligned addresses.

Reported by: Oskar Holmlund <oskar.holmlund at yahoo.com>
MFC after: immediately

3 years agoFix drace CTF for the rib_head.
Alexander V. Chernikov [Tue, 27 Apr 2021 07:47:53 +0000 (07:47 +0000)]
Fix drace CTF for the rib_head.

33cb3cb2e321 introduced an `rib_head` structure field under the
FIB_ALGO define. This may be problematic for the CTF, as some
 of the files including `route_var.h` do not have `fib_algo`
 defined.

Make dtrace happy by making the field unconditional.

Suggested by: markj

3 years agopw(8): use openmemstream instead of sbuf(9)
Baptiste Daroussin [Tue, 27 Apr 2021 03:05:13 +0000 (05:05 +0200)]
pw(8): use openmemstream instead of sbuf(9)

3 years agoMake pkg(7) use environment variables specified in pkg.conf
Moritz Schmitt [Tue, 27 Apr 2021 01:59:12 +0000 (03:59 +0200)]
Make pkg(7) use environment variables specified in pkg.conf

Modify /usr/sbin/pkg to use environment variables specified in pkg.conf.
This allows control over underlying libraries like fetch(3), which can
be configured by setting HTTP_PROXY.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29820

3 years agoClean up fsck_ffs error message output.
Kirk McKusick [Tue, 27 Apr 2021 01:42:48 +0000 (18:42 -0700)]
Clean up fsck_ffs error message output.

When fsck_ffs is creating a lost+found directory it must allocate
an inode and a filesystem block. If it encounters a cylinder group
with a bad check hash, it complains twice: once for the inode and
again for the filesystem block.

This change suppresses the second complaint.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix

3 years agonfscl: fix the handling of NFSERR_DELAY for Open/LayoutGet RPCs
Rick Macklem [Tue, 27 Apr 2021 00:48:21 +0000 (17:48 -0700)]
nfscl: fix the handling of NFSERR_DELAY for Open/LayoutGet RPCs

For a pNFS mount, the NFSv4.1/4.2 client uses compound RPCs that
have both Open and LayoutGet operations in them.
If the pNFS server were tp reply NFSERR_DELAY for one of these
compounds, the retry after a delay cannot be handled by
newnfs_request(), since there is a reference held on the open
state for the Open operation in them.

Fix this by adding these RPCs to the "don't do delay here"
list in newnfs_request().

This patch is only needed if the mount is using pNFS (the "pnfs"
mount option) and probably only matters if the MDS server
is issuing delegations as well as pNFS layouts.

Found by code inspection.

MFC after: 2 weeks

3 years agoUPDATING: add an entry for commit 875977314881
Rick Macklem [Mon, 26 Apr 2021 23:45:26 +0000 (16:45 -0700)]
UPDATING: add an entry for commit 875977314881

3 years agoMake fsck_ffs more persistent in creating a lost+found directory.
Kirk McKusick [Mon, 26 Apr 2021 23:47:27 +0000 (16:47 -0700)]
Make fsck_ffs more persistent in creating a lost+found directory.

When fsck_ffs is running in interactive mode and finds unlinked files,
it offers to either unlink them or place them in a lost+found directory.
If the lost+found directory option is requested and no lost+found
directory exists, fsck_ffs offers to create one. When creating one,
it must allocate an inode and a filesystem block. It attempts to
allocate them from the first cylinder group. If the first cylinder
group has a bad check hash, it gives up.

This change expands the search into later cylinder groups when the
first one fails with a bad check hash.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix

3 years agoparam.h: bump __FreeBSD_version for commit 875977314881
Rick Macklem [Mon, 26 Apr 2021 23:35:18 +0000 (16:35 -0700)]
param.h: bump __FreeBSD_version for commit 875977314881

Commit 875977314881 changed the internal KPI between the
nfsd and nfscommon modules, so both need to be rebuilt
from sources.

3 years agonfsd: fix the slot sequence# when a callback fails
Rick Macklem [Mon, 26 Apr 2021 23:24:10 +0000 (16:24 -0700)]
nfsd: fix the slot sequence# when a callback fails

Commit 4281bfec3628 patched the server so that the
callback session slot would be free'd for reuse when
a callback attempt fails.
However, this can often result in the sequence# for
the session slot to be advanced such that the client
end will reply NFSERR_SEQMISORDERED.

To avoid the NFSERR_SEQMISORDERED client reply,
this patch negates the sequence# advance for the
case where the callback has failed.
The common case is a failed back channel, where
the callback cannot be sent to the client, and
not advancing the sequence# is correct for this
case.  For the uncommon case where the client's
reply to the callback is lost, not advancing the
sequence# will indicate to the client that the
next callback is a retry and not a new callback.
But, since the FreeBSD server always sets "csa_cachethis"
false in the callback sequence operation, a retry
and a new callback should be handled the same way
by the client, so this should not matter.

Until you have this patch in your NFSv4.1/4.2 server,
you should consider avoiding the use of delegations.
Even with this patch, interoperation with the
Linux NFSv4.1/4.2 client in kernel versions prior
to 5.3 can result in frequent 15second delays if
delegations are enabled.  This occurs because, for
kernels prior to 5.3, the Linux client does a TCP
reconnect every time it sees multiple concurrent
callbacks and then it takes 15seconds to recover
the back channel after doing so.

MFC after: 2 weeks

3 years agocxgbe(4): Separate the sw- and hw-specific parts of resource allocations
Navdeep Parhar [Mon, 26 Apr 2021 21:03:06 +0000 (14:03 -0700)]
cxgbe(4): Separate the sw- and hw-specific parts of resource allocations

The driver uses both software resources (locks, callouts, memory for
descriptors and for bookkeeping, sysctls, etc.) and hardware resources
(VIs, DMA queues, TCAM entries, etc.) to operate the NIC.  This commit
splits the single *_ALLOCATED flag used to track all these resources
into separate *_SW_ALLOCATED and *_HW_ALLOCATED flags.

This is the simplified pseudocode that now applies to most queues (foo
can be ctrlq/txq/rxq/ofld_txq/ofld_rxq):

/* Idempotent */
alloc_foo
{
if (!SW_ALLOCATED)
init_iq/init_eq/init_fl no-fail sw init
alloc_iq_fl/alloc_eq/alloc_wrq may-fail sw alloc
add_foo_sysctls, etc. no-fail post-alloc items
if (!HW_ALLOCATED)
alloc_iq_fl_hwq/alloc_eq_hwq hw resource allocation
}

/* Idempotent */
free_foo
{
if (!HW_ALLOCATED)
free_iq_fl_hwq/free_eq_hwq release hw resources
if (!SW_ALLOCATED)
free_iq_fl/free_eq/free_wrq release sw resources
}

The routines that take the driver to FULL_INIT_DONE and VI_INIT_DONE and
back are now all idempotent.  The quiesce routines pay attention to the
HW_ALLOCATED flag and will not wait on the hardware for pidx/cidx
updates and other completions if this flag is not set.

MFC after: 1 month
Sponsored by: Chelsio Communications

3 years agosctp: improve handling of illegal packets containing INIT chunks
Michael Tuexen [Mon, 26 Apr 2021 08:38:05 +0000 (10:38 +0200)]
sctp: improve handling of illegal packets containing INIT chunks

Stop further processing of a packet when detecting that it
contains an INIT chunk, which is too small or is not the only
chunk in the packet. Still allow to finish the processing
of chunks before the INIT chunk.

Thanks to Antoly Korniltsev and Taylor Brandstetter for reporting
an issue with the userland stack, which made me aware of this
issue.

MFC after: 3 days

3 years agozfs: restore copyright disclaimer change from 4b84b4cca
Martin Matuska [Mon, 26 Apr 2021 20:03:30 +0000 (22:03 +0200)]
zfs: restore copyright disclaimer change from 4b84b4cca

The change will be pull-requested to upstream.

X-MFC-with: 4b84b4cca472e482bc22d5e5c7928be5a1393c84

3 years agopkgbase: Remove package name mangling in generate-ucl.sh
Mark Johnston [Mon, 26 Apr 2021 19:15:31 +0000 (15:15 -0400)]
pkgbase: Remove package name mangling in generate-ucl.sh

The mangling was present in the initial revision of the script, but its
purpose is not clear.  It may have been to avoid defining make(1)
variables with a dash in the name, but this is permitted.  Furthermore,
it results in invalid dependency information if a dependency's name
contains an underscore, causing e.g., libcompiler_rt-dev to depend on
libcompiler-rt, and resulting in warnings when installing base system
packages.  Remove the mangling.

Reviewed by: manu
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29883

3 years agoimgact_elf: Ensure that the return value in parse_notes is initialized
Mark Johnston [Mon, 26 Apr 2021 18:53:16 +0000 (14:53 -0400)]
imgact_elf: Ensure that the return value in parse_notes is initialized

parse_notes relies on the caller-supplied callback to initialize "res".
Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and
the latter fails to initialize res.  Fix it.

In the worst case, the bug would cause the inner loop of check_note to
examine more program headers than necessary, and the note header usually
comes last anyway.

Reviewed by: kib
Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29986

3 years agonewbus: remove support for SINGLETON
Warner Losh [Mon, 26 Apr 2021 17:04:15 +0000 (11:04 -0600)]
newbus: remove support for SINGLETON

Revert rest of de8dd262c43b since it's now unused.

jhibbits@ introduced this to give powerpc MMU functions IFUNC like
performance while retaining the kobj interface, speeding up operations
10-20%. Since there was only ever one instance of the mmu interface
active at any given time, we could cache the looked up results more
agressively.

powerpc migrated to using IFUNCs to get an even larger performance boost
in 45b69dd63e, deleting the two files it was added to in de8dd262c43b.

However, there's few, if any, other potential applications of this to
the tree today. It's now unused and undocumented. Retire it to eliminate
this wart and to preclude the need to document it. Should a simmilar
case arise in the future, the code is in git...

Discusssed with: jhibbits@
Reviewed by: jhb@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29997

3 years agoetcupdate: Add -D destdir to usage for 'extract'.
John Baldwin [Mon, 26 Apr 2021 16:49:34 +0000 (09:49 -0700)]
etcupdate: Add -D destdir to usage for 'extract'.

Reported by: Mark Millard <marklmi@yahoo.com>
MFC after: 1 week

3 years agoe1000: Fix register name in reg_dump sysctl
Kevin Bowling [Mon, 26 Apr 2021 16:30:54 +0000 (09:30 -0700)]
e1000: Fix register name in reg_dump sysctl

The correct name of this register is CTRL_EXT.

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

3 years agopf tests: Test automatically generated tables
Kristof Provost [Mon, 26 Apr 2021 09:14:44 +0000 (11:14 +0200)]
pf tests: Test automatically generated tables

Add a test case where the pfctl optimizer will generate a table
automatically. These tables have long names, which we accidentally broke
in the nvlist ADDRULE ioctl.

Reviewed by: melifaro
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29989

3 years agopf: Fix parsing of long table names
Kristof Provost [Sat, 24 Apr 2021 13:55:24 +0000 (15:55 +0200)]
pf: Fix parsing of long table names

When parsing the nvlist for a struct pf_addr_wrap we unconditionally
tried to parse "ifname". This broke for PF_ADDR_TABLE when the table
name was longer than IFNAMSIZ. PF_TABLE_NAME_SIZE is longer than
IFNAMSIZ, so this is a valid configuration.

Only parse (or return) ifname or tblname for the corresponding
pf_addr_wrap type.

This manifested as a failure to set rules such as these, where the pfctl
optimiser generated an automatic table:

pass in proto tcp to 192.168.0.1 port ssh
pass in proto tcp to 192.168.0.2 port ssh
pass in proto tcp to 192.168.0.3 port ssh
pass in proto tcp to 192.168.0.4 port ssh
pass in proto tcp to 192.168.0.5 port ssh
pass in proto tcp to 192.168.0.6 port ssh
pass in proto tcp to 192.168.0.7 port ssh

Reported by: Florian Smeets
Tested by: Florian Smeets
Reviewed by: donner
X-MFC-With: 5c11c5a3655842a176124ef2334fcdf830422c8a
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29962

3 years agolinuxkpi: Remove unneeded {} in atomic_dec_and_lock_irqsave()
Neel Chauhan [Mon, 26 Apr 2021 15:25:33 +0000 (08:25 -0700)]
linuxkpi: Remove unneeded {} in atomic_dec_and_lock_irqsave()

3 years agolinuxkpi: Elimiate brackets on return in spinlock.h
Neel Chauhan [Mon, 26 Apr 2021 15:16:48 +0000 (08:16 -0700)]
linuxkpi: Elimiate brackets on return in spinlock.h

3 years agolinuxkpi: Implement atomic_dec_and_lock_irqsave()
Neel Chauhan [Mon, 26 Apr 2021 15:15:49 +0000 (08:15 -0700)]
linuxkpi: Implement atomic_dec_and_lock_irqsave()

This is needed by the drm-kmod 5.5 update.

Reviewed by: hselasky, manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29988

3 years agolinuxkpi: Implement the wait_event_interruptible macro
Neel Chauhan [Mon, 26 Apr 2021 15:12:18 +0000 (08:12 -0700)]
linuxkpi: Implement the wait_event_interruptible macro

This is needed by the drm-kmod 5.5 update and is similar in logic to the
existing wait_event_killable macro.

Reviewed by: hselasky, manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29987

3 years agopfsync: Expose PFSYNCF_OK flag to userspace
Kristof Provost [Fri, 23 Apr 2021 12:24:59 +0000 (14:24 +0200)]
pfsync: Expose PFSYNCF_OK flag to userspace

Add 'syncok' field to ifconfig's pfsync interface output. This allows
userspace to figure out when pfsync has completed the initial bulk
import.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29948

3 years agopf tests: Test killing states with multiple labels
Kristof Provost [Wed, 21 Apr 2021 14:12:48 +0000 (16:12 +0200)]
pf tests: Test killing states with multiple labels

Now that we support having multiple labels on a rule ensure that we can
use each rule label to kill states.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29938

3 years agopf: Allow multiple labels to be set on a rule
Kristof Provost [Tue, 20 Apr 2021 09:04:48 +0000 (11:04 +0200)]
pf: Allow multiple labels to be set on a rule

Allow up to 5 labels to be set on each rule.
This offers more flexibility in using labels. For example, it replaces
the customer 'schedule' keyword used by pfSense to terminate states
according to a schedule.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29936

3 years agorc: remove the 'addswap' script.
Edward Tomasz Napierala [Mon, 26 Apr 2021 09:17:31 +0000 (10:17 +0100)]
rc: remove the 'addswap' script.

It's been unused since 268a55bc98b.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29749

3 years agosctp: small cleanup, no functional change
Michael Tuexen [Mon, 26 Apr 2021 00:56:48 +0000 (02:56 +0200)]
sctp: small cleanup, no functional change

MFC: 3 days

3 years agoe1000: Improve device name strings
Kevin Bowling [Wed, 21 Apr 2021 05:27:48 +0000 (22:27 -0700)]
e1000: Improve device name strings

This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts (this driver covers over 20 years
of silicon)

Reviewed by: erj
Approved by: markj
Sponsored by: Pink Floyd - Any Colour You Like (in kind)
Differential Revision: https://reviews.freebsd.org/D29872

3 years agoiflib: Improve mapping of TX/RX queues to CPUs
Patrick Kelsey [Mon, 26 Apr 2021 04:25:59 +0000 (00:25 -0400)]
iflib: Improve mapping of TX/RX queues to CPUs

iflib now supports mapping each (TX,RX) queue pair to the same CPU
(default), to separate CPUs, or to a pair of physical and logical CPUs
that share the same L2 cache.  The mapping mechanism supports unequal
numbers of TX and RX queues, with the excess queues always being
mapped to consecutive physical CPUs.  When the platform cannot
distinguish between physical and logical CPUs, all are treated as
physical CPUs.  See the comment on get_cpuid_for_queue() for the
entire matrix.

The following device-specific tunables influence the mapping process:
dev.<device>.<unit>.iflib.core_offset       (existing)
dev.<device>.<unit>.iflib.separate_txrx     (existing)
dev.<device>.<unit>.iflib.use_logical_cores (new)

The following new, read-only sysctls provide visibility of the mapping
results:
dev.<device>.<unit>.iflib.{t,r}xq<n>.cpu

When an iflib driver allocates TX softirqs without providing reference
RX IRQs, iflib now binds those TX softirqs to CPUs using the above
mapping mechanism (that is, treats them as if they were TX IRQs).
Previously, such bindings were left up to the grouptaskqueue code and
thus fell outside of the iflib CPU mapping strategy.

Reviewed by: kbowling
Tested by: olivier, pkelsey
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D24094

3 years agozfs: fix non-functional mismerges from vendor/openzfs
Martin Matuska [Mon, 26 Apr 2021 01:05:13 +0000 (03:05 +0200)]
zfs: fix non-functional mismerges from vendor/openzfs

- fix copyright in module/os/freebsd/spl/spl_acl.c
- fix mismerge in non-processed module/os/linux/zfs/zfs_uio.c

MFC after:      3 days
Obtained from:  OpenZFS

3 years agonfscl: return delegations in the NFS VOP_RECLAIM()
Rick Macklem [Mon, 26 Apr 2021 00:57:55 +0000 (17:57 -0700)]
nfscl: return delegations in the NFS VOP_RECLAIM()

After a vnode is recycled it can no longer be
acquired via vfs_hash_get() and, as such,
a delegation for the vnode cannot be recalled.

In the unlikely event that a delegation still
exists when the vnode is being recycled, return
the delegation since it will no longer be
recallable.

Until you have this patch in your NFSv4 client,
you should consider avoiding the use of delegations.

MFC after: 2 weeks

3 years agoRevert "Add workaround for a QoS-related bug in VMWare Workstation."
Ed Maste [Sun, 25 Apr 2021 21:14:23 +0000 (17:14 -0400)]
Revert "Add workaround for a QoS-related bug in VMWare Workstation."

This reverts commit 77c2fe20df6a9a7c1a353e1a4ab2ba80fefab881.

The VMware Workstation issue was fixed in 2019[1], and we'd rather not
carry unnecessary local changes in OpenSSH.

[1] https://communities.vmware.com/t5/VMware-Workstation-Pro/Regression-ssh-results-in-broken-pipe-upon-connecting-in-Vmware/m-p/486105/highlight/true#M25470

PR: 234426
Discussed with: yuripv
Approved by: des
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agonfscl: fix delegation recall when the file is not open
Rick Macklem [Sun, 25 Apr 2021 19:52:48 +0000 (12:52 -0700)]
nfscl: fix delegation recall when the file is not open

Without this patch, if a NFSv4 server recalled a
delegation when the file is not open, the renew
thread would block in the NFS VOP_INACTIVE()
trying to acquire the client state lock that it
already holds.

This patch fixes the problem by delaying the
vrele() call until after the client state
lock is released.

This bug has been in the NFSv4 client for
a long time, but since it only affects
delegation when recalled due to another
client opening the file, it got missed
during previous testing.

Until you have this patch in your client,
you should avoid the use of delegations.

MFC after: 2 weeks

3 years agoFix NOINET[6],!VIMAGE builds after FIB_ALGO addition to GENERIC
Alexander V. Chernikov [Wed, 21 Apr 2021 04:52:38 +0000 (05:52 +0100)]
Fix NOINET[6],!VIMAGE builds after FIB_ALGO addition to GENERIC

Reported by: jbeich
PR: 255390

3 years agoAdd code examples to cpuset(2), and improve cross referencing.
Robert Watson [Sun, 25 Apr 2021 14:22:00 +0000 (15:22 +0100)]
Add code examples to cpuset(2), and improve cross referencing.

MFC after: 1 week
Reviewed by: jeff, jrtc27, kevans, bcr (manpages)
Differential revision: https://reviews.freebsd.org/D27803

3 years agokern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW
Edward Tomasz Napierala [Sun, 25 Apr 2021 13:13:02 +0000 (14:13 +0100)]
kern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW

This makes this API match other kern_xxxat() functions.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29776

3 years agorc: improve dependencies for growfs
Edward Tomasz Napierala [Sun, 25 Apr 2021 12:41:36 +0000 (13:41 +0100)]
rc: improve dependencies for growfs

Previously it depended on sysctl, which itself has no dependencies,
so rcorder(8) had a bit too much flexibility when choosing when to run
it.  Make sure it runs just between 'fsck' and 'root'.

Reviewed By: jmg, imp
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29748

3 years agoFix NOINET[6] build after enabling FIB_ALGO in GENERIC.
Alexander V. Chernikov [Wed, 21 Apr 2021 01:45:49 +0000 (02:45 +0100)]
Fix NOINET[6] build after enabling FIB_ALGO in GENERIC.

Submitted by: jbeich
PR: 255389

3 years ago[fib algo] Do not print algo attach/detach message on boot
Alexander V. Chernikov [Sun, 25 Apr 2021 08:51:57 +0000 (08:51 +0000)]
[fib algo] Do not print algo attach/detach message on boot

MFC after: 1 day

3 years agoMake gcc happy by initializing error in rib_handle_ifaddr_info().
Alexander V. Chernikov [Sun, 25 Apr 2021 08:44:20 +0000 (08:44 +0000)]
Make gcc happy by initializing error in rib_handle_ifaddr_info().

3 years agoFix build with gcc
Stefan EĂźer [Sun, 25 Apr 2021 08:15:17 +0000 (10:15 +0200)]
Fix build with gcc

Correctly declare function without arguments as f(void) instead of f().

3 years agoMerge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'
Stefan EĂźer [Sun, 25 Apr 2021 06:42:31 +0000 (08:42 +0200)]
Merge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'

usr.bin/bc: update to version 4.0.1

This update adds a flush() of the output buffer to the bc print command.

3 years agoVendor import of Gavin D. Howards bc version 4.0.1
Stefan EĂźer [Sun, 25 Apr 2021 06:36:50 +0000 (08:36 +0200)]
Vendor import of Gavin D. Howards bc version 4.0.1

3 years agoAdd FIB_ALGO to GENERIC on amd64/arm64.
Alexander V. Chernikov [Sat, 24 Apr 2021 23:05:04 +0000 (23:05 +0000)]
Add FIB_ALGO to GENERIC on amd64/arm64.

Option `FIB_ALGO` gates new modular fib lookup functionality,
 enabling more performant routing table lookups and improving
 control plane convergence under the load.

Detailed feature description is available in D27401.

Reviewed By: olivier, gnn
Differential Revision: https://reviews.freebsd.org/D28434

3 years ago[rtsock] Enforce netmask/RTF_HOST consistency.
Alexander V. Chernikov [Fri, 23 Apr 2021 21:53:47 +0000 (21:53 +0000)]
[rtsock] Enforce netmask/RTF_HOST consistency.

Traditionally we had 2 sources of information whether the
 added/delete route request targets network or a host route:
netmask (RTA_NETMASK) and RTF_HOST flag.

The former one is tricky: netmask can be empty or can explicitly
 specify the host netmask. Parsing netmask sockaddr requires per-family
 parsing and that's what rtsock code traditionally avoided. As a result,
 consistency was not enforced and it was possible to specify network with
 the RTF_HOST flag and vice versa.

Continue normalization efforts from D29826 and D29826 and ensure that
 RTF_HOST flag always reflects host/network data from netmask field.

Differential Revision: https://reviews.freebsd.org/D29958
MFC after: 2 days

3 years agoImprove debugging output on routing tests failure.
Alexander V. Chernikov [Fri, 23 Apr 2021 21:28:38 +0000 (21:28 +0000)]
Improve debugging output on routing tests failure.

Most of the routing tests create per-test VNET, making
 it harder to repeat the failure with CLI tools.
Provide an additional route/nexthop data on failure.

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

3 years agotcp: fix man page
Michael Tuexen [Sat, 24 Apr 2021 20:31:36 +0000 (22:31 +0200)]
tcp: fix man page

Reviewed by: gbe, rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D29963

3 years agoSupport run-time configuration of the PIPE_MINDIRECT threshold.
Robert Watson [Sat, 2 Jan 2021 16:42:28 +0000 (16:42 +0000)]
Support run-time configuration of the PIPE_MINDIRECT threshold.
PIPE_MINDIRECT determines at what (blocking) write size one-copy
optimizations are applied in pipe(2) I/O.  That threshold hasn't
been tuned since the 1990s when this code was originally
committed, and allowing run-time reconfiguration will make it
easier to assess whether contemporary microarchitectures would
prefer a different threshold.

(On our local RPi4 baords, the 8k default would ideally be at least
32k, but it's not clear how generalizable that observation is.)

MFC after: 3 weeks
Reviewers: jrtc27, arichardson
Differential Revision: https://reviews.freebsd.org/D29819

3 years agohkbd: Fix typo which disables keyboard input in kdb
Vladimir Kondratyev [Sat, 24 Apr 2021 18:49:27 +0000 (21:49 +0300)]
hkbd: Fix typo which disables keyboard input in kdb

Reported by: Greg V
MFC after: 1 week

3 years agolinux: make ptrace(2) return EIO when trying to peek invalid address
Edward Tomasz Napierala [Sat, 24 Apr 2021 10:37:06 +0000 (11:37 +0100)]
linux: make ptrace(2) return EIO when trying to peek invalid address

Previously we've returned the error from native ptrace(2), ENOMEM.
This confused Linux strace(2).

Reviewed By: emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29925

3 years agoAllow the tcp_lro_flush_all() function to be called when the control
Hans Petter Selasky [Sat, 24 Apr 2021 10:20:33 +0000 (12:20 +0200)]
Allow the tcp_lro_flush_all() function to be called when the control
structure is zeroed, by setting the VNET after checking the mbuf count
for zero. It appears there are some cases with early interrupts on some
network devices which still trigger page-faults on accessing a NULL "ifp"
pointer before the TCP LRO control structure has been initialized.
This basically preserves the old behaviour, prior to
9ca874cf740ee68c5742df8b5f9e20910085c011 .

No functional change.

Reported by: rscheff@
Differential Revision: https://reviews.freebsd.org/D29564
MFC after: 2 weeks
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agompr/mps(4): Make device mapping some more robust.
Alexander Motin [Sat, 24 Apr 2021 03:18:01 +0000 (23:18 -0400)]
mpr/mps(4): Make device mapping some more robust.

Allow new enclosure to replace previously existing one if there is
no completely unused table entry, same as it is done for devices.

If we can not process DPM due to corruption -- wipe it and restart
from scratch.  Otherwise I don't see a way to recover persistence if
something go wrong and there is no BIOS to recover it for us.

Together this solves a problem that appeared when 9300-8i firmware
update to 16.00.10.00 somehow switched its mapping mode from Device
Persistence to Enclosure/Slot without wiping the DPM table.  It made
HBA completely unusable, since overflowed and conflicting mapping
table was unable to map any of enclosures and so devices.

Also while there make some enclosure mapping errors more informative.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

3 years agosound(4): fixing panic for INVARIANTS kernel
Tai-hwa Liang [Thu, 22 Apr 2021 12:45:18 +0000 (12:45 +0000)]
sound(4): fixing panic for INVARIANTS kernel

3e7bae08210e0 turns the BUS_READ_IVAR() failure from a warning into a
KASSERT.  For certain PCI audio devices such like snd_csa(4) and
snd_emu10kx(4), the ac97_create() keeps the device handler generated
by device_add_child(pci_dev, "pcm"), which is not really a PCI device
handler.  This in turn causes the subsequent pci_get_subdevice()
inside ac97_initmixer() triggering a panic.

This patch tries to put a bandaid for the aforementioned pcm device
children such that they can use the correct PCI handler(from parent)
to avoid a KASSERT panic in the INVARIANTS kernel.

Tested with: snd_csa(4), snd_ich(4), snd_emu10kx(4)
Reviewed by: imp
MFC after: 1 month

3 years agonfsd: fix session slot handling for failed callbacks
Rick Macklem [Fri, 23 Apr 2021 22:24:47 +0000 (15:24 -0700)]
nfsd: fix session slot handling for failed callbacks

When the NFSv4.1/4.2 server does a callback to a client
on the back channel, it will use a session slot in the
back channel session. If the back channel has failed,
the callback will fail and, without this patch, the
session slot will not be released.
As more callbacks are attempted, all session slots
can become busy and then the nfsd thread gets stuck
waiting for a back channel session slot.

This patch frees the session slot upon callback
failure to avoid this problem.

Without this patch, the problem can be avoided by leaving
delegations disabled in the NFS server.

MFC after: 2 weeks

3 years agoopenssh: add a note about pushing vendor updates
Ed Maste [Fri, 23 Apr 2021 19:35:40 +0000 (15:35 -0400)]
openssh: add a note about pushing vendor updates

Sponsored by: The FreeBSD Foundation

3 years agocxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time.
Navdeep Parhar [Fri, 23 Apr 2021 19:17:54 +0000 (12:17 -0700)]
cxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agoetcupdate: Remove the old pre-world tree when rotating for -p.
John Baldwin [Fri, 23 Apr 2021 16:40:04 +0000 (09:40 -0700)]
etcupdate: Remove the old pre-world tree when rotating for -p.

This fixes a bug in an earlier change to move tree rotation to
the end of the update where the step to make room for the new
preworld tree was deleting the old "current" tree instead of
the old "preworld" tree.

Reported by: olivier, dhw
Fixes: 0611aec3cf3a373e6a06f103699dbc91c3d6d472
MFC after: 2 weeks

3 years agodtrace tests: Fix tst.system.d after ping/ping6 unification
Mark Johnston [Fri, 23 Apr 2021 14:28:09 +0000 (10:28 -0400)]
dtrace tests: Fix tst.system.d after ping/ping6 unification

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoRe-enable network ioctls in capability mode
Mark Johnston [Fri, 23 Apr 2021 13:14:42 +0000 (09:14 -0400)]
Re-enable network ioctls in capability mode

This reverts a portion of 274579831b61 ("capsicum: Limit socket
operations in capability mode") as at least rtsol and dhcpcd rely on
being able to configure network interfaces while in capability mode.

Reported by: bapt, Greg V
Sponsored by: The FreeBSD Foundation

3 years agoCorrectly skip rtsock_l3 test when if_epair is not available
Alex Richardson [Fri, 23 Apr 2021 10:21:28 +0000 (11:21 +0100)]
Correctly skip rtsock_l3 test when if_epair is not available

This logic was accidentally changed in 67f2f67fc8ce8484066e95dabac5af892888fca1

Reported By: olivier
X-MFC-With: 67f2f67fc8ce8484066e95dabac5af892888fca1
Tested By: kp
Reviewed By: kp, melifaro
Fixes: 67f2f67fc8ce ("Update rtsock_l3 test after 2fe5a79425c7")
Differential Revision: https://reviews.freebsd.org/D29944

3 years agoiflib: initialize LRO unconditionally
Andrew Gallatin [Fri, 23 Apr 2021 09:51:22 +0000 (05:51 -0400)]
iflib: initialize LRO unconditionally

Changes to the LRO code have exposed a bug in iflib where devices
which are not capable of doing LRO are still calling
tcp_lro_flush_all(), even when they have not initialized the LRO
context. This used to be mostly harmless, but the LRO code now sets
the VNET based on the ifp in the lro context and will try to access it
through a NULL ifp resulting in a panic at boot.

To fix this, we unconditionally initializes LRO so that we have a
valid LRO context when calling tcp_lro_flush_all(). One alternative is
to check the device capabilities before calling tcp_lro_flush_all() or
adding a new state flag in the ctx. However, it seems unwise to add an
extra, mostly useless test for higher performance devices when we can
just initialize LRO for all devices.

Reviewed by: erj, hselasky, markj, olivier
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29928

3 years agocxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.
Navdeep Parhar [Fri, 23 Apr 2021 07:26:47 +0000 (00:26 -0700)]
cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.

It can be called to (re)apply the settings in the driver softc to the
hardware.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agocxgbe(4): Add flag to reliably stop the driver from accessing hw stats.
Navdeep Parhar [Fri, 23 Apr 2021 00:45:52 +0000 (17:45 -0700)]
cxgbe(4): Add flag to reliably stop the driver from accessing hw stats.

There are two kinds of routines in the driver that read statistics from
the hardware: the cxgbe_* variants read the per-port MPS/MAC registers
and the vi_* variants read the per-VI registers.  They can be called
from the 1Hz callout or if_get_counter.  All stats collection now takes
place under the callout lock and there is a new flag to indicate that
these routines should not access any hardware register.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agolibkiconv: address memory leak in not-found cases
Ed Maste [Wed, 21 Apr 2021 17:45:27 +0000 (13:45 -0400)]
libkiconv: address memory leak in not-found cases

Found in "Understanding and Detecting Disordered Error Handling with
Precise Function Pairing" by Qiushi Wu et al.

Reviewed by: imp, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29896

3 years agocxgbe(4): Fix minor nit in the display of MPS TCAM entries.
Navdeep Parhar [Thu, 22 Apr 2021 22:36:51 +0000 (15:36 -0700)]
cxgbe(4): Fix minor nit in the display of MPS TCAM entries.

MFC after: 3 days

3 years agocxgbe(4): make the logging helpers a little more robust.
Navdeep Parhar [Thu, 22 Apr 2021 22:28:43 +0000 (15:28 -0700)]
cxgbe(4): make the logging helpers a little more robust.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agohv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.
Vladimir Kondratyev [Thu, 22 Apr 2021 22:13:25 +0000 (01:13 +0300)]
hv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.

Reported by: olivier
MFC with: e4643aa4c4ff

3 years agocxgbe/t4_tom: Implement tod_pmtu_update.
Navdeep Parhar [Tue, 13 Apr 2021 23:31:08 +0000 (16:31 -0700)]
cxgbe/t4_tom: Implement tod_pmtu_update.

tod_pmtu_update was added to the kernel in 01d74fe1ffc.

Sponsored by: Chelsio Communications

3 years agonewvers.sh: better regexp for the FreeBSD_version line
Warner Losh [Thu, 22 Apr 2021 16:43:43 +0000 (10:43 -0600)]
newvers.sh: better regexp for the FreeBSD_version line

Tested with: cirrus-ci https://cirrus-ci.com/build/6012323274948608
Reviewed by: emaste@, rgrimes@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29869

3 years agostats.7: Add dwatch(1) to the list
Fernando ApesteguĂ­a [Thu, 22 Apr 2021 13:54:45 +0000 (15:54 +0200)]
stats.7: Add dwatch(1) to the list

PR: 255303
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D29924

3 years agopvscsi: Advertise maxio of 256k.
Warner Losh [Wed, 21 Apr 2021 18:10:42 +0000 (12:10 -0600)]
pvscsi: Advertise maxio of 256k.

While the PV SCSI SG list can handle 512k of SG entries, it can only do
so for I/O that's aligned to 4k or better. newfs_msdos does unaligned
I/O, so triggers too long for host errors in cam when a 512k I/O is
attempted. Prefer power of 2 256k to the absolute maximum 508k, though
that can be revisited should the latter show to give significant
performance improvement.

MFC After: 3 days
Tested by: darius on discord (508k version of patch)
Sponsored by: Netflix

3 years agobhyve: Gracefully handle virtio-scsi with no conf
Ryan Moeller [Thu, 22 Apr 2021 16:06:08 +0000 (12:06 -0400)]
bhyve: Gracefully handle virtio-scsi with no conf

Fixes segfault with the command `bhyve -s 0,virtio-scsi`, which is used
by some third party software to probe bhyve for virtio-scsi support.

Reviewed by: jhb
MFC after: 1 day
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29926

3 years agozfs: use vn_seqc_read_notmodify for racing .. lookups
Mateusz Guzik [Thu, 22 Apr 2021 13:18:39 +0000 (13:18 +0000)]
zfs: use vn_seqc_read_notmodify for racing .. lookups

Catching an in-flight unlocked vnode is fine here.

Reported by; pho

3 years agoocs_fc: Fix memory leak in ocs_scsi_io_alloc()
Ram Kishore Vegesna [Mon, 19 Apr 2021 15:40:59 +0000 (21:10 +0530)]
ocs_fc: Fix memory leak in ocs_scsi_io_alloc()

PR: 254690
Approved by: mav(mentor)
MFC after: 2 weeks

3 years agoAdd more USB quirks for Kingston devices.
Hans Petter Selasky [Thu, 22 Apr 2021 10:40:17 +0000 (12:40 +0200)]
Add more USB quirks for Kingston devices.

PR: 253855
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd more USB quirks for Garmin devices.
Hans Petter Selasky [Thu, 22 Apr 2021 10:31:33 +0000 (12:31 +0200)]
Add more USB quirks for Garmin devices.
Sort the Garmin products while at it.

PR: 254664
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoRemove USB device ID added by SVN r150701 in the CDC USB ethernet driver.
Hans Petter Selasky [Thu, 22 Apr 2021 10:22:39 +0000 (12:22 +0200)]
Remove USB device ID added by SVN r150701 in the CDC USB ethernet driver.
Since then, the FreeBSD USB stack has got proper USB RNDIS support.

PR: 254345
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years ago__FreeBSD_version: update the references to the doc tree
Ka Ho Ng [Thu, 22 Apr 2021 09:36:22 +0000 (17:36 +0800)]
__FreeBSD_version: update the references to the doc tree

Update the reference of which file to update in the doc tree when
bumping __FreeBSD_version.

This change is to catch up with commit f8fed61b80 in the doc repository.

MFC after: 3 days
Approved by: lwhsu (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29920

3 years agoFix vtnet TCP lro panic
Alexander V. Chernikov [Mon, 19 Apr 2021 15:58:41 +0000 (16:58 +0100)]
Fix vtnet TCP lro panic

Differential Revision: https://reviews.freebsd.org/D29900
Reviewed by: hps, kp

3 years agonewbus: style nit (align comments)
Warner Losh [Sun, 18 Apr 2021 05:44:25 +0000 (23:44 -0600)]
newbus: style nit (align comments)

Sponsored by: Netflix

3 years agonewbus: Optimize/Simplify kobj_class_compile_common a little
Warner Losh [Wed, 21 Apr 2021 21:35:54 +0000 (15:35 -0600)]
newbus: Optimize/Simplify kobj_class_compile_common a little

"i" is not used in this loop at all. There's no need to initialize and
increment it.

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

3 years agoriscv: Assert that SUM is not set in SSTATUS for exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:20 +0000 (13:57 -0700)]
riscv: Assert that SUM is not set in SSTATUS for exceptions.

Reviewed by: mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29764

3 years agoriscv: Clear SUM in SSTATUS for supervisor mode exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:04 +0000 (13:57 -0700)]
riscv: Clear SUM in SSTATUS for supervisor mode exceptions.

Previously, a page fault taken during copyin/out and related functions
would run the entire fault handler while permitting direct access to
user addresses.  This could also leak across context switches (e.g. if
the page fault handler was preempted by an interrupt or slept for disk
I/O).

To fix, clear SUM in assembly after saving the original version of
SSTATUS in the supervisor mode trapframe.

Reviewed by: mhorne, jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29763

3 years agopmcstat: fix the usage message for -t
Mitchell Horne [Wed, 21 Apr 2021 20:44:52 +0000 (17:44 -0300)]
pmcstat: fix the usage message for -t

A slight mix-up of the flags means this case isn't triggered when it
should be. Now, `pmcstat -s event -t 1234` will print the correct
error message.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agopmcstat: set initial counter value to zero
Mitchell Horne [Wed, 21 Apr 2021 20:28:12 +0000 (17:28 -0300)]
pmcstat: set initial counter value to zero

For an infrequent event, pmcstat may report (u_long)-1 for CPUs where
the counter was never incremented. Just set this to zero, instead.

ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but
this wasn't always the case.

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

3 years agopmc_allocate(3): document the count argument
Mitchell Horne [Wed, 21 Apr 2021 20:27:49 +0000 (17:27 -0300)]
pmc_allocate(3): document the count argument

This was added in b2ca2e50b9aa, and serves to provide an initial value
to the PMC, eliminating the need for a second syscall via pmc_set(3).

Reviewed by: gnn, 0mp (manpages)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29885