Avi Kivity wrote:
Gleb Natapov wrote:
kvm_vcpu_block() unhalts vpu on an interrupt/timer without checking
if interrupt window is actually opened.

+static int svm_interrupt_allowed(struct kvm_vcpu *vcpu)
+{
+    struct vcpu_svm *svm = to_svm(vcpu);
+    struct vmcb *vmcb = svm->vmcb;
+ return (vmcb->save.rflags & X86_EFLAGS_IF) && + !(vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK) &&
+        (svm->vcpu.arch.hflags & HF_GIF_MASK);
+}
+
+static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu)
+{
+    vmx_update_window_states(vcpu);
+    return vcpu->arch.interrupt_window_open;
+}
+
 static void kvm_do_inject_irq(struct kvm_vcpu *vcpu)
 }
+
+int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
+{
+    return kvm_x86_ops->interrupt_allowed(vcpu);
+}

If the guest enables interrupts but sets tpr/cr8 to block interrupts, we'll spin (like we do now).

So I think this should be called kvm_arch_can_accept_interrupt() and take tpr into account.


kvm_cpu_has_interrupt() takes the tpr into account, so we're okay here.

Marcelo, Sheng?

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to