All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, marcandre.lureau@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/1] serial: Open non-block
Date: Mon, 26 Feb 2018 15:13:29 +0000	[thread overview]
Message-ID: <20180226151328.GD2873@work-vm> (raw)
In-Reply-To: <70a6755d-22e4-3463-8ab0-6804c38af5b9@redhat.com>

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> On 26/02/2018 14:04, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > 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 <dgilbert@redhat.com>
> 
> Socket chardevs have "nowait" for that.  Should serial have something
> similar?

Hmm, maybe, although I think for real serial the nonblocking open should
be the default.
I've not got any more complex tests though for it.
stty -F uses the same trick of opening non-blocking.

Dave

> 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;
> >      }
> > 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-02-26 15:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 13:04 [Qemu-devel] [PATCH 1/1] serial: Open non-block Dr. David Alan Gilbert (git)
2018-02-26 13:57 ` Paolo Bonzini
2018-02-26 15:13   ` Dr. David Alan Gilbert [this message]
2018-06-29 14:36 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180226151328.GD2873@work-vm \
    --to=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.