Repository navigation
Conversation
|
The reason for introducing Simulated this behavior by broadcasting via IPI. From the ratified PLIC spec (Interrupt Notifications):
|
|
@liulog Thanks for the reminder. When I migrate IPI_EVENT_UPDATE_HART_LINE later, I will keep the multicast semantics. |
| /// Post a guest IRQ to the target vCPU and kick its pCPU. `source_cpu` is used | ||
| /// only by GICv2; `level` is the new line value, or `true` for an edge. | ||
| pub fn post_guest_irq( | ||
| target_cpu: usize, | ||
| irq_id: usize, | ||
| source_cpu: Option<usize>, | ||
| level: bool, | ||
| ) -> bool { |
There was a problem hiding this comment.
It sounds not good in some cases we must suppose some parameters should be some specific values (an edge then level=true).
A minimal modification is to split this into two functions but may introduce more complexity.
@li041 Any suggestions?
There was a problem hiding this comment.
Acctually only la may call this function with false. Other arch implements edge model.
However, I suggest keeping this parameter which outlines the model of interrupt handling. Futhermore, we can use enum instead of bool, and may have more detailed comment on this diff.
There was a problem hiding this comment.
Thanks. I will use enum instead of bool. BTW, besides LoongArch, the follow-up RISC-V vPLIC migration also drives VSEIP as a level line, so the level path won’t stay LoongArch-only.
03a9edc to
fd42eab
Compare
Summary
Continues removing
PERCPU_EVENTS(follow-up to #407) by moving RISC-V and LoongArch virtual IPIs from the event FIFO to per-vCPU interrupt state.refactor(irqchip): move per-vCPU IRQ hooks into each architecture: Each architecture now suppliesGUEST_IRQ_NR(GIC vINTIDs, RISC-Vhvipbits, LoongArch ESTAT.IS lines 0..=12, x86 vectors),ArchVcpu::prepare_post(),flush_guest_irqs()andVCPU_KICK_DOORBELL, so the commonpost_guest_irq(),kick_vcpu()andflush_current_guest_irqs()no longer contain GIC-specific cfg blocks. The GICv2 SGI source update and same-source coalescing move from the commonpost_guest_irq()into the AArch64ArchVcpu::prepare_post(). x86 only gets stubs; its interrupts still go throughPENDING_VECTORS.refactor(riscv64): post SBI IPIs through per-vCPU state: SBIsend_ipipostsIRQ_VS_SOFTto the target vCPU instead of queuingIPI_EVENT_SEND_IPI. Pending bits are flushed intohvipon guest entry and on trap/interrupt return.refactor(irqchip): add level-triggered lines to guest IRQ state: Adds per-architectureGUEST_LINES, plusline_dirty,set_level()andtake_dirty_lines()toGuestCpuIrqState.post_guest_irq()takes alevelargument. Edge numbers keep their existing behavior (level = true; rejected when the zone is missing or the vCPU isStopped). Level numbers are only rejected when the zone is missing, and they kick only when the level changes. Claiming andhas_pending_edges()skip level numbers.refactor(loongarch64): move virtual IPI state into ArchVcpu as a level line: IPI status/enable/mailbox registers move from global per-CPU statics intoArchVcpu(VirtIpiRegs).update_ipi_status()updates status understatus_lockand posts INT_IPI as a level line when the status changes between zero and non-zero._vcpu_return()syncs dirty lines to ESTAT.IPI_EVENT_SEND_IPI,sync_virtual_ipi_line(),arch_send_virtual_ipi()and the unusedemulate_iocsr_legacy()are removed.Motivation
Virtual IPIs routed through the shared event FIFO take the queue lock, may allocate, and are coupled to host event dispatch. As in #407 for AArch64, the producer now publishes pending state on the target vCPU before kicking its pCPU, and the target installs the interrupt on its own guest entry. LoongArch IPI status is level-like (INT_IPI stays asserted while IPI_STATUS is non-zero), so it is modeled as a level line instead of an edge. Level lines also prepare for the later RISC-V vPLIC (VSEIP) and LoongArch HWI migrations.
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)"Load" runs more shell busy-loop processes than the zone has vCPUs (8 in zone0, 4 in zone1); process creation, exit and wakeups exercise cross-CPU IPIs.
Risks and Limitations