From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] If interrupt injection is not possible do not scan IRR.
Date: Mon, 18 May 2009 12:08:06 +0300 [thread overview]
Message-ID: <20090518090806.GB10818@redhat.com> (raw)
In-Reply-To: <4A1123B8.10601@redhat.com>
On Mon, May 18, 2009 at 12:00:40PM +0300, Avi Kivity wrote:
> Gleb Natapov wrote:
>> @@ -3174,10 +3174,11 @@ static void inject_pending_irq(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>> vcpu->arch.nmi_injected = true;
>> kvm_x86_ops->set_nmi(vcpu);
>> }
>> - } else if (kvm_cpu_has_interrupt(vcpu)) {
>> - if (kvm_x86_ops->interrupt_allowed(vcpu)) {
>> - kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu),
>> - false);
>> + } else if (kvm_x86_ops->interrupt_allowed(vcpu)) {
>> + int vec = kvm_cpu_get_interrupt(vcpu);
>> + if (vec != -1) {
>> + printk(KERN_ERR"inject %d rip=%x\n", vec, kvm_rip_read(vcpu));
>> + kvm_queue_interrupt(vcpu, vec, false);
>> kvm_x86_ops->set_irq(vcpu);
>> } }
>>
>
> Not sure if this is a win. Usually interrupts are allowed, so we'll
> have to do both calculations. On vmx ->interrupt_allowed() reads the
> vmcs, which is slow.
>
Depend on how slow vmcs read is. In case when interrupt is available we
also scan IRR twice with current code: first time in kvm_cpu_has_interrupt()
and another in kvm_cpu_get_interrupt().
If we want to optimize vmcs access, and for nested virtualization we may
want to do it, we can read common ones on exit and use in memory copy.
--
Gleb.
next prev parent reply other threads:[~2009-05-18 9:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-18 8:44 [PATCH] If interrupt injection is not possible do not scan IRR Gleb Natapov
2009-05-18 9:00 ` Avi Kivity
2009-05-18 9:08 ` Gleb Natapov [this message]
2009-05-18 11:16 ` Gleb Natapov
2009-05-19 9:50 ` Avi Kivity
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=20090518090806.GB10818@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).