From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alex Williamson <alex.williamson@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Alex Graf <agraf@suse.de>
Subject: Re: [RFC PATCH] PCI: Introduce INTx check & mask API
Date: Fri, 25 May 2012 08:31:56 -0300 [thread overview]
Message-ID: <4FBF6DAC.3030608@siemens.com> (raw)
In-Reply-To: <4FBF6C55.1070603@ozlabs.ru>
On 2012-05-25 08:26, Alexey Kardashevskiy wrote:
> 25.05.2012 20:43, Jan Kiszka написал:
>> On 2012-05-24 23:47, Alexey Kardashevskiy wrote:
>>> On 25/05/12 12:29, Jan Kiszka wrote:
>>>> On 2012-05-24 22:18, Alexey Kardashevskiy wrote:
>>>>> On 24/05/12 22:02, Jan Kiszka wrote:
>>>>>> On 2012-05-24 04:44, Alexey Kardashevskiy wrote:
>>>>>>> [Found while debugging VFIO on POWER but it is platform independent]
>>>>>>>
>>>>>>> There is a feature in PCI (>=2.3?) to mask/unmask INTx via PCI_COMMAND and
>>>>>>> PCI_STATUS registers.
>>>>>>
>>>>>> Yes, 2.3 introduced this. Masking is done via command register, checking
>>>>>> if the source was the PCI in question via the status register. The
>>>>>> latter is important for supporting IRQ sharing - and that's why we
>>>>>> introduced this masking API to the PCI layer.
>>>>>
>>>>>
>>>>> Is not it just a quite small optimization to not to disable interrupts on all devices which share
>>>>> the same IRQ but just on those who fired an interrupt? If so, do PCI devices really often share
>>>>> IRQs? Does not supporting this mean real slowdown on such devices?
>>>>>
>>>>> As far as I understand, everyone who cares about performance uses MSI/MSIX, no?
>>>>
>>>> Not everyone is blessed with MSI-only PCI devices. From my notebook:
>>>>
>>>> # cat /proc/interrupts
>>>> [...]
>>>> 22: [...] IO-APIC-fasteoi ehci_hcd:usb1, ehci_hcd:usb2
>>>>
>>>> So, if I want to assign one EHCI controller to a guest, I have to
>>>> disable the other as well. The same can happen quickly if you attach a
>>>> few legacy PCI adapters to a system and want to pass them through.
>>>
>>> Why? vfio-pci receives interrupt, disables it, handles it, enables interrupt back. Yes, handling is
>>> a bit longer and includes passing interrupt to QEMU and then to the guest (can be optimized to avoid
>>> QEMU) and waiting for EOI notification but this is all the difference.
>>
>> You can disable the complete IRQ line as you cannot predict when the
>> untrusted device driver that VFIO, KVM, or UIO serves will finally
>> decide to silence the IRQ reason in hardware. If you did this, you risk
>> a DoS attack on those other devices.
>
>
> Untrusted device still can pull down (or up? do not remember :) )
> hardware INT# line, stop other devices on this line and you cannot do
> anything about it. How does INTx help if the device is that broken?
If the untrusted device truly complies to PCI 2.3, we can stop it from
pulling that line by setting the generic INTx mask bit. That's the whole
reason for this exercise here.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-05-25 11:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-24 7:44 [RFC PATCH] PCI: Introduce INTx check & mask API Alexey Kardashevskiy
2012-05-24 12:02 ` Jan Kiszka
2012-05-24 14:41 ` Alex Williamson
2012-05-25 1:06 ` Alexey Kardashevskiy
2012-06-05 1:39 ` Benjamin Herrenschmidt
2012-06-05 1:44 ` Alexander Graf
2012-06-05 2:56 ` Benjamin Herrenschmidt
2012-05-25 1:18 ` Alexey Kardashevskiy
2012-05-25 2:29 ` Jan Kiszka
2012-05-25 2:47 ` Alexey Kardashevskiy
2012-05-25 10:43 ` Jan Kiszka
2012-05-25 11:26 ` Alexey Kardashevskiy
2012-05-25 11:31 ` Jan Kiszka [this message]
2012-06-05 1:39 ` Benjamin Herrenschmidt
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=4FBF6DAC.3030608@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=kvm@vger.kernel.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