diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-12-18 19:18:23 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-12-18 19:18:23 +0000 |
commit | b46d769fc373a8d20f3bd8c5c7604f657223d8b6 (patch) | |
tree | f0a6969dda5d006a0ad336a5f6674a2d2a53280a /sys/dev | |
parent | c9eccb02a456f2ccc9be867e606fde123f163dfb (diff) |
The VM host might send multiple messages at once but vmt(4) only
processed one of time per second. Change the code to process all
queued messages without delay immediately. This fixes two things: a)
the vmt time sensor is available on boot when ntpd -s is loaded and b)
the random seeding on resume (OS_Resume message) is executed almost
immediately and not delayed by about 20 seconds.
ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/vmt.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/vmt.c b/sys/dev/vmt.c index 76346d31176..500552f70b2 100644 --- a/sys/dev/vmt.c +++ b/sys/dev/vmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmt.c,v 1.21 2014/12/18 16:30:29 deraadt Exp $ */ +/* $OpenBSD: vmt.c,v 1.22 2014/12/18 19:18:22 reyk Exp $ */ /* * Copyright (c) 2007 David Crawshaw <david@zentus.com> @@ -492,6 +492,10 @@ vmt_tclo_tick(void *xarg) struct vmt_softc *sc = xarg; u_int32_t rlen; u_int16_t ack; + int delay; + + /* By default, poll every second for new messages */ + delay = 1; /* reopen tclo channel if it's currently closed */ if (sc->sc_tclo_rpc.channel == 0 && @@ -541,6 +545,9 @@ vmt_tclo_tick(void *xarg) } sc->sc_tclo_ping = 0; + /* The VM host can queue multiple messages; continue without delay */ + delay = 0; + if (strcmp(sc->sc_rpc_buf, "reset") == 0) { if (sc->sc_rpc_error != 0) { @@ -681,8 +688,13 @@ vmt_tclo_tick(void *xarg) } } + if (sc->sc_rpc_error == 1) { + /* On error, give time to recover and wait a second */ + delay = 1; + } + out: - timeout_add_sec(&sc->sc_tclo_tick, 1); + timeout_add_sec(&sc->sc_tclo_tick, delay); } #define BACKDOOR_OP_I386(op, frame) \ |