From: Jan Kiszka <jan.kiszka@web.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: kvm <kvm@vger.kernel.org>,
patches@linaro.org, Marcelo Tosatti <mtosatti@redhat.com>,
Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] kvm: Move kvm_allows_irq0_override() to target-i386
Date: Sat, 21 Jul 2012 13:08:30 +0200 [thread overview]
Message-ID: <500A8DAE.3040909@web.de> (raw)
In-Reply-To: <CAFEAcA8fuAdBZb5YAyjFZMfvCWjVB5TP+VYACwrrEg7SGVSJ8g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4988 bytes --]
On 2012-07-21 12:53, Peter Maydell wrote:
> On 21 July 2012 11:22, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2012-07-21 11:56, Peter Maydell wrote:
>>> Or are you trying to talk about defining interrupt routes when the
>>> source and destination are both kernel code but the route needs to
>>> be set by userspace (ie is machine specific not cpu specific)?
>>
>> It describes this requirement primarily.
>>
>>> Whether that's possible sounds to me like it would depend on all
>>> the board model code between the source and destination rather
>>> than being a single global boolean check.
>>
>> It depends on the feature set of the in-kernel irqchips and if this can
>> possibly vary on real hw.
>
> If the interrupt route is on-CPU then its routing is fixed (for
> that CPU), and you don't need to care about irqfds because the
> kernel knows what CPU it's providing to the guest, has both ends
> of the connection and can just do the right thing however is most
> convenient for the internal implementation. If the interrupt route
> is off-CPU then all bets are off because the routing is machine
> specific and could go through any kind of logic between the peripheral
> and the CPU's irqchip.
>
> I don't see how you can do this with QEMU's current IRQ infrastructure,
> which basically just hardwires everything with qemu_irq lines and
> doesn't provide any way to query the routing and logic from an
> irq source to its destination.
Routing from arbitrary sources to the in-kernel sink, skipping
intermediate steps in the hotpath is in fact an unsolved issue in QEMU.
We are just introducing band-aid for PCI on x86 (to introduce PCI device
assignment). Long-term, this requires a generic solution which allows
path discovery etc. But this is a userspace problem, nothing related to
the KVM kernel features.
>
>>>>>>> But you can perfectly well have an in-kernel-irqchip that doesn't
>>>>>>> support irqfd
>>>>>>
>>>>>> You could, thought this doesn't make much sense.
>>>>>
>>>>> Why doesn't it make sense? On ARM, in-kernel-irqchip means you can take
>>>>> advantage of the hardware support for a virtual GIC, and you can use
>>>>> the virtual timer support too. These are both big performance advantages
>>>>> even if QEMU never does anything with irqfds. (In fact the current
>>>>> ARM KVM VGIC code doesn't support irqfds as far as I can see from
>>>>> a quick scan of the kernel code.)
>>>>
>>>> It doesn't make sense as it means your in-kernel irqchip model is
>>>> semi-finished. If you didn't consider how to support direct in-kernel
>>>> IRQ injections, you risk designing something that requires userspace
>>>> quirk handling later on when extending it to full-featured in-kernel
>>>> irqchip support.
>>>
>>> Well, the in-kernel virtual timer already does direct in-kernel IRQ
>>> injection to the VGIC: it calls a function to say "inject IRQ X"...
>>> (this works because the interrupt line used is fixed by the CPU,
>>> it's not a board model property so there is no need for the routing
>>> to be defined by userspace. (ie both ends of this irq injection are
>>> in the CPU proper.))
>>
>> Could you inject IRQs from an in-kernel helper that (partially or fully)
>> emulates some device sitting on peripheral buses as well (like PCI)? If
>> not, you aren't done with the in-kernel irqchip model yet.
>
> This is still sounding like "there is an extra feature which you should
> probably implement at some point and should certainly design with the
> intention of supporting", not "you cannot have an irqchip without irqfds".
>
> Therefore QEMU code which cares about irqfds should be doing
> checks for irqfd functionality, not "is there an in kernel
> irqchip".
Defining some kvm_irqfd_available() is one thing. Ignoring irqfd "for
now" while introducing in-kernel irqchip is another, less wise decision.
>>> As far as I can tell you seem to be saying "irqfds are an extra
>>> feature you might want later", which is exactly "you can have
>>> an irqchip without them".
>>
>> Once the prerequisites for peripheral interrupt injections are there,
>> enabling irqfd for your arch should be straightforward. I'm picking on
>> those prerequisites here, not irqfd.
>>
>>>
>>> (Is there some summary of the design of the irqfds stuff somewhere I
>>> can go and read up?)
>>
>> linux/Documentation/virtual/kvm/api.txt is a good start, though not
>> really a high-level summary.
>
> I looked for 'irqfd' in that and found a straightforward ioctl for
> "wire this eventfd up to this irqchip input". That doesn't say anything
> about remapping of IRQs, and it's not clear to me either why a
> straightforward "use an ioctl to deliver incoming interrupts" design
> would be broken by adding that later: it's just a different source
> for the interrupt...
Once you support the backend (KVM_SET_GSI_ROUTING + KVM_IRQ_LINE),
adding irqfd is in fact simple.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-07-21 11:08 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 19:14 [Qemu-devel] [PATCH] kvm: Move kvm_allows_irq0_override() to target-i386 Peter Maydell
2012-07-21 6:57 ` Jan Kiszka
2012-07-21 8:54 ` Peter Maydell
2012-07-21 9:14 ` Jan Kiszka
2012-07-21 9:30 ` Peter Maydell
2012-07-21 9:44 ` Jan Kiszka
2012-07-21 9:56 ` Peter Maydell
2012-07-21 10:22 ` Jan Kiszka
2012-07-21 10:53 ` Peter Maydell
2012-07-21 11:08 ` Jan Kiszka [this message]
2012-07-21 12:17 ` Peter Maydell
2012-07-21 12:35 ` Jan Kiszka
2012-07-21 12:57 ` Peter Maydell
2012-07-21 13:16 ` Jan Kiszka
2012-07-23 12:04 ` Cornelia Huck
2012-07-23 12:18 ` Avi Kivity
2012-07-23 12:25 ` Peter Maydell
2012-07-23 12:31 ` Avi Kivity
2012-07-23 12:34 ` Avi Kivity
2012-07-23 13:06 ` Cornelia Huck
2012-07-23 13:14 ` Avi Kivity
2012-07-23 13:55 ` Cornelia Huck
2012-07-23 14:27 ` Avi Kivity
2012-07-23 15:01 ` Cornelia Huck
2012-07-23 12:26 ` Avi Kivity
2012-07-23 12:58 ` Peter Maydell
2012-07-23 13:09 ` Avi Kivity
2012-07-23 13:27 ` Peter Maydell
2012-07-23 13:38 ` Avi Kivity
2012-07-23 13:50 ` Peter Maydell
2012-07-23 14:30 ` Avi Kivity
2012-07-23 17:58 ` Peter Maydell
2012-07-24 8:50 ` Avi Kivity
2012-07-24 8:54 ` Peter Maydell
2012-07-24 8:58 ` Jan Kiszka
2012-07-23 15:19 ` Peter Maydell
2012-07-23 16:55 ` Jan Kiszka
2012-07-23 17:41 ` Peter Maydell
2012-07-23 17:51 ` Jan Kiszka
2012-07-24 8:56 ` 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=500A8DAE.3040909@web.de \
--to=jan.kiszka@web.de \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 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).