kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org,
	jan.kiszka@siemens.com
Subject: Re: [RFC PATCH] kvm: Extend irqfd to support level interrupts
Date: Mon, 18 Jun 2012 09:00:38 +0300	[thread overview]
Message-ID: <20120618060037.GC1423@redhat.com> (raw)
In-Reply-To: <CAEMbtc+aw5fm0mL6J54aTy0aGj0thUgUQNr_Ys=ZGcbvMoVDkg@mail.gmail.com>

On Sun, Jun 17, 2012 at 04:15:44PM -0600, Alex Williamson wrote:
> On Sun, Jun 17, 2012 at 3:38 PM, Alex Williamson
> <alex.williamson@redhat.com> wrote:
> > On Sun, 2012-06-17 at 21:44 +0300, Michael S. Tsirkin wrote:
> >> On Sat, Jun 16, 2012 at 10:34:39AM -0600, Alex Williamson wrote:
> >> > I'm looking for opinions on this approach.  For vfio device assignment
> >> > we minimally need a way to get EOIs from the in-kernel irqchip out to
> >> > userspace.  Getting that out via an eventfd would allow us to bounce
> >> > all level interrupts out to userspace, where we would de-assert the
> >> > device interrupt in qemu and unmask the physical device.  Ideally we
> >> > could deassert the interrupt in KVM, which allows us to send the EOI
> >> > directly to vfio.  To do that, we need to use a new IRQ source ID so
> >> > the guest sees the logical OR of qemu requested state and external
> >> > device state.
> >>
> >> Given that yopu want to involve userspace anyway, why insist on irqfd
> >> for this?  You can simply use KVM_IRQ_LINE_STATUS from qemu, no?
> >
> > Well, actually I'd like to have a way to bypass userspace, which the
> > combination of an irqfd + eventfd w/ deassert does.


Hmm but above you say
	> >> > Getting that out via an eventfd would allow us to bounce
	> >> > all level interrupts out to userspace, where we would de-assert the
	> >> > device interrupt in qemu and unmask the physical device.
so what is the plan?

>  I'm not quite sure
> > I understand how KVM_IRQ_LINE_STATUS would work for this.  AIUI, that
> > effectively gives us a way to post an interrupt AND let us know whether
> > it was masked, coalesced, or delivered.  So I'd have to poll by posting
> > a potentially spurious interrupt and if it was spurious unmask the
> > physical device and wait for a real interrupt?  What am I missing,
> > because that seems barely functional?  Thanks,
> 
> Just to clarify, setting the interrupt from qemu isn't a problem.  We
> can do that just like any other device.  The unique aspect is that we
> need to know when the guest has issued an EOI so that we can unmask
> the physical device interrupt and wait for it to fire again.  This is
> where I don't understand how KVM_IRQ_LINE_STATUS helps us.
> The minimal support I mention above just requires informing userspace
> about the EOI, then we can deassert and unmask from qemu.  That means
> we issue two more ioctl before we're enabled for the next interrupt.

Exactly.

> Rather than invent a new interface for a sub-optimal implementation,
> fixing irqfd to support level triggered interrupts is potentially more
> useful and I think this implementation is not specific to device
> assignment.  BTW, what happens with vhost use of irqfd when the guest
> runs out of MSI vectors?  Could it use this interface for that?
> Thanks,
> 
> Alex


Sure. OTOH this never was a real issue - if it was
we could teach Linux to share MSI interrupt.

-- 
MST

  reply	other threads:[~2012-06-18  6:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16 16:34 [RFC PATCH] kvm: Extend irqfd to support level interrupts Alex Williamson
2012-06-17 11:17 ` Jan Kiszka
2012-06-17 18:44 ` Michael S. Tsirkin
2012-06-17 21:38   ` Alex Williamson
2012-06-17 22:15     ` Alex Williamson
2012-06-18  6:00       ` Michael S. Tsirkin [this message]
2012-06-18 14:00         ` Alex Williamson
2012-06-18  5:51     ` Michael S. Tsirkin
2012-06-18 14:06       ` Alex Williamson
2012-06-18  8:02 ` Avi Kivity
2012-06-18  8:52   ` Jan Kiszka
2012-06-18  9:33     ` Avi Kivity
2012-06-18 10:11       ` Michael S. Tsirkin
2012-06-18 10:14         ` Avi Kivity
2012-06-18 10:55           ` Michael S. Tsirkin
2012-06-18 11:03             ` Avi Kivity
2012-06-18 11:17               ` Michael S. Tsirkin
2012-06-18 14:32                 ` Alex Williamson
2012-06-18 14:27           ` Alex Williamson
2012-06-18 14:33             ` Avi Kivity
2012-06-18 16:47               ` Alex Williamson
2012-06-18 14:23         ` Alex Williamson
2012-06-18 14:18   ` Alex Williamson
2012-06-18 14:35     ` 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=20120618060037.GC1423@redhat.com \
    --to=mst@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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).