Skip to content

Fix aarch64 timer interrupt configuration - #2585

Open
Gelbpunkt wants to merge 2 commits into
hermit-os:mainfrom
Gelbpunkt:aarch64-timer-fixes
Open

Fix aarch64 timer interrupt configuration#2585
Gelbpunkt wants to merge 2 commits into
hermit-os:mainfrom
Gelbpunkt:aarch64-timer-fixes

Conversation

@Gelbpunkt

Copy link
Copy Markdown
Member

We currently misconfigure the timer interrupt on aarch64, which results in it constantly firing if we have a BOOT_COUNTER that is not zero. We were also losing precision in some hypothetical edge cases. After fixing both, I see around 7 Gbit/s of throughput in the networking benchmarks rather than 5 Mbit/s and no more constant timer interrupts firing.

Dividing first and then multiplying could hypothetically result in
losing accuracy. If, for example, wt is 999, then wt / 1000 is 0
and we end up with a deadline that is 0. If we perform the multiplication
first, we preserve precision.
All of our absolute times are boot-relative, so we need to add the
BOOT_COUNTER offset to the absolute value before programming
CNTP_CVAL_EL0. Otherwise, if BOOT_COUNTER has a nonzero value, our
timer interrupts would always be in the past and fire constantly.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Benchmark Results

Details
Benchmark Current: 14a9820 Previous: 2e23902 Performance Ratio
startup_benchmark Build Time 84.23 s 80.34 s 1.05
startup_benchmark File Size 0.79 MB 0.80 MB 1.00
Startup Time - 1 core 0.76 s (±0.02 s) 0.75 s (±0.02 s) 1.01
Startup Time - 2 cores 0.76 s (±0.02 s) 0.74 s (±0.02 s) 1.03
Startup Time - 4 cores 0.77 s (±0.04 s) 0.74 s (±0.02 s) 1.03
multithreaded_benchmark Build Time 86.27 s 82.11 s 1.05
multithreaded_benchmark File Size 0.90 MB 0.86 MB 1.05
Multithreaded Pi Efficiency - 2 Threads 91.72 % (±5.11 %) 85.89 % (±6.61 %) 1.07
Multithreaded Pi Efficiency - 4 Threads 45.71 % (±2.79 %) 43.43 % (±2.56 %) 1.05
Multithreaded Pi Efficiency - 8 Threads 25.86 % (±1.58 %) 25.76 % (±1.53 %) 1.00
micro_benchmarks Build Time 86.17 s 80.40 s 1.07
micro_benchmarks File Size 0.90 MB 0.86 MB 1.05
Scheduling time - 1 thread 65.98 ticks (±3.66 ticks) 62.65 ticks (±4.06 ticks) 1.05
Scheduling time - 2 threads 36.95 ticks (±5.49 ticks) 34.08 ticks (±4.10 ticks) 1.08
Micro - Time for syscall (getpid) 3.85 ticks (±0.66 ticks) 3.45 ticks (±0.58 ticks) 1.11
Memcpy speed - (built_in) block size 4096 83180.02 MByte/s (±57453.60 MByte/s) 82448.38 MByte/s (±56997.13 MByte/s) 1.01
Memcpy speed - (built_in) block size 1048576 30335.58 MByte/s (±24510.37 MByte/s) 30585.98 MByte/s (±24707.84 MByte/s) 0.99
Memcpy speed - (built_in) block size 16777216 26194.12 MByte/s (±21662.98 MByte/s) 26340.06 MByte/s (±21720.96 MByte/s) 0.99
Memset speed - (built_in) block size 4096 83238.16 MByte/s (±57496.92 MByte/s) 82292.76 MByte/s (±56891.50 MByte/s) 1.01
Memset speed - (built_in) block size 1048576 31076.82 MByte/s (±24945.88 MByte/s) 31323.85 MByte/s (±25145.86 MByte/s) 0.99
Memset speed - (built_in) block size 16777216 26959.59 MByte/s (±22154.85 MByte/s) 27104.68 MByte/s (±22209.94 MByte/s) 0.99
Memcpy speed - (rust) block size 4096 73455.06 MByte/s (±51221.51 MByte/s) 74097.96 MByte/s (±51811.44 MByte/s) 0.99
Memcpy speed - (rust) block size 1048576 30192.66 MByte/s (±24461.51 MByte/s) 30361.60 MByte/s (±24602.37 MByte/s) 0.99
Memcpy speed - (rust) block size 16777216 27013.20 MByte/s (±22375.87 MByte/s) 27625.34 MByte/s (±22806.88 MByte/s) 0.98
Memset speed - (rust) block size 4096 73905.87 MByte/s (±51551.12 MByte/s) 74373.47 MByte/s (±51976.48 MByte/s) 0.99
Memset speed - (rust) block size 1048576 30918.67 MByte/s (±24887.59 MByte/s) 31110.89 MByte/s (±25033.24 MByte/s) 0.99
Memset speed - (rust) block size 16777216 27773.31 MByte/s (±22846.33 MByte/s) 28386.93 MByte/s (±23265.03 MByte/s) 0.98
alloc_benchmarks Build Time 78.39 s 74.76 s 1.05
alloc_benchmarks File Size 0.87 MB 0.87 MB 1.00
Allocations - Allocation success 91.31 % 91.31 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 61.44 % 61.44 % 1
Allocations - Average Allocation time 4236.81 Ticks (±103.92 Ticks) 5860.58 Ticks (±98.43 Ticks) 0.72
Allocations - Average Allocation time (no fail) 5042.30 Ticks (±104.07 Ticks) 6554.81 Ticks (±92.86 Ticks) 0.77
Allocations - Average Deallocation time 1174.89 Ticks (±186.24 Ticks) 1805.01 Ticks (±250.35 Ticks) 0.65
mutex_benchmark Build Time 78.86 s 79.82 s 0.99
mutex_benchmark File Size 0.90 MB 0.86 MB 1.05
Mutex Stress Test Average Time per Iteration - 1 Threads 12.10 ns (±0.41 ns) 12.10 ns (±0.41 ns) 1.00
Mutex Stress Test Average Time per Iteration - 2 Threads 40.04 ns (±2.30 ns) 40.26 ns (±1.68 ns) 0.99

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

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.

1 participant