Skip to content

patina_boot: microbench connect_all and expand_device_path - #160

Open
kat-perez wants to merge 1 commit into
OpenDevicePartnership:mainfrom
kat-perez:patina-boot-microbenches
Open

patina_boot: microbench connect_all and expand_device_path#160
kat-perez wants to merge 1 commit into
OpenDevicePartnership:mainfrom
kat-perez:patina-boot-microbenches

Conversation

@kat-perez

Copy link
Copy Markdown
Contributor

Adds criterion microbenchmarks on the benches/ harness:

  • connect_allhelpers::connect_all against a synthetic MockBootServices handle topology, parametrized over 1/16/128/512 handles, measuring per-handle connect scaling.
  • expand_device_pathhelpers::expand_device_path against 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

Copilot AI review requested due to automatic review settings July 31, 2026 21:01
@kat-perez
kat-perez requested a review from a team as a code owner July 31, 2026 21:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) in Cargo.toml.
  • Adds connect_all scaling benchmark over increasing synthetic handle counts.
  • Adds expand_device_path worst-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_all does 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.

Comment thread uefi/crates/patina_boot/benches/expand_device_path.rs Outdated
Comment thread uefi/crates/patina_boot/benches/connect_all.rs Outdated
Comment thread uefi/crates/patina_boot/benches/connect_all.rs Outdated
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
kat-perez force-pushed the patina-boot-microbenches branch from 4a3e8a2 to 0329ddd Compare July 31, 2026 22:01
Copilot AI review requested due to automatic review settings July 31, 2026 22:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 rdtsc without serialization can under/over-count due to out-of-order execution around the counter reads, which adds noise to microbench results. Add an lfence (or use rdtscp) 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 rdtsc cycle 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.

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.

Microbench helpers::expand_device_path against synthetic topology Microbench helpers::connect_all against synthetic handle topology

2 participants