[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] hw/char/serial: Don't retry on serial_xmit
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] hw/char/serial: Don't retry on serial_xmit if errno == EPIPE |
Date: |
Thu, 31 May 2018 11:52:01 +0200 |
Hi
On Thu, May 31, 2018 at 9:46 AM, Sergio Lopez <address@hidden> wrote:
> If writing to the frontend channel failed with EPIPE, don't set up a
> retry. EPIPE is not a recoverable error, so trying again is a waste of CPU
> cycles.
>
> If the vCPU writing to the serial device and emulator thread are pinned
> to the same pCPU, it can also compromise the stability of the Guest OS,
> as both threads will be competing for pCPU's time, with the vCPU
> actively polling the serial device and barely giving time to the
> emulator thread to make actual progress.
> ---
> hw/char/serial.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 2c080c9..f26e86b 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -262,6 +262,7 @@ static void serial_xmit(SerialState *s)
> /* in loopback mode, say that we just received a char */
> serial_receive1(s, &s->tsr, 1);
> } else if (qemu_chr_fe_write(&s->chr, &s->tsr, 1) != 1 &&
> + errno != EPIPE &&
> s->tsr_retry < MAX_XMIT_RETRY) {
Instead of adding explicit handling of EPIPE, shouldn't the code be
rewritten to treat -1 return && errno != EAGAIN as fatal?
> assert(s->watch_tag == 0);
> s->watch_tag =
> --
> 1.8.3.1
>
>
--
Marc-André Lureau