From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] Interrupt unhalts vcpu when it shouldn't Date: Mon, 23 Mar 2009 16:31:28 +0200 Message-ID: <49C79D40.4000101@redhat.com> References: <20090323101205.25798.69237.stgit@dhcp-1-237.tlv.redhat.com> <20090323101211.25798.89641.stgit@dhcp-1-237.tlv.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33086 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755831AbZCWObf (ORCPT ); Mon, 23 Mar 2009 10:31:35 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n2NEVXH9027830 for ; Mon, 23 Mar 2009 10:31:33 -0400 In-Reply-To: <20090323101211.25798.89641.stgit@dhcp-1-237.tlv.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. -- error compiling committee.c: too many arguments to function