Commit Graph

272138 Commits

Author SHA1 Message Date
Wolfram Schneider
1536d37b20 fix casting issue in error message for 32bit CPUs (e.g. armv7) 2022-01-31 18:30:07 +00:00
Kristof Provost
6f47a72d8e libpfctl: fix pfctl_kill_states()
735748f30a changed the output of the states so that the creator id
endianness would be consistent. This means that we need to convert the
host endianness creatorid back to big-endian before we give it to the
kernel.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-01-31 19:13:26 +01:00
Wolfram Schneider
d7e8005bfa cleanup documentation 2022-01-31 18:11:14 +00:00
Wolfram Schneider
00ad40d70a throw an error if reading from stdin failed 2022-01-31 18:04:45 +00:00
Wolfram Schneider
834a8fa169 enable to configure the locate path length at compile time
The length has not changed and is 1024 chars (equals PATH_MAX).

PR: 201243
Submitted by: Willem Jan Withagen <wjw@digiware.nl>
2022-01-31 17:32:46 +00:00
Wolfram Schneider
8d35ca86c5 Fix statistics for empty databases
An empty database is a database which does not contain any filenames.
It should not occur in practice but maybe in the case of an error.

echo | /usr/libexec/locate.mklocatedb > empty.db; locate -d empty.db -S
2022-01-31 17:03:08 +00:00
Konstantin Belousov
90be4091a7 insmntque(9): update and correct man page
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D34071
2022-01-31 16:51:05 +02:00
Konstantin Belousov
66c5fbca77 insmntque1(): remove useless arguments
Also remove once-used functions to clean up after failed insmntque1(),
which were destructor callbacks in previous life.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D34071
2022-01-31 16:49:08 +02:00
Wolfram Schneider
69ae5b9667 remove register
There are no measurable performance differences if registers are used or not.
2022-01-31 10:59:07 +00:00
Kornel Duleba
1a6d987b7f enetc: Wait for pending transmissions before disabling TX queues
According to the RM it's not safe to disable a TX ring while it is busy
transmitting frames.
In order to be safe wait until the ring is empty. (cidx==pidx)
Use this opportunity to remove a set-but-unused variable.

Obtained from: Semihalf
Sponsored by: Alstom Group
2022-01-31 08:57:48 +01:00
Kornel Duleba
a6bda3e1ef enetc: Simply TX ring credits counting logic
According to the RM rings can hold at most ring_size - 1 descriptors at any time.
No additional logic is needed since iflib already respects this constrain.
Thanks to that the pidx == cidx situation is not ambiguous and indicates an
empty ring.
Use that to simplify the logic that calculates the amount of processed frames.

Obtained from: Semihalf
Sponsored by: Alstom Group
2022-01-31 08:57:48 +01:00
Kornel Duleba
f485d733e8 enetc: Disable HW IP packet alignment
The NIC can IP align received packets.
It was observed that it caused some rare stalls, that required full board reset.
Disable this feature for now. It doesn't provide any significant performance
improvement anyway.

Obtained from: Semihalf
Sponsored by: Alstom Group
2022-01-31 08:57:48 +01:00
Konstantin Belousov
8d8589b385 ufs: be more persistent with finishing some operations
when the vnode is doomed after relock.  The mere fact that the vnode is
doomed does not prevent us from doing UFS operations on it while it is
still belongs to UFS, which is determined by non-NULL v_data.  Not
finishing some operations, e.g. not syncing the inode block only because
the vnode started reclamation, is not correct.

Add macro IS_UFS() which incapsulates the v_data != NULL, and use it
instead of VN_IS_DOOMED() for places where the operation completion is
important.

Reviewed by:	markj, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
2022-01-31 04:46:21 +02:00
Konstantin Belousov
4559700a0a ffs_snapblkfree(): add a comment explaining lockmgr invocation
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
2022-01-31 04:46:21 +02:00
Konstantin Belousov
0cdc603308 ufs: Use IS_SNAPSHOT()
Reviewed by:	markj, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
2022-01-31 04:46:21 +02:00
Konstantin Belousov
3d68c4e175 syncer VOP_FSYNC(): unlock syncer vnode around call to VFS_SYNC()
The lock is unneccessary since the mount point is busied, which prevents
unmount and syncer vnode deallocation.  Having the vnode locked causes
innocent LoRs and complicates debugging.

Also stop starting write accounting around it.  Any caller of
VOP_FSYNC() must do it already, and sync_vnode() does.

Reported and tested by:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
2022-01-31 04:46:21 +02:00
Konstantin Belousov
5875b94c74 buf_alloc(): lock the buffer with LK_NOWAIT
The buffer must not be accessed by any other thread, it is freshly
allocated.  As such, LK_NOWAIT should be nop but also it prevents
recording the order between the buffer lock and any other locks we might
own in the call to getnewbuf().  In particular, if we own FFS snap lock,
it should avoid triggering false positive warning.

Reviewed by:	markj, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
2022-01-31 04:46:21 +02:00
Konstantin Belousov
531f8cfea0 Use dedicated lock name for pbufs
Also remove a pointer to array variable, use array address directly.

Reviewed by:	markj, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
2022-01-31 04:46:14 +02:00
Konstantin Belousov
9cd59de2e1 ext2fs: remove remnants of the UFS snapshot code
Noted and reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34095
2022-01-31 04:37:16 +02:00
Kirk McKusick
85f7e9a4f0 In GEOM debugging output, show consumer for cloned and duplicated bio's.
When using bio's created by g_clone_bio() or g_duplicate_bio()
their consumer device (the device to which their I/O requests
are sent) is listed by the geom debugging facility as [unknown].
If available, this update lists the consumer associated with
the bio's parent.

MFC after:    2 weeks
Sponsored by: Netflix
2022-01-30 17:21:13 -08:00
Gregory Neil Shapiro
e58d0869c6 Update commit instructions. Still more TBD as I plan out the first
git-based vendor import.
2022-01-30 22:20:12 +00:00
Ed Maste
42818aba8d ObsoleteFiles: move libelf.so.2 to MOVED_LIBS
5a536241ea moved it from /usr/lib to /lib.  This case is now handled
using MOVED_LIBS.

Reported by:	dim
Sponsored by:	The FreeBSD Foundation
2022-01-30 16:35:02 -05:00
Dimitry Andric
fdf2784101 Apply clang fix for assertion failure compiling science/chrono
Merge commit 6b0f35931a44 from llvm git (by Jennifer Yu):

  Fix signal during the call to checkOpenMPLoop.

  The root problem is a null pointer is accessed during the call to
  checkOpenMPLoop, because loop up bound expr is an error expression
  due to error diagnostic was emit early.

  To fix this, in setLCDeclAndLB, setUB and setStep instead return false,
  return true when LB, UB or Step contains Error, so that the checking is
  stopped in checkOpenMPLoop.

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

Note this only fixes the assertion reported in bug 261567; some other
tweaks for port dependencies are probably still required to make it
build to completion.

PR:		261567
MFC after:	3 days
2022-01-30 21:41:37 +01:00
Wolfram Schneider
33ee87fa0a improve error handling for corrupt database 2022-01-30 18:04:52 +00:00
Wolfram Schneider
5260fbcebd fix check for integer
For historical reasons, the integer is stored with an offset of plus 14.
That means, for a given max path length of 1024 the valid values
are -1009 .. 1037 and not -1023 .. 1023

PR: 201243
2022-01-30 16:27:27 +00:00
Wolfram Schneider
e7d6783f4a enable to set locate command 2022-01-30 16:24:49 +00:00
Wolfram Schneider
8e7c0a6d32 fix fgets error handling (from last commit) 2022-01-30 13:08:42 +00:00
Wolfram Schneider
72a0982cd5 improve error handling 2022-01-30 09:27:21 +00:00
Jason A. Harmening
a01ca46b9b unionfs: use VV_ROOT to check for root vnode in unionfs_lock()
This avoids a potentially wild reference to the mount object.
Additionally, simplify some of the checks around VV_ROOT in
unionfs_nodeget().

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D33914
2022-01-29 22:38:44 -06:00
Alexander Motin
67c58cd729 GEOM: Remove g_wait_sim.
It seems never been used since addition.
2022-01-29 22:12:43 -05:00
Alexander Motin
10ae42ccbd GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers.
All I/O requests through the taste consumers are synchronous, done
with g_read_data() and without any locks held.  It makes no sense
to delegate the I/O to g_down/g_up threads.

This removes many of context switches during disk retaste.

MFC after:	2 weeks
2022-01-29 21:59:03 -05:00
Chuck Tuffli
ac678b4aaf bhyve nvme: Fix Identify Namespace, NSID=ffffffff
If the NVMe Controller doesn't support Namespace Management, it should
return "Invalid Namespace or Format" when the Host request Identify
Namespace with the global NSID value.

Fixes UNH IOL 16.0 Test 9.1, Case 6

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33578
2022-01-29 23:11:14 -08:00
Chuck Tuffli
fa263c532b bhyve nvme: Fix Set Features, AEN
NVMe Controllers which do not support Endurance Groups must return an
error when the Endurance Group Event Aggregate Log Change Notices bit is
set in Set Features, Asynchronous Event Configuration.

Fixes UNH IOL Test 3.12, Case 8

Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33577
2022-01-29 23:10:59 -08:00
Chuck Tuffli
ff5ed0fac4 bhyve nvme: Fix reported VWC value
v1.4 and later NVMe Controllers report "Flush all Namespaces" support
differently.

Fixes UNH IOL 16.0 Test 2.6, Case 3

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33576
2022-01-29 23:10:42 -08:00
Chuck Tuffli
9d8cd04694 bhyve nvme: Fix LBA out-of-range calculation
The function which checks for a valid LBA range mistakenly named an
input value as NLB ("Number of Logical Blocks") instead of "number of
blocks". The NVMe specification defines NLB as a zero-based value (i.e.
NLB=0x0 represents 1 block, 0x1 is 2 blocks, etc.), but the passed
parameter is a 1's-based value.

Fix is to rename the variable to avoid future confusion.

While in the neighborhood, also check that the starting LBA is less than
the size of the backing storage to avoid an integer overflow.

Reviewed by:	imp, allanjude, jhb
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33575
2022-01-29 23:09:57 -08:00
Chuck Tuffli
073f2076fe bhyve nvme: Add Select support to Get Features
Implement basic support for the SEL field of Get Features. This returns
information about Namespace Specific features.

Fixes UNH ILO 16.0 Test 1.2, Case 13

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33574
2022-01-29 23:09:35 -08:00
Chuck Tuffli
29241c96f7 bhyve nvme: Update v1.4 Identify Controller data
Compliant v1.4 Controllers must report a Controller Type (CNTRLTYPE).
Also, do not advertise secure erase functionality in the Format NVM
Attributes field of the Identify Controller data structure as the
Controller does not implement secure erase.

Fixes UNH ILO Test 1.1, Case 2

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33573
2022-01-29 23:09:10 -08:00
Chuck Tuffli
ea9ee35583 bhyve nvme: Add Temperature Threshold support
This adds the ability for a guest OS to send Set / Get Feature,
Temperature Threshold commands. The implementation assumes a constant
temperature and will generate an Asynchronous Event Notification if the
specified threshold is above/below this value. Although the
specification allows 9 temperature values, this implementation only
implements the Composite Temperature.

While in the neighborhood, move the clear of the CSTS register in the
reset function after all other cleanup. This avoids a race with the
guest thinking the reset is complete (i.e. CSTS.RDY = 0) before the NVMe
emulation is actually complete with the reset.

Fixes UNH IOL 16.0 Test 1.7, cases 1, 2, and 4.

Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33572
2022-01-29 23:08:47 -08:00
Chuck Tuffli
1381a11829 bhyve nvme: Fix Set Features
Be more conservative and only support the Features mandatory for an I/O
Controller.

Avoids a "hang" in UNH test 1.2.10 associated with Predictable Latency
Mode Configuration and Host Behavior Support features.

Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33571
2022-01-29 23:07:44 -08:00
Chuck Tuffli
45ab4076f3 bhyve nvme: Remove redundant AER Limit checks
The NVMe emulation checked if the Asynchronous Event Request Limit
(a.k.a AERL) would be exceeded in pci_nvme_aer_add(), but this function
is only called from nvme_opc_async_event_req() which also checks for
exceeding the AERL.

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33570
2022-01-29 23:07:29 -08:00
Chuck Tuffli
785b5da318 bhyve nvme: Add missing Admin opcodes
Don't treat unsupported Admin commands as Invalid Opcode. Instead return
the proper Invalid Field in Command.

Fixes UNH IOL test 1.17.2

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33569
2022-01-29 23:07:04 -08:00
Chuck Tuffli
b1b2a4d9e8 bhyve nvme: Implement Log Page Offset
Modify the Get Log Page command to parse the Log Page Offset fields to
support more recent versions of the NVMe specification.

Fixes various tests for UNH Test 1.3.*

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33568
2022-01-29 23:06:46 -08:00
Chuck Tuffli
62d47feceb bhyve nvme: Fix Namespace Specific Set Features
Return an error if the feature specified in Set Features is Namespace
specific but the Namespace ID uses the Global Namespace tag.

Fixes UNH Test 1.2.7

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33566
2022-01-29 23:06:23 -08:00
Chuck Tuffli
cf76cdd4bf bhyve nvme: Fix NVM Format completion status
The NVM Format command is unique among the Admin commands in that it
needs to finish asynchronously. For this reason, the emulation code
invented a synthetic completion status (NVME_NO_STATUS) to indicate that
the command was still in progress and the command processing loop should
not generate a completion message. The implementation used the value
0xffff for the synthetic value as this set both the Status Code and
Status Code Type fields to reserved values.

Format initialized the completion status to this value and expected
error cases to override it with a status code/type appropriate to the
situation. The macros used to set the NVMe status are careful not to
modify bit 0 (i.e. the phase bit), which with the synthetic completion
status, causes the phase bit to get out of sync. When running tests in a
guest with illegal NVM Format commands, Admin commands would eventually
hang because it appeared there were no completions due to the incorrect
phase bit value.

Fix is to only set NVME_NO_STATUS if the blockif delete command
succeeds. While in the neighborhood, add a missing break statement when
NVM Format is not supported.

Reviewed by:	imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33565
2022-01-29 23:05:58 -08:00
Chuck Tuffli
595a12f18b bhyve nvme: Advertise v1.4 support
Bump advertised NVMe support from v1.3 to v1.4

Reviewed by:	allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33564
2022-01-29 23:04:25 -08:00
Dimitry Andric
9738bc28ab Apply llvm fix for assertion failure compiling recent libc++
Merge commit c7c84b90879f from llvm git (by Adrian Prantl):

  [DwarfDebug] Refuse to emit DW_OP_LLVM_arg values wider than 64 bits

  DwarfExpression::addUnsignedConstant(const APInt &Value) only supports
  wider-than-64-bit values when it is used to emit a top-level DWARF
  expression representing the location of a variable. Before this change,
  it was possible to call addUnsignedConstant on >64 bit values within a
  subexpression when substituting DW_OP_LLVM_arg values.

  This can trigger an assertion failure (e.g. PR52584, PR52333) when it
  happens in a fragment (DW_OP_LLVM_fragment) expression, as
  addUnsignedConstant on >64 bit values splits the constant into separate
  DW_OP_pieces, which modifies DwarfExpression::OffsetInBits.

  This change papers over the assertion errors by bailing on overly wide
  DW_OP_LLVM_arg values. A more comprehensive fix might be to be to split
  wide values into pointer-sized fragments.

  [0] https://github.com/llvm/llvm-project/blob/e71fa03/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L799-L805

  Patch by Ricky Zhou!

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

MFC after:	3 days
2022-01-29 22:28:24 +01:00
Mateusz Piotrowski
79afae3b3f style.mdoc.5: Document the conventions for -width
Reviewed by:	debdrup
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33394
2022-01-29 22:24:35 +01:00
Mateusz Piotrowski
60401b3883 ipheth.4: Simplify output filtering example
MFC after:	2 weeks
2022-01-29 22:16:50 +01:00
Mateusz Piotrowski
d0b92c068e ipheth.4: Fix examples
It is now necessary to use the -d flag for some of the usbconfig(8)
invocations.

MFC after:	2 weeks
2022-01-29 22:13:42 +01:00
Mateusz Piotrowski
75a86e93e6 usbconfig.8: Sort flags according to style(9)
MFC after:	2 weeks
2022-01-29 22:10:21 +01:00