mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"avi@redhat.com" <avi@redhat.com>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"yongjie.ren@intel.com" <yongjie.ren@intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [PATCH] KVM: Use IRQF_ONESHOT for assigned device MSI interrupts
Date: Fri, 01 Jun 2012 11:59:18 -0600	[thread overview]
Message-ID: <1338573558.23475.41.camel@bling.home> (raw)
In-Reply-To: <4FC8F867.7080103@siemens.com>

On Fri, 2012-06-01 at 19:14 +0200, Jan Kiszka wrote:
> On 2012-06-01 19:03, Alex Williamson wrote:
> > On Fri, 2012-06-01 at 18:39 +0200, Jan Kiszka wrote:
> >> On 2012-06-01 18:16, Alex Williamson wrote:
> >>> The kernel no longer allows us to pass NULL for a hard interrupt
> >>> handler without IRQF_ONESHOT.  Should have been using this flag
> >>> anyway.
> >>
> >> This make the IRQ handling tail a bit slower (due to
> >> irq_finalize_oneshot). MSIs are edge-triggered, so there was no need for
> >> masking in theory.
> > 
> > Aren't these asynchronous since we can theoretically do
> > irq_finalize_oneshot while the guest is servicing the device?
> 
> If it runs on a different CPU. But usually it's more efficient to have
> handler and user on the same CPU. And this work has to be processed
> somewhere.

Yes we need more CPUs and it's better to not do work if we don't have
to.  I don't want to go off on too much of a tangent, but I'm not
entirely convinced that host to guest handler locality is all that
important.  There's just not enough touched by the host handler to make
much difference.  Guest handler and guest user locality is obviously
important, just as it is on bare metal.

> >>  Hmm, can't we trust the information that an IRQ
> >> grabbed here is really a MSI type?
> > 
> > 
> > Apparently not, comment added with this check (1c6c6952):
> > 
> >        * The interrupt was requested with handler = NULL, so
> >        * we use the default primary handler for it. But it
> >        * does not have the oneshot flag set. In combination
> >        * with level interrupts this is deadly, because the
> >        * default primary handler just wakes the thread, then
> >        * the irq lines is reenabled, but the device still
> >        * has the level irq asserted. Rinse and repeat....
> >        *
> >        * While this works for edge type interrupts, we play
> >        * it safe and reject unconditionally because we can't
> >        * say for sure which type this interrupt really
> >        * has. The type flags are unreliable as the
> >        * underlying chip implementation can override them.
> 
> I was talking about KVM here: Can't the KVM device assignment code
> ensure that only MSIs are registered as such so that the above concerns
> no longer apply?

Is that making assumptions about how the chipset handles an MSI?  Are
you suggesting we need a request_edge_threaded_only_irq() API?  Thanks,

Alex




  reply	other threads:[~2012-06-01 18:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 16:16 Alex Williamson
2012-06-01 16:39 ` Jan Kiszka
2012-06-01 17:03   ` Alex Williamson
2012-06-01 17:14     ` Jan Kiszka
2012-06-01 17:59       ` Alex Williamson [this message]
2012-06-01 18:26         ` Jan Kiszka
2012-06-03  8:42           ` Avi Kivity
2012-06-04 11:21             ` Thomas Gleixner
2012-06-04 11:40               ` Jan Kiszka
2012-06-04 13:07                 ` Thomas Gleixner
2012-06-04 13:16                   ` Jan Kiszka
2012-06-04 13:22                     ` Thomas Gleixner
2012-06-08  7:47                 ` Michael S. Tsirkin
2012-06-08  7:55                   ` Jan Kiszka
2012-06-08  8:00                     ` Michael S. Tsirkin
2012-06-08  8:03                       ` Jan Kiszka
2012-06-08 14:39                 ` Michael S. Tsirkin
2012-06-08 14:50                   ` Jan Kiszka
2012-06-11 10:01                     ` Avi Kivity
2012-06-11 10:21                       ` Michael S. Tsirkin
2012-06-18  8:46                         ` Ren, Yongjie
2012-06-18 11:00                         ` 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=1338573558.23475.41.camel@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=yongjie.ren@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

all inboxes | Powered by JetHome®