From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Rusty Russell <rusty@rustcorp.com.au>,
virtualization@lists.linux-foundation.org,
Anthony Liguori <anthony@codemonkey.ws>,
kvm@vger.kernel.org
Subject: Re: [PATCH RFC 0/8] virtio: add guest MSI-X support
Date: Mon, 04 May 2009 14:57:36 +0300 [thread overview]
Message-ID: <49FED830.2090008@redhat.com> (raw)
In-Reply-To: <20090504115450.GB30001@redhat.com>
Michael S. Tsirkin wrote:
> On Mon, May 04, 2009 at 12:21:28PM +0300, Avi Kivity wrote:
>
>> Michael S. Tsirkin wrote:
>>
>>>>> So what I see is transports providing something like:
>>>>>
>>>>> struct virtio_interrupt_mapping {
>>>>> int virtqueue;
>>>>> int interrupt;
>>>>> };
>>>>>
>>>>> map_vqs_to_interrupt(dev, struct virtio_interrupt_mapping *, int nvirtqueues);
>>>>> unmap_vqs(dev);
>>>>>
>>>>>
>>>> Isn't that the same thing? Please explain the flow.
>>>>
>>>>
>>> So to map vq 0 to vector 0, vq 1 to vector 1 and vq 2 to vector 2 the driver would do:
>>>
>>> struct virtio_interrupt_mapping mapping[3] = { {0, 0}, {1, 1}, {2, 2} };
>>> vec = map_vqs_to_interrupt(dev, mapping, 3);
>>> if (vec) {
>>> error handling
>>> }
>>>
>>> and then find_vq as usual.
>>>
>>>
>> Yes, that works.
>>
>> Given that pci_enable_msix() can fail, we can put the retry loop in
>> virtio-pci, and instead of a static mapping, supply a dynamic mapping:
>>
>> static void get_vq_interrupt(..., int nr_interrupts, int vq)
>> {
>> /* reserve interrupt 0 to config changes; round-robin vqs to
>> interrupts */
>> return 1 + (vq % (nr_interrupts - 1));
>> }
>>
>> driver_init()
>> {
>> map_vqs_to_interrupt(dev, get_vq_interrupt);
>> }
>>
>> map_vqs_to_interrupts() would call get_vq_interrupt() for each vq,
>> assuming the maximum nr_interrupts, and retry with smaller nr_interrupts
>> on failure.
>>
>
> Since guest drivers are going to do round-robin most of the time, I
> think the right thing to do is to make the API simple, along the lines
> proposed by Rusty, and make the guest/host ABI rich enough to support
> arbitrary mapping, along the lines proposed by you. We can always change
> the API, ABI is harder.
>
We can provide the round-robin mapper as a helper, so driver code
doesn't need to implement any callback if they're satisfied with the
default.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
next prev parent reply other threads:[~2009-05-04 11:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 12:31 [PATCH RFC 0/8] virtio: add guest MSI-X support Michael S. Tsirkin
2009-04-27 14:00 ` Christian Borntraeger
2009-04-27 14:32 ` Michael S. Tsirkin
2009-04-27 15:37 ` Christian Borntraeger
2009-04-27 17:17 ` Michael S. Tsirkin
2009-04-27 15:06 ` Avi Kivity
2009-04-27 15:39 ` Michael S. Tsirkin
2009-04-27 16:59 ` Christian Borntraeger
2009-04-27 17:19 ` Michael S. Tsirkin
2009-04-28 6:47 ` Avi Kivity
2009-04-28 17:41 ` Michael S. Tsirkin
2009-04-28 17:51 ` Avi Kivity
2009-04-28 18:02 ` Michael S. Tsirkin
2009-04-28 19:56 ` Anthony Liguori
2009-04-28 21:01 ` Michael S. Tsirkin
2009-05-04 9:21 ` Avi Kivity
2009-05-04 11:54 ` Michael S. Tsirkin
2009-05-04 11:57 ` Avi Kivity [this message]
2009-04-27 14:39 ` Anthony Liguori
2009-04-27 17:42 ` Michael S. Tsirkin
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=49FED830.2090008@redhat.com \
--to=avi@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=borntraeger@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.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