Skip to content

Conversation

n0toose
Copy link
Member

@n0toose n0toose commented Oct 10, 2025

  • Skip memory probes, use default address directly on Uhyve.
  • Checking whether the processor supports x2apic in init_x2apic goes against the component's own conventions.
  • We need a local APIC, but IO-APIC is not supported.
  • Show more relevant info/warning messages.
  • Fix minor formatting issue that shows "0x0x" prefix.

Fixes #1352

@n0toose
Copy link
Member Author

n0toose commented Oct 10, 2025

As pointed out in #1352 (comment), a manual skip of x2apic causes an error (adding that it appears both under QEMU and Uhyve). I don't currently believe it is relevant to my changes.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark Results

Benchmark Current: 08867bb Previous: 8e08755 Performance Ratio
startup_benchmark Build Time 115.54 s 118.64 s 0.97
startup_benchmark File Size 0.90 MB 0.90 MB 1.00
Startup Time - 1 core 0.88 s (±0.03 s) 0.92 s (±0.03 s) 0.96
Startup Time - 2 cores 0.90 s (±0.03 s) 0.93 s (±0.03 s) 0.97
Startup Time - 4 cores 0.90 s (±0.04 s) 0.90 s (±0.03 s) 0.99
multithreaded_benchmark Build Time 114.31 s 115.52 s 0.99
multithreaded_benchmark File Size 1.01 MB 1.01 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 87.84 % (±9.47 %) 89.14 % (±8.69 %) 0.99
Multithreaded Pi Efficiency - 4 Threads 43.64 % (±3.30 %) 43.33 % (±4.80 %) 1.01
Multithreaded Pi Efficiency - 8 Threads 25.03 % (±1.86 %) 24.89 % (±3.25 %) 1.01
micro_benchmarks Build Time 110.99 s 121.35 s 0.91
micro_benchmarks File Size 1.01 MB 1.01 MB 1.00
Scheduling time - 1 thread 65.85 ticks (±5.14 ticks) 64.78 ticks (±3.48 ticks) 1.02
Scheduling time - 2 threads 37.95 ticks (±5.22 ticks) 39.58 ticks (±5.81 ticks) 0.96
Micro - Time for syscall (getpid) 3.16 ticks (±0.50 ticks) 3.11 ticks (±0.35 ticks) 1.01
Memcpy speed - (built_in) block size 4096 77124.23 MByte/s (±53565.81 MByte/s) 76892.26 MByte/s (±53208.68 MByte/s) 1.00
Memcpy speed - (built_in) block size 1048576 42717.77 MByte/s (±29575.57 MByte/s) 42437.70 MByte/s (±29401.77 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 24106.08 MByte/s (±20044.63 MByte/s) 24216.95 MByte/s (±20131.45 MByte/s) 1.00
Memset speed - (built_in) block size 4096 76675.88 MByte/s (±53248.29 MByte/s) 76746.14 MByte/s (±53110.30 MByte/s) 1.00
Memset speed - (built_in) block size 1048576 42897.69 MByte/s (±29697.86 MByte/s) 42677.86 MByte/s (±29565.07 MByte/s) 1.01
Memset speed - (built_in) block size 16777216 24505.42 MByte/s (±20221.68 MByte/s) 24944.26 MByte/s (±20616.34 MByte/s) 0.98
Memcpy speed - (rust) block size 4096 69331.51 MByte/s (±48574.36 MByte/s) 72842.39 MByte/s (±51003.78 MByte/s) 0.95
Memcpy speed - (rust) block size 1048576 42474.29 MByte/s (±29435.83 MByte/s) 42614.04 MByte/s (±29546.77 MByte/s) 1.00
Memcpy speed - (rust) block size 16777216 24490.51 MByte/s (±20300.02 MByte/s) 25125.16 MByte/s (±20845.63 MByte/s) 0.97
Memset speed - (rust) block size 4096 69543.27 MByte/s (±48704.40 MByte/s) 73212.71 MByte/s (±51231.34 MByte/s) 0.95
Memset speed - (rust) block size 1048576 42680.82 MByte/s (±29575.26 MByte/s) 42865.24 MByte/s (±29720.96 MByte/s) 1.00
Memset speed - (rust) block size 16777216 24750.78 MByte/s (±20393.15 MByte/s) 25840.21 MByte/s (±21299.14 MByte/s) 0.96
alloc_benchmarks Build Time 106.69 s 106.38 s 1.00
alloc_benchmarks File Size 0.97 MB 0.97 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 69.99 % (±0.30 %) 70.03 % (±0.28 %) 1.00
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 12712.40 Ticks (±157.18 Ticks) 11224.94 Ticks (±674.74 Ticks) 1.13
Allocations - Average Allocation time (no fail) 12712.40 Ticks (±157.18 Ticks) 11224.94 Ticks (±674.74 Ticks) 1.13
Allocations - Average Deallocation time 760.79 Ticks (±128.50 Ticks) 733.24 Ticks (±64.51 Ticks) 1.04
mutex_benchmark Build Time 104.79 s 111.63 s 0.94
mutex_benchmark File Size 1.01 MB 1.01 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 12.50 ns (±0.94 ns) 13.10 ns (±0.85 ns) 0.95
Mutex Stress Test Average Time per Iteration - 2 Threads 13.96 ns (±1.23 ns) 14.56 ns (±0.90 ns) 0.96

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

@mkroening mkroening self-requested a review October 11, 2025 08:18
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Could you split this up into several commits to ease review of separate changes? :)

I am not too convinced about the log changes. Not being able to find APIC via ACPI or MP is expected for certain machines (such as Uhyve). I don't think this warrants a warning. In what kind of cases are the logs useful in practice?

@mkroening mkroening self-assigned this Oct 11, 2025
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Do I understand correctly that this is improving the performance and not fixing a problem?

@n0toose
Copy link
Member Author

n0toose commented Oct 16, 2025

Do I understand correctly that this is improving the performance and not fixing a problem?

I considered performing checks "that will not go anywhere" in the Uhyve environment to be a problem/bug, but I understand why the fix: might be misleading. Sorry.

To answer your question: Yes. To the best extend that I am aware of, I don't find that the previous checks are necessary within Uhyve (as far as its main branch is concerned) for Uhyve to work. This change removes this "small freeze effect"-feeling when launching Uhyve.

@mkroening mkroening changed the title fix(apic): skip apic probe on uhyve, simplify checks perf(x86_64): skip APIC probe on uhyve Oct 17, 2025
@mkroening
Copy link
Member

mkroening commented Oct 17, 2025

All right, I have further separated the refactoring from the first commit. I think you missed adding a condition in application_processor_init. I wonder why this caused no problems, though. It should have, as far as I understand.

Are you okay with my changes? :) c2159c8..9d15052

Copy link
Member Author

@n0toose n0toose left a comment

Choose a reason for hiding this comment

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

Yes, thanks for catching this and you have my apologies for the errors. :)

Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Thanks! :)

@n0toose
Copy link
Member Author

n0toose commented Oct 20, 2025

CI reports:

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/uhyve-0.5.0/src/linux/x86_64/kvm_cpu.rs:145:14:
Unable to disable exists due pause instructions: Error(22)
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

@mkroening
Copy link
Member

Yeah, that's #1992. I thought we might be able to avoid rebasing.

n0toose and others added 3 commits October 20, 2025 11:50
- Skip memory probes, use default address directly on Uhyve.
- We need a local APIC, but IO-APIC is not supported.
@mkroening mkroening force-pushed the uhyve-skip-apic branch 2 times, most recently from 08867bb to 78813ec Compare October 20, 2025 09:52
@mkroening mkroening added this pull request to the merge queue Oct 20, 2025
Merged via the queue into hermit-os:main with commit 54ef48b Oct 20, 2025
19 of 34 checks passed
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.

Skip APIC detection on Uhyve

2 participants