Skip to content

Remove print_debug and simplify Cargo features - #1980

Merged
ludfjig merged 3 commits into
hyperlight-dev:mainfrom
ludfjig:remove-print-debug-build-metadata
Nov 18, 2026
Merged

ludfjig merged 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
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

This comment has been minimized.

simongdavies
simongdavies previously approved these changes Nov 18, 2026
ludfjig and others added 3 commits November 18, 2026 09:27
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 b11097b to c302b92 Compare November 18, 2026 17:30
@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: c302b9207a02
Baseline commit: 9c7bf8aa0ab3

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 280.02 ns (➖ 1.01x faster)
vec_bytes 99.79 ns (➖ 1.27x slower)
374.03 µs (➖ 1.00x slower)

payload_allocation

slot_pool_segmented
262144 520.51 ns (➖ 1.00x slower)
65536 141.26 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 13.06 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
7.71 ns (➖ 1.00x slower) 7.69 ns (➖ 1.00x slower) 7.69 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 98.27 µs (➖ 1.00x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 6.97 µs (➖ 1.04x faster) 7.11 µs (➖ 1.00x faster)
65536 1.92 µs (➖ 1.09x faster) 2.06 µs (➖ 1.07x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 26.95 µs (➖ 1.00x slower)
65536 6.23 µs (➖ 1.01x faster) 6.18 µs (➖ 1.06x faster)
8192 1.03 µs (➖ 1.03x slower) 1.05 µs (➖ 1.08x faster)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 267.58 ns (➖ 1.05x slower)
vec_bytes 83.05 ns (➖ 1.01x slower)
656.94 µs (➖ 1.02x faster)

payload_allocation

slot_pool_segmented
262144 490.73 ns (➖ 1.02x faster)
65536 173.13 ns (➖ 1.02x slower)

sandboxes

create_initialized_and_drop
medium 15.27 ms (➖ 1.02x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
6.76 ns (➖ 1.03x faster) 6.75 ns (➖ 1.03x faster) 6.84 ns (➖ 1.01x faster)

snapshot_files

load_snapshot_unverified
small 48.90 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.46 µs (➖ 1.01x faster) 7.49 µs (➖ 1.00x faster)
65536 2.11 µs (➖ 1.01x slower) 2.09 µs (➖ 1.03x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 28.60 µs (➖ 1.02x faster)
65536 6.94 µs (➖ 1.01x faster) 6.95 µs (➖ 1.01x faster)
8192 700.35 ns (➖ 1.00x slower) 718.45 ns (➖ 1.01x slower)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 374.55 ns (➖ 1.03x slower)
vec_bytes 98.19 ns (➖ 1.06x faster)
359.90 µs (➖ 1.35x slower)

payload_allocation

slot_pool_segmented
262144 763.45 ns (➖ 1.08x faster)
65536 187.92 ns (➖ 1.03x faster)

sandboxes

create_initialized_and_drop
medium 63.12 ms (➖ 1.02x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.75 ns (➖ 1.04x faster) 9.87 ns (➖ 1.03x slower) 9.72 ns (➖ 1.01x faster)

snapshot_files

load_snapshot_unverified
small 106.53 µs (➖ 1.00x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 10.17 µs (➖ 1.02x slower) 10.05 µs (➖ 1.02x faster)
65536 2.21 µs (➖ 1.01x faster) 2.41 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 36.51 µs (➖ 1.04x faster)
65536 8.27 µs (➖ 1.17x faster) 8.37 µs (➖ 1.19x faster)
8192 1.24 µs (➖ 1.02x slower) 1.20 µs (➖ 1.07x faster)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 360.44 ns (➖ 1.01x faster)
vec_bytes 85.23 ns (➖ 1.03x faster)
717.99 µs (➖ 1.10x slower)

payload_allocation

slot_pool_segmented
262144 657.63 ns (➖ 1.04x faster)
65536 236.67 ns (➖ 1.04x faster)

sandboxes

create_initialized_and_drop
medium 82.80 ms (➖ 1.19x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.15 ns (➖ 1.03x slower) 9.11 ns (➖ 1.04x slower) 9.11 ns (➖ 1.05x slower)

snapshot_files

load_snapshot_unverified
small 56.18 µs (➖ 1.03x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.94 µs (➖ 1.01x faster) 8.04 µs (➖ 1.00x slower)
65536 2.29 µs (➖ 1.01x faster) 2.27 µs (➖ 1.00x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 39.79 µs (➖ 1.06x faster)
65536 7.46 µs (➖ 1.03x faster) 7.49 µs (➖ 1.00x faster)
8192 885.85 ns (➖ 1.04x faster) 885.20 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 549.46 ns (➖ 1.04x faster)
vec_bytes 162.73 ns (➖ 1.02x slower)
1.90 ms (➖ 1.02x faster)

payload_allocation

slot_pool_segmented
262144 886.84 ns (➖ 1.11x slower)
65536 232.01 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 11.70 ms (➖ 1.05x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
10.03 ns (➖ 1.00x faster) 9.99 ns (➖ 1.12x faster) 9.99 ns (➖ 1.06x faster)

snapshot_files

load_snapshot_unverified
small 810.05 µs (➖ 1.08x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.97 µs (➖ 1.02x faster) 9.23 µs (➖ 1.01x faster)
65536 2.30 µs (➖ 1.02x faster) 2.32 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 38.52 µs (➖ 1.01x faster)
65536 9.01 µs (➖ 1.01x faster) 9.47 µs (➖ 1.00x faster)
8192 1.24 µs (➖ 1.04x faster) 1.26 µs (➖ 1.02x faster)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 613.49 ns (➖ 1.03x slower)
vec_bytes 168.11 ns (➖ 1.00x slower)
3.45 ms (➖ 1.09x slower)

payload_allocation

slot_pool_segmented
262144 752.69 ns (➖ 1.01x slower)
65536 208.76 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 15.25 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.65 ns (➖ 1.00x faster) 9.93 ns (➖ 1.00x slower) 9.60 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 699.95 µs (➖ 1.02x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.79 µs (➖ 1.01x slower) 7.67 µs (➖ 1.00x faster)
65536 2.32 µs (➖ 1.00x slower) 2.29 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 41.82 µs (➖ 1.02x slower)
65536 9.29 µs (➖ 1.00x faster) 8.41 µs (➖ 1.01x faster)
8192 1.07 µs (➖ 1.08x faster) 1.18 µs (➖ 1.11x slower)

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

@ludfjig
ludfjig merged commit b9dfef3 into hyperlight-dev:main Nov 18, 2026
75 of 81 checks passed
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