Extending virtio_console to support multiple ports

Amit Shah amit.shah at redhat.com
Sun Aug 30 03:10:57 PDT 2009


On (Fri) Aug 28 2009 [12:00:08], Anthony Liguori wrote:
> Amit Shah wrote:
>> On (Tue) Aug 25 2009 [11:47:20], Amit Shah wrote:
>>   
>>> Hello all,
>>>
>>> Here is a new iteration of the patch series that implements a
>>> transport for guest and host communications.
>>>
>>> The code has been updated to reuse the virtio-console device instead
>>> of creating a new virtio-serial device.
>>>     
>>
>> And the problem now is that hvc calls the put_chars function with
>> spinlocks held and we now allocate pages in send_buf(), called from
>> put_chars.
>>   
>
> Don't allocate pages in send_buf.  There's a fixed number of possible  
> entries on the ring.  Preallocate them up front and then you don't need  
> to sleep.

I did think about that as well, but there are problems:

- vnc clients (at least tigervnc) wants to receive the entire clipboard
  in a single flush command. So in the pre-allocated buffers scenario we
  could run short of the available buffers in some cases. So there will
  have to be a flag with each buffer that says 'there's more data
  pending for this particular write' which will have to be passed on to
  qemu and qemu will then flush it once it receives all the data

- A lock has to be introduced to fetch one unused buffer from the list
  and pass it on to the host. And this lock has to be a spinlock, just
  because writes can be called from irq context.

We're basically just turning a simple transport into more and more
complex code just to handle this special case.

		Amit


More information about the Virtualization mailing list