[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] serial: Open non-block
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] serial: Open non-block |
Date: |
Mon, 26 Feb 2018 14:57:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 26/02/2018 14:04, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> On a real serial device, the open can block if the handshake
> lines are in a particular state. If a QEMU is passing the serial
> device to the guest, the QEMU startup is blocked opening the device
> (with a symptom seen as a timeout from libvirt).
>
> Open the serial port with O_NONBLOCK.
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Socket chardevs have "nowait" for that. Should serial have something
similar?
Thanks,
Paolo
> ---
> chardev/char-serial.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/chardev/char-serial.c b/chardev/char-serial.c
> index feb52e559d..97be5d4a63 100644
> --- a/chardev/char-serial.c
> +++ b/chardev/char-serial.c
> @@ -265,7 +265,8 @@ static void qmp_chardev_open_serial(Chardev *chr,
> ChardevHostdev *serial = backend->u.serial.data;
> int fd;
>
> - fd = qmp_chardev_open_file_source(serial->device, O_RDWR, errp);
> + fd = qmp_chardev_open_file_source(serial->device, O_RDWR | O_NONBLOCK,
> + errp);
> if (fd < 0) {
> return;
> }
>