From: Paolo Bonzini <pbonzini@redhat.com>
To: Matt Gingell <gingell@google.com>, kvm@vger.kernel.org
Cc: Steve Rutherford <srutherford@google.com>
Subject: Re: [PATCH 3/3] KVM: x86: fix ready_for_interrupt reporting in split IRQ chip case
Date: Fri, 13 Nov 2015 09:52:21 +0100 [thread overview]
Message-ID: <5645A4C5.9070304@redhat.com> (raw)
In-Reply-To: <C9011C2F-D76D-4181-AFDA-41F78ECF7559@google.com>
On 12/11/2015 20:07, Matt Gingell wrote:
> This patch adds a call to kvm_arch_interrupt_allowed to ensure ready for
> interrupt is reported to user space correctly. This addresses a problem
> observed in QEMU when kvm->ready_for_interrupt is set but the x86
> interrupt flag is clear.
>
> Additionally, test that the APIC is ready to accept an interrupt before
> reporting we are ready for injection.
>
> Reviewed-by: Andy Honig <ahonig@google.com>
> Signed-off-by: Matt Gingell <gingell@google.com>
I think you need to add the same call to dm_request_for_irq_injection, like
- return (irqchip_split(vcpu->kvm)
- ? kvm_apic_accept_pic_intr(vcpu)
- : kvm_arch_interrupt_allowed(vcpu));
+ if (!kvm_arch_interrupt_allowed(vcpu))
+ return false;
+
+ return !lapic_in_kernel(vcpu) || kvm_apic_accept_pic_intr(vcpu);
At this point, just to err on the safe side, we probably should test
kvm_event_needs_reinjection(vcpu) as well in dm_request_for_irq_injection.
We can then make a new function kvm_vcpu_ready_for_interrupt_injection
with the sequence of tests (kvm_cpu_has_interrupt,
kvm_arch_interrupt_allowed, kvm_event_needs_reinjection, possibly
kvm_apic_accept_pic_intr) so that:
- dm_request_for_irq_injection becomes simply
return (vcpu->run->request_interrupt_window &&
likely(!pic_in_kernel(vcpu->kvm));
- the caller of dm_request_for_irq_injection does
if (dm_request_for_irq_injection(vcpu) &&
kvm_vcpu_ready_for_interrupt_injection(vcpu))
- post_kvm_run_save's assignment becomes
kvm_run->ready_for_interrupt_injection =
!pic_in_kernel(vcpu->kvm) ||
kvm_vcpu_ready_for_interrupt_injection(vcpu);
The code would make a lot of sense then; I hope it will work too. :)
Paolo "ceci n'est pas une patch"
next prev parent reply other threads:[~2015-11-13 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 19:07 [PATCH 3/3] KVM: x86: fix ready_for_interrupt reporting in split IRQ chip case Matt Gingell
2015-11-13 8:52 ` Paolo Bonzini [this message]
2015-11-13 22:16 ` Steve Rutherford
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=5645A4C5.9070304@redhat.com \
--to=pbonzini@redhat.com \
--cc=gingell@google.com \
--cc=kvm@vger.kernel.org \
--cc=srutherford@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.