From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>,
kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH 2/2] Interrupt unhalts vcpu when it shouldn't
Date: Tue, 24 Mar 2009 13:24:34 +0800 [thread overview]
Message-ID: <200903241324.35410.sheng@linux.intel.com> (raw)
In-Reply-To: <49C7A816.2090605@redhat.com>
On Monday 23 March 2009 23:17:42 Avi Kivity wrote:
> 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?
Yes, looks good to me.
--
regards
Yang, Sheng
next prev parent reply other threads:[~2009-03-24 5:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-23 10:12 [PATCH 1/2] Timer event should not unconditionally unhalt vcpu Gleb Natapov
2009-03-23 10:12 ` [PATCH 2/2] Interrupt unhalts vcpu when it shouldn't Gleb Natapov
2009-03-23 14:31 ` Avi Kivity
2009-03-23 15:17 ` Avi Kivity
2009-03-24 5:24 ` Sheng Yang [this message]
2009-03-24 10:13 ` Avi Kivity
2009-03-23 13:11 ` [PATCH 1/2] Timer event should not unconditionally unhalt vcpu Gleb Natapov
2009-03-23 14:26 ` Avi Kivity
2009-03-23 16:50 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200903241324.35410.sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox