Repository navigation
Conversation
li041
reviewed
Nov 26, 2026
Comment on lines
+826
to
+829
| /// Serializes IRQ producers targeting a zone's virtual irqchip with zone start and shutdown. | ||
| /// Producers take it for reading; start and shutdown take it for writing, before any `ctrl_lock`. | ||
| #[cfg(any(target_arch = "riscv64", target_arch = "x86_64"))] | ||
| pub static ZONE_IRQ_LIFECYCLE: RwLock<()> = RwLock::new(()); |
Contributor
There was a problem hiding this comment.
The main issue with ZONE_IRQ_LIFECYCLE is that acquiring this lock is entirely the caller's responsibility. It's a standalone pub static, so any code that wants to touch a zone's virtual irqchip or start/shutdown a zone can simply... not take the lock, and nothing stops it.
Idiomatic Rust tries to make the invariant impossible to violate by construction rather than documented. The usual pattern is to move the guarded state behind a type that owns the lock, so the only way to reach the state is through a method that takes the lock for you.
peikachu
force-pushed
the
peikachu/percpu-events/stage4-2
branch
from
November 26, 2026 07:36
549092f to
d62640f
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.
Summary
Finishes moving virtio IRQs off PERCPU_EVENTS (follow-up to #407, #415, #438 and #448). On x86 and RISC-V, the CPU that produces a virtio IRQ now updates the target zone's virtual interrupt controller directly, and VIRTIO_IRQS and the two virtio events are removed.
Motivation
On x86 and RISC-V, virtio IRQs still went through the event FIFO, and RISC-V also queued them in VIRTIO_IRQS under a global lock, only for the target CPU to inject them into its own vPLIC/vAPLIC. All three controllers can be updated from any CPU (the vPLIC through post_guest_irq() since #438, the vAPLIC through the IMSIC guest file, the vIOAPIC through post_guest_vector()), so the queue, the extra IPI and the per-CPU lists are unnecessary. Both architectures need the same guard against zone start/shutdown, so they share one lock.
Verification
No hypervisor panic or ERROR logs. Each commit builds on all six boards (qemu-gicv3/gicv2/plic/aia, ls3a5000, x86_64 qemu) with no new warnings and passes cargo fmt --all -- --check.
Risks and Limitations