From: Laszlo Ersek <lersek@redhat.com>
To: Amit Shah <amit.shah@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] qemu-ga behavior on virtio-serial unplug
Date: Thu, 20 Jun 2013 20:56:08 +0200 [thread overview]
Message-ID: <51C35048.4040708@redhat.com> (raw)
In-Reply-To: <20130620133003.GA3347@amit-x200.redhat.com>
On 06/20/13 15:31, Amit Shah wrote:
> On (Wed) 19 Jun 2013 [13:17:57], Laszlo Ersek wrote:
>> In any case we'd need a way to tell "host side close" from "port unplug".
>
> Will POLLHUP|POLLERR help, along with error returns on read() and
> write()?
I think so:
- read() == 0 --> host side disconnected,
- read() == -1, equivalently POLLERR --> unplug (or other error)
- write() == -1 / errno == EPIPE: host side disconnected,
- write() == -1 / errno == EIO (or ENXIO or EINVAL): unplug
I think the current code could be adapted to such a scheme gracefully.
(Regarding the error codes on write(), I just made them up, but you get
the idea.)
On hot-unplug we could bail out to a more external loop that tries to
reopen the same device, or just exit and leave the restart to udev/systemd.
If possible I would like to avoid SIGIO. SIGIO is basically a non-queued
(= can be pending or not pending; any realtime queueing variant is
limited in depth hence useless) and edge triggered readiness
notification. It isn't portable and requires extra hoops to jump through
just to get the file descriptor and to tell a read event from a write event.
Although it's possible to base level triggered readiness on top of it
(by setting read & write readiness booleans on SIGIO and clearing them
on the respective -1/EAGAIN, while blocking SIGIO carefully), I think
that's quite distant from our current event loop. Hence we should remove
O_ASYNC (and the Solaris equivalent too) with the same fell swoop.
Thanks
Laszlo
next prev parent reply other threads:[~2013-06-20 18:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 11:17 [Qemu-devel] qemu-ga behavior on virtio-serial unplug Laszlo Ersek
2013-06-20 13:31 ` Amit Shah
2013-06-20 18:56 ` Laszlo Ersek [this message]
2013-06-20 15:12 ` mdroth
2013-06-20 15:20 ` mdroth
2013-08-13 12:00 ` Amit Shah
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=51C35048.4040708@redhat.com \
--to=lersek@redhat.com \
--cc=amit.shah@redhat.com \
--cc=mdroth@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).