From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>
Cc: Jan Kiszka <jan.kiszka@web.de>,
Thomas Gleixner <tglx@linutronix.de>,
Marcelo Tosatti <mtosatti@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
kvm <kvm@vger.kernel.org>, Tom Lyon <pugs@cisco.com>,
Alex Williamson <alex.williamson@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 5/5] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices
Date: Mon, 06 Dec 2010 18:11:58 +0100 [thread overview]
Message-ID: <4CFD195E.5060208@siemens.com> (raw)
In-Reply-To: <4CFD16FC.8040905@redhat.com>
Am 06.12.2010 18:01, Avi Kivity wrote:
> On 12/06/2010 06:46 PM, Jan Kiszka wrote:
>> Am 06.12.2010 17:40, Avi Kivity wrote:
>>> On 12/06/2010 06:34 PM, Jan Kiszka wrote:
>>>>>
>>>>> What's the protocol for doing this? I suppose userspace has to disable
>>>>> interrupts, ioctl(SET_INTX_MASK, masked), ..., ioctl(SET_INTX_MASK,
>>>>> unmasked), enable interrupts?
>>>>
>>>> Userspace just has to synchronize against itself - what it already does:
>>>> qemu_mutex, and masking/unmasking is synchronous /wrt the the executing
>>>> VCPU. Otherwise, masking/unmasking is naturally racy, also in Real Life.
>>>> The guest resolves the remaining races.
>>>
>>> I meant when qemu sets INTX_MASK and the kernel clears it immediately
>>> afterwards because the two are not synchronized. I guess that won't
>>> happen in practice because playing with INTX_MASK is very rare.
>>
>> Ah, there is indeed a race, and the qemu-kvm patches I did not post yet
>> (to wait for the kernel interface to settle) actually suffer from it:
>> userspace needs to set the kernel mask before writing the config space
>> (it's the other way around ATM). This avoids that the kernel overwrites
>> what userspace just wrote out. We always suffer from the race the other
>> way around, see below.
>
> Please document the protocol.
Yes, will do.
> Is this always the right order?
> Shouldn't it be reversed when unmasking? I admit I'm confused about this.
The kernel only notes down userspace's view on the mask, it doesn't
modify the hardware (unless it is in line-disabling mode, but then there
is no conflict anyway). Therefore, if userspace first unmasks and an
interrupts arrives before this was reported to the kernel, the device
interrupt will remain masked and no event is delivered to userspace.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2010-12-06 17:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-03 23:37 [PATCH 0/5] KVM&genirq: Enable adaptive IRQ sharing for passed-through devices Jan Kiszka
2010-12-03 23:37 ` [PATCH 1/5] genirq: Pass descriptor to __free_irq Jan Kiszka
2010-12-03 23:37 ` [PATCH 2/5] genirq: Introduce interrupt sharing notifier Jan Kiszka
2010-12-03 23:37 ` [PATCH 3/5] KVM: Split up MSI-X assigned device IRQ handler Jan Kiszka
2010-12-03 23:37 ` [PATCH 4/5] KVM: Clean up unneeded void pointer casts Jan Kiszka
2010-12-03 23:37 ` [PATCH 5/5] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices Jan Kiszka
2010-12-06 16:21 ` Avi Kivity
2010-12-06 16:34 ` Jan Kiszka
2010-12-06 16:40 ` Avi Kivity
2010-12-06 16:46 ` Jan Kiszka
2010-12-06 17:01 ` Avi Kivity
2010-12-06 17:11 ` Jan Kiszka [this message]
2010-12-04 10:37 ` [PATCH 0/5] KVM&genirq: Enable adaptive IRQ sharing for passed-through devices Thomas Gleixner
2010-12-04 11:34 ` Jan Kiszka
2010-12-04 14:41 ` Thomas Gleixner
2010-12-04 14:54 ` Jan Kiszka
2010-12-04 16:10 ` Thomas Gleixner
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=4CFD195E.5060208@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=alex.williamson@redhat.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pugs@cisco.com \
--cc=tglx@linutronix.de \
/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