Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144532657
D12132.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D12132.id.diff
View Options
Index: sys/dev/random/random_harvestq.h
===================================================================
--- sys/dev/random/random_harvestq.h
+++ sys/dev/random/random_harvestq.h
@@ -47,6 +47,7 @@
#define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN)
#define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx)
+#define RANDOM_HARVEST_TRYLOCK(x) mtx_trylock_spin(&harvest_context.hc_mtx)
#define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx)
#endif /* SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED */
Index: sys/dev/random/random_harvestq.c
===================================================================
--- sys/dev/random/random_harvestq.c
+++ sys/dev/random/random_harvestq.c
@@ -425,7 +425,10 @@
KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin));
if (!(harvest_context.hc_source_mask & (1 << origin)))
return;
- RANDOM_HARVEST_LOCK();
+ if (!RANDOM_HARVEST_TRYLOCK()) {
+ random_harvest_fast(entropy, size, bits, origin);
+ return;
+ }
ring_in = (harvest_context.hc_entropy_ring.in + 1)%RANDOM_RING_MAX;
if (ring_in != harvest_context.hc_entropy_ring.out) {
/* The ring is not full */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 10, 6:40 AM (12 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28616582
Default Alt Text
D12132.id.diff (1 KB)
Attached To
Mode
D12132: Avoid spinning in random_harvest_queue
Attached
Detach File
Event Timeline
Log In to Comment