Skip to content

Support virtio entropy device - #2547

Open
sbutz wants to merge 3 commits into
hermit-os:mainfrom
sbutz:sb/virtio_entropy
Open

Support virtio entropy device#2547
sbutz wants to merge 3 commits into
hermit-os:mainfrom
sbutz:sb/virtio_entropy

Conversation

@sbutz

@sbutz sbutz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

In virtualized deployments seed DRNG from entropy provided by host.

Tbh this driver is of limited use, but was good exercise to get started with virtio.

Arch mmio pci
x86_64
aarch64
riscv64 ❌ - pci will be added with #2550

Blocked by integration of rust-osdev/virtio-spec-rs#24 and new release of virtio-spec-rs.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Details
Benchmark Current: 9a3240a Previous: 2e23902 Performance Ratio
startup_benchmark Build Time 81.91 s 80.34 s 1.02
startup_benchmark File Size 0.77 MB 0.80 MB 0.96
Startup Time - 1 core 0.76 s (±0.02 s) 0.75 s (±0.02 s) 1.02
Startup Time - 2 cores 0.76 s (±0.02 s) 0.74 s (±0.02 s) 1.03
Startup Time - 4 cores 0.76 s (±0.03 s) 0.74 s (±0.02 s) 1.02
multithreaded_benchmark Build Time 84.55 s 82.11 s 1.03
multithreaded_benchmark File Size 0.87 MB 0.86 MB 1.02
Multithreaded Pi Efficiency - 2 Threads 88.99 % (±6.57 %) 85.89 % (±6.61 %) 1.04
Multithreaded Pi Efficiency - 4 Threads 43.87 % (±2.36 %) 43.43 % (±2.56 %) 1.01
Multithreaded Pi Efficiency - 8 Threads 25.58 % (±1.49 %) 25.76 % (±1.53 %) 0.99
micro_benchmarks Build Time 83.24 s 80.40 s 1.04
micro_benchmarks File Size 0.88 MB 0.86 MB 1.02
Scheduling time - 1 thread 65.98 ticks (±3.41 ticks) 62.65 ticks (±4.06 ticks) 1.05
Scheduling time - 2 threads 36.10 ticks (±4.66 ticks) 34.08 ticks (±4.10 ticks) 1.06
Micro - Time for syscall (getpid) 4.49 ticks (±0.70 ticks) 3.45 ticks (±0.58 ticks) 1.30
Memcpy speed - (built_in) block size 4096 82626.56 MByte/s (±57054.43 MByte/s) 82448.38 MByte/s (±56997.13 MByte/s) 1.00
Memcpy speed - (built_in) block size 1048576 30140.40 MByte/s (±24338.31 MByte/s) 30585.98 MByte/s (±24707.84 MByte/s) 0.99
Memcpy speed - (built_in) block size 16777216 26203.78 MByte/s (±21686.61 MByte/s) 26340.06 MByte/s (±21720.96 MByte/s) 0.99
Memset speed - (built_in) block size 4096 83106.47 MByte/s (±57369.50 MByte/s) 82292.76 MByte/s (±56891.50 MByte/s) 1.01
Memset speed - (built_in) block size 1048576 30888.32 MByte/s (±24780.12 MByte/s) 31323.85 MByte/s (±25145.86 MByte/s) 0.99
Memset speed - (built_in) block size 16777216 26967.52 MByte/s (±22174.48 MByte/s) 27104.68 MByte/s (±22209.94 MByte/s) 0.99
Memcpy speed - (rust) block size 4096 75097.31 MByte/s (±52391.18 MByte/s) 74097.96 MByte/s (±51811.44 MByte/s) 1.01
Memcpy speed - (rust) block size 1048576 30071.47 MByte/s (±24371.31 MByte/s) 30361.60 MByte/s (±24602.37 MByte/s) 0.99
Memcpy speed - (rust) block size 16777216 27143.07 MByte/s (±22400.28 MByte/s) 27625.34 MByte/s (±22806.88 MByte/s) 0.98
Memset speed - (rust) block size 4096 75772.31 MByte/s (±52845.56 MByte/s) 74373.47 MByte/s (±51976.48 MByte/s) 1.02
Memset speed - (rust) block size 1048576 30816.13 MByte/s (±24804.05 MByte/s) 31110.89 MByte/s (±25033.24 MByte/s) 0.99
Memset speed - (rust) block size 16777216 27911.75 MByte/s (±22877.62 MByte/s) 28386.93 MByte/s (±23265.03 MByte/s) 0.98
alloc_benchmarks Build Time 76.55 s 74.76 s 1.02
alloc_benchmarks File Size 0.84 MB 0.87 MB 0.97
Allocations - Allocation success 91.34 % 91.31 % 1.00
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 61.54 % 61.44 % 1.00
Allocations - Average Allocation time 2679.27 Ticks (±705.73 Ticks) 5860.58 Ticks (±98.43 Ticks) 0.46
Allocations - Average Allocation time (no fail) 3703.72 Ticks (±619.95 Ticks) 6554.81 Ticks (±92.86 Ticks) 0.57
Allocations - Average Deallocation time 728.74 Ticks (±126.43 Ticks) 1805.01 Ticks (±250.35 Ticks) 0.40
mutex_benchmark Build Time 80.92 s 79.82 s 1.01
mutex_benchmark File Size 0.88 MB 0.86 MB 1.02
Mutex Stress Test Average Time per Iteration - 1 Threads 12.14 ns (±0.40 ns) 12.10 ns (±0.41 ns) 1.00
Mutex Stress Test Average Time per Iteration - 2 Threads 40.82 ns (±2.30 ns) 40.26 ns (±1.68 ns) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

@mkroening mkroening self-assigned this Jul 10, 2026
@sbutz
sbutz force-pushed the sb/virtio_entropy branch 3 times, most recently from 20127b4 to f0239f1 Compare July 11, 2026 11:52
@sbutz
sbutz marked this pull request as ready for review July 12, 2026 06:56
Commit shall be reverted when a new version of virtio-spec-rs is published.
@sbutz
sbutz force-pushed the sb/virtio_entropy branch 2 times, most recently from 59ce74e to 9fd9743 Compare August 7, 2026 17:39
@sbutz
sbutz force-pushed the sb/virtio_entropy branch from 9fd9743 to 9a3240a Compare August 7, 2026 18:05
@sbutz

sbutz commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@mkroening does the new feature virtio-entropy require a new kernel version and a bump in hermit-rs?
The ci tests are added in the last commit. It can be moved to separate PR which can be merged after the next new kernel release and bump in hermit-rs.

@mkroening

mkroening commented Aug 7, 2026

Copy link
Copy Markdown
Member

@mkroening does the new feature virtio-entropy require a new kernel version and a bump in hermit-rs? The ci tests are added in the last commit. It can be moved to separate PR which can be merged after the next new kernel release and bump in hermit-rs.

All it should need is the new feature being listed in the hermit-rs wrapper crate's Cargo.toml. A new kernel release or kernel bump in hermit-rs should not be necessary for the kernel CI to pick up the feature. Kernel CI always uses the latest hermit-rs commit. So please open a PR in hermit-rs, adding the feature. That uncontroversial one-line change can be merged immediately to unblock your further work here.

Sorry for the long wait. I have not forgotten this PR and will review it in the next days. :)

Edit: Thanks for keeping this PR up to date and rebasing on #2527, which I had prioritized for review in preparation for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants