Repository navigation
multikernel: take a halt notice only from the kernel that halted - #56
Merged
congwang-mk merged 1 commit intoNov 24, 2026
Merged
Conversation
MK_SYS_HALTED and MK_SYS_SHUTDOWN_ACK name the halted instance by the resource_id in their payload, and the host acts on that ID. A spawned kernel can therefore report the halt of a sibling that is still running: the host settles the sibling as halted, which fences its device leases and moves it to LOADED, or completes the host's pending wait for the sibling's graceful halt early. Since commit b296ae5 ("multikernel: Tell message handlers which kernel sent the message") the handler knows which ring a message came in on. Drop a halt notice unless it comes from a child and names that child, as MK_SYS_SHUTDOWN already checks its sender. The handler reads the notice in the ring slot itself, which the sender can still write, so act on the sender's ID rather than reading the payload again, and rate limit the warning a misbehaving child can trigger at will. Fixes: 00dde38 ("x86/multikernel: Return CPUs to the pool on spawn kernel halt") Signed-off-by: Utkarsh Maurya <projects.utkarshMaurya@gmail.com>
Author
|
Tested at runtime on RISC-V QEMU (#49 head + #55–#59), with a test-only hook letting spawn A send |
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.
MK_SYS_HALTEDandMK_SYS_SHUTDOWN_ACKname the halted instance by theresource_idin their payload, and the host acts on that ID. A spawn can report the halt of a sibling that is still running: the host fences the sibling's device leases and moves it to LOADED, or ends its wait for the sibling's graceful halt early.Since b296ae5 the handler knows which ring a message came in on. Drop a halt notice unless it comes from a child and names that child, as
MK_SYS_SHUTDOWNalready checks its sender. The notice stays in the ring slot, which the sender can still write, so after the check the handlers act onfrom->idinstead of reading the payload again. The warning is rate limited.Tested: RISC-V QEMU virt (aia=aplic-imsic, OpenSBI v1.8.1), #49 head b4be1bf with #55–#59 applied: graceful and forced halts, in-spawn poweroff and reboot all still settle the instance (28 spawns). A spoofed notice was not sent at runtime; that needs a modified spawn kernel. Builds on current master (fca2f47): x86_64 clang W=1 with no new warnings, also with PCI=n and with MULTIKERNEL=n; checkpatch --strict clean.