Skip to content

refactor(virtio): reduce code duplication#2527

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

refactor(virtio): reduce code duplication#2527
cagatay-y wants to merge 7 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: b0d3c80 Previous: 496a427 Performance Ratio
startup_benchmark Build Time 79.39 s 80.41 s 0.99
startup_benchmark File Size 0.80 MB 0.80 MB 1.00
Startup Time - 1 core 0.74 s (±0.02 s) 0.73 s (±0.02 s) 1.01
Startup Time - 2 cores 0.73 s (±0.02 s) 0.73 s (±0.02 s) 1.00
Startup Time - 4 cores 0.75 s (±0.02 s) 0.74 s (±0.02 s) 1.01
multithreaded_benchmark Build Time 78.17 s 81.45 s 0.96
multithreaded_benchmark File Size 0.86 MB 0.86 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 87.87 % (±5.61 %) 89.19 % (±7.29 %) 0.99
Multithreaded Pi Efficiency - 4 Threads 44.15 % (±2.14 %) 43.23 % (±2.22 %) 1.02
Multithreaded Pi Efficiency - 8 Threads 25.62 % (±1.71 %) 25.70 % (±1.35 %) 1.00
micro_benchmarks Build Time 76.68 s 80.50 s 0.95
micro_benchmarks File Size 0.86 MB 0.86 MB 1.00
Scheduling time - 1 thread 60.15 ticks (±1.19 ticks) 61.77 ticks (±3.53 ticks) 0.97
Scheduling time - 2 threads 34.83 ticks (±5.25 ticks) 34.80 ticks (±4.41 ticks) 1.00
Micro - Time for syscall (getpid) 3.09 ticks (±0.52 ticks) 3.24 ticks (±0.53 ticks) 0.95
Memcpy speed - (built_in) block size 4096 84681.81 MByte/s (±58413.33 MByte/s) 82518.62 MByte/s (±57031.72 MByte/s) 1.03
Memcpy speed - (built_in) block size 1048576 30887.61 MByte/s (±24795.27 MByte/s) 30748.73 MByte/s (±24797.64 MByte/s) 1.00
Memcpy speed - (built_in) block size 16777216 29280.75 MByte/s (±24025.00 MByte/s) 26790.22 MByte/s (±22121.79 MByte/s) 1.09
Memset speed - (built_in) block size 4096 84850.46 MByte/s (±58534.82 MByte/s) 82944.82 MByte/s (±57257.89 MByte/s) 1.02
Memset speed - (built_in) block size 1048576 31638.26 MByte/s (±25229.14 MByte/s) 31513.05 MByte/s (±25249.82 MByte/s) 1.00
Memset speed - (built_in) block size 16777216 30059.45 MByte/s (±24481.56 MByte/s) 27578.05 MByte/s (±22634.55 MByte/s) 1.09
Memcpy speed - (rust) block size 4096 77628.35 MByte/s (±54067.44 MByte/s) 77062.45 MByte/s (±53546.55 MByte/s) 1.01
Memcpy speed - (rust) block size 1048576 30455.75 MByte/s (±24611.68 MByte/s) 30445.41 MByte/s (±24660.75 MByte/s) 1.00
Memcpy speed - (rust) block size 16777216 29494.60 MByte/s (±24231.73 MByte/s) 27553.35 MByte/s (±22787.50 MByte/s) 1.07
Memset speed - (rust) block size 4096 78079.15 MByte/s (±54378.42 MByte/s) 77521.43 MByte/s (±53878.01 MByte/s) 1.01
Memset speed - (rust) block size 1048576 31208.15 MByte/s (±25055.70 MByte/s) 31217.22 MByte/s (±25122.56 MByte/s) 1.00
Memset speed - (rust) block size 16777216 30281.62 MByte/s (±24686.59 MByte/s) 28357.26 MByte/s (±23299.40 MByte/s) 1.07
alloc_benchmarks Build Time 76.23 s 75.20 s 1.01
alloc_benchmarks File Size 0.87 MB 0.87 MB 1.00
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 4884.73 Ticks (±95.31 Ticks) 5199.04 Ticks (±177.30 Ticks) 0.94
Allocations - Average Allocation time (no fail) 5702.50 Ticks (±87.93 Ticks) 5969.39 Ticks (±137.74 Ticks) 0.96
Allocations - Average Deallocation time 1652.04 Ticks (±256.73 Ticks) 1612.60 Ticks (±268.46 Ticks) 1.02
mutex_benchmark Build Time 75.46 s 76.02 s 0.99
mutex_benchmark File Size 0.86 MB 0.86 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 12.04 ns (±0.28 ns) 11.94 ns (±0.37 ns) 1.01
Mutex Stress Test Average Time per Iteration - 2 Threads 39.48 ns (±2.56 ns) 40.06 ns (±2.30 ns) 0.99

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.
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