From: Stefan Sperling Subject: Re: vio(4): recover from missed RX interrupts in vio_rxtick To: Moritz Buhl Cc: tech@openbsd.org Date: Wed, 15 Apr 2026 10:03:52 +0200 On Wed, Apr 15, 2026 at 04:58:31AM +0200, Moritz Buhl wrote: > On my Intel(R) Atom(TM) CPU C3558 with 4 cores and 14 vms I feel > like this has a positive impact on the vms network interfaces. > I am running this diff on all vms since end of February and prior > to this diff I would see one vm (vio interface) lose connection > every few days. I haven't seen any stuck vio interfaces myself but this diff makes sense to me and I don't see any downside to it. ok stsp@ > I still see some races when starting and stopping vms, especially > after a physical reboot (vionet_rx: driver not ready) but once the > interface is up, it stays working with this. I have seen this issue, too. It usually triggers when vmd starts up all VMs (30 in my case) after rebooting the host. When it is possible to log into the guests's console the problem can be repaired by running ifconfig vio0 down up inside the guest. I've also seen guests become completely unresponsive, requiring vmctl stop -f to recover. > On Sun, Feb 22, 2026 at 07:22:16PM +0100, Renaud Allard wrote: > > Hi, > > > > I've been running an OpenBSD 7.8 VM on Oracle Cloud (arm64, KVM) with a > > vio(4) interface doing sustained 50-100 Mbps. Every few days, the > > interface goes completely dead -- no packets in or out. A reboot from > > the cloud console fixes it for another few days. > > > > I traced the problem through the driver and I believe the root cause is > > that vio_rxtick doesn't poll the RX used ring the way vio_txtick polls > > the TX used ring. If an RX interrupt gets lost (which can happen with > > EVENT_IDX -- the man page already has flag 0x2 as a workaround for > > exactly this class of bug), the RX side has no way to recover. > > > > Here's the diff, then the explanation. > > > > Index: sys/dev/pv/if_vio.c > > =================================================================== > > RCS file: /cvs/src/sys/dev/pv/if_vio.c,v > > retrieving revision 1.78 > > diff -u -p -r1.78 if_vio.c > > --- sys/dev/pv/if_vio.c 15 Jan 2026 09:06:19 -0000 1.78 > > +++ sys/dev/pv/if_vio.c 22 Feb 2026 00:00:00 -0000 > > @@ -1661,6 +1661,7 @@ vio_rxtick(void *arg) > > int i; > > > > for (i = 0; i < sc->sc_nqueues; i++) { > > + virtio_check_vq(sc->sc_virtio, sc->sc_q[i].viq_rxvq); > > mtx_enter(&sc->sc_q[i].viq_rxmtx); > > vio_populate_rx_mbufs(sc, &sc->sc_q[i]); > > mtx_leave(&sc->sc_q[i].viq_rxmtx);