Re: [PATCH 5/5] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_SOCKET

Anthony Liguori
2011-07-20T02:49:31Z

On 07/13/2011 02:07 AM, Avi Kivity wrote:
> On 07/13/2011 09:45 AM, Pekka Enberg wrote:
>> >
>> > OK, what's the simplest thing we can do here to keep Avi happy and get
>> > the functionality of Sasha's original patch that helps us avoid guest
>> > exits for serial console? I agree with Avi that we don't want
>> > fragmented ABI but it seems to me there's no clear idea how to fix
>> > KVM_IOEVENTFD_FLAG_SOCKET corner cases, right?
>>
>> And btw, I didn't follow the discussion closely, but introducing a new
>> type of exit for a feature that's designed to _avoid exits_ doesn't
>> seem like a smart thing to do. Is it even possible to support sockets
>> sanely for this?
>
> First of all, this feature doesn't avoid exits.

I don't think it's possible to do correct UART emulation and avoid an exit.

And yeah, looking at your serial emulation, you're not properly updating
the LSR register. The fact that this works with Linux is just luck.
You will encounter guests that poll LSR.THRE in order to write more data
to the THR and you will no longer be able to treat THR as having no side
effects.

Worse yet, if the Linux driver ever changes in the future in a way
that's fully compliant to the UART spec, it'll break your emulation.

If you're not going to emulate a UART properly, why not just use a
paravirtual serial device that you can keep simple?

Regards,

Anthony Liguori