kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, avi@redhat.com, zamsden@redhat.com
Subject: Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.
Date: Wed, 26 Aug 2009 16:50:40 +0300	[thread overview]
Message-ID: <20090826135040.GF30093@redhat.com> (raw)
In-Reply-To: <20090826133842.GB676@amt.cnet>

On Wed, Aug 26, 2009 at 10:38:42AM -0300, Marcelo Tosatti wrote:
> > > > > If you don't have a host timer emulating the guest PIT, to periodically
> > > > > bang on kvm_set_irq, how do you know when to attempt reinjection?
> > > > > 
> > > > > You keep calling kvm_set_irq on every guest entry to figure out when 
> > > > > reinjection is possible?
> > > > If we have timer to inject then yes. It is relatively cheap. Most of the
> > > > time pending count will be zero.
> > > 
> > > Won't work with non-tick-based emulation on the host.
> > Why? This is the most important point, can you elaborate?
> 
> >From http://www.mail-archive.com/kvm@vger.kernel.org/msg18644.html.
> 
> An injectable timer interrupt is defined by:
> 
> - time(now) >= time(next_expiration)
> - Previous timer interrupt has been acked (thus we can inject).
> 
> The thing is, sure you can drop ack notifiers and check IRR
> on every guest entry, but why bother if you can receive an
> asynchronous notification?
> 
> Would you prefer to replace
> 
> +               if (!ktimer->can_inject)
> 
> With
> 		kvm_set_irq()
> 
> ?
> 
> Not relatively cheap.
Most of the times time(now) will be less then time(next_expiration) so
on most entries kvm_set_irq() will not be called at all. When interrupt
has to be injected I prefer to try to inject it ASAP. PIC and APIC
effectively have 2 element interrupt queue (irr/isr) so injection may
succeed even though ack was not yet received.

--
			Gleb.

  parent reply	other threads:[~2009-08-26 13:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 12:06 [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts Gleb Natapov
2009-08-24 16:32 ` Marcelo Tosatti
2009-08-24 17:16   ` Gleb Natapov
2009-08-24 17:44     ` Marcelo Tosatti
2009-08-24 18:19       ` Gleb Natapov
2009-08-24 19:01         ` Gleb Natapov
2009-08-26 12:45           ` Marcelo Tosatti
2009-08-26 12:43         ` Marcelo Tosatti
2009-08-26 13:19           ` Gleb Natapov
2009-08-26 13:38             ` Marcelo Tosatti
2009-08-26 13:48               ` Avi Kivity
2009-08-26 13:50               ` Gleb Natapov [this message]
2009-08-26 13:49             ` 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=20090826135040.GF30093@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=zamsden@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;
as well as URLs for NNTP newsgroup(s).