From: Jan Kiszka <jan.kiszka@web.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()
Date: Tue, 14 Aug 2012 10:09:12 +0200 [thread overview]
Message-ID: <502A07A8.4080704@web.de> (raw)
In-Reply-To: <CAFEAcA8ZGDTgY8kx6_8m_5wMBbYWp4hENkTWg9FGLnasiDnZHg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]
On 2012-08-14 09:52, Peter Maydell wrote:
> On 14 August 2012 08:42, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2012-08-14 09:40, Peter Maydell wrote:
>>> On 14 August 2012 08:33, Jan Kiszka <jan.kiszka@web.de> wrote:
>>>> KVM_IRQ_LINE is old-style, deprecated, KVM_IRQ_LINE_STATUS (i.e
>>>> injection with feedback to allow lost-tick compensation) is the current
>>>> standard that other archs should pick up.
>>>
>>> Can it be documented in the kernel api.txt then, please? Nobody
>>> is going to use it otherwise... (If I'd been paying attention at the
>>> time I'd have nak'd the qemu patches that added it on the grounds
>>> they were using an undocumented kernel API :-))
>>
>> The kernel API's documentation has in fact a much younger history than
>> KVM support in QEMU. I think we still need to add quite a few standard
>> IOCTLs to make it complete. Patches always welcome.
>
> Well, you appear to know what this variant ioctl does and why it's
> better than KVM_IRQ_LINE, whereas I don't. I just want to deliver
> an interrupt, KVM_IRQ_LINE lets me deliver an interrupt, why
> do I need anything more? (What would I do with the status return, for
> instance? I have to assert the incoming irq line, there's nothing for
> me to do if the kernel says "sorry, can't do that" except abort qemu.)
Not sure how timekeeping of all your guests will work, but a classic
scenario on x86 is that some timer is programmed to deliver periodic
ticks (or one-shot ticks that also generates a virtual periodic timer)
and that those ticks will then be used to derive the system time of the
guest. Now, if the guest was unable to process the past tick completely
(due to host load) and we inject already another tick event, that one
will get lost. Some guests (older Linuxes but also many proprietary
OSes) are not prepared for such tick loss and will suffer from drifting
wall clocks.
For that reason, we allow userspace to find out if a (potentially) tick
driving IRQ was actually received by the guest or if it coalesced with
an ongoing event. In the latter case, userspace can reinject those
events once the guest is able to receive them again. All we need from
the kernel API is that feedback KVM_IRQ_LINE_STATUS provides. The return
values are "nicely" hidden in kvm_set_irq:
/*
* Return value:
* < 0 Interrupt was ignored (masked or not delivered for other reasons)
* = 0 Interrupt was coalesced (previous irq is still pending)
* > 0 Number of CPUs interrupt was delivered to
*/
QEMU doesn't make use of that number of receiving CPUs and I'm mot sure
why we even report it. Maybe the kernel API should just state that >0
means delivered.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-08-14 8:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 17:05 [Qemu-devel] [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create() Peter Maydell
2012-08-12 13:13 ` Peter Maydell
2012-08-13 20:45 ` Marcelo Tosatti
2012-08-13 21:40 ` Peter Maydell
2012-08-14 7:33 ` Jan Kiszka
2012-08-14 7:40 ` Peter Maydell
2012-08-14 7:42 ` Jan Kiszka
2012-08-14 7:52 ` Peter Maydell
2012-08-14 8:09 ` Jan Kiszka [this message]
2012-08-14 13:10 ` Peter Maydell
2012-08-14 13:27 ` Jan Kiszka
2012-08-14 11:01 ` Avi Kivity
2012-08-14 11:05 ` Jan Kiszka
2012-08-14 13:14 ` Avi Kivity
2012-08-14 13:36 ` Jan Kiszka
2012-08-14 7:36 ` Jan Kiszka
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=502A07A8.4080704@web.de \
--to=jan.kiszka@web.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).