[PATCH] RISC-V: KVM: Fix lost virtual interrupts during IRQ sync

Xie Bo xb at ultrarisc.com
Mon Jul 13 00:33:36 PDT 2026


Hi Anup,

After sending v3, I found that kvm_riscv_vcpu_has_interrupts() held
irqs_pending_lock while the AIA helper could acquire the IMSIC
vsfile_lock. Since vsfile_lock is sleepable on PREEMPT_RT, this creates
a sleep-in-atomic issue. IMSIC update paths can also acquire the locks
in the reverse order, creating an ABBA lock ordering cycle.

I fixed this in v4 by splitting the AIA high pending bitmap check from
the IMSIC VS-file check. The bitmap check remains protected by
irqs_pending_lock, while the IMSIC check runs after releasing it.

The v4 patch is still based on Linux 7.2-rc3. Both RV64 and RV32 KVM
builds pass, and checkpatch reports no issues.

The v4 patch follows this reply.

Regards,
Xie Bo




More information about the kvm-riscv mailing list