Re: [PATCH] Make virtio devices multi-function

Anthony Liguori
2008-04-22T19:10:50Z

Marcelo Tosatti wrote:
> On Tue, Apr 22, 2008 at 05:32:45PM +0300, Avi Kivity wrote:
>
>> Anthony Liguori wrote:
>>
>>> This patch changes virtio devices to be multi-function devices whenever
>>> possible. This increases the number of virtio devices we can support now by
>>> a factor of 8.
>>>
>>> With this patch, I've been able to launch a guest with either 220 disks or 220
>>> network adapters.
>>>
>>>
>>>
>> Does this play well with hotplug? Perhaps we need to allocate a new
>> device on hotplug.
>>
>> (certainly if we have a device with one function, which then gets
>> converted to a multifunction device)
>>
>
> Would have to change the hotplug code to handle functions...
>

BTW, I've never been that convinced that hotplugging devices is as
useful as people make it out to be. I also think that's particularly
true when it comes to hot adding/removing very large numbers of disks.

I think if you created all virtio devices as multifunction devices, but
didn't add additional functions until you ran out of PCI slots, it would
be a pretty acceptable solution. Hotplug works just as it does today
until you get much higher than 32 devices. Even then, hotplug still
works with most of your devices (until you hit the absolute maximum
number of devices of course).

Regards,

Anthony Liguori

> It sounds less hacky to just extend the PCI slots instead of (ab)using
> multiple functions per-slot.