Skip to content

refactor(virtio): make devices generic over transport#2447

Draft
cagatay-y wants to merge 1 commit into
hermit-os:mainfrom
cagatay-y:refactor-generic-transport
Draft

refactor(virtio): make devices generic over transport#2447
cagatay-y wants to merge 1 commit into
hermit-os:mainfrom
cagatay-y:refactor-generic-transport

Conversation

@cagatay-y
Copy link
Copy Markdown
Contributor

Instead of relying on importing one of the PCI and MMIO transport modules that implement identically named structs to select the transport used by VIRTIO device drivers, use generics. This is in preparation for removing the mutual exclusivity of PCI and MMIO-based devices.

@cagatay-y
Copy link
Copy Markdown
Contributor Author

I've marked the PR as draft because before we can allow MMIO and PCI drivers to coexist, we need to decide how we want to handle cases where there are multiple devices of a kind (e.g. NICs, console devices, filesystems, etc.). It shouldn't hurt to merge the changes before we make those decisions but it is also not particularly useful.

@cagatay-y cagatay-y force-pushed the refactor-generic-transport branch from df4ad6f to f7af9df Compare May 31, 2026 20:52
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

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: 34fe584 Previous: 0e06134 Performance Ratio
startup_benchmark Build Time 114.61 s 114.75 s 1.00
startup_benchmark File Size 0.75 MB 0.75 MB 1.00
Startup Time - 1 core 1.00 s (±0.04 s) 1.03 s (±0.05 s) 0.97
Startup Time - 2 cores 1.03 s (±0.05 s) 1.00 s (±0.04 s) 1.04
Startup Time - 4 cores 1.01 s (±0.05 s) 1.05 s (±0.06 s) 0.96
multithreaded_benchmark Build Time 115.66 s 118.19 s 0.98
multithreaded_benchmark File Size 0.87 MB 0.87 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 89.19 % (±15.26 %) 88.13 % (±17.77 %) 1.01
Multithreaded Pi Efficiency - 4 Threads 44.72 % (±7.49 %) 43.83 % (±8.68 %) 1.02
Multithreaded Pi Efficiency - 8 Threads 24.41 % (±4.02 %) 24.19 % (±4.32 %) 1.01
micro_benchmarks Build Time 94.37 s 95.80 s 0.99
micro_benchmarks File Size 0.87 MB 0.87 MB 1.00
Scheduling time - 1 thread 72.27 ticks (±4.06 ticks) 73.66 ticks (±3.11 ticks) 0.98
Scheduling time - 2 threads 42.05 ticks (±3.91 ticks) 42.62 ticks (±4.47 ticks) 0.99
Micro - Time for syscall (getpid) 4.10 ticks (±1.18 ticks) 3.97 ticks (±0.24 ticks) 1.03
Memcpy speed - (built_in) block size 4096 74273.13 MByte/s (±51552.77 MByte/s) 74285.81 MByte/s (±51386.38 MByte/s) 1.00
Memcpy speed - (built_in) block size 1048576 29586.16 MByte/s (±24261.76 MByte/s) 29225.43 MByte/s (±24061.57 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 24216.45 MByte/s (±19860.05 MByte/s) 24481.29 MByte/s (±20083.82 MByte/s) 0.99
Memset speed - (built_in) block size 4096 74620.48 MByte/s (±51749.58 MByte/s) 74360.40 MByte/s (±51439.53 MByte/s) 1.00
Memset speed - (built_in) block size 1048576 30324.82 MByte/s (±24684.05 MByte/s) 29962.87 MByte/s (±24486.09 MByte/s) 1.01
Memset speed - (built_in) block size 16777216 24854.42 MByte/s (±20242.50 MByte/s) 25226.63 MByte/s (±20580.18 MByte/s) 0.99
Memcpy speed - (rust) block size 4096 67909.73 MByte/s (±47393.90 MByte/s) 65746.63 MByte/s (±45737.46 MByte/s) 1.03
Memcpy speed - (rust) block size 1048576 29606.28 MByte/s (±24297.81 MByte/s) 29209.13 MByte/s (±23985.94 MByte/s) 1.01
Memcpy speed - (rust) block size 16777216 24198.28 MByte/s (±19883.36 MByte/s) 23697.58 MByte/s (±19489.14 MByte/s) 1.02
Memset speed - (rust) block size 4096 68300.56 MByte/s (±47655.94 MByte/s) 66213.47 MByte/s (±46120.45 MByte/s) 1.03
Memset speed - (rust) block size 1048576 30351.34 MByte/s (±24716.88 MByte/s) 29959.89 MByte/s (±24426.81 MByte/s) 1.01
Memset speed - (rust) block size 16777216 24848.64 MByte/s (±20280.53 MByte/s) 24144.16 MByte/s (±19717.09 MByte/s) 1.03
alloc_benchmarks Build Time 90.42 s 90.67 s 1.00
alloc_benchmarks File Size 0.83 MB 0.83 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 4058.64 Ticks (±55.95 Ticks) 4059.19 Ticks (±54.22 Ticks) 1.00
Allocations - Average Allocation time (no fail) 4058.64 Ticks (±55.95 Ticks) 4059.19 Ticks (±54.22 Ticks) 1.00
Allocations - Average Deallocation time 662.81 Ticks (±38.34 Ticks) 686.32 Ticks (±49.99 Ticks) 0.97
mutex_benchmark Build Time 90.50 s 90.77 s 1.00
mutex_benchmark File Size 0.87 MB 0.87 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 14.02 ns (±0.71 ns) 13.46 ns (±0.64 ns) 1.04
Mutex Stress Test Average Time per Iteration - 2 Threads 17.34 ns (±1.78 ns) 15.42 ns (±9.10 ns) 1.12

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

@cagatay-y cagatay-y force-pushed the refactor-generic-transport branch from f7af9df to 34fe584 Compare May 31, 2026 21:09
Instead of relying on importing one of the PCI and MMIO transport
modules that implement identically named structs to select the transport
used by VIRTIO device drivers, use generics. This is in preparation for
removing the mutual exclusivity of PCI and MMIO-based devices.
@cagatay-y cagatay-y force-pushed the refactor-generic-transport branch from 34fe584 to 22f3748 Compare June 1, 2026 13:52
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.

1 participant