[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hw/char/serial: Only retry if qemu_chr_fe_write

From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH] hw/char/serial: Only retry if qemu_chr_fe_write returns 0
Date: Mon, 9 Jul 2018 14:23:01 +0200


On Mon, Jul 9, 2018 at 2:11 PM, Peter Maydell <address@hidden> wrote:
> On 9 July 2018 at 11:25, Marc-André Lureau <address@hidden> wrote:
>> Shouldn't it rety if it returns -1 and the errno == EAGAIN? I am not
>> sure when it would return 0 and a retry would make sense.
> This came up in previous discussion on an earlier version of this:
> https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg00171.html

Thanks, I lost that thread somehow

> qemu_chr_fe_write() should never return -1/EAGAIN, because then
> all of its callers need to deal with it. It should handle EAGAIN
> internally and report "try again later" by returning 0.

But that's not the case, unless qemu_chr_write() 'write_all' arg is true.

qemu_chr_fe_write() uses false.

I suppose the patch should also change qemu_chr_fe_write() to
qemu_chr_fe_write_all() to be complete and let the chardev handle

> The logic is that (a) EAGAIN is a pain to handle and we should
> avoid expanding the set of places in QEMU that has to care about
> it where we can and (b) this function already has a way to say
> 'try again later' (ie, returning 0), so it is confusing and
> complicates callsites to give it a second way to say the same
> thing (ie, returning -1/EINTR). Better to always report "try
> again" in the same way.
> thanks
> -- PMM

Marc-André Lureau

reply via email to

[Prev in Thread] Current Thread [Next in Thread]