2017-11-21 17:30+0200, Liran Alon: > Do not consider pending exception when return injected exception > to user-mode. A "pending" exception means it's side-effect have not > been applied yet. In contrast, an "injected" exception means it's > side-effect have been already applied. > Therefore, we only need to report of injected exceptions to user-mode. > This is aligned with how interrupts are reported in same ioctl. Pending interrupts are stored in IRR, but we don't have anything for exceptions -- we would lose a trap exception that was made pending after handling inject_pending_event() if the VCPU got a userspace signal and save+restored before starting the next vcpu_enter_guest() cycle. (Non-trap exceptions should be generated again when re-executing, so losing them isn't that bad.) I think we should add state for pending exceptions in kvm_vcpu_events, like the FIXME says. Pending and injected are actually exclusive (for now?), so maybe we can use only one bit for that, thanks. An alternative, probably unattainable, would be to process the side-effects as we hit the exception. Using IRR to store pending interrupts also seems possible, but I'd expect more problems down the road.