refactor(virtio): reduce code duplication#2527
Open
cagatay-y wants to merge 7 commits into
Open
Conversation
This will allow sharing code between PCI and MMIO based devices.
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.
51195e0 to
973e439
Compare
There was a problem hiding this comment.
Benchmark Results
Details
| Benchmark | Current: fdbce51 | Previous: 8b752b3 | Performance Ratio |
|---|---|---|---|
| startup_benchmark Build Time | 78.55 s |
80.58 s |
0.97 ❗ |
| startup_benchmark File Size | 0.80 MB |
0.80 MB |
1.00 ❗ |
| Startup Time - 1 core | 0.77 s (±0.02 s) |
0.75 s (±0.02 s) |
1.03 |
| Startup Time - 2 cores | 0.76 s (±0.02 s) |
0.75 s (±0.02 s) |
1.02 |
| Startup Time - 4 cores | 0.76 s (±0.01 s) |
0.76 s (±0.03 s) |
1.01 |
| multithreaded_benchmark Build Time | 82.78 s |
83.77 s |
0.99 ❗ |
| multithreaded_benchmark File Size | 0.90 MB |
0.90 MB |
1.00 ❗ |
| Multithreaded Pi Efficiency - 2 Threads | 89.66 % (±5.53 %) |
88.91 % (±5.63 %) |
1.01 |
| Multithreaded Pi Efficiency - 4 Threads | 43.92 % (±3.33 %) |
43.58 % (±2.56 %) |
1.01 |
| Multithreaded Pi Efficiency - 8 Threads | 25.36 % (±1.56 %) |
25.21 % (±1.38 %) |
1.01 |
| micro_benchmarks Build Time | 77.63 s |
83.23 s |
0.93 ❗ |
| micro_benchmarks File Size | 0.90 MB |
0.90 MB |
1 |
| Scheduling time - 1 thread | 66.07 ticks (±3.40 ticks) |
66.41 ticks (±2.49 ticks) |
0.99 |
| Scheduling time - 2 threads | 38.03 ticks (±5.71 ticks) |
36.98 ticks (±4.38 ticks) |
1.03 |
| Micro - Time for syscall (getpid) | 4.16 ticks (±0.56 ticks) |
4.38 ticks (±0.61 ticks) |
0.95 |
| Memcpy speed - (built_in) block size 4096 | 81534.93 MByte/s (±56547.20 MByte/s) |
80964.12 MByte/s (±56065.00 MByte/s) |
1.01 |
| Memcpy speed - (built_in) block size 1048576 | 30534.87 MByte/s (±24663.33 MByte/s) |
30488.32 MByte/s (±24607.18 MByte/s) |
1.00 |
| Memcpy speed - (built_in) block size 16777216 | 29228.30 MByte/s (±24038.99 MByte/s) |
26922.99 MByte/s (±22163.33 MByte/s) |
1.09 |
| Memset speed - (built_in) block size 4096 | 81318.07 MByte/s (±56395.69 MByte/s) |
81292.09 MByte/s (±56295.77 MByte/s) |
1.00 |
| Memset speed - (built_in) block size 1048576 | 31270.63 MByte/s (±25089.27 MByte/s) |
31212.89 MByte/s (±25032.24 MByte/s) |
1.00 |
| Memset speed - (built_in) block size 16777216 | 29974.93 MByte/s (±24462.92 MByte/s) |
27704.28 MByte/s (±22658.95 MByte/s) |
1.08 |
| Memcpy speed - (rust) block size 4096 | 75568.58 MByte/s (±52655.30 MByte/s) |
73359.02 MByte/s (±51215.91 MByte/s) |
1.03 |
| Memcpy speed - (rust) block size 1048576 | 30294.63 MByte/s (±24512.45 MByte/s) |
30393.47 MByte/s (±24606.70 MByte/s) |
1.00 |
| Memcpy speed - (rust) block size 16777216 | 29049.84 MByte/s (±23876.60 MByte/s) |
27849.43 MByte/s (±22986.75 MByte/s) |
1.04 |
| Memset speed - (rust) block size 4096 | 76026.03 MByte/s (±52921.54 MByte/s) |
73359.02 MByte/s (±51215.91 MByte/s) |
1.04 |
| Memset speed - (rust) block size 1048576 | 31033.85 MByte/s (±24934.50 MByte/s) |
31145.98 MByte/s (±25044.39 MByte/s) |
1.00 |
| Memset speed - (rust) block size 16777216 | 29795.22 MByte/s (±24301.94 MByte/s) |
28625.01 MByte/s (±23459.41 MByte/s) |
1.04 |
| alloc_benchmarks Build Time | 76.21 s |
77.14 s |
0.99 ❗ |
| alloc_benchmarks File Size | 0.88 MB |
0.88 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 | 4798.63 Ticks (±114.09 Ticks) |
5021.61 Ticks (±76.52 Ticks) |
0.96 ❗ |
| Allocations - Average Allocation time (no fail) | 5554.15 Ticks (±150.67 Ticks) |
5797.34 Ticks (±78.21 Ticks) |
0.96 ❗ |
| Allocations - Average Deallocation time | 1102.44 Ticks (±334.82 Ticks) |
1468.37 Ticks (±182.04 Ticks) |
0.75 |
| mutex_benchmark Build Time | 77.46 s |
76.50 s |
1.01 ❗ |
| mutex_benchmark File Size | 0.90 MB |
0.90 MB |
1.00 ❗ |
| Mutex Stress Test Average Time per Iteration - 1 Threads | 12.18 ns (±0.48 ns) |
12.08 ns (±0.27 ns) |
1.01 |
| Mutex Stress Test Average Time per Iteration - 2 Threads | 41.96 ns (±2.23 ns) |
41.70 ns (±1.99 ns) |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.