patina_boot: microbench connect_all and expand_device_path - #160
Open
kat-perez wants to merge 1 commit into
Open
patina_boot: microbench connect_all and expand_device_path#160kat-perez wants to merge 1 commit into
kat-perez wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new Criterion microbenchmarks to the patina_boot crate to characterize scaling behavior of key boot helper routines using fully synthetic, hardware-free mock topologies.
Changes:
- Registers two new bench targets (
connect_all,expand_device_path) inCargo.toml. - Adds
connect_allscaling benchmark over increasing synthetic handle counts. - Adds
expand_device_pathworst-case scan benchmark with the matching handle placed last.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| uefi/crates/patina_boot/Cargo.toml | Registers the two new Criterion bench harnesses. |
| uefi/crates/patina_boot/benches/connect_all.rs | Adds a scaling microbenchmark for helpers::connect_all using MockBootServices. |
| uefi/crates/patina_boot/benches/expand_device_path.rs | Adds a worst-case topology-scan microbenchmark for helpers::expand_device_path using synthetic device paths. |
Suppressed comments (1)
uefi/crates/patina_boot/benches/connect_all.rs:49
helpers::connect_alldoes not deduplicate handles by address (it only checks handle-count stabilization), so the explanation of why synthetic handles must have distinct addresses is inaccurate.
// `connect_all` dedups handles by address (`handle as usize`), so the
// synthetic handles must have distinct addresses or the topology would
// collapse to a single connected handle.
Add criterion microbenchmarks for helpers::connect_all and helpers::expand_device_path against synthetic MockBootServices handle topologies (sizes 1/16/128/512), on the benches/ harness. Both run hardware-free; connect_all measures per-handle connect scaling and expand_device_path measures a worst-case full-topology partition scan.
kat-perez
force-pushed
the
patina-boot-microbenches
branch
from
July 31, 2026 22:01
4a3e8a2 to
0329ddd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
uefi/crates/patina_boot/benches/support/mod.rs:37
- Using raw
rdtscwithout serialization can under/over-count due to out-of-order execution around the counter reads, which adds noise to microbench results. Add anlfence(or userdtscp) to serialize the timestamp reads.
fn end(&self, start: u64) -> u64 {
// SAFETY: see `start`.
let now = unsafe { core::arch::x86_64::_rdtsc() };
now.wrapping_sub(start)
}
uefi/crates/patina_boot/benches/support/mod.rs:7
- The module docs claim
rdtsccycle counts are frequency-independent and more stable across machines. That’s not guaranteed (e.g., VMs, non-invariant/unsynchronized TSC, core migration), so this wording can mislead when comparing results across hosts.
This issue also appears on line 33 of the same file.
//! [`Cycles`] is a criterion measurement backed by the x86 timestamp counter
//! (`rdtsc`), reporting elapsed reference cycles per iteration instead of
//! wall-clock time. The board acceptance criteria call for cycle counts, which
//! are also frequency-independent and so more stable across machines than
//! wall-time.
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.
Adds criterion microbenchmarks on the
benches/harness:connect_all—helpers::connect_allagainst a syntheticMockBootServiceshandle topology, parametrized over 1/16/128/512 handles, measuring per-handle connect scaling.expand_device_path—helpers::expand_device_pathagainst a synthetic device-path topology with the matching partition placed last, measuring a worst-case full-topology scan over 1/16/128/512 handles.Both run hardware-free in the dev harness.
Closes #116
Closes #117