Skip to content

Remove print_debug and simplify Cargo features - #1980

Open
ludfjig wants to merge 3 commits into
hyperlight-dev:mainfrom
ludfjig:remove-print-debug-build-metadata
Open

ludfjig wants to merge 3 commits into
hyperlight-dev:mainfrom
ludfjig:remove-print-debug-build-metadata

Conversation

@ludfjig

@ludfjig ludfjig commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Git metadata collection adds a costly build dependency and provides empty fields for crates.io builds.

  • Keep build metadata logging and drop git2 and Git fields.
  • Remove print_debug and the exported debug! macro.
  • Simplify Cargo feature lists.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 18:00
@ludfjig
ludfjig requested a review from danbugs as a code owner October 23, 2026 18:00
@ludfjig ludfjig added the C-refactor For PRs that restructure or remove code without adding new functionality. label Oct 23, 2026

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.

🟢 Approval recommended

Static review found no blocking issues, and the removals are consistent across callers, feature forwarding, build recipes, and documentation.

No open issues 🎉

What changed in this PR

This PR reduces Hyperlight host build overhead by removing two Cargo features and their logging machinery. It also simplifies feature forwarding and documents the breaking changes.

Changes:

  • Remove print_debug, hyperlight_host::debug!, and build-metadata logging with its build dependencies.
  • Simplify guest feature lists and keep common-crate tracing optional.
  • Update build recipes, coverage documentation, and the changelog.
File Description
src/​tests/​rust_guests/​witguest/​Cargo.toml Simplifies guest feature forwarding.
src/​tests/​rust_guests/​simpleguest/​Cargo.toml Simplifies guest feature forwarding.
src/​tests/​rust_guests/​dummyguest/​Cargo.toml Simplifies memory-profile forwarding.
src/​hyperlight_libc/​Cargo.toml Removes the empty features table.
src/​hyperlight_host/​src/​sandbox/​uninitialized.rs Removes build logging, uses tracing directly, and ungates tracing tests.
src/​hyperlight_host/​src/​sandbox/​trace/​context.rs Uses tracing::debug! directly.
src/​hyperlight_host/​src/​lib.rs Removes the debug macro and build-metadata machinery.
src/​hyperlight_host/​Cargo.toml Removes both features and the built dependency.
src/​hyperlight_host/​build.rs Removes metadata generation and the debug-print configuration alias.
src/​hyperlight_guest_bin/​Cargo.toml Simplifies tracing feature forwarding.
src/​hyperlight_common/​Cargo.toml Keeps tracing optional when enabling std.
Justfile Removes obsolete features from checks and test commands.
hack/​clippy-package-features.sh Removes stale feature exclusions.
docs/​how-to-run-coverage.md Aligns documented feature combinations with coverage commands.
CHANGELOG.md Documents feature removals and migration guidance.
Cargo.lock Removes unused build-metadata dependencies.

Review effort: Balanced

@ludfjig

ludfjig commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@simongdavies I know you have said in the past that build-metadata can be useful, but I don't agree. Applications can check their cargo.lock to see what version they use, and if they really want to include it in their tracing at runtime, they can do that too for any dependency they care about. I don't think hyperlight needs special feature for this

@hyperlight-gh-bot

This comment has been minimized.

andreiltd
andreiltd previously approved these changes Oct 26, 2026

@simongdavies simongdavies left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we should remove the build-metadata functionaility, the rest of it is fine.

@simongdavies

Copy link
Copy Markdown
Member

@simongdavies I know you have said in the past that build-metadata can be useful, but I don't agree. Applications can check their cargo.lock to see what version they use, and if they really want to include it in their tracing at runtime, they can do that too for any dependency they care about. I don't think hyperlight needs special feature for this

I don't believe that we should remove build-metadata(we can remove the feature but I don't think we should remove the functionality) I don't believe that it is possible for a consumer to actually reconstruct all this information , which has the potential to be very informative useful for production incident investigation. It has extremely low run time impact, it gets emitted once when hyperlight is first initialised.

@ludfjig

ludfjig commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

@simongdavies I know you have said in the past that build-metadata can be useful, but I don't agree. Applications can check their cargo.lock to see what version they use, and if they really want to include it in their tracing at runtime, they can do that too for any dependency they care about. I don't think hyperlight needs special feature for this

I don't believe that we should remove build-metadata(we can remove the feature but I don't think we should remove the functionality) I don't believe that it is possible for a consumer to actually reconstruct all this information , which has the potential to be very informative useful for production incident investigation. It has extremely low run time impact, it gets emitted once when hyperlight is first initialised.

Which information do you think is useful and do you know anybody using this? And why not let them (the applications) embed it themselves at compile time if they want, along with any other crates they care about, instead of relying on us to do it for them?

If you really want to keep this, what do you think of at least dropping the git2 dep of built so we don't need to build git all the time, since it's broken currently anyway (GIT_VERSION, GIT_DIRTY, GIT_HEAD_REF, GIT_COMMIT_HASH are not set when hyyperlight downloaded from crates.io), and I don't think anyone would need these refs during developement?

@simongdavies

Copy link
Copy Markdown
Member

If you really want to keep this, what do you think of at least dropping the git2 dep of built so we don't need to build git all the time, since it's broken currently anyway (GIT_VERSION, GIT_DIRTY, GIT_HEAD_REF, GIT_COMMIT_HASH are not set when hyyperlight downloaded from crates.io), and I don't think anyone would need these refs during developement?

Yes, this sounds reasonable.

ludfjig and others added 3 commits November 12, 2026 09:21
print_debug made the exported debug! macro also print to stdout in
debug builds. tracing::debug! already emits the same message. The
macro's cfg is evaluated in the caller's crate, so it never printed
for external users.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
* Enabling std on hyperlight-common no longer pulls in tracing.
* Feature lists name only the crates each package uses directly.
* Drop the empty hyperlight-libc features table and stale feature
  names from the clippy script.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig
ludfjig force-pushed the remove-print-debug-build-metadata branch from 7a74694 to b11097b Compare November 12, 2026 17:28
@ludfjig ludfjig changed the title Remove the print_debug and build-metadata cargo features Remove print_debug and simplify Cargo features Nov 12, 2026
@ludfjig

ludfjig commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

If you really want to keep this, what do you think of at least dropping the git2 dep of built so we don't need to build git all the time, since it's broken currently anyway (GIT_VERSION, GIT_DIRTY, GIT_HEAD_REF, GIT_COMMIT_HASH are not set when hyyperlight downloaded from crates.io), and I don't think anyone would need these refs during developement?

Yes, this sounds reasonable.

Applied! Ready for another review now

@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: b11097bd09c2
Baseline commit: 01df99173865

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 755.86 ns (➖ 1.04x faster)
vec_bytes 588.24 ns (➖ 1.02x faster)
373.14 µs (➖ 1.00x faster)

payload_allocation

slot_pool_segmented
262144 526.95 ns (➖ 1.01x slower)
65536 144.79 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 13.06 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
7.73 ns (➖ 1.00x slower) 7.72 ns (➖ 1.00x slower) 7.78 ns (➖ 1.17x faster)

snapshot_files

load_snapshot_unverified
small 99.72 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.63 µs (➖ 1.05x slower) 7.19 µs (➖ 1.01x slower)
65536 1.93 µs (➖ 1.08x faster) 2.06 µs (➖ 1.07x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 28.23 µs (➖ 1.04x slower)
65536 6.27 µs (➖ 1.00x slower) 6.25 µs (➖ 1.06x faster)
8192 1.08 µs (➖ 1.05x slower) 1.04 µs (➖ 1.03x slower)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 811.00 ns (➖ 1.01x slower)
vec_bytes 615.93 ns (➖ 1.01x faster)
744.59 µs (➖ 1.04x faster)

payload_allocation

slot_pool_segmented
262144 596.89 ns (➖ 1.02x slower)
65536 202.47 ns (➖ 1.02x slower)

sandboxes

create_initialized_and_drop
medium 14.92 ms (➖ 1.00x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
8.14 ns (➖ 1.02x slower) 8.18 ns (➖ 1.03x slower) 8.26 ns (➖ 1.04x slower)

snapshot_files

load_snapshot_unverified
small 62.52 µs (➖ 1.11x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 9.04 µs (➖ 1.02x slower) 8.93 µs (➖ 1.02x slower)
65536 2.53 µs (➖ 1.02x slower) 2.53 µs (➖ 1.01x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 35.73 µs (➖ 1.05x slower)
65536 8.34 µs (➖ 1.01x slower) 8.38 µs (➖ 1.02x slower)
8192 837.09 ns (➖ 1.00x slower) 850.41 ns (➖ 1.01x faster)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 944.85 ns (➖ 1.02x slower)
vec_bytes 765.91 ns (➖ 1.07x slower)
366.70 µs (➖ 1.38x slower)

payload_allocation

slot_pool_segmented
262144 717.16 ns (➖ 1.05x faster)
65536 189.79 ns (➖ 1.02x faster)

sandboxes

create_initialized_and_drop
medium 65.91 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.69 ns (➖ 1.01x slower) 10.02 ns (➖ 1.02x faster) 9.76 ns (➖ 1.01x slower)

snapshot_files

load_snapshot_unverified
small 105.37 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 10.01 µs (➖ 1.02x slower) 10.23 µs (➖ 1.05x faster)
65536 2.24 µs (➖ 1.00x slower) 2.43 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 36.40 µs (➖ 1.06x faster)
65536 8.52 µs (➖ 1.24x faster) 8.46 µs (➖ 1.16x faster)
8192 1.26 µs (➖ 1.04x slower) 1.26 µs (➖ 1.02x faster)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 928.21 ns (➖ 1.03x faster)
vec_bytes 673.71 ns (➖ 1.02x slower)
676.88 µs (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
262144 627.30 ns (➖ 1.06x faster)
65536 236.96 ns (➖ 1.08x faster)

sandboxes

create_initialized_and_drop
medium 60.66 ms (➖ 1.24x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.16 ns (➖ 1.05x slower) 9.17 ns (➖ 1.04x slower) 9.13 ns (➖ 1.05x slower)

snapshot_files

load_snapshot_unverified
small 56.79 µs (➖ 1.04x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.02 µs (➖ 1.01x slower) 7.97 µs (➖ 1.00x faster)
65536 2.28 µs (➖ 1.00x slower) 2.28 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 41.43 µs (➖ 1.09x slower)
65536 7.54 µs (➖ 1.00x slower) 7.53 µs (➖ 1.01x faster)
8192 896.68 ns (➖ 1.03x faster) 893.79 ns (➖ 1.03x faster)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.16 µs (➖ 1.08x faster)
vec_bytes 781.59 ns (➖ 1.14x faster)
2.20 ms (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
262144 795.10 ns (➖ 1.00x slower)
65536 230.76 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 12.71 ms (➖ 1.03x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
10.60 ns (➖ 1.00x faster) 10.59 ns (➖ 1.00x faster) 10.61 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 794.23 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.67 µs (➖ 1.01x faster) 8.63 µs (➖ 1.05x faster)
65536 2.54 µs (➖ 1.01x faster) 2.52 µs (➖ 1.03x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 37.52 µs (➖ 1.04x faster)
65536 8.57 µs (➖ 1.05x faster) 8.88 µs (➖ 1.02x slower)
8192 1.34 µs (➖ 1.02x faster) 1.38 µs (➖ 1.04x slower)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.25 µs (➖ 1.01x faster)
vec_bytes 834.65 ns (➖ 1.05x slower)
3.09 ms (➖ 1.04x slower)

payload_allocation

slot_pool_segmented
262144 745.23 ns (➖ 1.00x slower)
65536 208.89 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 14.42 ms (➖ 1.03x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.74 ns (➖ 1.03x faster) 10.06 ns (➖ 1.02x slower) 9.64 ns (➖ 1.10x faster)

snapshot_files

load_snapshot_unverified
small 676.59 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.73 µs (➖ 1.00x faster) 7.48 µs (➖ 1.03x faster)
65536 2.34 µs (➖ 1.00x faster) 2.30 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 41.15 µs (➖ 1.02x faster)
65536 8.50 µs (➖ 1.01x slower) 8.66 µs (➖ 1.03x slower)
8192 1.08 µs (➖ 1.08x faster) 1.11 µs (➖ 1.04x slower)

Reported by cargo ci bench-report --candidate run:43269815474 --config-file bench_report.toml.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-refactor For PRs that restructure or remove code without adding new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants