diff options
author | jhb <jhb@FreeBSD.org> | 2012-09-25 14:55:46 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2012-09-25 14:55:46 +0000 |
commit | cabd8b8de74ed56244621b305e859bf472197ae1 (patch) | |
tree | a1944b486a5735f685a3b728ef64d34e893fc0af /sys/kern/kern_intr.c | |
parent | 446cdf51f30f8f5ae3624d416fcbf0e066c36fa4 (diff) | |
download | FreeBSD-src-cabd8b8de74ed56244621b305e859bf472197ae1.zip FreeBSD-src-cabd8b8de74ed56244621b305e859bf472197ae1.tar.gz |
Add optional entropy harvesting for software interrupts in swi_sched()
as controlled by kern.random.sys.harvest.swi. SWI harvesting feeds into
the interrupt FIFO and each event is estimated as providing a single bit of
entropy.
Reviewed by: markm, obrien
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_intr.c')
-rw-r--r-- | sys/kern/kern_intr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 8e7ac1fc..bce2397 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -1144,11 +1144,21 @@ swi_sched(void *cookie, int flags) { struct intr_handler *ih = (struct intr_handler *)cookie; struct intr_event *ie = ih->ih_event; + struct intr_entropy entropy; int error; CTR3(KTR_INTR, "swi_sched: %s %s need=%d", ie->ie_name, ih->ih_name, ih->ih_need); + if (harvest.swi) { + CTR2(KTR_INTR, "swi_sched: pid %d (%s) gathering entropy", + curproc->p_pid, curthread->td_name); + entropy.event = (uintptr_t)ih; + entropy.td = curthread; + random_harvest(&entropy, sizeof(entropy), 1, 0, + RANDOM_INTERRUPT); + } + /* * Set ih_need for this handler so that if the ithread is already * running it will execute this handler on the next pass. Otherwise, |