On Mon, Jun 28, 2021 at 8:09 AM stsp <stsp2@xxxxxxxxx> wrote: > > 28.06.2021 17:29, Maxim Levitsky пишет: > > I used to know that area very very well, and I basically combed > > the whole thing back and forth, > > and I have patch series to decouple injected and > > pending exceptions. > > Yes, and also I dislike the fact > that you can't easily distinguish > the exception injected from > user-space, with the PF coming > from the guest itself. They occupy > the same pending/injected fields. > Some refactoring will definitely > not hurt. > > > > I'll refresh my memory on this and then I'll review your patch. > > > > My gut feeling is that you discovered too that injections of > > exceptions from userspace is kind of broken and only works > > because Qemu doesn't really inject much > > Actually I discovered that injecting > _interrupts_ is kinda broken (on Core2), > because they clash with guest's PF. > Maybe if I would be using KVM-supplied > injection APIs, I would avoid the problem. > But I just use KVM_SET_REGS to inject > the interrupt, which perhaps qemu doesn't > do. > I don't know how you can inject an interrupt with KVM_SET_REGS, but I suspect that you're doing something wrong. :-) If I wanted to inject an interrupt from userspace, I would use KVM_SET_LAPIC (assuming that the local APIC is active) to set the appropriate bit in IRRV. Before you can deliver an interrupt, you have to check the local APIC anyway, to see whether or not your interrupt would be blocked by PPR.