Skip to content

refactor(virtio): reduce code duplication#2527

Open
cagatay-y wants to merge 8 commits into
hermit-os:mainfrom
cagatay-y:refactor-virtio
Open

refactor(virtio): reduce code duplication#2527
cagatay-y wants to merge 8 commits into
hermit-os:mainfrom
cagatay-y:refactor-virtio

Conversation

@cagatay-y

Copy link
Copy Markdown
Contributor

No description provided.

@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: 7e5e4eb Previous: 2e23902 Performance Ratio
startup_benchmark Build Time 75.47 s 80.34 s 0.94
startup_benchmark File Size 0.76 MB 0.80 MB 0.95
Startup Time - 1 core 0.71 s (±0.02 s) 0.75 s (±0.02 s) 0.95
Startup Time - 2 cores 0.73 s (±0.02 s) 0.74 s (±0.02 s) 0.99
Startup Time - 4 cores 0.74 s (±0.02 s) 0.74 s (±0.02 s) 0.99
multithreaded_benchmark Build Time 81.30 s 82.11 s 0.99
multithreaded_benchmark File Size 0.90 MB 0.86 MB 1.05
Multithreaded Pi Efficiency - 2 Threads 89.15 % (±6.32 %) 85.89 % (±6.61 %) 1.04
Multithreaded Pi Efficiency - 4 Threads 44.93 % (±2.16 %) 43.43 % (±2.56 %) 1.03
Multithreaded Pi Efficiency - 8 Threads 26.07 % (±1.13 %) 25.76 % (±1.53 %) 1.01
micro_benchmarks Build Time 81.56 s 80.40 s 1.01
micro_benchmarks File Size 0.90 MB 0.86 MB 1.05
Scheduling time - 1 thread 62.76 ticks (±1.45 ticks) 62.65 ticks (±4.06 ticks) 1.00
Scheduling time - 2 threads 36.67 ticks (±5.65 ticks) 34.08 ticks (±4.10 ticks) 1.08
Micro - Time for syscall (getpid) 3.53 ticks (±0.50 ticks) 3.45 ticks (±0.58 ticks) 1.02
Memcpy speed - (built_in) block size 4096 82897.36 MByte/s (±57454.49 MByte/s) 82448.38 MByte/s (±56997.13 MByte/s) 1.01
Memcpy speed - (built_in) block size 1048576 30800.53 MByte/s (±24797.44 MByte/s) 30585.98 MByte/s (±24707.84 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 26992.04 MByte/s (±22279.23 MByte/s) 26340.06 MByte/s (±21720.96 MByte/s) 1.02
Memset speed - (built_in) block size 4096 82934.13 MByte/s (±57482.06 MByte/s) 82292.76 MByte/s (±56891.50 MByte/s) 1.01
Memset speed - (built_in) block size 1048576 31494.85 MByte/s (±25209.07 MByte/s) 31323.85 MByte/s (±25145.86 MByte/s) 1.01
Memset speed - (built_in) block size 16777216 27749.34 MByte/s (±22755.71 MByte/s) 27104.68 MByte/s (±22209.94 MByte/s) 1.02
Memcpy speed - (rust) block size 4096 78263.08 MByte/s (±54203.73 MByte/s) 74097.96 MByte/s (±51811.44 MByte/s) 1.06
Memcpy speed - (rust) block size 1048576 30684.29 MByte/s (±24748.85 MByte/s) 30361.60 MByte/s (±24602.37 MByte/s) 1.01
Memcpy speed - (rust) block size 16777216 27033.90 MByte/s (±22285.00 MByte/s) 27625.34 MByte/s (±22806.88 MByte/s) 0.98
Memset speed - (rust) block size 4096 78313.51 MByte/s (±54233.85 MByte/s) 74373.47 MByte/s (±51976.48 MByte/s) 1.05
Memset speed - (rust) block size 1048576 31419.90 MByte/s (±25175.66 MByte/s) 31110.89 MByte/s (±25033.24 MByte/s) 1.01
Memset speed - (rust) block size 16777216 27823.17 MByte/s (±22785.79 MByte/s) 28386.93 MByte/s (±23265.03 MByte/s) 0.98
alloc_benchmarks Build Time 79.71 s 74.76 s 1.07
alloc_benchmarks File Size 0.84 MB 0.87 MB 0.96
Allocations - Allocation success 91.31 % 91.31 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 61.44 % 61.44 % 1
Allocations - Average Allocation time 2336.73 Ticks (±512.04 Ticks) 5860.58 Ticks (±98.43 Ticks) 0.40
Allocations - Average Allocation time (no fail) 3390.26 Ticks (±431.97 Ticks) 6554.81 Ticks (±92.86 Ticks) 0.52
Allocations - Average Deallocation time 631.92 Ticks (±79.46 Ticks) 1805.01 Ticks (±250.35 Ticks) 0.35
mutex_benchmark Build Time 86.36 s 79.82 s 1.08
mutex_benchmark File Size 0.90 MB 0.86 MB 1.05
Mutex Stress Test Average Time per Iteration - 1 Threads 11.86 ns (±0.40 ns) 12.10 ns (±0.41 ns) 0.98
Mutex Stress Test Average Time per Iteration - 2 Threads 38.98 ns (±2.54 ns) 40.26 ns (±1.68 ns) 0.97

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

@mkroening mkroening self-assigned this Jul 5, 2026
This will allow sharing code between PCI and MMIO based devices.
cagatay-y added 6 commits July 9, 2026 00:45
Device ID is a constant defined in the VIRTIO specification for a given device
on a transport, so storing and printing it on error does not provide additional
information to the user.
Structures initialized with placeholder values can allow incorrect code that
reads them before they are actually filled in. This previously caused bugs in
virtio-net. For virtio-net, our solution was to work around it by making the
structure generic over its initialization stage. This approach, however, causes
the way the driver is initialized to differ in structure from how the other
drivers are initialized. This is an issue for us because it prevents making more
parts of the driver initialization common between the different device types.
@cagatay-y
cagatay-y force-pushed the refactor-virtio branch 3 times, most recently from 42a5931 to cb5456c Compare July 16, 2026 17:22
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