From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Sheng Yang <sheng@linux.intel.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 3/3] KVM: Reset PIT irq injection logic when the PIT IRQ is unmasked
Date: Mon, 5 Jan 2009 16:31:59 -0200 [thread overview]
Message-ID: <20090105183159.GC5592@amt.cnet> (raw)
In-Reply-To: <1231085685-32201-4-git-send-email-avi@redhat.com>
On Sun, Jan 04, 2009 at 06:14:45PM +0200, Avi Kivity wrote:
> While the PIT is masked the guest cannot ack the irq, so the reinject logic
> will never allow the interrupt to be injected.
>
> Fix by resetting the reinjection counters on unmask.
>
> Unbreaks Xen.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> arch/x86/kvm/i8254.c | 15 +++++++++++++++
> arch/x86/kvm/i8254.h | 1 +
> 2 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index 528daad..d78d430 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -539,6 +539,16 @@ void kvm_pit_reset(struct kvm_pit *pit)
> pit->pit_state.irq_ack = 1;
> }
>
> +static void pit_mask_notifer(struct kvm_irq_mask_notifier *kimn, int mask)
> +{
> + struct kvm_pit *pit = container_of(kimn, struct kvm_pit, mask_notifier);
> +
> + if (!mask) {
> + atomic_set(&pit->pit_state.pit_timer.pending, 0);
> + pit->pit_state.irq_ack = 1;
> + }
> +}
I'm not sure about zeroing the counter here. The guest can mask the
interrupt during normal operation, and in such cases you want the
pending count to be retained (and reinjected later).
I suppose setting irq_ack to one is enough.
next prev parent reply other threads:[~2009-01-05 18:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-04 16:14 [PATCH 0/3] Reset PIT reinjection logic on irq unmask Avi Kivity
2009-01-04 16:14 ` [PATCH 1/3] KVM: Add CONFIG_HAVE_KVM_IRQCHIP Avi Kivity
2009-01-04 16:14 ` [PATCH 2/3] KVM: Interrupt mask notifiers for ioapic Avi Kivity
2009-01-05 7:06 ` Sheng Yang
2009-01-05 13:24 ` Avi Kivity
2009-01-05 18:29 ` Marcelo Tosatti
2009-01-05 20:57 ` Avi Kivity
2009-01-04 16:14 ` [PATCH 3/3] KVM: Reset PIT irq injection logic when the PIT IRQ is unmasked Avi Kivity
2009-01-05 18:31 ` Marcelo Tosatti [this message]
2009-01-05 20:59 ` Avi Kivity
2009-01-05 21:58 ` Marcelo Tosatti
2009-01-06 8:25 ` Avi Kivity
2009-01-06 9:35 ` Dor Laor
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=20090105183159.GC5592@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=sheng@linux.intel.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;
as well as URLs for NNTP newsgroup(s).