summaryrefslogtreecommitdiff
path: root/sys
AgeCommit message (Collapse)Author
2022-08-17No more disklabel -B.Miod Vallat
2022-08-16Remove kqueue-related ktrace points from poll(2) and select(2)Visa Hankala
These ktrace points do not seem useful any longer because the new implementation of poll(2) and select(2) appears to work well. OK deraadt@ mpi@
2022-08-16Remove obsolete kern.nselcoll sysctl.Visa Hankala
OK millert@ deraadt@
2022-08-16regenJonathan Gray
2022-08-16add id for Intel Optane SSD 9 Series (900P/905P)Jonathan Gray
initial patch from Andreas Bartelt ok deraadt@
2022-08-15Run IPv6 hop-by-hop options processing in parallel. The ip6_hbhchcheck()Alexander Bluhm
code is MP safe and moves from ip6_local() to ip6_ours(). If there are any options, store the chain offset and next protocol in a mbuf tag. When dequeuing without tag, it is a regular IPv6 header. As mbuf tags degrade performance, use them only if a hop-by-hop header is present. Such packets are rare and pf drops them by default. OK mvs@
2022-08-15remove FSPACE macros, unused after uvm_map_sel_limits() removalJonathan Gray
2022-08-15Introduce tcp_sogetpcb() to assign `inp' and `tp' from passed socket.Vitaliy Makkoveev
This function will help to avoid code duplication when tcp_usrreq() will be divided to multiple handlers. ok bluhm@
2022-08-15unifdef KDBJonathan Gray
2022-08-15Fix a doc comment to match upstreamTheo Buehler
2022-08-15Add softraid(4) RAID 1C boot supportKlemens Nanni
This is the arm64 adaptation of stsp's (commitid: p55cmsVoEH0fRg77) "add support for booting from RAID 1C softraid(4) volumes on amd64". Tell the boot loader to decrypt 1C like C volumes and check the number of disks in 1C like in 1C volumes -- no new code rquired. Tested on SolidRun CEX7 OK stsp NB: While kernel and boot loader support root on softraid on arm64, installboot(8) does not, i.e. default installations still require manual disk preparation for now.
2022-08-15Adjust whitespace (tabs vs spaces) on one line to reduce diff with upstreamTheo Buehler
2022-08-15Revert previous. It was not ok'ed by dlg@.Vitaliy Makkoveev
2022-08-15Introduce 'pr_usrreqs' structure and move existing user-protocolVitaliy Makkoveev
handlers into it. We want to split existing (*pr_usrreq)() to multiple short handlers for each PRU_ request as it was already done for PRU_ATTACH and PRU_DETACH. This is the preparation step, (*pr_usrreq)() split will be done with the following diffs. Based on reverted diff from guenther@. ok bluhm@
2022-08-15Stop doing lockless `t_flags' check within task_add(9) and task_del(9).Vitaliy Makkoveev
This doesn't work on MP systems. We do locked `t_flags' check just after lockless check, so just remove it. ok dlg@
2022-08-15drop detection code for 386sx/386dx CPUsDaniel Dickman
OpenBSD/i386 doesn't actually support running on 386sx or 386dx CPUs so we don't need to test whether we're running on one of these CPUs anymore. The 486 (which was launched in 1989) added a few new features over the 386: - an alignment check flag in EFLAGS - 3 new userland instructions: bswap / cmpxchg / xadd - 3 new kernel mode instructions: invd / wbinvd / invlpg - new bits in CR0 (386 CPUs did not support ring0 write protection) - new bits in CR3 In this diff, we remove the code that checks for the alignment check flag as we've only supported Pentium (or newer) CPUs for some time. The rest of the diff is about updating comments related to pre-486 CPUs. 2 files under arch/amd64 are updated to keep them in sync with the arch/i386 updates. ok mlarkin@, jsg@; tweak from miod@
2022-08-15remove unused uvm_aiobuf_poolJonathan Gray
2022-08-15remove unused uvm_map_sel_limits()Jonathan Gray
ok miod@ millert@
2022-08-15remove tulip_mbuf_compress() unused since if_de.c 1.127Jonathan Gray
ok miod@
2022-08-15remove unused smc91cxx_activate()Jonathan Gray
ok miod@
2022-08-15remove msdosfs findwin95()Jonathan Gray
unused since msdosfs_vfsops.c 1.95 ok miod@ millert@
2022-08-15remove unused uvideo_enable()/uvideo_disable()Jonathan Gray
ok mglocker@ miod@
2022-08-14Unbreak, don't assume we always hold the NET_LOCKJeremie Courreges-Anglas
After net/if.c:rev 1.661 ifioctl() doesn't take the net lock any more around SIOCGIFMEDIA and SIOCSIFMEDIA, which broke cad_ioctl(). The same was already true about SIOCGIFSFFPAGE. Only release/reacquire the net lock if warranted. Input mvs@, ok miod@ mvs@ bluhm@
2022-08-14db_ctf_decompress: use size_t not off_t for length parameterTodd C. Miller
The only caller of db_ctf_decompress() passes a size_t for the length. This eliminates sign comparison warnings without using casts. OK jca@ tb@
2022-08-14remove unneeded includes in sys/kernJonathan Gray
ok mpi@ miod@
2022-08-13Introduce the pru_*() wrappers for corresponding (*pr_usrreq)() calls.Vitaliy Makkoveev
This is helpful for the following (*pr_usrreq)() split to multiple handlers. But right now this makes code more readable. Also add '#ifndef _SYS_SOCKETVAR_H_' to sys/socketvar.h. This prevents the collisions when both sys/protosw.h and sys/socketvar.h are included together. Both 'socket' and 'protosw' structures are required to be defined before pru_*() wrappers, so we need to include sys/socketvar.h to sys/protosw.h. ok bluhm@
2022-08-13Remove needless include pledge.h accidently added in previous commit.Alexander Bluhm
OK claudio@
2022-08-13blist: fix a possible blist corruption with blist_alloc() due to unsignedSebastien Marie
swblk_t on OpenBSD. reorder if condition in blst_meta_alloc(), in order to check if the node is 'Terminator' node first (and leave the loop). DragonFlyBSD is unaffected by it as swblk_t is signed (and the first condition isn't taken). add a regress test for it. while here, more the KASSERT() to KDASSERT(). it is useful but only with DEBUG. ok miod@ todd@
2022-08-13Correct rx data rate for rtl8192euKevin Lo
ok stsp@, jmatthew@
2022-08-13avoid uninitialised var when boot_unit has an unexpected valueJonathan Gray
tested by and ok aoyama@
2022-08-12Crank amd64 boot loader version numbers for softraid(4) RAID 1C boot support.Stefan Sperling
2022-08-12add support for booting from RAID 1C softraid(4) volumes on amd64Stefan Sperling
Only boot-loader changes are needed. Both installboot(8) and the kernel already do what is required to make this work. ok kn@ Tested: biosboot on vmm: kn, stsp biosboot and efiboot on server hardware: stsp
2022-08-12Revert to pre-r1.249 more laissez-faire checks for valid MBRKenneth R Westerback
partitions. miod@ (re)discovered an off-by-one in some device size calculations. Whether the ancient misbehaviour of some devices to confuse number of sectors with highest valid sector address or something newer. Should fix miod@'s octeon boot disk.
2022-08-12Make sure we don't pass uninitialized siginfo values to trapsignal(); fromMiod Vallat
clang via jsg@, ok jsg@
2022-08-12Remove differences between ip_fragment() and ip6_fragment(). TheyAlexander Bluhm
do nearly the same thing, so they should look similar. OK sashan@
2022-08-12Fix non working continue in do while(0) loop.Alexander Bluhm
OK mvs@ jca@ CID 1519492
2022-08-12Remove unused fields from 'pflow_softc' structure.Vitaliy Makkoveev
ok bluhm@
2022-08-12Fix race between pflow_output_process() and pflow_clone_destroy().Vitaliy Makkoveev
Unlink pflow(4) interface from `pflowif_list' before start destruction to prevent pflow_output_process() being rescheduled. Also wait until running pflow_output_process() task finished. Problem reported and fix tested by Hrvoje Popovski. ok bluhm@
2022-08-12There are some places in ip and ip6 input where operations fail dueAlexander Bluhm
to out of memory. Use a generic idropped counter for those. OK mvs@
2022-08-12Put more struct vnode fields under splbio().Visa Hankala
Buffer cache related struct vnode fields can be accessed in interrupt context. Be more consistent with the use of splbio(). OK mpi@
2022-08-12Fix to work 1bpp Xorg server again on 1bpp framebuffer hardware.Kenji Aoyama
Recent xenocara wsfb driver can treat LUNA's framebuffer "offset", but it requires one more page by mmap() when we use offset. Noticed and tested on nono emulator with 1bpp setting.
2022-08-12At successful return ip6_check_rh0hdr() keeps *offp unmodified.Alexander Bluhm
The IPv6 routing header type 0 check should modify *offp only in case of an error, so that the generated icmp6 packet has the correct pointer. OK sashan@
2022-08-12use string literal for format stringJonathan Gray
ok deraadt@ miod@
2022-08-12use string literal for format stringJonathan Gray
ok miod@
2022-08-12amd64: simplify TSC synchronization testingScott Soule Cheloha
Computing a per-CPU TSC skew value is error-prone, especially on multisocket machines and VMs. My best guess is that larger latencies appear to the current skew measurement test as TSC desync, and so the TSC is demoted to a kernel timecounter on these machines or marked non-monotonic. This patch eliminates per-CPU TSC skew values. Instead of trying to measure and correct for TSC desync we only try to detect desync, which is less error-prone. This approach should allow a wider variety of machines to use the TSC as a timecounter when running OpenBSD. In the new sync test, both CPUs repeatedly try to detect whether their TSC is trailing the other CPU's TSC. The upside to this approach is that it yields no false positives. The downside to this approach is that it takes more time than the current skew measurement test. Each test round takes 1ms, and we run up to two rounds per CPU, so this patch slows boot down by 2ms per AP. If any CPU fails the sync test, the TSC is marked non-monotonic and a different timecounter is activated. The TC_USER flag remains intact. There is no middle ground where we fall back to only using the TSC in the kernel. Before running the test, we check for the IA32_TSC_ADJUST register and reset it if necessary. This is a trivial way to work around firmware bugs that desync the TSC before we reach the kernel. Unfortunately, at the moment this register appears to only be available on Intel processors. I cannot find an equivalent but differently-named MSR for AMD processors. Because there is no per-CPU skew value, there is also no concept of TSC drift anymore. Miscellaneous notes: - This patch adds a new timecounter utility function, tc_reset_quality(). Used after sync test failure to mark the TSC non-monotonic. - I have left TSC_DEBUG enabled for now. Unsure if we should leave it enabled for release or not. If we disable it we no longer run the sync test after failing it once. Running the test even after failure provides information about the desync on every CPU. - Taking 1ms per test round is fairly conservative. We can experiment with and discuss shorter test rounds. My main goal with a relatively long test round is ensuring VMs actually run the test. It would be bad if a hypervisor interrupted the test for so long that it concealed desync. - The use of two test rounds is mostly a diagnostic tool: it would be very strange if a CPU passed the first round but failed the second. If we ever saw this in the wild it would indicate something odd. - Most of the desync seen in test reports is on Ryzen CPUs. I believe, but cannot prove, that this is due to a widespread firmware bug on AMD motherboards. Hopefully AMD and/or the downstream vendors fix it. - Fixing TSC desync by writing the TSC directly with WRMSR is very difficult. The TSC is a moving target incrementing very quickly and compensating for WRMSR overhead is non-trivial. We can experiment with this, but my confidence is low that we can make it work reliably. Prompted by deraadt@ and kettenis@ in 2021. Shepherded along by deraadt@ throughout. Reprompted by Yuichiro Naito several times. With input from Yuichiro Naito, naddy@, sthen@, dv@, and deraadt@. Tested by florian@, gnezdo@, sthen@, Josh Rickmar, dv@, Mohamed Aslan, Hrvoje Popovski, Yuichiro Naito, semarie@, mlarkin@, asou@, jmatthew@, Renato Aguiar, and Timo Myyra. Patch v1: https://marc.info/?l=openbsd-tech&m=164330092208035&w=2 Patch v2: https://marc.info/?l=openbsd-tech&m=164558519712957&w=2 Patch v3: https://marc.info/?l=openbsd-tech&m=165698681018991&w=2 Patch v4: https://marc.info/?l=openbsd-tech&m=165835507113680&w=2 Patch v5: https://marc.info/?l=openbsd-tech&m=165923705118770&w=2 "just commit it" deraadt@
2022-08-12Coverity says multiplying two uint32_t's and assigning them toKenneth R Westerback
a uint64_t may not produce the (humanly) obvious result. Cast one of them to a (uint64_t) in the hope of invoking the appropriate int promotion god. CID 1519495
2022-08-11Don't trust gpt header data read from disk until after itsKenneth R Westerback
validity is checked. Found the hard way by kn@ Cluebats from millert@ and deraadt@. Fix tested by and ok kn@
2022-08-11powerpc64: cpu_initclocks: do tc_init(9) before cpu_startclock()Scott Soule Cheloha
In the future, the clock interrupt will need a working timecounter to accurately reschedule itself. Move tc_init(9) up before cpu_startclock(). kettenis@ notes several other platforms need this same change. Maybe we can do the rest all at once. Tested by kettenis@. Link: https://marc.info/?l=openbsd-tech&m=165343754512382&w=2 ok kettenis@
2022-08-11Don't yet configure smmu(4) on Qualcomm SoCs as used on the Lenovo x13sPatrick Wildt
as it is still not ready for runtime use and probably needs further quirks. Discussed with deraadt@
2022-08-11Revert previous commit as the bounds check was correct.Anton Lindqvist