Repository navigation
ioc: power_on clears only the lines the IOC drives - #274
Merged
techomancer merged 1 commit intoOct 22, 2026
Merged
Conversation
The CPU's interrupt word is shared. Besides the IOC's IP2..IP6 it carries IP7, which the compare timer raises from the hptimer thread, and bit 63, the soft-reset request a device sets through CpuDevice::signal. power_on stored 0 over the whole word, so a reset through the IOC — Machine::reset, a snapshot load or a rollback, all of which run power_on_devices — could drop a tick or a pending soft reset that landed while it ran, neither of which the IOC owns. Clear exactly the five lines update_interrupts drives, and keep that set in one constant. Test: a word with every bit set comes back with only IP2..IP6 cleared. Fixes techomancer#264
Owner
|
thanks! |
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.
ioc: power_on clears only the lines the IOC drives
Ioc::power_onstored 0 over the CPU's whole interrupt word. That word is shared: besides the IOC's IP2..IP6 it carries IP7, which the compare timer raises from the hptimer thread, and bit 63, the soft-reset request a device sets throughCpuDevice::signal. A reset through the IOC (Machine::reset, a snapshot load or a rollback — all of them runpower_on_devices) therefore also dropped a timer tick or a pending soft reset that landed while it ran, neither of which the IOC owns. The window is the gap betweencpu.power_on(), which is entitled to clear the word, andioc.power_on(), which is not.The change
power_onclears exactly the five linesupdate_interruptsdrives (fetch_and, notstore), so a reset no longer touches IP7 or bit 63.IOC_OWNED_LINESnames that set once, with the ownership rule in its doc comment, so the reset path and the update path cannot drift apart.Tests
power_on_clears_only_the_cpu_lines_the_ioc_drives: with every bit of the word set, a reset leaves everything except IP2..IP6, and the test pinsIOC_OWNED_LINESto exactly those five, so IP7 (the compare timer's) and bit 63 (a soft-reset request) can never be folded into it.main:assertion left == right failed: a reset clears the IOC's own lines and nothing else; left: 0, right: 0xffff_ffff_ffff_e7ff— the whole word went to zero.cargo test --lib: 1092 passed, 0 failed, 19 ignored (1091 before the change, i.e. the new test is the only difference). Oneunused_mutwarning fromnet/testnet.rs:1292is pre-existing onmain.netbsd-INSTALL32_IP2xinstallation kernel served with--tftp-dir, thenboot -f bootp()/netbsdfrom the Command Monitor, with an empty 512 MB SCSI disk and a CD-ROM attached. The kernel reports the R4400, its L1/L2 caches,ioc0 ... machine Indy (Guinness),wdsc0 ... WD33C93A,sq0 ... SGI Seeq 80c03, the emulatedSGI, IRIS EMUL DISKandSony, CDU-76S, and then starts sysinst (NetBSD-10.0 Install System). Log:netbsd-boot-fixed.log.main: built without this change and booted the same way — same kernel banner, same device list, same installer (main-boot.log). This change is a no-op on the boot path.reset— theMachine::resetpath that runspower_on_devices, i.e. this function — leaves the CPU at0xffffffffbfc00000, and the second TFTP boot reaches the installer again (netbsd-two-boots-and-reset.log).lightning,jitv2,gpujit,idle-pause,hostgl) leg and the macOS/Windows legs were not run here.Fixes #264