diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2019-11-29 00:51:29 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2019-11-29 00:51:29 +0000 |
commit | 1d83bb6c290dd57db296c3d90fd5ce0509bdc944 (patch) | |
tree | 66a1484fce0caf02f617c2b26aed496a9ed963ff /usr.sbin/vmd/virtio.c | |
parent | cacfaa0626ff6a9543196d35ce5e68af2a8c94d3 (diff) |
Fix at least one cause of VMs spinning at 100% host CPU
After debugging with ori@, it looks like an event ends up on the wrong
libevent queue, and we end continually de-queueing and re-queueing the
event continually. While it's unclear exactly why this happened, a clue
on libevent's github issues page for the same problem pointed us to using
a different event base for the device events. This seems to have unstuck
ori@'s problematic VM, and I have also seen no more hangs after this.
We have not completely separated the queues; ori@ will work on setting
new libevent bases for those later. But those events are pretty
frequency.
with help from and ok ori@
Diffstat (limited to 'usr.sbin/vmd/virtio.c')
-rw-r--r-- | usr.sbin/vmd/virtio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c index e1c49fe7209..8dc42ffe5c1 100644 --- a/usr.sbin/vmd/virtio.c +++ b/usr.sbin/vmd/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.79 2019/09/24 12:14:54 mlarkin Exp $ */ +/* $OpenBSD: virtio.c,v 1.80 2019/11/29 00:51:27 mlarkin Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -48,6 +48,7 @@ #include "atomicio.h" extern char *__progname; +extern struct event_base *evbase; struct viornd_dev viornd; struct vioblk_dev *vioblk; @@ -1880,6 +1881,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, event_set(&vionet[i].event, vionet[i].fd, EV_READ | EV_PERSIST, vionet_rx_event, &vionet[i]); + event_base_set(evbase, &vionet[i].event); if (event_add(&vionet[i].event, NULL)) { log_warn("could not initialize vionet event " "handler"); @@ -2034,6 +2036,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, vmmci.pci_id = id; evtimer_set(&vmmci.timeout, vmmci_timeout, NULL); + event_base_set(evbase, &vmmci.timeout); } void |