Age | Commit message (Collapse) | Author |
|
Commits f0b002d01d5 "Release the netlock when sleeping for control
messages in in vioioctl()" and 126b881f71 "Insert a workaround for
per-ifp ioctl being called w/o NET_LOCK()." in vio(4) fixed a deadlock
but may cause a crash with a protection fault trap if addresses are
added/removed concurrently.
The actual issue is that signals are not handled correctly while
sleeping. After a signal, there is a race condition where sc_ctrl_inuse
is first set to FREE and then the interrupt handler sets it to DONE,
causing a hang in the next vio_wait_ctrl() call.
To fix it:
* Revert the NET_LOCK unlocking work-around.
* Remove PCATCH from the sleep call when we wait for control queue,
avoiding the race with vio_ctrleof(). To ensure that we don't hang
forever, use a 5 second timeout.
* If the timeout is hit, or if the hypervisor has set the
DEVICE_NEEDS_RESET status bit, do not try to use the control queue
until the next ifconfig down/up which resets the device.
* In order to allow reading the device status from device drivers, add a
new interface to the virtio transport drivers.
* Avoid a crash if there is outgoing traffic while doing ifconfig down.
OK bluhm@
|
|
|
|
ok mpi@
|
|
Tested by bluhm
ok bluhm@
|
|
Tested by Brian Conway and bluhm
With tweaks from bluhm
ok bluhm
|
|
For LRO with ix(4) it is necessary to detect ethernet padding.
Extract ip_len and ip6_plen from the mbuf and provide it to the
drivers.
Add extended sanitity checks, like IP packet is shorter than TCP
header. This prevents offloading to network hardware with bougus
packets.
Also iphlen of extracted headers contains header length for IPv4
and IPv6, to make code in drivers simpler.
OK mglocker@
|
|
Several drivers need IPv4 header length and TCP offset for checksum
offload, TSO and LRO. Accessing these fields directly caused crashes
on sparc64 due to misaligned access. It cannot be guaranteed that
IP and TCP header is 4 byte aligned in driver level. Also gcc 4.2.1
assumes that bit fields can be accessed with 32 bit load instructions.
Use memcpy() in ether_extract_headers() to get the bits from IPv4
and TCP header and store the header length in struct ether_extracted.
From there network drivers can esily use it without caring about
alignment and bit shift. Do some sanity checks with the length
values to prevent that invalid values from evil packets get stored
into hardware registers. If check fails, clear the pointer to the
header to hide it from the driver. Add debug prints that help to
figure out the reason for bad packets and provide information when
debugging drivers.
OK mglocker@
|
|
netlock held and cause recursive lock acquisition issue.
|
|
ok sf@
|
|
ok sf@
|
|
tested on Linux/KVM
tested on proxmox and vultr by florian
ok florian
|
|
Fix handling of feature bits >= 32. This does not yet affect any driver
as no high feature bit besides VERSION_1 is used, and that one has
special handling.
Also, with VIRTIO_DEBUG, simply walk through all transport and device
feature names, so that we don't need to adjust the if clause whenever
the standard introduces new transport features.
ok jan@ bluhm@
|
|
Rename ifq_set_maxlen() to ifq_init_maxlen(). This function neither
uses WRITE_ONCE() nor a mutex and is called before the ifq mutex
is initialized. The new name expresses that it should be used only
during interface attach when there is no concurrency.
Protect ifq_len(), ifq_empty(), ifiq_len(), and ifiq_empty() with
READ_ONCE(). They can be used without lock as they only read a
single integer.
OK dlg@
|
|
Problem reported and much testing by Christian Kujau. Thanks!
Roughly equivalent to bouyer@NetBSD changes prompted by
Christian.
ok mlarkin@ dlg@
|
|
Execute vmt_tclo_tick() timeout handler in process context to allow
context switch within vmt_tclo_broadcastip().
ok yasuoka
|
|
data access within kvp_get_ip_info().
ok bluhm
|
|
|
|
same way that the shared interrupt handler does. This is one of the
requirements of virtio_dequeue(), as specified in its comment above.
Without the DMA sync, it will not see a new entry on the ring and
return. Since the interrupt is edge-triggered there won't be another
one and we'll get stuck.
ok dv@
|
|
compatible due to lack of endbr64. Replace the indirect call with a new
hv_hypercall_trampoline() routine which jumps to the hypercall page without any
indirection.
Allows me to boot OpenBSD using Hyper-V on Windows 11 again.
ok guenther@
|
|
|
|
The DRIVER_OK bit must be set before using any virt-queues. To allow
virtio device drivers to use the virt-queues in their attach functions,
set the bit there and not in the virtio transport attach function. Only
vioscsi and viogpu really need this, but let's only have one standard
way to do this.
Noticed because of hangs with vioscsi on qemu/windows and in the Oracle
cloud. With much debugging help by Aaron Mason.
Also revert vioscsi.c 1.31 "Temporarily workaround double calls into
vioscsi_req_done()"
ok krw@
|
|
causing NULL de-reference.
Reported, initial patch and tests by Antun Matanovic. Thanks!
ok miod@
|
|
uninitialized content. When we rasops_init() with RI_VCONS, a new screen
is allocated. If ri->ri_bs is set, this will be copied. Otherwise a new
one will be allocated and filled with ASCII spaces. Copying the ri->ri_bs
is useful in case we have an early console which contents we want to keep.
As we do not have an early console here, there's no point in setting it at
the moment.
With this my Hetzner arm64 VM doesn't panic anymore.
ok jcs@ kettenis@
|
|
works enough to get a console on qemu with more work to come from
others
feedback from miod
ok patrick
|
|
feedback and ok jmc@ miod, ok millert@
|
|
The timecounting code has had stubs for pulse-per-second (PPS) polling
since it was imported in 2004. At this point it seems unlikely that
anyone is going to finish adding PPS support, so let's remove the stubs:
- Delete the dead tc_poll_pps() call from tc_windup().
- Remove all tc_poll_pps symbols from the kernel.
Link: https://marc.info/?l=openbsd-tech&m=167519035723210&w=2
ok miod@
|
|
ok yasuoka
|
|
ok tb mlarkin giovanni
|
|
|
|
ok kn mvs mlarkin asou deraadt
|
|
the buffer in the vmt softc when doing RPC for PVBUSIOC_KV{READ|WRITE}
ioctl.
ok asou
|
|
ok mpi@
|
|
Naming the list like the struct itself makes for awful grepping.
Call the global variable "ifnetlist" from now on.
There used to be kvm(3) consumers in base picking up this symbol, but those
have long been converted to other interfaces.
A few potential ports users remain, same deal as sys/net/if_var.h r1.116
"Remove struct ifnet's unused if_switchport member": they get bumped.
Previous users pointed out by deraadt
OK bluhm
|
|
ok miod@ guenther@
|
|
Now that we have delay_init(), use it in all the places where we
currently set delay_func by hand.
lapic_delay() is great: 3000. hv_delay() is needed before we set up
lapic_delay() on Hyper-V guests: 4000. tsc_delay() is better than
lapic_delay() and (probably?) hv_delay(): 5000.
We may bump hv_delay's quality value up over that of tsc_delay() in a
future patch. It's a little ambiguous whether hv_delay() causes a VM
exit.
Idea and patch from jsg@. With tons of input, research and advice
from jsg@.
Link: https://marc.info/?l=openbsd-tech&m=166053729104923&w=2
ok mlarkin@ jsg@
|
|
ok krw@
|
|
as an index into an array.
Reported by Demi Marie Obenour of Invisible Things Lab.
feedback and ok jmatthew@
|
|
ok millert@, deraadt@
|
|
feedback and ok tb@ jmc@ ok ratchov@
|
|
|
|
|
|
we're still using the i8254 for that. On Hyper-V Gen 2 VMs there is no
i8254 we can trust, so we need some kind of fallback, especially if there
is no TSC either.
Discussed with the hackroom
ok kettenis@
|
|
from niklas@ via mikeb@
|
|
ok mikeb
|
|
it sends commands and waits for replies to come back in. The receive
pipe seems to contain both command completions and data packets. When
waiting for command completion during hvn(4) attach, it's possible for
packets to show up as well. We shouldn't call if_input() if hvn(4) is
not set up, so drop them when we're not running.
ok mikeb@
|
|
|
|
The timecounter struct is large and I think it may change in the
future. Changing it later will be easier if we use C99-style
initialization for all timecounter structs. It also makes reading the
code a bit easier.
For reasons I cannot explain, switching to C99-style initialization
sometimes changes the hash of the resulting object file, even though
the resulting struct should be the same. So there is a binary change
here, but only sometimes. No behavior should change in either case.
I can't compile-test this everywhere but I have been staring at the
diff for days now and I'm relatively confident this will not break
compilation. Fingers crossed.
ok gnezdo@
|
|
CID 1501713
ok jmatthew@
|
|
here 10 years ago, xdr isn't scary at all.
ok dlg@
|
|
allocated as part of the softc, though it's always been the same buffer
so far.
ok dlg@
|