Passing overlapping buffers to strcpy yields an undefined result, so let's avoid it. The copy doesn't really need to happen anyways, we can just point to the domain part of the hostname.
Users may interpret the message as a possible hardware error, but the issue is in fact unimplemented functionality. Reword the message to avoid implying it is an error.
Reviewed by: wulf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46092
ota: Import 9f971fba471b from bsd-feature for 20240623
Jun 23, 2024 Fix signal for system-status test. Thanks to Tim van der Molen. Rewrite if-else chain as switch. Thanks to Andrew Sukach.
May 27, 2024 Spelling fixes and removal of unneeded prototypes and extern. Thanks to Jonathan Gray.
May 4, 2024 Fixed a use-after-free bug with ARGV for "delete ARGV". Also ENVtab is no longer global. Thanks to Benjamin Sturz for spotting the ARGV issue and Todd Miller for the fix.
May 3, 2024: Remove warnings when compiling with g++. Thanks to Arnold Robbins.
We currently use this slot in CheriBSD to maintain counters in userspace while providing access to them vis sysctl. CHERI support isn't landing in FreeBSD quite yet (probably for 16 unless hardware access accelerates radically), but it seems highly likely at this point so reserving slots will limit future diffs in both directions.
nvme: Always lock and only avoid processing for recovery state
When we lose a race with the timeout code, shift towards waiting for that timeout code to complete so we can acquire the lock. This way we can make sure we're in 'normal' mode before processing I/O completions. If we're not in 'normal' mode, then we're resetting and we should avoid completions.
nvme: Lock when processing an abort completion command.
When processing an abort completion command, we have to lock. But we have to lock the qpair of the original transaction (not the abort we're completing). We do this to avoid races with checking the completion id to tr mapping array, as well as to manually complete it.
Note: we don't handle the completion status of 'Asked to abort too many transactions at once.' That will be fixed on subsequent commits. Add a note to that effect for now since it's a harder problem to solve.
Optimize timeout code based on three observations.
(1) The tr queues are sorted in order of submission, so the first one that could time out is the first "real" one on the list. (2) Timeouts for a given queue are all the same length (well, except at startup, where timeout doesn't matter, and when you change it at runtime, where timeouts will still happen eventually and the difference isn't worth optimizing for). (3) Calling the ISR races the real ISR and we should avoid that better.
So now, after checking to see if the card is there and working, the timeout routine scans the pending tracker list until it finds a non-AER tracker. If the deadline hasn't passed, we return, doing nothing further. Otherwise, we call poll completions and then process the list looking for timed out items.
This should move the timeout routine to touching hardware only when it's really necessary. It thus avoids racing the normal ISR, while still timig out stuck transactions quickly enough.
There was also some minor code motion to make all of the above flow more nicely for the reader.
When interrupts aren't working at all, then this will increase latency somewhat. But when interrupts aren't working at all, there's bigger problems and we should poll quite often in that case. That will be handled in future commits.
Issue a warning if we have system interrupt issues. If you get this warning, then we submitted a request, it timed out without an interrupt being posted, but when we polled the card's completion, we found completion events. This indicates that we're missing interrupts, and to date all the times I've helped people track issues like this down it has been a system issue, not an NVMe driver isseue.
malloc(9): extend contigmalloc(9) by a "slab cookie"
Extend kern_malloc.c internals to also cover contigmalloc(9) by a "slab cookie" and not just malloc/malloc_large. This allows us to call free(9) even on contigmalloc(9) addresses and deprecate contigfree(9). Update the contigmalloc(9) man page accordingly.
The way this is done (free(9) working for contigmalloc) will hide the UMA/VM bits from a consumer which may otherwise need to know whether the original allocation was by malloc or contigmalloc by looking at the cookie (likely via an accessor function). This simplifies the implementation of consumers of mixed environments a lot.
This is preliminary work to allow LinuxKPI to be adjusted to better play by the rules Linux puts out for various allocations. Most of this was described/explained to me by jhb.
One may observe that realloc(9) is currently unchanged (and contrary to [contig]malloc/[contig]free an implementation may need access the "slab cookie" information given it will likely be implementation dependent which allocation type to use if size changes beyond the usable size of the initial allocation).
Described by: jhb Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: markj, kib Differential Revision: https://reviews.freebsd.org/D45812