From: Peter Xu <peterx@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [RFC PATCH 1/2] kvm: x86: add new gsi route type EVENTFD
Date: Wed, 8 Feb 2017 17:35:22 +0800 [thread overview]
Message-ID: <20170208093522.GB4031@pxdev.xzpeter.org> (raw)
In-Reply-To: <b0f36c8e-cffc-5e69-4283-1c5c30c7c114@redhat.com>
On Wed, Feb 08, 2017 at 09:26:10AM +0100, Paolo Bonzini wrote:
>
>
> On 08/02/2017 08:58, Peter Xu wrote:
> > This idea was invoked when I was trying to solve an emulated VT-d issue
> > when guest kernel setup incorrect IRTE. When that happens, instead of
> > raising error immediately, what we should do is to keep the error, and
> > inject this error to vIOMMU when the specific interrupt is triggered.
> >
> > However this is very hard to be achieved since for now vIOMMU is working
> > in userspace, while currently there is no simple way that kernel irq can
> > talk to a userspace program.
> >
> > With this patch, we can easily provide such a way that when guest fault
> > irq is triggered, kernel can notify user program by signaling the
> > corresponding eventfd handle
>
> I think I understand the scenario, but I don't understand why it needs
> kernel intervention. Why couldn't this be handled entirely in
> userspace, without ever setting up a GSI route or irqfd in KVM? In
> other words, you're doing
>
> write(irqfd) read(irq fault eventfd)
> | ^
> v |
> KVM -------> KVM_GSI_ROUTING_EVENTFD
>
> but why is this needed as opposed to just
>
> write(irqfd) ------> read(irq fault eventfd)
>
> ?
Paolo,
Thanks for pointing out this issue. This is one of my concern as well,
and Jan has had the same comment before (sorry I forgot to cc Jan,
doing it now). I was trying to identify the risk for both solutions. I
posted this just trying to choose one way out of the two, and
currently this series is my clumsy choice.
I agree that logicall this can be done all in userspace. Now the
problem is that, I am afraid we can't do it easily, and lots of codes
may need to be touched for QEMU to achieve a whole userspace solution
- now we not only need irqfd and virq to setup a route, we need to
prepare a fault sink for each of the irqfd. Not to say that we have
lots of assumption in QEMU that virq and irqfd are treated seperately.
That'll of course expand the test scope as well, covering all the
devices using irqfd. Of course we can try to abstract that out into
something common, I am just afraid that'll be still a relatively big
change, and I am still uncertain about the "size" of it.
With this feature, everything will be in control totally in vIOMMU
side in QEMU. It'll be fairly straightforward and clean. But of course
I understand your concern since we should keep KVM as simple as
possible, even this is only tens of lines of changes (I wouldn't dare
to post a series for this for more than 100 LOCs :-).
And, even if we don't like this feature bit, I am still not sure
whether I should move on on QEMU side to do a possible big change only
to benefit error handling in VT-d vIOMMU. Any of your further comment
would be welcomed to help me settle this down.
(Or, maybe I should just put this problem aside for now. Comparing to
solve this, I think fixing the IRTE bug in kernel might be easier :-)
Thanks,
-- peterx
next prev parent reply other threads:[~2017-02-08 9:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 7:58 [RFC PATCH 0/2] kvm: introduce KVM_IRQ_ROUTING_EVENTFD Peter Xu
2017-02-08 7:58 ` [RFC PATCH 1/2] kvm: x86: add new gsi route type EVENTFD Peter Xu
2017-02-08 8:26 ` Paolo Bonzini
2017-02-08 9:35 ` Peter Xu [this message]
2017-02-08 7:58 ` [RFC PATCH 2/2] kvm: add new cap KVM_CAP_GSI_EVENTFD Peter Xu
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=20170208093522.GB4031@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@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