aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* pass: Update comments about scsi and devstatWarner Losh26 hours1-3/+8
| | | | | | | | | scsi is the only transport to do tag_action, so is the only one that needs that support in devstat. Make a note of that. nvme and ata do support some ordering, but that's done in the [an]da driver for each of these devices and not for passthru commands and not via these tags. Sponsored by: Netflix
* pass: Use pointer to ccb header rather than longer constructWarner Losh26 hours1-22/+26
| | | | | | | | | | | | | | | | | Take a pointer to the ccb header in a few places where it's not ambiguous (eg we have multiple ccbs in the routine). The code is a little shorter this way. In places we had mulitple ccbs, I refrained from doing this since that's more complex to manage. This also means that we're making a stronger guarantee to the compiler we're only accessing this part of the ccb, which reduces a few warnings from gcc with picky settings we normally disable for CAM). This makes the driver slightly less SCSI specific where csio was used to do this needlessly. There's no functional change. Sponsored by: Netflix
* pass: Remove unneeded includeWarner Losh26 hours1-1/+0
Nothing from scsi_all.h is used here, so don't include it. Sponsored by: Netflix
* pass: Make the name of the driver a #defineWarner Losh45 hours1-4/+6
"pass" is in several places, but should be a #define. Make it one. This also lets folks with particular needs that copy this driver to reduce diffs. Sponsored by: Netflix
* tcp: remove TCPTV_TWTRUNCMichael Tuexen3 days1-2/+0
It is not used anymore... Reviewed by: rscheff, Peter Lei MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50900
* Don't include netinet/tcp_timer.h when not neededMichael Tuexen4 days5-5/+0
Reviewed by: glebius MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50889
* tcp: cleanup timer initialisationsMichael Tuexen4 days2-16/+12
Use MSEC_2_TICKS() to make clearer, which values are used and to ensure that the value stored is at least one tick. This also avoids the need of some protection code. Reviewed by: cc, glebius Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50840
* Revert "Makefile.inc1: allow real-update-packages to be called independently"Warner Losh4 days1-3/+4
Revert b44147bb1245. It doesn't work right since it doesn't bootstrap things quite right. It doesn't look trivial to fix, so revert until a proper solution is done (though maybe that solution is just do `make update-packages` and not document/support these other targets). Suggested by: bapt, emaste Sponsored by: Netflix
* ufshci: Add to build on arm64 and aarch64Warner Losh5 days1-0/+5
Add UFS Host Controller Itnerface driver to the build. Sponsored by: Netflix
* tcp: fix handling of TIME WAIT for local TCP connectionsMichael Tuexen7 days1-1/+1
The sysctl-variable net.inet.tcp.nolocaltimewait should affect TCP connections where the remote endpoint is on the local host and not on the local area network. Reported by: cc Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50830
* udp: fix local blackholingMichael Tuexen7 days1-1/+1
The sysctl-variable net.inet.udp.blackhole_local should affect UDP packets from an IPv6 address of the local host, not of a host on the local area network. Thanks to cc@ for pointing me to the issue. Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50829
* tcp: fix local blackholingMichael Tuexen7 days1-1/+1
The sysctl-variable net.inet.tcp.blackhole_local should affect TCP segments from an IPv6 address of the local host, not of a host on the local area network. Thanks to cc@ for pointing me to the issue. Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50828
* clock_gettime: Better markupWarner Losh7 days1-1/+3
Markup CLOCK_REALTIME better. Noticed by: kib Fixes: 7b7ba7857ce8 Sponsored by: Netflix
* kern_time: minor style nitsWarner Losh7 days2-17/+19
Typically we spell error values 'error' not 'err'. And fix EINVAL markup nit. Suggested by: kib Fixes: 7b7ba7857ce8 Sponsored by: Netflix
* ssp: Protect sig2str with proper visibility markersWarner Losh9 days1-0/+2
| | | | | | | | | | We only define SIG2STR_MAX with careful visibility, but define the fortified version unconditionally. It needs to have the same visibility both places. Fixes: 3d12567133bf Reviewed by: jrtc27, kevans Sponsored by: Netflix
* nanobsd: Fix kernel buildWarner Losh9 days1-0/+1
'device crypto' is now required for 'device pf' so add it. Sponsored by: Netflix
* ddb: fix handling of BBLog entries when BBLog is disabledMichael Tuexen10 days2-4/+8
Fixes: a62c6b0de48a ("ddb: add optional printing of BBLog entries") MFC after: 1 week Sponsored by: Netflix, Inc.
* ddb: add optional printing of BBLog entriesMichael Tuexen10 days4-7/+405
Add a /b option to show tcpcb and show all tcpcbs to print BBLog entries. Right now this supports the entries generated by the FreeBSD default TCP stack. It should help in debugging issues reported by syzkaller. The syntax for printing sent and received packets is similar to the one used by packetdrill, since the output of ddb will be used to create packetdrill scripts for debugging. Reviewed by: thj Tested by: thj MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50629
* efi: Include sys/types.h for register_tWarner Losh2025-06-042-0/+4
This file depends on sys/types.h being included before it, which isn't the best assumption. Include it here since we have no namespace pollution concerns. Sponsored by: Netflix
* kboot: Create quit commandWarner Losh2025-05-301-0/+12
| | | | | | | | | Create a command that just quits out of the loader. Useful for debugging. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D50589
* style: Use static consistentlyWarner Losh2025-05-301-4/+4
| | | | | | | | | | | C doesn't require that we have static on both the declaration and definition of a function. But stylistically, FreeBSD does. Make that so. Also make a function static that wasn't because, it seems, that static and struct look a lot alike in a column of text. Sponsored by: Netflix Reviewed by: tsoome, jhibbits Differential Revision: https://reviews.freebsd.org/D50588
* stand: Retire arch_loadaddr using md_align, pending its replacementWarner Losh2025-05-3011-117/+95
| | | | | | | | | | | | | | | | | | arch_loadaddr() is inconsistently used. In fact, I removed it entirely from kboot because its interface wasn't wide enough (though I broke powerpc kboot several years ago, and this commit might fix that). For now, modify uboot to put it into copyin like all the other loaders do. This might break arm ubldr. In its place, use the new md_align() and any replacement will be called from there, or via some explicit init() function. These changes allow me to load a amd64 kernel via UEFI with all the modules aligned to 16k. Sponsored by: Netflix Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D50587
* stand: Style nitWarner Losh2025-05-301-1/+2
| | | | | | Sponsored by: Netflix Reviewed by: chs, tsoome Differential Revision: https://reviews.freebsd.org/D50586
* stand: Introduce md_alignWarner Losh2025-05-308-22/+45
| | | | | | | | | | | | | | When we're loading metadata, we need to align it in a certain way. Right now that way is hard-coded to be PAGE_SIZE. Rather than do the actual physical thing in all these places, move this into a wrapper routine. We may want to load a 16k kernel and align all these on 16k or a 4k kernel and align on 4k on aarch64 (today you have to compile the loader with the right page size). This will also reduce the number of places we might have to touch to do that. Sponsored by: Netflix Reviewed by: tsoome, jhibbits Differential Revision: https://reviews.freebsd.org/D50585
* stand/efi: Use EFI_PAGE_SIZE here, it's more appropriateWarner Losh2025-05-301-2/+2
No functional change: We're allocating a page from EFI, which is always 4k on amd64. So, this should always be 4k. PAGE_SIZE usually is this, but might not be in some cases. For the end of the stack pointer in the ist1, it should point the architecture's physical page past where we've allocated. EFI_PAGE_SIZE more faithfully reflects that here since PAGE_SIZE might not be exactly that in the future (if we had a larger logical page than physical page). Since the AllocPage interface is in EFI_PAGE_SIZE pages always, this seems safer. No functional change since they are both 2096 today. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D50584
* ddb: add show all tcpcbsMichael Tuexen2025-05-282-1/+32
| | | | | | | | | | | | | | | Add a command to show all TCP control blocks. Also provide an option to limit the output to TCP control blocks, which are locked. The plan is to run show all tcpcbs/l when syzkaller triggers a panic. If a TCP control block is affected, it is most likely locked and therefore the command shows the information of the affected TCP control block. Reviewed by: markj, thj Tested by: thj MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50516
* ddb: improve show tcpcbMichael Tuexen2025-05-281-0/+52
Print the name of the TCP function block and the name of the congestion control algorithm. Furthermore, print some information related to Black Box Logging. Reviewed by: thj MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50535
* stand: Update commentWarner Losh2025-05-261-1/+2
Some routines are necessary, so note that. Sponsored by: Netflix
* stand/kboot: Remove _end forward declWarner Losh2025-05-261-1/+0
| | | | | | We don't need/use it. Sponsored by: Netflix
* stand/userboot: Initialize archsw at compile timeWarner Losh2025-05-261-10/+10
| | | | Sponsored by: Netflix
* stand/i386/zfsboot: Initialzie archsw at compile time.Warner Losh2025-05-261-10/+10
| | | | | | | | Also, add a comment about the weird reason we even have an archsw here at all. tl;dr: zfs code uses archsw when it aught not, but this hack here is easier than fixing that code properly. Sponsored by: Netflix
* stand/uboot: Move archsw init to compile timeWarner Losh2025-05-261-8/+9
| | | | Sponsored by: Netflix
* stand/powerpc/ofw: Initialize archsw at compile timeWarner Losh2025-05-261-8/+15
| | | | | | There's no real reason to do this at runtime. Sponsored by: Netflix
* stand/efi: Initialize archsw at compile timeWarner Losh2025-05-261-11/+11
| | | | Sponsored by: Netflix
* stand/i386: Initialize archsw at compile timeWarner Losh2025-05-261-17/+21
| | | | | | | No need to initialize this at runtime. This trades .bss space + code in .text for just .data and is net smaller by 4 bytes. Sponsored by: Netflix
* kboot: Initialize archsw at compile timeWarner Losh2025-05-261-10/+10
| | | | | | | No need to initialize this at runtime. This trades .bss space + code in .text for just .data and is net smaller. Sponsored by: Netflix
* stand/powerpc/ofw: Remove bogus end declWarner Losh2025-05-261-2/+0
This likely used to be needed for some code here, or maybe it's been here since it was copied from elsewhere that did neeed it. Remove it. Sponsored by: Netflix
* stand/uboot: Remove unneeded nitems definitionWarner Losh2025-05-261-9/+5
Also, remove the trailing white space that was introduced in the same commit as the nitems fallback definition. Sponsored by: Netflix
* efivar: Kill needless sys/cdefs.hWarner Losh2025-05-254-4/+0
Sponsored by: Netflix
* ddb4: improve formattingMichael Tuexen2025-05-241-2/+2
Improve the consistency of the formatting. Reviewed by: ziaee MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D50514
* UPDATING: Note umass/cam updatesWarner Losh2025-05-071-0/+7
Sponsored by: Netflix
* usb/quirks: Remove overly broad quirksWarner Losh2025-05-071-10/+0
| | | | | | | | | | | | | | | | | | | | Now that we have a safe way to detect the vast majority of problems with SYNCHRONIEZ CACHE, and since I have devices from many of these vendors that work just fine (one of which will hang if you send it a SYNCHROMIZE CACHE), I think these should all be reverted. The details of when they were added are sketchy, the age of the devices in question means these vendors have many generations of products after and the general over-quirking of SYNCHRONIZE CACHE all point to just removing them and adding back specific quirks should any need arise after trying other means to debug. The APPLE quirk was added because the autoquirk code would hang an ipod with RockBox with a reset loop in the firmware. Since it was quirked, it disabled the autoprobe and started working. Now that we've disabled the autoprobe, we can remove it for sure. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49478
* usb: Make autoquirk code optional and opt outWarner Losh2025-05-073-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are significant problems with the current autoquirk code. This results in quite a bit of bogus over-quirking. Most commands don't do the proper "sense" dance to get the scsi sense codes to see if the failures are interesting or not. A number of 'sleeps' are used to try to get around this, but they are racy. Rather than fix these, use better hueristics just introduced to catch SYNCHRONIZE CACHE problems, etc. The test for getting max lun number was bogus. It would set this quirk both on errors and when 0 was returned. It appears to be an attempt to filter our REPORT LUNS error messages that are actually benign (we ignore the errors properly). These errors are also only filtered sometimes, so the test is unreliable. In addition, it's doing exactly the same test that the umass driver is doing and recovering in the same way. There's no value add here. The TEST UNIT READY almost always fails because the drive is becoming ready. The SENSE is usually UNIT ATTENTION 28/0 "Drive went from not ready to ready" which is a normal condition. The crazy looping to get INQUIRY data is odd. It shouldn't be needed and rarely actually fails (I've not seen any, despite using this code on some really sketchy drives). It should set a NO_INQUIRY quirk if it fails, but instead sets a whole bunch of other, mostly unrelated quirks if it fails. The INQUIRY code also doesn't recognie RBC devices as well as DIRECT devices. This means it fails on some older generations of cameras that could actually benefit from this code. The SYNCHRONIZE CACHE test is flawed. It will do the same failed test over and over again in the event the command succeeds. There are better ways to detect probelms. The START STOP test is useless. It doesn't really help on any of the devices I've tested on. It appears to be another result of the failure to properly obtain the SENSE code and do appropriate things with it. The PREVENT ALLOW test is useless. It is overwhelmingly used to prevent an error message later. However, after it was added the error message was changed to be informative and not scary. We properly probe this at runtime on all the devices I tested on. At the end of the tests, we try to clear the SENSE errors, but do so imperfectly. Only one is cleared and we use INQUIRY rather than the better TEST UNIT READY. Attempted re-write to fix this caused additional problems as the reset code was not at all robust (the same sequnce in umass / CAM worked when we disabled this code). In addition, the over-quirking and hair-triggered declaration that SYNCHRONIE CACHE is bad would mean that some working drives that have cache wouldn't flush the cache when WCE=1, leading to corruption. Thankfully, nearly all (but not all) the USB sticks I have default to WCE=0. One, however, did default to WCE=1 and some allow setting it (despite the fact this is a bad idea on removeable devices). However, for real disks attached via USB could be tripped up over this. When we do reset, some small subset of drives are now failing to probe. There are reports on the FreeBSD forums that at least one ebook reader no longer works. A different ebook reads is affected as well (one of my long-time friends has htis). in my collection, one USB memory stick, one SD card reader and one USB to generic PATA adapter no longer work. All of them are pretty obscure (you could literally say they were found in my junk drawer), but are troubling. These problems appear to disappear if we stop doing the auto-quirk code. For all these reasons, I'm turning this off and will likely remove it entirely in the future once the alternative SYNC CACHE code has provent itself. Differential Revision: https://reviews.freebsd.org/D49477 Sponsored by: Netflix
* scsi/da: Only send SYNC CACHE for devices with mode page 8Warner Losh2025-05-071-33/+212
| | | | | | | | | | | | | | | | | | | | | | Mode page 8 is the 'cache' mode page. It's used to control the cache, if one is present, on a device. When it is absent, that's a very strong hint that SYNCHRONIZED CACHE willl not be necessary. Set the NO_SYNC_CACHE quirk for this situation. SBC defines the 2010 Profile which specifies that both SYNCRHONIZE CACHE and Cache Mode Page must be supported. There are additional vague statements tieing these two together, but nothing that explicitly requires Cache Mode Page support when SYNCHRONIZE CACHE is needed for cache coherency. However, when the Cace Mode Page is present, that's a very strong hint SYNCHRONIZE CACHE is supported (or at the very least won't hang the firmware). Given the diversity of implementations, it's hard to say this is 100% safe. However, many devices known to hang or worse on a SYNCHRONIZE CACHE tolerate querying an unsupported mode page well. If there's any devices that have a valid Cache page, but where SYNCHRONIZE CACHE actually hangs can be dealt with by specific quirks. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49476
* umass: Bring in small fix from NetBSD's umassWarner Losh2025-05-071-4/+9
| | | | | | | | | | | | | | When completing a request for UFI, don't fail the request on non-zero asc/ascq values if we've done a request sense. This idea is from umass.c 1.100 by mycroft. He used it to help elminate the INQUIRY_SHORT quirk that we still have. However, it will make little difference because we treat both return values the same for CBI. And it appears we have (maybe bogusly) some devices that specify this quirk that aren't CBI. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49475
* umass: Fix a direct call to sc_transformWarner Losh2025-05-071-5/+9
| | | | | | | | | | Call umass_std_transform instead of following the sc_transform member to get the standard transforms now that has moved to umass_std_transform. Pass NULL as the CCB so that we don't stomp on the status that was just set (and allow that in std_transform). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49474
* umass: Be more consistent about how we fail bad commandsWarner Losh2025-05-071-4/+1
| | | | | | | | Elsewhere, if we fail a command, we use SCSI code ILLEGAL REQUEST/24/00, but here we were using the CAM code for illegal request. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49473
* umass: Move INQUIRY and TEST UNIT READY quirks to umass_std_transformWarner Losh2025-05-071-64/+36
| | | | | | | | Only doing a short inquiry and converting TUR to START STOP UNIT are the same everywhere, so move those quirks to umass_std_transform. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49472
* umass: Move common code into umass_std_transformWarner Losh2025-05-071-43/+11
| | | | | | | | | | Move the length checks, and byte copying into umass_std_transform. The copies are typically small and this simplifies the code a lot. Move zeroing the buffer now to only when we change TEST UNIT READY to START STOP. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49471
* umass: make *_transform() return a boolWarner Losh2025-05-071-32/+31
| | | | | | | These are now boolean, so make them return a boolean. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49470