snapshot: re-anchor the mc timebase on start - #63
Merged
Conversation
mach-kernel
force-pushed
the
snapshot-restore-4
branch
from
July 30, 2026 13:30
f7c0f6e to
5331077
Compare
Nothing re-anchors last_host_ticks across a stop, so the first MC read after a pause credits the whole stopped interval to RPSS_CTR.
mach-kernel
force-pushed
the
snapshot-restore-4
branch
from
July 30, 2026 14:02
5331077 to
395846a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
last_host_ticksinMemoryController::start(), after therunning.swapguard so a redundant start does not discard live elapsed time.load_state:machine.rs:1448runs it well before the bulk memory restore at1503-1526, andrestart_peripherals()is the last statement ofload_snapshot_inner.cpu_cycle_accandrpss_cycle_accare left alone;power_onalready zeroes them and runs first on every restore path.Coverage / needs eyes
mc::tests::start_reanchors_timebasestales the anchor by 100 s, callsstart(), readsREG_RPSS_CTR. Reverting the one-line fix fails it at1500000954counts, the predicted 1.5e9 for 100 s at 50 MHz. With the fix the same read lands at 777-831 counts over four runs.cargo test --release --features lightning,rex-jit,chd: 358 passed, 11 ignored.update_timersstep ofcpu_cycles=16630691385after a snapshot restore,RPSS_CTR0x24d1b19to0xc88ead47.gdb_stub.rs:726/810and the monitorcpu stopcommand stop the CPU without stopping the MC, sostart()never runs and a held breakpoint is still billed on the next MC read. Worth a follow-up, left out to keep this to one thing.