Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci viornd(4): Process host entropy in softint context.
details: https://anonhg.NetBSD.org/src/rev/8366a44f68c4
branches: trunk
changeset: 364417:8366a44f68c4
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Mar 23 23:23:25 2022 +0000
description:
viornd(4): Process host entropy in softint context.
Samples added to the entropy pool in hard interrupt context are only
buffered, never processed directly, and if they fill the buffer, the
sample is dropped -- this serves to encourage taking timing samples
in hard interrupt context because it's cheap, and we have no idea how
many samples we really need for full entropy so it's safer to err on
the side of `as many as we can get'.
But for viornd(4), we assume the host has full entropy so we only
need a single 32-byte sample, and we want to avoid dropping it so we
get full entropy ASAP. Entering the sample in a soft interrupt
rather than hard interrupt achieves this.
diffstat:
sys/dev/pci/viornd.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r af308f3e1272 -r 8366a44f68c4 sys/dev/pci/viornd.c
--- a/sys/dev/pci/viornd.c Wed Mar 23 23:20:52 2022 +0000
+++ b/sys/dev/pci/viornd.c Wed Mar 23 23:23:25 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: viornd.c,v 1.16 2022/03/19 16:20:45 riastradh Exp $ */
+/* $NetBSD: viornd.c,v 1.17 2022/03/23 23:23:25 riastradh Exp $ */
/* $OpenBSD: viornd.c,v 1.1 2014/01/21 21:14:58 sf Exp $ */
/*
@@ -139,7 +139,7 @@
sc->sc_dev = self;
sc->sc_virtio = vsc;
- mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_VM);
+ mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_SOFTSERIAL);
error = bus_dmamem_alloc(virtio_dmat(vsc),
VIRTIO_PAGE_SIZE, 0, 0, segs, 1, &nsegs,
@@ -177,7 +177,7 @@
}
virtio_child_attach_start(vsc, self, IPL_NET, &sc->sc_vq,
- NULL, virtio_vq_intr, 0,
+ NULL, virtio_vq_intr, VIRTIO_F_INTR_MPSAFE|VIRTIO_F_INTR_SOFTINT,
0, VIRTIO_COMMON_FLAG_BITS);
error = virtio_alloc_vq(vsc, &sc->sc_vq, 0, VIORND_BUFSIZE, 1,
Home |
Main Index |
Thread Index |
Old Index