Skip to content

fix(virtio/pci): map BARs only once#2572

Open
cagatay-y wants to merge 3 commits into
hermit-os:mainfrom
cagatay-y:fix-bar-mapping
Open

fix(virtio/pci): map BARs only once#2572
cagatay-y wants to merge 3 commits into
hermit-os:mainfrom
cagatay-y:fix-bar-mapping

Conversation

@cagatay-y

Copy link
Copy Markdown
Contributor

It is possible for multiple capabilities to be accessed through the same base address, so only create a new mapping if one does not already exist for the BAR slot.

It is possible for multiple capabilities to be accessed through the same base
address, so only create a new mapping if one does not already exist for the BAR
slot.

@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: 79de297 Previous: 2e23902 Performance Ratio
startup_benchmark Build Time 81.37 s 80.34 s 1.01
startup_benchmark File Size 0.76 MB 0.80 MB 0.95
Startup Time - 1 core 0.72 s (±0.02 s) 0.75 s (±0.02 s) 0.97
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.03 s) 0.74 s (±0.02 s) 1.00
multithreaded_benchmark Build Time 81.97 s 82.11 s 1.00
multithreaded_benchmark File Size 0.90 MB 0.86 MB 1.05
Multithreaded Pi Efficiency - 2 Threads 88.78 % (±6.77 %) 85.89 % (±6.61 %) 1.03
Multithreaded Pi Efficiency - 4 Threads 43.95 % (±2.62 %) 43.43 % (±2.56 %) 1.01
Multithreaded Pi Efficiency - 8 Threads 25.56 % (±1.05 %) 25.76 % (±1.53 %) 0.99
micro_benchmarks Build Time 81.08 s 80.40 s 1.01
micro_benchmarks File Size 0.90 MB 0.86 MB 1.05
Scheduling time - 1 thread 62.98 ticks (±2.10 ticks) 62.65 ticks (±4.06 ticks) 1.01
Scheduling time - 2 threads 35.92 ticks (±5.87 ticks) 34.08 ticks (±4.10 ticks) 1.05
Micro - Time for syscall (getpid) 3.38 ticks (±0.55 ticks) 3.45 ticks (±0.58 ticks) 0.98
Memcpy speed - (built_in) block size 4096 86287.79 MByte/s (±59747.76 MByte/s) 82448.38 MByte/s (±56997.13 MByte/s) 1.05
Memcpy speed - (built_in) block size 1048576 30708.53 MByte/s (±24720.74 MByte/s) 30585.98 MByte/s (±24707.84 MByte/s) 1.00
Memcpy speed - (built_in) block size 16777216 27492.34 MByte/s (±22612.07 MByte/s) 26340.06 MByte/s (±21720.96 MByte/s) 1.04
Memset speed - (built_in) block size 4096 86366.81 MByte/s (±59803.86 MByte/s) 82292.76 MByte/s (±56891.50 MByte/s) 1.05
Memset speed - (built_in) block size 1048576 31462.99 MByte/s (±25162.11 MByte/s) 31323.85 MByte/s (±25145.86 MByte/s) 1.00
Memset speed - (built_in) block size 16777216 28279.54 MByte/s (±23109.09 MByte/s) 27104.68 MByte/s (±22209.94 MByte/s) 1.04
Memcpy speed - (rust) block size 4096 76598.37 MByte/s (±53392.96 MByte/s) 74097.96 MByte/s (±51811.44 MByte/s) 1.03
Memcpy speed - (rust) block size 1048576 30587.48 MByte/s (±24681.34 MByte/s) 30361.60 MByte/s (±24602.37 MByte/s) 1.01
Memcpy speed - (rust) block size 16777216 27733.99 MByte/s (±22828.53 MByte/s) 27625.34 MByte/s (±22806.88 MByte/s) 1.00
Memset speed - (rust) block size 4096 76998.74 MByte/s (±53677.73 MByte/s) 74373.47 MByte/s (±51976.48 MByte/s) 1.04
Memset speed - (rust) block size 1048576 31328.79 MByte/s (±25116.22 MByte/s) 31110.89 MByte/s (±25033.24 MByte/s) 1.01
Memset speed - (rust) block size 16777216 28491.35 MByte/s (±23290.56 MByte/s) 28386.93 MByte/s (±23265.03 MByte/s) 1.00
alloc_benchmarks Build Time 75.73 s 74.76 s 1.01
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 3082.47 Ticks (±215.36 Ticks) 5860.58 Ticks (±98.43 Ticks) 0.53
Allocations - Average Allocation time (no fail) 4057.06 Ticks (±184.36 Ticks) 6554.81 Ticks (±92.86 Ticks) 0.62
Allocations - Average Deallocation time 993.19 Ticks (±98.43 Ticks) 1805.01 Ticks (±250.35 Ticks) 0.55
mutex_benchmark Build Time 75.87 s 79.82 s 0.95
mutex_benchmark File Size 0.90 MB 0.86 MB 1.05
Mutex Stress Test Average Time per Iteration - 1 Threads 11.90 ns (±0.46 ns) 12.10 ns (±0.41 ns) 0.98
Mutex Stress Test Average Time per Iteration - 2 Threads 38.66 ns (±2.42 ns) 40.26 ns (±1.68 ns) 0.96

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

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

LLM review

The changes introduce a caching mechanism for PCI BAR mappings using LazyCell, but there are potential correctness and safety issues to address.

Comment thread src/drivers/virtio/transport/pci.rs
Comment thread src/drivers/virtio/transport/pci.rs
Comment thread src/drivers/virtio/transport/pci.rs
Comment thread src/drivers/virtio/transport/pci.rs Outdated
@stlankes

stlankes commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@cagatay-y @mkroening @jounathaen Sorry, this PR was my test if an LLM is able to support reviews. I am not sure, if this helps...

@cagatay-y

Copy link
Copy Markdown
Contributor Author

Sorry, this PR was my test if an LLM is able to support reviews. I am not sure, if this helps...

I replied to the comments in case it is useful for the evaluation of the test :)

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