All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org, avi@redhat.com
Subject: Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.
Date: Wed, 26 Aug 2009 10:49:38 -0300	[thread overview]
Message-ID: <20090826134938.GA1109@amt.cnet> (raw)
In-Reply-To: <20090826131917.GE30093@redhat.com>

On Wed, Aug 26, 2009 at 04:19:17PM +0300, Gleb Natapov wrote:
> On Wed, Aug 26, 2009 at 09:43:48AM -0300, Marcelo Tosatti wrote:
> > On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote:
> > > > > Current code very fragile and relies on hacks to work. Lets take calling
> > > > > of ack notifiers on pic reset as an example. Why is it needed? 
> > > > 
> > > > To signal the ack notifiers users that, in case of reset with pending
> > > > IRR, the given interrupt has been "acked" (its an artificial ack event).
> > > > 
> > > But IRR was not acked. The reason it is done is that otherwise the
> > > current logic will prevent further interrupt injection. 
> > 
> > Or will keep the host irq disabled, for the assigned device case (in
> > case you drop the hackish ack notification from pic_reset).
> > 
> > I don't think it exists there because of PIT reinjection only, it seems
> > a generic problem for users of ack notifiers (a reset notifier as you
> > mentioned would also do it, and be cleaner).
> > 
> Yes, I agree pic reset should be propagated to assigned devices somehow.
> 
> > > > Is there a need to differentiate between actual interrupt ack and reset
> > > > with pending IRR? At the time this code was written, there was no
> > > > indication that differentation would be necessary.
> > > This is two different things. Ack notifiers should be called when guest
> > > acks interrupt. Calling it on reset is wrong (see below). We can add reset
> > > notifiers, but we just build yet another infrastructure to support
> > > current reinjection scheme.
> > 
> > Its not specific to PIT reinjection.
> > 
> > Anything that relies on ack notification to perform some action (either
> > reinjection or host irq line enablement or some other use) suffers from
> > the same thing.
> > 
> > You might argue that a separate reset notification is more appropriate.
> > 
> > > > > It is obviously wrong thing to do from assigned devices POV.
> > > > 
> > > > Thats not entirely clear to me. So what happens if a guest with PIC
> > > > assigned device resets with a pending IRR? The host interrupt line will
> > > > be kept disabled, even though the guest is able to process further
> > > > interrupts?
> > > The host interrupt line will be enabled (assigned device ack notifier
> > > does this) without clearing interrupt condition in assigned device
> > > (guest hasn't acked irq so how can we be sure it ran device's irq
> > > handler?). Host will hang.
> > > 
> > > > > Why ioapic calls mask notifiers but pic doesn't?
> > > > 
> > > > Because it is not implemented.
> > > I see that. Why? Why it was important to implement for ioapic but not
> > > for pic? 
> > 
> > 4780c65904f0fc4e312ee2da9383eacbe04e61ea
> > 
> This commit and previous one adds infrastructure to fix a bug that is
> there only because how we choose to do pit reinjection. Do it differently
> and you can revert both of them.
> 
> > > Do we know what doesn't work now?
> > 
> > What you mean?
> I mean that pit doesn't call mask notifier so similar bug to 4780c65
> hides somewhere out there. How can we test it?

Program periodic PIT, mask irq0, wait a while, unmask irq0 ?



      parent reply	other threads:[~2009-08-26 13:49 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
2009-08-26 13:49             ` Marcelo Tosatti [this message]

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=20090826134938.GA1109@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=gleb@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 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.