Repository navigation
Conversation
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
Continues removing
PERCPU_EVENTS(follow-up to #407, #415 and #438). Virtio IRQs on LoongArch and aarch64 no longer go through the event FIFO. The root CPU posts them to the target vCPU, which installs them on its next guest entry.fix(zone): tolerate in-flight IRQ producers holding a removed zone:hv_virtio_inject_irq()andhv_virtio_deassert_irq()reuse the zone from their firstfind_zone(). Before,get_target_cpu()looked it up again and panicked if the zone had been removed in between.remove_zone()warns instead of assertingstrong_count == 1, and the zone is freed on the last drop. Without theVIRTIO_IRQSlock, a producer may still hold the zone during shutdown.refactor(loongarch64): model guest HWI as level lines: HWI0..=HWI7 (ESTAT.IS bits 2..=9) joinINT_IPIinGUEST_LINES. Virtio inject, deassert and the root wakeup call the newls7a2000::post_guest_hwi(). This replaces the per-pCPUGUEST_HWI_ASSERTEDbitmap and its helpers, and LoongArch no longer uses the virtio events.HVISOR_VIPI_DOORBELLis renamedHVISOR_VIRQ_DOORBELL.refactor(irqchip): share GIC INTID range helpers: GICv2 and GICv3 shareSGI_RANGE,SPI_RANGE(32..1020),is_sgi()andis_spi(), plusis_lpi()on GICv3. These replace the per-driver helpers and literal comparisons. The only behavior change is that the GICv3 IRQ entry checksis_spi() || is_lpi()instead of> 31, so INTIDs 1020–1022 now hit the existing warning branch.refactor(aarch64): post virtio IRQs as software SPIs:post_guest_irq()accepts SGIs and SPIs. Virtio responses and the root wakeup go through the newpost_guest_spi().VIRTIO_IRQS,handle_virtio_irq*()and the two virtio events are now compiled only for riscv64 and x86_64.Hardware SPIs, PPIs and LPIs still use
inject_irq()andPENDING_VIRQS.Motivation
Every virtio IRQ went through the shared event FIFO: the root CPU took the queue lock, might grow the queue on the heap, and sent an IPI, only for the target to set a line or install an LR itself. aarch64 also kept the IRQs in
VIRTIO_IRQSunder a global lock, and LoongArch kept HWI lines in a separate per-pCPU bitmap. Posting to per-vCPU state, as virtual IPIs do since #407 and #415, removes that cost and the extra state, and takes the two virtio events off the FIFO on these architectures. HWI is a level signal held until the root deasserts it, so a level line models it directly and only kicks when the level changes.Verification
insmod hvisor.ko→ virtio backend →zone start→ zone1 shell and load →zone shutdown -id 1→ zone0 loadzone shutdownnot run (GICv2arch_irqchip_reset()is unimplemented)All runs had no hypervisor panic and no ERROR logs. Each commit builds on qemu-gicv3, qemu-gicv2, qemu-plic, qemu-aia, ls3a5000 and x86_64 qemu, and
cargo fmt --all -- --checkpasses. "Load" runs more busy-loop processes than the zone has vCPUs.Risks and Limitations