22.06.2021 01:33, Jim Mattson пишет:
Maybe what you want is run->ready_for_interrupt_injection? And, if that's not set, try KVM_RUN with run->request_interrupt_window set?
static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) { return kvm_arch_interrupt_allowed(vcpu) && !kvm_cpu_has_interrupt(vcpu) && !kvm_event_needs_reinjection(vcpu) && kvm_cpu_accept_dm_intr(vcpu); } So judging from this snippet, I wouldn't bet on the right indication from run->ready_for_interrupt_injection in our situation. It doesn't check for vcpu->arch.exception.pending or anything like that. I believe, the exit to user-space with pending synchronous exception was not supposed to happen (but it does). Also x86_emulate_instruction() seems to be doing kvm_clear_exception_queue(vcpu) before anything else, so obviously such scenario is not trivial... Possibly the non-emulate path forgets to clear the queue on entry?